After recently moving to Fastly’s CDN for chromatichq.com we built and released fastly-cli to enable fast and efficient access to the Fastly API via the command line.
Once we had the basics up and running with fastly-cli, we hit a small roadblock. Some of the functionality in the Fastly API had been changed since the release of the Fastly node.js client we were utilizing. We dug in and were able to identify/fix the issue with a pull request, but we did not want to delay the release of fastly-cli while we waited for review, so we had to uncover how to reference our patched version of the npm package as a dependency.
package.json Changes
To specify an alternate version of a library in our package, include the full repository url followed by a #
and the tag you want to reference. This can be a git tag, branch or commit hash. In this case, we ended up using the commit hash:
npm install --save git://github.com/ChromaticHQ/fastly.git#85086829958a05faa53b445501d782e4772f356a
With our fix in hand, we were ready to tag a first release and submit fastly-cli to npm. Crisis (and impatience) averted.