neo-cmp-cli 1.7.0 → 1.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo-cmp-cli",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "前端脚手架:自定义组件开发工具,支持react 和 vue2.0技术栈。",
5
5
  "keywords": [
6
6
  "neo-cli",
@@ -161,92 +161,95 @@ yargs
161
161
  neoConfigInit('neo.config.js');
162
162
  }
163
163
  )
164
- .command(
165
- 'create project [options]',
166
- '创建自定义组件项目(含工程代码)',
167
- (yargs) => {
168
- yargs
169
- .reset()
170
- .usage(titleTip('Usage') + ': $0 preview [options]')
171
- .option('name', {
172
- alias: 'n',
173
- describe: '自定义组件项目名称'
174
- })
175
- .alias('h', 'help');
176
- },
177
- (argv) => {
178
- if (argv.name) {
179
- mainAction.createCmpProjectByTemplate(argv.name);
180
- } else {
181
- const questions = [
182
- {
183
- name: 'name',
184
- type: 'input',
185
- message: '请设置自定义组件项目名称:'
186
- }
187
- ];
188
-
189
- inquirer.prompt(questions).then((ans) => {
190
- // 验证项目名称是否合法
191
- const { isValid, errors } = validateProjectName(ans.name);
192
- if (!isValid) {
193
- console.error(errors.join('\n'));
194
- process.exit(1);
195
- }
196
-
197
- if (!ans.name) {
198
- console.error('自定义组件项目名称不能为空。');
199
- process.exit(1);
200
- } else {
201
- mainAction.createCmpProjectByTemplate(ans.name);
202
- }
203
- });
164
+ .command('create', '创建项目或者组件', (yargs) => {
165
+ return yargs
166
+ .command(
167
+ 'project [options]',
168
+ '创建自定义组件项目(含工程代码)',
169
+ (yargs) => {
170
+ yargs
171
+ .reset()
172
+ .usage(titleTip('Usage') + ': $0 project [options]')
173
+ .option('name', {
174
+ alias: 'n',
175
+ describe: '自定义组件项目名称'
176
+ })
177
+ .alias('h', 'help');
178
+ },
179
+ (argv) => {
180
+ if (argv.name) {
181
+ mainAction.createCmpProjectByTemplate(argv.name);
182
+ } else {
183
+ const questions = [
184
+ {
185
+ name: 'name',
186
+ type: 'input',
187
+ message: '请设置自定义组件项目名称:'
188
+ }
189
+ ];
190
+
191
+ inquirer.prompt(questions).then((ans) => {
192
+ // 验证项目名称是否合法
193
+ const { isValid, errors } = validateProjectName(ans.name);
194
+ if (!isValid) {
195
+ console.error(errors.join('\n'));
196
+ process.exit(1);
197
+ }
198
+
199
+ if (!ans.name) {
200
+ console.error('自定义组件项目名称不能为空。');
201
+ process.exit(1);
202
+ } else {
203
+ mainAction.createCmpProjectByTemplate(ans.name);
204
+ }
205
+ });
206
+ }
204
207
  }
205
- }
206
- )
207
- .command(
208
- 'create cmp [options]',
209
- '创建自定义组件',
210
- (yargs) => {
211
- yargs
212
- .reset()
213
- .usage(titleTip('Usage') + ': $0 preview [options]')
214
- .option('name', {
215
- alias: 'n',
216
- describe: '自定义组件名称'
217
- })
218
- .alias('h', 'help');
219
- },
220
- (argv) => {
221
- if (argv.name) {
222
- mainAction.createCmpByTemplate(argv.name);
223
- } else {
224
- const questions = [
225
- {
226
- name: 'name',
227
- type: 'input',
228
- message: '请设置自定义组件名称:'
229
- }
230
- ];
231
-
232
- inquirer.prompt(questions).then((ans) => {
233
- if (!ans.name) {
234
- console.error('自定义组件名称不能为空。');
235
- process.exit(1);
236
- } else {
237
- mainAction.createCmpByTemplate(ans.name);
238
- }
239
- });
208
+ )
209
+ .command(
210
+ 'cmp [options]',
211
+ '创建自定义组件',
212
+ (yargs) => {
213
+ yargs
214
+ .reset()
215
+ .usage(titleTip('Usage') + ': $0 cmp [options]')
216
+ .option('name', {
217
+ alias: 'n',
218
+ describe: '自定义组件名称'
219
+ })
220
+ .alias('h', 'help');
221
+ },
222
+ (argv) => {
223
+ if (argv.name) {
224
+ mainAction.createCmpByTemplate(argv.name);
225
+ } else {
226
+ const questions = [
227
+ {
228
+ name: 'name',
229
+ type: 'input',
230
+ message: '请设置自定义组件名称:'
231
+ }
232
+ ];
233
+
234
+ inquirer.prompt(questions).then((ans) => {
235
+ if (!ans.name) {
236
+ console.error('自定义组件名称不能为空。');
237
+ process.exit(1);
238
+ } else {
239
+ mainAction.createCmpByTemplate(ans.name);
240
+ }
241
+ });
242
+ }
240
243
  }
241
- }
242
- )
244
+ )
245
+ })
243
246
  .command(
244
247
  'pull cmp [options]',
245
248
  '拉取线上自定义组件',
246
249
  (yargs) => {
247
250
  yargs
248
251
  .reset()
249
- .usage(titleTip('Usage') + ': $0 preview [options]')
252
+ .usage(titleTip('Usage') + ': $0 pull cmp [options]')
250
253
  .option('name', {
251
254
  alias: 'n',
252
255
  describe: '自定义组件名称'
@@ -295,7 +298,7 @@ yargs
295
298
  (yargs) => {
296
299
  yargs
297
300
  .reset()
298
- .usage(titleTip('Usage') + ': $0 deleteCmp [options]')
301
+ .usage(titleTip('Usage') + ': $0 delete cmp [options]')
299
302
  .option('name', {
300
303
  alias: 'n',
301
304
  describe: '自定义组件名称'
@@ -484,7 +487,7 @@ yargs
484
487
  (yargs) => {
485
488
  yargs
486
489
  .reset()
487
- .usage(titleTip('Usage') + ': $0 pushCmp [options]')
490
+ .usage(titleTip('Usage') + ': $0 push cmp [options]')
488
491
  .option('name', {
489
492
  alias: 'n',
490
493
  describe: '自定义组件名称'
@@ -48,7 +48,7 @@
48
48
  "@commitlint/config-conventional": "^9.1.1",
49
49
  "@types/react": "^16.9.11",
50
50
  "@types/react-dom": "^16.9.15",
51
- "neo-cmp-cli": "^1.7.0",
51
+ "neo-cmp-cli": "^1.7.1",
52
52
  "husky": "^4.2.5",
53
53
  "lint-staged": "^10.2.9",
54
54
  "prettier": "^2.0.5"
@@ -48,7 +48,7 @@
48
48
  "@commitlint/config-conventional": "^9.1.1",
49
49
  "@types/react": "^16.9.11",
50
50
  "@types/react-dom": "^16.9.15",
51
- "neo-cmp-cli": "^1.7.0",
51
+ "neo-cmp-cli": "^1.7.1",
52
52
  "husky": "^4.2.5",
53
53
  "lint-staged": "^10.2.9",
54
54
  "prettier": "^2.0.5",
@@ -46,7 +46,7 @@
46
46
  "@commitlint/config-conventional": "^9.1.1",
47
47
  "@types/react": "^16.9.11",
48
48
  "@types/react-dom": "^16.9.15",
49
- "neo-cmp-cli": "^1.7.0",
49
+ "neo-cmp-cli": "^1.7.1",
50
50
  "husky": "^4.2.5",
51
51
  "lint-staged": "^10.2.9",
52
52
  "prettier": "^2.0.5"
@@ -52,7 +52,7 @@
52
52
  "@types/react": "^16.9.11",
53
53
  "@types/react-dom": "^16.9.15",
54
54
  "@types/axios": "^0.14.0",
55
- "neo-cmp-cli": "^1.7.0",
55
+ "neo-cmp-cli": "^1.7.1",
56
56
  "husky": "^4.2.5",
57
57
  "lint-staged": "^10.2.9",
58
58
  "prettier": "^2.0.5"
@@ -45,7 +45,7 @@
45
45
  "devDependencies": {
46
46
  "@commitlint/cli": "^8.3.5",
47
47
  "@commitlint/config-conventional": "^9.1.1",
48
- "neo-cmp-cli": "^1.7.0",
48
+ "neo-cmp-cli": "^1.7.1",
49
49
  "husky": "^4.2.5",
50
50
  "lint-staged": "^10.2.9",
51
51
  "prettier": "^2.0.5"
@@ -47,7 +47,7 @@
47
47
  "@commitlint/config-conventional": "^9.1.1",
48
48
  "@types/react": "^16.9.11",
49
49
  "@types/react-dom": "^16.9.15",
50
- "neo-cmp-cli": "^1.7.0",
50
+ "neo-cmp-cli": "^1.7.1",
51
51
  "husky": "^4.2.5",
52
52
  "lint-staged": "^10.2.9",
53
53
  "prettier": "^2.0.5"
@@ -45,7 +45,7 @@
45
45
  "devDependencies": {
46
46
  "@commitlint/cli": "^8.3.5",
47
47
  "@commitlint/config-conventional": "^9.1.1",
48
- "neo-cmp-cli": "^1.7.0",
48
+ "neo-cmp-cli": "^1.7.1",
49
49
  "husky": "^4.2.5",
50
50
  "lint-staged": "^10.2.9",
51
51
  "prettier": "^2.0.5",