@@ -33,17 +33,13 @@ class Spike extends EventEmitter {
33
33
* @fires Spike#error
34
34
* @fires Spike#warning
35
35
* @fires Spike#compile
36
- * @return {Array } a unique compile id, and webpack compiler instance
36
+ * @return {Object } compile id, webpack compiler
37
37
*/
38
38
compile ( ) {
39
39
const id = this . _id ( )
40
40
const compiler = webpack ( this . config )
41
-
42
41
compiler . run ( compileCallback . bind ( this , id ) )
43
-
44
- // Returns the compilation's ID synchronously, this can be checked against
45
- // events emitted from the project instance.
46
- return [ id , compiler ]
42
+ return { id, compiler}
47
43
}
48
44
49
45
/**
@@ -52,13 +48,14 @@ class Spike extends EventEmitter {
52
48
* @fires Spike#error
53
49
* @fires Spike#warning
54
50
* @fires Spike#compile
55
- * @return {Watcher } webpack watcher instance
51
+ * @return {Object } watch id, webpack watcher
56
52
*/
57
53
watch ( opts = { } ) {
58
54
const id = this . _id ( )
59
55
this . compiler = webpack ( this . config )
60
- this . watcher = this . compiler . watch ( opts , compileCallback . bind ( this , id ) )
61
- return this . watcher
56
+ const watcher = this . compiler . watch ( opts , compileCallback . bind ( this , id ) )
57
+ this . watcher = watcher
58
+ return { id, watcher}
62
59
}
63
60
64
61
/**
@@ -76,10 +73,10 @@ class Spike extends EventEmitter {
76
73
* @static
77
74
* @param {Object } options - options for new project
78
75
* @param {String } options.root - path ro the root of the project
79
- * @param {String } [options.template='base'] - name of the template to use
80
- * @param {String } [options.src=https://github.com/static-dev/spike-tpl-base.git] - path to the template source
81
- * @param {Object } [options.overrides] - locals provided to the sprout template
76
+ * @param {String } [options.template] - name of the template to use
77
+ * @param {Object } [options.locals] - locals provided to the sprout template
82
78
* @param {EventEmitter } [options.emitter] - an event emitter for feedback
79
+ * @param {Inquirer } [options.inquirer] - inquirer instance for CLI
83
80
* @fires Spike#info
84
81
* @fires Spike#error
85
82
* @fires Spike#done
@@ -127,11 +124,11 @@ class Spike extends EventEmitter {
127
124
128
125
// run it
129
126
promise
130
- . tap ( ( ) => { emit ( 'info' , 'initializing template' ) } )
127
+ . tap ( ( ) => emit ( 'info' , 'initializing template' ) )
131
128
. then ( sprout . init . bind ( sprout , opts . template , opts . root , sproutOptions ) )
132
- . tap ( ( ) => { emit ( 'info' , 'installing production dependencies' ) } )
129
+ . tap ( ( ) => emit ( 'info' , 'installing production dependencies' ) )
133
130
. then ( npmInstall . bind ( null , opts ) )
134
- . then ( ( ) => { return new Spike ( { root : opts . root } ) } )
131
+ . then ( ( ) => new Spike ( { root : opts . root } ) )
135
132
. done (
136
133
( instance ) => { emit ( 'done' , instance ) } ,
137
134
( err ) => { emit ( 'error' , err ) }
@@ -181,7 +178,7 @@ function compileCallback (id, err, stats) {
181
178
this . emit ( 'warning' , new Warning ( { id : id , message : jsonStats . warnings } ) )
182
179
}
183
180
184
- this . emit ( 'compile' , { id : id , stats : stats } )
181
+ this . emit ( 'compile' , { id , stats} )
185
182
}
186
183
187
184
/**
@@ -195,7 +192,7 @@ Spike.template = {
195
192
* @param {String } src - url from which the template can be `git clone`d
196
193
* @param {EventEmitter } emitter - will return events to report progress
197
194
* @fires emitter#info
198
- * @fires emitter#done
195
+ * @fires emitter#success
199
196
* @fires emitter#error
200
197
*/
201
198
add : function ( options = { } ) {
@@ -278,7 +275,6 @@ Spike.template = {
278
275
} ,
279
276
/**
280
277
* Removes the primary spike config and all templates, like a clean install
281
- * @private
282
278
*/
283
279
reset : function ( ) {
284
280
try {
0 commit comments