Testbench for automatically configuring a Node environment on clone/pull/update/whatever.
This example has two branches as an example:
master
, has a dependency on Express 4 (yarn list express
shows 4.x)express-3
, has a dependency on Express 3
Doing git checkout <branch>
should set the correct Express version automatically. You can see this with yarn list express
.
- It has
nvm
installed - It has Bash somewhere
Yarn is used because it's faster than NPM, whilst also being compatible. There is a yarn.lock
file that should be tracked in the repository that will ensure Node package and package dependency version consistency between developer machines, as well as Docker images and production boxes.
The check-node-env.sh
script will install the latest Yarn globally if it's not already present.
The bootstrap script is ./install-git-hooks.sh
. It is run as a postinstall
script when yarn install
is ran. Seeing as yarn install
must be run for the project to be used anyway, it's practically guaranteed that install-git-hooks.sh
is run before anything else.
The post-merge
script runs on pull
The post-checkout
script when the user changes a branch
- It should be added into
githooks/
- It should have the correct name for the Git hook you're targeting. Grep through the Git hooks docs for the options.
- It should be executable (
chmod +x githooks/*
)
- Install NVM
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
- TODO: Other firewally-type scripts from the current deploy