@mpxjs/cli 2.7.1 → 2.8.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/mpx-init.js +1 -1
- package/lib/generate.js +16 -18
- package/lib/options.js +3 -3
- package/package.json +2 -2
package/bin/mpx-init.js
CHANGED
|
@@ -119,7 +119,7 @@ function run () {
|
|
|
119
119
|
} else {
|
|
120
120
|
checkVersion(() => {
|
|
121
121
|
// use official templates
|
|
122
|
-
const officialTemplate = 'mpx-ecology/' + template
|
|
122
|
+
const officialTemplate = 'mpx-ecology/' + template + '#beta'
|
|
123
123
|
downloadAndGenerate(officialTemplate)
|
|
124
124
|
})
|
|
125
125
|
}
|
package/lib/generate.js
CHANGED
|
@@ -111,24 +111,22 @@ function preUseDefault (prompts) {
|
|
|
111
111
|
const data = metalsmith.metadata()
|
|
112
112
|
Object.keys(prompts).forEach((key) => {
|
|
113
113
|
const prompt = prompts[key]
|
|
114
|
-
if (prompt.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
data[key] = prompt.default
|
|
131
|
-
}
|
|
114
|
+
if (typeof prompt.default === 'function') {
|
|
115
|
+
let temp
|
|
116
|
+
Object.defineProperty(data, key, {
|
|
117
|
+
get () {
|
|
118
|
+
if (temp !== undefined) {
|
|
119
|
+
return temp
|
|
120
|
+
}
|
|
121
|
+
return prompt.default(data)
|
|
122
|
+
},
|
|
123
|
+
set (val) {
|
|
124
|
+
temp = val
|
|
125
|
+
},
|
|
126
|
+
enumerable: true
|
|
127
|
+
})
|
|
128
|
+
} else {
|
|
129
|
+
data[key] = prompt.default
|
|
132
130
|
}
|
|
133
131
|
})
|
|
134
132
|
done()
|
package/lib/options.js
CHANGED
|
@@ -66,11 +66,11 @@ function setDefault (opts, key, val) {
|
|
|
66
66
|
const prompts = opts.prompts || (opts.prompts = {})
|
|
67
67
|
if (!prompts[key] || typeof prompts[key] !== 'object') {
|
|
68
68
|
prompts[key] = {
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
type: 'string',
|
|
70
|
+
default: val
|
|
71
71
|
}
|
|
72
72
|
} else {
|
|
73
|
-
prompts[key]
|
|
73
|
+
prompts[key].default = val
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0-beta.1",
|
|
4
4
|
"description": "mpx脚手架",
|
|
5
5
|
"bin": {
|
|
6
6
|
"mpx": "bin/mpx.js",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"scripts": {
|
|
59
59
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "2d37697869b9bdda3efab92dda8c910b68fd05c0"
|
|
62
62
|
}
|