Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): taro init 命令新增 autoInstall 的配置支持 #16129

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading