File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ export interface IProjectConf {
4343 hideDefaultTemplate ?: boolean
4444 framework : FrameworkType
4545 compiler ?: CompilerType
46+ ask ?: Function
4647}
4748
4849type CustomPartial < T , K extends keyof T > = Omit < T , K > & Partial < Pick < T , K > > ;
@@ -126,6 +127,14 @@ export default class Project extends Creator {
126127 await this . askTemplate ( conf , prompts , templates )
127128 const templateChoiceAnswer = await inquirer . prompt < IProjectConf > ( prompts )
128129
130+ // 导航步骤扩展
131+ try {
132+ if ( typeof conf . ask === 'function' ) {
133+ const { ask, ...other } = conf
134+ await conf . ask ( { ...other , templatePath : this . templatePath ( templateChoiceAnswer . template ) } )
135+ }
136+ } catch ( e ) { }
137+
129138 return {
130139 ...answers ,
131140 ...compilerAndTemplateSourceAnswer ,
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ export default (ctx: IPluginContext) => {
1414 '--template [template]' : '项目模板' ,
1515 '--css [css]' : 'CSS预处理器(sass/less/stylus/none)' ,
1616 '--autoInstall' : '自动安装依赖' ,
17+ '--ask [ask]' : '扩展脚手架的导航步骤' ,
1718 '-h, --help' : 'output usage information'
1819 } ,
1920 async fn ( opts ) {
@@ -34,6 +35,7 @@ export default (ctx: IPluginContext) => {
3435 hideDefaultTemplate,
3536 sourceRoot,
3637 autoInstall,
38+ ask
3739 } = opts . options
3840
3941 const Project = require ( '../../create/project' ) . default
@@ -52,7 +54,8 @@ export default (ctx: IPluginContext) => {
5254 compiler,
5355 hideDefaultTemplate,
5456 autoInstall,
55- css
57+ css,
58+ ask
5659 } )
5760
5861 project . create ( )
You can’t perform that action at this time.
0 commit comments