Skip to content

Commit

Permalink
style: 代码整理
Browse files Browse the repository at this point in the history
  • Loading branch information
peijunlei committed Jan 8, 2025
1 parent 1fff7a3 commit 1fe7281
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ const { getGitReposList } = require('./api')
program.version(pkg.version, '-v, --version')

// 定义 create 命令
program.command('create [pageName] [targetPath]').alias('c')
.description('生成模板页面~')
.option('--style [bool]', '是否引入样式文件',(value) => value === 'true')
.action(async (pageName, targetPath, options) => {
program
.command('create [pageName] [targetPath]')
.alias('c')
.description('生成模板页面')
.option('--style [bool]', '是否引入样式文件', (value) => value === 'true')
.action(async (pageName,targetPath, options) => {
const needStyle = options.style
// // 获取项目名称
// 获取项目名称
pageName = pageName || await input({ message: '请输入页面名称:', default: 'DemoPage' });
// // 获取项目路径
// 获取项目路径
targetPath = targetPath || await input({ message: '请输入项目路径:', default: 'src' });
const newPageName = (pageName)
const sourceDir = path.join(__dirname, 'templates/page-context');
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pjl-cli",
"version": "1.0.6",
"version": "1.0.7",
"description": "创建页面",
"main": "index.js",
"homepage": "https://github.com/peijunlei/pjl-cli#readme",
Expand All @@ -17,7 +17,7 @@
"cli",
"commander",
"inquirer",
"create page"
"create-page"
],
"author": "peijunlei",
"license": "ISC",
Expand Down

0 comments on commit 1fe7281

Please sign in to comment.