This repository has been archived by the owner on Apr 22, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 41
/
prompts.js
59 lines (55 loc) · 1.47 KB
/
prompts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const debug = require('debug')('vue-cli-plugin-i18n:prompts')
module.exports = pkg => {
const { semver } = require(require.resolve('@vue/cli-shared-utils'))
const version = semver.minVersion(pkg.dependencies.vue)
debug('vue version', version)
const isVue3 = version.major === 3
const prompts = [
{
type: 'input',
name: 'locale',
message: 'The locale of project localization.',
validate: input => !!input,
default: 'en'
},
{
type: 'input',
name: 'fallbackLocale',
message: 'The fallback locale of project localization.',
validate: input => !!input,
default: 'en'
},
{
type: 'input',
name: 'localeDir',
message:
"The directory where store localization messages of project. It's stored under `src` directory.",
validate: input => !!input,
default: 'locales'
}
]
if (isVue3) {
prompts.push({
type: 'confirm',
name: 'enableLegacy',
message: 'Enable legacy API (compatible vue-i18n@v8.x) mode ?',
default: false
})
} else {
prompts.push({
type: 'confirm',
name: 'enableInSFC',
message: 'Enable locale messages in Single file components ?',
default: false
})
prompts.push({
type: 'confirm',
name: 'enableBridge',
message:
'Whether to set up a bridge to migrate to vue-i18n@v9.x from vue-i18n@v8.26',
default: false
})
}
debug('prompts', prompts)
return prompts
}