-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #375 from quicksnap/example_build_tools
Add script to help travis build all examples
- Loading branch information
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
language: node_js | ||
node_js: | ||
- "iojs" | ||
script: | ||
- npm test | ||
- npm run build:examples | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Runs an ordered set of commands within each of the build directories. | ||
*/ | ||
|
||
import fs from 'fs'; | ||
import path from 'path'; | ||
import { spawnSync } from 'child_process'; | ||
|
||
var exampleDirs = fs.readdirSync(__dirname).filter((file) => { | ||
return fs.statSync(path.join(__dirname, file)).isDirectory(); | ||
}); | ||
|
||
// Ordering is important here. `npm install` must come first. | ||
var cmdArgs = [ | ||
{ cmd: 'npm', args: ['install'] }, | ||
{ cmd: 'webpack', args: ['index.js'] } | ||
]; | ||
|
||
for (let dir of exampleDirs) { | ||
let opts = { | ||
cwd: path.join(__dirname, dir), | ||
stdio: 'inherit' | ||
}; | ||
|
||
for (let cmdArg of cmdArgs) { | ||
let result = spawnSync(cmdArg.cmd, cmdArg.args, opts); | ||
if (result.status !== 0) { | ||
throw new Error('Building examples exited with non-zero'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters