Last active
February 24, 2017 11:53
-
-
Save bjankord/c5d1b0a578a2c7122e8e1a906f0ab1bd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
"scripts": { | |
"compile": "node ../../scripts/compile.js", | |
"lint": "node ../../scripts/lint.js", | |
"pretest": "node ../../scripts/pretest.js", | |
"release:major": "npm test && npm run compile && npm version major -m \"Released version %s\" && npm publish && git push", | |
"release:minor": "npm test && npm run compile && npm version minor -m \"Released version %s\" && npm publish && git push", | |
"release:patch": "npm test && npm run compile && npm version patch -m \"Released version %s\" && npm publish && git push", | |
"test": "node ../../scripts/test.js" | |
} |
This file contains hidden or 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
const shell = require('shelljs'); | |
// Paths are relative to location script is called from | |
// Uncomment next line to view work directory scripts are executed from | |
// shell.exec('pwd'); | |
shell.exec('npm run lint'); |
This file contains hidden or 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
const shell = require('shelljs'); | |
// Paths are relative to location script is called from | |
// Uncomment next line to view work directory scripts are executed from | |
// shell.exec('pwd'); | |
shell.exec('../../node_modules/.bin/eslint **/*.js, **/*.jsx'); | |
if (shell.exec('../../node_modules/.bin/eslint **/*.js, **/*.jsx').code !== 0) { | |
shell.echo('Error: JS lint errors detected'); | |
shell.exit(1); | |
} | |
shell.exec('../../node_modules/.bin/eslint **/*.js, **/*.jsx', function(code, stdout, stderr) { | |
if (code !== 0) { | |
process.exit(1); | |
} | |
// console.log('Exit code:', code); | |
// console.log('Program output:', stdout); | |
// console.log('Program stderr:', stderr); | |
}); |
This file contains hidden or 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
const shell = require('shelljs'); | |
// Paths are relative to location script is called from | |
// Uncomment next line to view work directory scripts are executed from | |
// shell.exec('pwd'); | |
shell.exec('../../node_modules/.bin/jest --config ../../jestconfig.json'); |
Using the following in lint.js
shell.exec('../../node_modules/.bin/eslint **/*.js, **/*.jsx', function(code, stdout, stderr) {
if (code !== 0) {
shell.exit(code);
}
});
And call npm run lint
in the npm-script "pretest" rather than node ../../scripts/pretest.js
seems to cause the script to error out correctly if there is lint rather than moving on to running tests.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm running into an issue when pretest.js is run. If there is lint, it will report in the output but continue on to running tests. I've tried thowing and error and exiting the node process with no luck.