File tree Expand file tree Collapse file tree 7 files changed +39
-37
lines changed Expand file tree Collapse file tree 7 files changed +39
-37
lines changed Original file line number Diff line number Diff line change @@ -55,12 +55,7 @@ const options = () => {
55
55
*
56
56
* @type {Source } https://github.com/paulmillr/chokidar
57
57
*/
58
- const watcher = chokidar . watch ( options ( ) . globs , {
59
- usePolling : false ,
60
- awaitWriteFinish : {
61
- stabilityThreshold : 750
62
- }
63
- } ) ;
58
+ const watcher = chokidar . watch ( options ( ) . globs , global . chokidar ) ;
64
59
65
60
/**
66
61
* Main script process
@@ -72,7 +67,8 @@ const main = async (script) => {
72
67
/** Lint file */
73
68
if ( ! args . nolint ) await lint . main ( script . input ) ;
74
69
75
- if ( script . hasOwnProperty ( 'devModule' ) ) delete script . devModule ;
70
+ if ( script . hasOwnProperty ( 'devModule' ) )
71
+ delete script . devModule ;
76
72
77
73
const bundle = await rollup . rollup ( script ) ;
78
74
@@ -82,6 +78,8 @@ const main = async (script) => {
82
78
cnsl . describe ( `${ alerts . rollup } Rollup in ${ alerts . str . path ( script . input ) } out ` +
83
79
`${ alerts . str . path ( script . output [ i ] . file ) } ` ) ;
84
80
}
81
+
82
+ bundle . close ( ) ;
85
83
} catch ( err ) {
86
84
cnsl . error ( `Rollup failed (main): ${ err . stack } ` ) ;
87
85
}
Original file line number Diff line number Diff line change @@ -31,17 +31,12 @@ const GLOBS = [
31
31
`${ DIST } /**/*.js`
32
32
] ;
33
33
34
- /**
34
+ /**
35
35
* Our Chokidar Watcher
36
36
*
37
37
* @type {Source } https://github.com/paulmillr/chokidar
38
38
*/
39
- const watcher = chokidar . watch ( GLOBS , {
40
- usePolling : false ,
41
- awaitWriteFinish : {
42
- stabilityThreshold : 750
43
- }
44
- } ) ;
39
+ const watcher = chokidar . watch ( GLOBS , global . chokidar ) ;
45
40
46
41
/**
47
42
* The Express App
Original file line number Diff line number Diff line change @@ -38,12 +38,12 @@ const options = () => {
38
38
source : source ,
39
39
dist : path . join ( global . base , global . dist ) ,
40
40
base_path : base_path ,
41
- views : ` ${ base_path } / ${ global . entry . views } ` ,
41
+ views : path . join ( base_path , global . entry . views ) ,
42
42
ext : ext ,
43
43
globs : config . globs || [
44
44
resolve ( 'config/slm' , false ) ,
45
- ` ${ source } /**/*${ ext } `,
46
- ` ${ source } /**/*.md`
45
+ path . join ( source , ` /**/*${ ext } `) ,
46
+ path . join ( source , ' /**/*.md' )
47
47
]
48
48
}
49
49
}
@@ -53,12 +53,7 @@ const options = () => {
53
53
*
54
54
* @type {Source } https://github.com/paulmillr/chokidar
55
55
*/
56
- const watcher = chokidar . watch ( options ( ) . globs , {
57
- usePolling : false ,
58
- awaitWriteFinish : {
59
- stabilityThreshold : 750
60
- }
61
- } ) ;
56
+ const watcher = chokidar . watch ( options ( ) . globs , global . chokidar ) ;
62
57
63
58
/**
64
59
* Write the html file to the distribution folder
Original file line number Diff line number Diff line change @@ -32,9 +32,11 @@ const options = () => {
32
32
return {
33
33
modules : modules ,
34
34
globs : [
35
- `${ path . join ( global . base , global . src ) } /**/*.scss` ,
36
- tokens . options ( ) . input ,
37
- tokens . options ( ) . tailwindcss
35
+ resolve ( 'config/tokens' , false ) ,
36
+ resolve ( 'config/tailwindcss' , false ) ,
37
+ resolve ( 'config/sass' , false ) ,
38
+ resolve ( 'config/postcss' , false ) ,
39
+ path . join ( global . base , global . src , '/**/*.scss' )
38
40
]
39
41
}
40
42
} ;
@@ -67,10 +69,7 @@ const main = async (modules) => {
67
69
*/
68
70
const watcher = chokidar . watch ( options ( ) . globs , {
69
71
ignored : tokens . options ( ) . output . replace ( / " / g, '' ) ,
70
- usePolling : false ,
71
- awaitWriteFinish : {
72
- stabilityThreshold : 750
73
- }
72
+ ...global . chokidar
74
73
} ) ;
75
74
76
75
/**
Original file line number Diff line number Diff line change @@ -31,7 +31,10 @@ const options = () => {
31
31
m . ext = '.svg' ;
32
32
33
33
return m ;
34
- } )
34
+ } ) ,
35
+ globs : [
36
+ resolve ( 'config/svgs' , false )
37
+ ]
35
38
}
36
39
} ;
37
40
@@ -191,11 +194,10 @@ const run = async () => {
191
194
192
195
if ( ! fs . existsSync ( mod . source ) ) continue ;
193
196
194
- const globs = [
195
- `${ mod . source } /**/*${ mod . ext } `
196
- ] ;
197
-
198
- const watcher = chokidar . watch ( globs , {
197
+ const watcher = chokidar . watch ( [
198
+ `${ mod . source } /**/*${ mod . ext } ` ,
199
+ ...opts . globs
200
+ ] , {
199
201
usePolling : false ,
200
202
awaitWriteFinish : {
201
203
stabilityThreshold : 750
@@ -219,7 +221,7 @@ const run = async () => {
219
221
cnsl . success ( `Svgs finished` ) ;
220
222
} ) ;
221
223
222
- cnsl . watching ( `Svgs watching ${ alerts . str . ext ( globs . join ( ', ' ) ) } ` ) ;
224
+ cnsl . watching ( `Svgs watching ${ alerts . str . ext ( opts . globs . join ( ', ' ) ) } ` ) ;
223
225
}
224
226
} catch ( err ) {
225
227
console . error ( `${ alerts . error } Svgs (run): ${ err } ` ) ;
Original file line number Diff line number Diff line change @@ -29,6 +29,18 @@ module.exports = {
29
29
svg : 'svg'
30
30
} ,
31
31
32
+ /**
33
+ * Global chokidar options
34
+ *
35
+ * @type {Object }
36
+ */
37
+ chokidar : {
38
+ usePolling : false ,
39
+ awaitWriteFinish : {
40
+ stabilityThreshold : 750
41
+ }
42
+ } ,
43
+
32
44
/**
33
45
* Directories to scaffold. The scaffold command will create the filesystem
34
46
* configured here and use files in the ./scaffold directory as the contents
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ let plugins = [
37
37
module . exports = [
38
38
{
39
39
input : path . join ( global . base , global . src , global . entry . scripts ) ,
40
+ cache : true ,
40
41
output : [ {
41
42
file : path . join ( global . base , global . dist , global . entry . scripts ) ,
42
43
name : global . entry . name ,
You can’t perform that action at this time.
0 commit comments