Skip to content

Commit

Permalink
feat(cli): taro init 命令新增 autoInstall 的配置支持 (#16129)
Browse files Browse the repository at this point in the history
  • Loading branch information
koppthe authored Jul 19, 2024
1 parent 0970bf7 commit f22ddc4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/taro-cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ export default class CLI {
clone: !!args.clone,
template: args.template,
css: args.css,
autoInstall: args.autoInstall,
h: args.h
})
break
Expand Down
20 changes: 18 additions & 2 deletions packages/taro-cli/src/presets/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,28 @@ export default (ctx: IPluginContext) => {
'--clone [clone]': '拉取远程模板时使用git clone',
'--template [template]': '项目模板',
'--css [css]': 'CSS预处理器(sass/less/stylus/none)',
'--autoInstall': '自动安装依赖',
'-h, --help': 'output usage information'
},
async fn (opts) {
// init project
const { appPath } = ctx.paths
const { options } = opts
const { projectName, templateSource, clone, template, description, typescript, css, npm, framework, compiler, hideDefaultTemplate, sourceRoot } = options
const {
projectName,
templateSource,
clone,
template,
description,
typescript,
css,
npm,
framework,
compiler,
hideDefaultTemplate,
sourceRoot,
autoInstall,
} = opts.options

const Project = require('../../create/project').default
const project = new Project({
sourceRoot,
Expand All @@ -33,6 +48,7 @@ export default (ctx: IPluginContext) => {
framework,
compiler,
hideDefaultTemplate,
autoInstall,
css
})

Expand Down

0 comments on commit f22ddc4

Please sign in to comment.