Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Commit

Permalink
Merge pull request #387 from wincent/glh/travis-alt-fix
Browse files Browse the repository at this point in the history
Force install before build to fix Travis NPM deploys
  • Loading branch information
wincent committed Aug 29, 2017
2 parents f468f29 + bb8b2a6 commit f9b80fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"testonly": "mocha $npm_package_options_mocha",
"lint": "eslint src",
"check": "flow check",
"build": "rm -rf dist/* && node_modules/.bin/babel src --ignore __tests__ --out-dir dist && npm run build:flow",
"build": "rm -rf dist/* && babel src --ignore __tests__ --out-dir dist && npm run build:flow",
"build:flow": "find ./src -name '*.js' -not -path '*/__tests__*' | while read filepath; do cp $filepath `echo $filepath | sed 's/\\/src\\//\\/dist\\//g'`.flow; done",
"watch": "node resources/watch.js",
"cover": "babel-node node_modules/.bin/isparta cover --root src --report html node_modules/.bin/_mocha -- $npm_package_options_mocha",
Expand Down
15 changes: 8 additions & 7 deletions resources/prepublish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@
# prepublish runs after `npm install` and `npm pack`.
# In order to only run prepublish before `npm publish`, we have to check argv.
if node -e "process.exit(($npm_config_argv).original[0].indexOf('pu') === 0)"; then
exit 0;
exit 0
fi

# Publishing to NPM is currently supported by Travis CI, which ensures that all
# tests pass first and the deployed module contains the correct file struture.
# In order to prevent inadvertently circumventing this, we ensure that a CI
# environment exists before continuing.
if [ "$CI" != true ]; then
echo "\n\n\n \033[101;30m Only Travis CI can publish to NPM. \033[0m" 1>&2;
echo " Ensure git is left is a good state by backing out any commits and deleting any tags." 1>&2;
echo " Then read CONTRIBUTING.md to learn how to publish to NPM.\n\n\n" 1>&2;
exit 1;
fi;
echo "\n\n\n \033[101;30m Only Travis CI can publish to NPM. \033[0m" 1>&2
echo " Ensure git is left is a good state by backing out any commits and deleting any tags." 1>&2
echo " Then read CONTRIBUTING.md to learn how to publish to NPM.\n\n\n" 1>&2
exit 1
fi

# Build before Travis CI publishes to NPM
npm run build;
npm install
npm run build

0 comments on commit f9b80fc

Please sign in to comment.