@mpxjs/cli 2.7.1 → 2.8.0-beta.2

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 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.hasOwnProperty('default')) {
115
- if (typeof prompt.default === 'function') {
116
- let temp
117
- Object.defineProperty(data, key, {
118
- get () {
119
- if (temp !== undefined) {
120
- return temp
121
- }
122
- return prompt.default(data)
123
- },
124
- set (val) {
125
- temp = val
126
- },
127
- enumerable: true
128
- })
129
- } else {
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
- 'type': 'string',
70
- 'default': val
69
+ type: 'string',
70
+ default: val
71
71
  }
72
72
  } else {
73
- prompts[key]['default'] = val
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.7.1",
3
+ "version": "2.8.0-beta.2",
4
4
  "description": "mpx脚手架",
5
5
  "bin": {
6
6
  "mpx": "bin/mpx.js",
@@ -42,7 +42,8 @@
42
42
  "lib"
43
43
  ],
44
44
  "publishConfig": {
45
- "registry": "https://registry.npmjs.org"
45
+ "registry": "https://registry.npmjs.org",
46
+ "access": "public"
46
47
  },
47
48
  "repository": {
48
49
  "type": "git",
@@ -58,5 +59,5 @@
58
59
  "scripts": {
59
60
  "test": "echo \"Error: run tests from root\" && exit 1"
60
61
  },
61
- "gitHead": "a672cdbf1689bb4d7f1a0fbcb1037d9f99e5d015"
62
+ "gitHead": "cd57f83a9d47236f527bd51a8650119514f4b433"
62
63
  }