Skip to content

Commit

Permalink
test: create .npmrcs if they're gone
Browse files Browse the repository at this point in the history
This is what happens as a result of the changes to `fstream-npm` -- when
you try to integrate npm downstream, those files won't be there more
because `make release` calls `npm pack`, which uses `fstream-npm`.

PR-URL: npm#9476
  • Loading branch information
othiym23 committed Sep 3, 2015
1 parent 9966912 commit 901fdec
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion test/tap/00-config-setup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var fs = require('graceful-fs')
var path = require('path')
var userconfigSrc = path.resolve(__dirname, '..', 'fixtures', 'config', 'userconfig')
exports.userconfig = userconfigSrc + '-with-gc'
@@ -55,9 +56,24 @@ exports.envDataFix = {
'other-env-thing': 1000
}

var projectConf = path.resolve(__dirname, '..', '..', '.npmrc')
try {
fs.statSync(projectConf)
} catch (er) {
// project conf not found, probably working with packed npm
fs.writeFileSync(projectConf, 'save-prefix = ~\nproprietary-attribs = false\n')
}

var projectRc = path.join(__dirname, '..', 'fixtures', 'config', '.npmrc')
try {
fs.statSync(projectRc)
} catch (er) {
// project conf not found, probably working with packed npm
fs.writeFileSync(projectRc, 'just = testing')
}

if (module === require.main) {
// set the globalconfig in the userconfig
var fs = require('fs')
var uc = fs.readFileSync(userconfigSrc)
var gcini = 'globalconfig = ' + exports.globalconfig + '\n'
fs.writeFileSync(exports.userconfig, gcini + uc)

0 comments on commit 901fdec

Please sign in to comment.