greenkeeper-shrinkwrap
v1.0.13greenkeeper-shrinkwrap
Enabling shrinkwrap support for Greenkeeper via Travis CI
Setup
After enabling Greenkeeper for your repository you can use this package to make it work with shrinkwrapped projects.
Create a GitHub access token with push access to your repository and make it available to Travis CI's environment as
GH_TOKEN
.Configure Travis CI to use the npm version you want your shrinkwrap files to be generated with before it
npm install
s your dependencies.
before_install:
# It is advisable to use latest npm, as there are a lot of shrinkwrap fixes in there
- npm install -g npm
- Install
greenkeeper-shrinkwrap
as well.
before_install:
- npm install -g npm
- npm install -g greenkeeper-shrinkwrap@1
- Configure Travis CI to run
greenkeeper-shrinkwrap-update
right before it executes your tests.
before_script: greenkeeper-shrinkwrap-update
- Configure Travis CI to run
greenkeeper-shrinkwrap-upload
right after it executed your tests.
after_script: greenkeeper-shrinkwrap-upload
Testing multiple node versions
It is common to test multiple node versions and therefor have multiple test jobs for one build. In this case the shrinkwrap will automatically be updated for every job, but only uploaded for the first one.
node_js:
- 6
- 4
before_install:
- npm install -g npm
- npm install -g greenkeeper-shrinkwrap@1
before_script: greenkeeper-shrinkwrap-update
# Only the node version 6 job will upload the shrinkwrap
after_script: greenkeeper-shrinkwrap-upload
How does it work
- This script detects whether it's running on a Greenkeeper created branch
- If so it updates the shrinkwrap file with the latest version of the updated dependency
- It pushes the commit with the updated shrinkwrap file back to the Greenkeeper branch/pull request
npm i greenkeeper-shrinkwrap
Metadata
- Apache-2.0
- >=4
- Stephan Bönnemann
- released 5/4/2017