UNPKG

923 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.default = (ctx) => {
4 ctx.registerCommand({
5 name: 'create',
6 optionsMap: {
7 '--name [name]': '名称',
8 '--description [description]': '介绍'
9 },
10 fn() {
11 const { type, name, description } = ctx.runOpts;
12 const { chalk } = ctx.helper;
13 const { appPath } = ctx.paths;
14 if (typeof name !== 'string') {
15 return console.log(chalk.red('请输入需要创建的页面名称'));
16 }
17 if (type === 'page') {
18 const Page = require('../../create/page').default;
19 const page = new Page({
20 pageName: name,
21 projectDir: appPath,
22 description
23 });
24 page.create();
25 }
26 }
27 });
28};