-
Notifications
You must be signed in to change notification settings - Fork 67
/
gulpfile.js
34 lines (30 loc) · 1.14 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
var child_process = require("child_process");
var yargs = require("yargs");
async function runSnapshots(storiesList, isDryRun) {
const stories =
yargs.argv.stories === undefined ? storiesList : yargs.argv.stories;
const aStories = stories.split(",");
const storiesReg = aStories.join("|");
const storiesRX = `^\\bSkin/\(?:${storiesReg})\\b`;
const storiesRXString = "\\bSkin/\\(?:" + storiesReg + ")\\b";
const dryRun = yargs.argv.dry === undefined ? isDryRun : yargs.argv.dry;
const percyExecutable = dryRun
? "snapshots:execute:dry"
: "snapshots:execute";
console.log(`
************************************************************
Running Percy Snapshot(s)...
Snapshot(s): ${stories}
Percy Stories Regex: ${storiesRXString}
Percy Dry Run: ${dryRun}
Running Snapshot(s)...
************************************************************
`);
return child_process
.spawn("npm", ["run", percyExecutable, storiesRX], { stdio: "inherit" })
.on("close", function () {
console.log("\nCompleted\n\n");
});
}
// public tasks
exports.runSnapshots = runSnapshots;