Created
June 9, 2016 22:56
-
-
Save particlebanana/fa3fb1765aaddf40c9c37dd6e9d5d366 to your computer and use it in GitHub Desktop.
Script to dynamically build up .npmrc in production
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ╔═╗╦═╗╔═╗╦╔╗╔╔═╗╔╦╗╔═╗╦ ╦ ┌─┐┌─┐┌┬┐ ┌┐┌┌─┐┌┬┐┬─┐┌─┐ ┌─┐┬┬ ┌─┐ | |
// ╠═╝╠╦╝║╣ ║║║║╚═╗ ║ ╠═╣║ ║ └─┐├┤ │ │││├─┘│││├┬┘│ ├┤ ││ ├┤ | |
// ╩ ╩╚═╚═╝╩╝╚╝╚═╝ ╩ ╩ ╩╩═╝╩═╝ └─┘└─┘ ┴ ┘└┘┴ ┴ ┴┴└─└─┘ └ ┴┴─┘└─┘ | |
// | |
// Used in production to install npm private modules | |
if(process.env.NODE_ENV !== 'production') { | |
return; | |
} | |
var fs = require('fs'); | |
fs.writeFileSync('.npmrc', '//registry.npmjs.org/:_authToken=${NPM_TOKEN}'); | |
fs.chmodSync('.npmrc', 0600); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment