Skip to content

Commit

Permalink
consolidate pre-push hook & travis test script
Browse files Browse the repository at this point in the history
  • Loading branch information
andykais committed Mar 1, 2019
1 parent aaeb45c commit 32ca4e2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 33 deletions.
44 changes: 17 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,7 @@ stages:
- name: deploy website
if: branch = master AND NOT type IN (pull_request)

# test script
script: |
(
set -Eeuo pipefail
set -x
npm run typecheck
npm run test:unit
npm run test:functional
npm run lint
npm run format:check
)
# matrix script runs `npm run test`

# deploy jobs
jobs:
Expand All @@ -43,22 +33,22 @@ jobs:
provider: script
script: |
(
set -Eeuo pipefail
set -x
# bump version based on github release tag
npm version --no-git-tag-version "$TRAVIS_TAG"
# publish package to npmjs.org
echo '//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}' >> ~/.npmrc
npm run build
cd lib
npm publish
cd ..
# push updated package.json to github
git checkout -b master
git add package.json package-lock.json
git commit --message "release $TRAVIS_TAG"
git remote add deploy https://${GITHUB_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git
git push deploy master
set -Eeuo pipefail
set -x
# bump version based on github release tag
npm version --no-git-tag-version "$TRAVIS_TAG"
# publish package to npmjs.org
echo '//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}' >> ~/.npmrc
npm run build
cd lib
npm publish
cd ..
# push updated package.json to github
git checkout -b master
git add package.json package-lock.json
git commit --message "release $TRAVIS_TAG"
git remote add deploy https://${GITHUB_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git
git push deploy master
)
on:
tags: true
Expand Down
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
"format:check": "git ls-files '*.ts' '*.json' | xargs prettier --list-different",
"typecheck": "tsc --noEmit --project tsconfig.json",
"typecheck:watch": "npm run typecheck -- --watch",
"test": "run-s test:unit test:functional",
"test:watch": "mocha-webpack --grep node_modules -i **/*.test.ts --watch",
"test:unit": "mocha-webpack src/**/*.unit.test.ts",
"test:functional": "mocha-webpack testing/**/*functional.test.ts"
"test:functional": "mocha-webpack testing/**/*functional.test.ts",
"test": "run-s typecheck test:unit test:functional lint format:check"
},
"repository": {
"type": "git",
Expand All @@ -38,10 +38,7 @@
"node": "<=8.0"
},
"pre-push": [
"test:unit",
"test:functional",
"lint",
"format:check"
"test"
],
"devDependencies": {
"@babel/core": "^7.2.2",
Expand Down

0 comments on commit 32ca4e2

Please sign in to comment.