1
- const _ = require ( 'lodash' ) ;
2
1
const runQuestionnaire = require ( './run-questionnaire' ) ;
3
2
const {
3
+ pickPlugin,
4
4
askBundler,
5
5
askLoader,
6
6
askHttp,
@@ -43,9 +43,6 @@ module.exports = async function(preselectedFeatures = [], opts = {}, _debug = []
43
43
if ( flow === 'app' ) {
44
44
features = await appFlow ( features , flowUnattended , _debug ) ;
45
45
} else if ( flow === 'plugin' ) {
46
- // Plugin skeleton is only based on cli-bundler.
47
- // Don't allow user to overwrite cli-bundler with webpack
48
- _ . pull ( features , 'webpack' ) ;
49
46
features = await pluginFlow ( features , flowUnattended , _debug ) ;
50
47
} else {
51
48
throw new Error ( `Workflow "${ flow } " is not recognizable.` ) ;
@@ -62,9 +59,9 @@ const PRESETS = {
62
59
'default-esnext' : { flow : 'app' , recommendedFeatures : [ 'jest' , 'vscode' ] , unattended : true } ,
63
60
'default-typescript' : { flow : 'app' , recommendedFeatures : [ 'jest' , 'typescript' , 'vscode' ] , unattended : true } ,
64
61
'custom-app' : { flow : 'app' } ,
65
- 'default-plugin-esnext' : { flow : 'plugin' , recommendedFeatures : [ 'cli-bundler' , 'requirejs' , ' jest', 'vscode' ] , unattended : true } ,
66
- 'default-plugin-typescript' : { flow : 'plugin' , recommendedFeatures : [ 'cli-bundler' , 'requirejs' , ' jest', 'typescript' , 'vscode' ] , unattended : true } ,
67
- 'custom-plugin' : { flow : 'plugin' , recommendedFeatures : [ 'cli-bundler' , 'requirejs' ] }
62
+ 'default-plugin-esnext' : { flow : 'plugin' , recommendedFeatures : [ 'jest' , 'vscode' ] , unattended : true } ,
63
+ 'default-plugin-typescript' : { flow : 'plugin' , recommendedFeatures : [ 'jest' , 'typescript' , 'vscode' ] , unattended : true } ,
64
+ 'custom-plugin' : { flow : 'plugin' }
68
65
} ;
69
66
70
67
async function selectWorkFlow ( opts , _debug ) {
@@ -76,36 +73,35 @@ async function selectWorkFlow(opts, _debug) {
76
73
} else {
77
74
const ans = await runQuestionnaire ( [ ] , [ {
78
75
message : 'Would you like to use the default setup or customize your choices?' ,
79
- choices : [ {
80
- value : 'default-esnext' ,
81
- message : 'Default ESNext App' ,
82
- hint : 'A basic app with Babel and Webpack.'
83
- } , {
84
- value : 'default-typescript' ,
85
- message : 'Default TypeScript App' ,
86
- hint : 'A basic app with TypeScript and Webpack.'
87
- } , {
88
- value : 'custom-app' ,
89
- message : 'Custom App' ,
90
- hint : 'Select bundler, loader, transpiler, CSS pre-processor and more.'
91
- }
92
- /* TODO enable plugin flow after providing the plugin skeleton
93
- {
94
- role: 'separator'
95
- }, {
96
- value: 'default-plugin-esnext',
97
- message: 'Default ESNext Aurelia Plugin',
98
- hint: 'A basic Aurelia plugin with Babel'
99
- }, {
100
- value: 'default-plugin-typescript',
101
- message: 'Default TypeScript Aurelia Plugin',
102
- hint: 'A basic Aurelia plugin with TypeScript'
103
- }, {
104
- value: 'custom-plugin',
105
- message: 'Custom Aurelia Plugin',
106
- hint: 'Select transpiler, CSS pre-processor and more.'
107
- } */
108
- ]
76
+ choices : opts . plugin ?
77
+ // plugin flows
78
+ [ {
79
+ value : 'default-plugin-esnext' ,
80
+ message : 'Default ESNext Aurelia Plugin' ,
81
+ hint : 'A basic Aurelia plugin with Babel'
82
+ } , {
83
+ value : 'default-plugin-typescript' ,
84
+ message : 'Default TypeScript Aurelia Plugin' ,
85
+ hint : 'A basic Aurelia plugin with TypeScript'
86
+ } , {
87
+ value : 'custom-plugin' ,
88
+ message : 'Custom Aurelia Plugin' ,
89
+ hint : 'Select transpiler, CSS pre-processor and more.'
90
+ } ] :
91
+ // app flows
92
+ [ {
93
+ value : 'default-esnext' ,
94
+ message : 'Default ESNext App' ,
95
+ hint : 'A basic app with Babel and Webpack.'
96
+ } , {
97
+ value : 'default-typescript' ,
98
+ message : 'Default TypeScript App' ,
99
+ hint : 'A basic app with TypeScript and Webpack.'
100
+ } , {
101
+ value : 'custom-app' ,
102
+ message : 'Custom App' ,
103
+ hint : 'Select bundler, loader, transpiler, CSS pre-processor and more.'
104
+ } ]
109
105
} ] , false , _debug ) ;
110
106
111
107
workflow = ans [ 0 ] ;
@@ -133,6 +129,10 @@ async function appFlow(features, unattended, _debug) {
133
129
134
130
async function pluginFlow ( features , unattended , _debug ) {
135
131
return await runQuestionnaire ( features , [
132
+ pickPlugin ,
133
+ askBundler ,
134
+ askLoader ,
135
+ askPlatform ,
136
136
askTranspiler ,
137
137
askMarkupProcessor ,
138
138
askCssProcessor ,
0 commit comments