Permalink
Browse files

Add script to link local react-intl in examples/ (#794)

1 parent cb63f36 commit 493253c447bd7005da1c7ed38ed16ce54f1f530e @ericf ericf committed on GitHub Dec 29, 2016
Showing with 18 additions and 0 deletions.
  1. +2 −0 package.json
  2. +16 −0 scripts/examples.js
View
@@ -136,6 +136,8 @@
"test:all": "npm run lint && npm run test && npm run test:react",
"test:watch": "jest --watch",
"test:perf": "cross-env NODE_ENV=production babel-node test/perf",
+ "examples:install": "babel-node scripts/examples npm install",
+ "examples:link": "npm link && babel-node scripts/examples npm link react-intl",
"preversion": "npm run clean && npm run build && npm run test:all",
"prepublish": "npm run clean && npm run build"
}
View
@@ -0,0 +1,16 @@
+import {sync as globSync} from 'glob';
+import {spawnSync} from 'child_process';
+
+const [command, ...args] = process.argv.slice(2);
+
+globSync('./examples/*/').forEach((exampleDir) => {
+ const opts = {
+ cwd: exampleDir,
+ stdio: 'inherit',
+ };
+
+ const result = spawnSync(command, args, opts);
+ if (result.status !== 0) {
+ throw new Error('Linking examples exited with non-zero');
+ }
+});

0 comments on commit 493253c

Please sign in to comment.