8
8
import * as gulp from 'gulp' ;
9
9
import frontvue from '../core' ;
10
10
import { PluginProvider } from '../plugin-manager/installable' ;
11
- import { AnyFunction , sleep } from '../util/utility-functions' ;
11
+ import { AnyFunction } from '../util/utility-functions' ;
12
12
13
13
14
14
// Configuration defaults
15
15
const configDefaults = {
16
- fullName : 'John Smith' ,
17
- useDefault : true ,
16
+ buildDir : 'build' ,
17
+ plugins : [ ] ,
18
+ sourceDir : 'source' ,
18
19
} ;
19
20
20
21
// Configuration wizard questions
21
22
const questions = [
22
23
{
23
- default : configDefaults . fullName ,
24
- message : 'Type in your full name ' ,
25
- name : 'fullName ' ,
24
+ default : configDefaults . sourceDir ,
25
+ message : 'Main source directory ' ,
26
+ name : 'sourceDir ' ,
26
27
type : 'input' ,
27
28
} ,
29
+ {
30
+ default : configDefaults . buildDir ,
31
+ message : 'Main build directory' ,
32
+ name : 'buildDir' ,
33
+ type : 'input' ,
34
+ } ,
35
+ {
36
+ choices : [ 'stylus' , 'vue' , 'html' ] ,
37
+ message : 'What plugins would you like to use?' ,
38
+ name : 'plugins' ,
39
+ type : 'checkbox' ,
40
+ } ,
28
41
] ;
29
42
30
43
// Object to be exported
31
44
const taskExport = {
32
- // configDefaults,
33
- // configQuestionnaire: {
34
- // namespace: 'init',
35
- // questions,
36
- // },
45
+ configDefaults,
46
+ configQuestionnaire : {
47
+ namespace : 'init' ,
48
+ questions,
49
+ } ,
37
50
description : 'Task for initializing a new project' ,
38
51
hook : 'init' ,
39
52
name : 'init' ,
@@ -47,14 +60,20 @@ const taskExport = {
47
60
* @param pluginProvider Assortment of tools for plugins and tasks (e.g. logger, config manager, etc.)
48
61
*/
49
62
async function taskFn ( done : AnyFunction , { config, logger } : PluginProvider ) : Promise < any > {
50
- console . log ( JSON . stringify ( await config . get ( ) , null , 2 ) ) ;
51
- // return gulp.series('template', 'clean', 'process', 'watch');
52
- return done && done ( ) ;
63
+ return new Promise ( async resolve => {
64
+ const core = await frontvue ;
65
+
66
+ for ( const hook of [ 'config' , 'template' ] ) {
67
+ await core . run ( hook ) ;
68
+ }
69
+
70
+ resolve ( ) ;
71
+ } ) ;
53
72
}
54
73
55
74
56
75
/* test:start */
57
- export { taskFn } ;
76
+ export { taskFn , configDefaults } ;
58
77
/* test:end */
59
78
60
79
export default taskExport ;
0 commit comments