Skip to content

Commit 596d89b

Browse files
committed
build(validate): use Yarn to run package scripts
1 parent d9dea39 commit 596d89b

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ cache:
1212
directories:
1313
- node_modules
1414

15-
script: npm run validate
15+
script: yarn validate
1616

1717
jobs:
1818
include:
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`validate allows you to specify your own npm scripts 1`] = `concurrently --kill-others-on-fail --prefix [{name}] --names specialbuild,specialtest,speciallint --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset,bgMagenta.bold.reset "npm run specialbuild --silent" "npm run specialtest --silent" "npm run speciallint --silent"`;
3+
exports[`validate allows you to specify your own npm scripts 1`] = `concurrently --kill-others-on-fail --prefix [{name}] --names specialbuild,specialtest,speciallint --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset,bgMagenta.bold.reset "yarn run specialbuild" "yarn run specialtest" "yarn run speciallint"`;
44

5-
exports[`validate calls concurrently with all scripts 1`] = `concurrently --kill-others-on-fail --prefix [{name}] --names build,lint,test,flow --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset,bgMagenta.bold.reset,bgCyan.bold.reset "npm run build --silent" "npm run lint --silent" "npm run test --silent -- --coverage" "npm run flow --silent"`;
5+
exports[`validate calls concurrently with all scripts 1`] = `concurrently --kill-others-on-fail --prefix [{name}] --names build,lint,test,flow --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset,bgMagenta.bold.reset,bgCyan.bold.reset "yarn run build" "yarn run lint" "yarn run test --coverage" "yarn run flow"`;
66

7-
exports[`validate does not include "build" if it doesn't have that script 1`] = `concurrently --kill-others-on-fail --prefix [{name}] --names lint,test,flow --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset,bgMagenta.bold.reset "npm run lint --silent" "npm run test --silent -- --coverage" "npm run flow --silent"`;
7+
exports[`validate does not include "build" if it doesn't have that script 1`] = `concurrently --kill-others-on-fail --prefix [{name}] --names lint,test,flow --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset,bgMagenta.bold.reset "yarn run lint" "yarn run test --coverage" "yarn run flow"`;
88

9-
exports[`validate does not include "flow" if it doesn't have that script 1`] = `concurrently --kill-others-on-fail --prefix [{name}] --names build,lint,test --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset,bgMagenta.bold.reset "npm run build --silent" "npm run lint --silent" "npm run test --silent -- --coverage"`;
9+
exports[`validate does not include "flow" if it doesn't have that script 1`] = `concurrently --kill-others-on-fail --prefix [{name}] --names build,lint,test --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset,bgMagenta.bold.reset "yarn run build" "yarn run lint" "yarn run test --coverage"`;
1010

11-
exports[`validate does not include "lint" if it doesn't have that script 1`] = `concurrently --kill-others-on-fail --prefix [{name}] --names build,test,flow --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset,bgMagenta.bold.reset "npm run build --silent" "npm run test --silent -- --coverage" "npm run flow --silent"`;
11+
exports[`validate does not include "lint" if it doesn't have that script 1`] = `concurrently --kill-others-on-fail --prefix [{name}] --names build,test,flow --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset,bgMagenta.bold.reset "yarn run build" "yarn run test --coverage" "yarn run flow"`;
1212

13-
exports[`validate does not include "test" if it doesn't have that script 1`] = `concurrently --kill-others-on-fail --prefix [{name}] --names build,lint,flow --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset,bgMagenta.bold.reset "npm run build --silent" "npm run lint --silent" "npm run flow --silent"`;
13+
exports[`validate does not include "test" if it doesn't have that script 1`] = `concurrently --kill-others-on-fail --prefix [{name}] --names build,lint,flow --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset,bgMagenta.bold.reset "yarn run build" "yarn run lint" "yarn run flow"`;
1414

15-
exports[`validate doesn't use test or lint if it's in pre-commit 1`] = `concurrently --kill-others-on-fail --prefix [{name}] --names build,flow --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset "npm run build --silent" "npm run flow --silent"`;
15+
exports[`validate doesn't use test or lint if it's in pre-commit 1`] = `concurrently --kill-others-on-fail --prefix [{name}] --names build,flow --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset "yarn run build" "yarn run flow"`;

src/scripts/validate.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@ const useDefaultScripts = typeof validateScripts !== 'string'
1717

1818
const scripts = useDefaultScripts
1919
? {
20-
build: ifScript('build', 'npm run build --silent'),
21-
lint: preCommit ? null : ifScript('lint', 'npm run lint --silent'),
22-
test: preCommit
23-
? null
24-
: ifScript('test', 'npm run test --silent -- --coverage'),
25-
flow: ifScript('flow', 'npm run flow --silent'),
20+
build: ifScript('build', 'yarn run build'),
21+
lint: preCommit ? null : ifScript('lint', 'yarn run lint'),
22+
test: preCommit ? null : ifScript('test', 'yarn run test --coverage'),
23+
flow: ifScript('flow', 'yarn run flow'),
2624
}
2725
: validateScripts.split(',').reduce((scriptsToRun, name) => {
28-
scriptsToRun[name] = `npm run ${name} --silent`
26+
scriptsToRun[name] = `yarn run ${name}`
2927
return scriptsToRun
3028
}, {})
3129

0 commit comments

Comments
 (0)