File tree Expand file tree Collapse file tree 4 files changed +47
-6
lines changed Expand file tree Collapse file tree 4 files changed +47
-6
lines changed Original file line number Diff line number Diff line change 4
4
script :
5
5
- npm test
6
6
- npm run build:examples
7
-
7
+ - npm run test:examples
Original file line number Diff line number Diff line change @@ -13,20 +13,23 @@ var exampleDirs = fs.readdirSync(__dirname).filter((file) => {
13
13
// Ordering is important here. `npm install` must come first.
14
14
var cmdArgs = [
15
15
{ cmd : 'npm' , args : [ 'install' ] } ,
16
- { cmd : 'webpack' , args : [ 'index.js' ] } ,
17
- { cmd : 'npm' , args : [ 'test' ] }
16
+ { cmd : 'webpack' , args : [ 'index.js' ] }
18
17
] ;
19
18
20
19
for ( let dir of exampleDirs ) {
21
20
22
21
for ( let cmdArg of cmdArgs ) {
23
- // delcare opts in this scope to avoid https://github.com/joyent/node/issues/9158
22
+ // declare opts in this scope to avoid https://github.com/joyent/node/issues/9158
24
23
let opts = {
25
24
cwd : path . join ( __dirname , dir ) ,
26
25
stdio : 'inherit'
27
26
} ;
28
-
29
- let result = spawnSync ( cmdArg . cmd , cmdArg . args , opts ) ;
27
+ let result = { } ;
28
+ if ( process . platform === 'win32' ) {
29
+ result = spawnSync ( cmdArg . cmd + '.cmd' , cmdArg . args , opts ) ;
30
+ } else {
31
+ result = spawnSync ( cmdArg . cmd , cmdArg . args , opts ) ;
32
+ }
30
33
if ( result . status !== 0 ) {
31
34
throw new Error ( 'Building examples exited with non-zero' ) ;
32
35
}
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Runs an ordered set of commands within each of the build directories.
3
+ */
4
+
5
+ import fs from 'fs' ;
6
+ import path from 'path' ;
7
+ import { spawnSync } from 'child_process' ;
8
+
9
+ var exampleDirs = fs . readdirSync ( __dirname ) . filter ( ( file ) => {
10
+ return fs . statSync ( path . join ( __dirname , file ) ) . isDirectory ( ) ;
11
+ } ) ;
12
+
13
+ // Ordering is important here. `npm install` must come first.
14
+ var cmdArgs = [
15
+ { cmd : 'npm' , args : [ 'test' ] }
16
+ ] ;
17
+
18
+ for ( let dir of exampleDirs ) {
19
+
20
+ for ( let cmdArg of cmdArgs ) {
21
+ // declare opts in this scope to avoid https://github.com/joyent/node/issues/9158
22
+ let opts = {
23
+ cwd : path . join ( __dirname , dir ) ,
24
+ stdio : 'inherit'
25
+ } ;
26
+
27
+ let result = { } ;
28
+ if ( process . platform === 'win32' ) {
29
+ result = spawnSync ( cmdArg . cmd + '.cmd' , cmdArg . args , opts ) ;
30
+ } else {
31
+ result = spawnSync ( cmdArg . cmd , cmdArg . args , opts ) ;
32
+ }
33
+ if ( result . status !== 0 ) {
34
+ throw new Error ( 'Building examples exited with non-zero' ) ;
35
+ }
36
+ }
37
+ }
Original file line number Diff line number Diff line change 10
10
"test" : " mocha --compilers js:babel/register --recursive" ,
11
11
"test:watch" : " npm test -- --watch" ,
12
12
"test:cov" : " babel-node $(npm bin)/isparta cover $(npm bin)/_mocha -- --recursive" ,
13
+ "test:examples" : " babel-node examples/testAll.js" ,
13
14
"check" : " npm run lint && npm run test" ,
14
15
"build:lib" : " babel src --out-dir lib" ,
15
16
"build:umd" : " webpack src/index.js dist/redux.js --config webpack.config.development.js" ,
You can’t perform that action at this time.
0 commit comments