and
Great Again!
Awesome!
Supreme
...at
Michael K Snead
Remember when that one guy broke npm?
Let's solve these problems!
node.js itself can be "xcopy deployed"
This means your team can be independent of whatever is installed on the TeamCity agents
Supreme's folder looks like this:
Make sure you add everything, including the node_modules folder in \Binaries\ to source control!
You can either point to the node.js installed on your system (ie: program files) or to the one under \Binaries\.
Your choice.
Supreme uses a simple batch script to kick off gulp/webpack/etc. builds, tests and tasks.
:: We start from \Binaries\ folder when running the script
:: Let's use our \Binaries\ copy of node.js too
SET PATH=%CD%;%PATH%
:: Now let's go tell gulp to build stuff
PUSHD ..\ApplicationTracking\WebApplication\
:: Use CALL or it doesn't work right from batch script
CALL gulp gulp-build
:: Return to \Binaries\
POPD
The key bits are setting the path and using "CALL" to start node-related stuff.
Test this locally before dropping it on TC!
Prior to npm3+, which fixes long paths on Windows, Supreme attempted to fix this by 7-zipping the node_modules folder and extracting on build.
It was fast. It was reliable in CI.
It was manual and easy to forget to update. :(
That might work! Some things to consider, though...
To make this less painful I've heard of folks storing node_modules in its own repository...
# Install local-npm
npm install -g local-npm
# Start it up
local-npm
# Point npm at it
npm set registry http://127.0.0.1:5080
# To revert back to npm (why?) run:
npm set registry https://registry.npmjs.org
BOOM!
Much like we use devspare4 for nuget file hosting, we need a machine to run this lightweight node-based server.
(ie: devspare4? devspare 4 1/2?)
Added bonus: if npm ever goes down, Paylocity doesn't have to worry. We no longer spam npm with requests from our CI servers.