Skip to content

Commit

Permalink
prefer local over global npmrc file (#39)
Browse files Browse the repository at this point in the history
* feat(npmrc): prefer local over global rc file

* chore(misc): fix capitalisation

* chore(debug): use debug instead of console.log

* fix(npmrc): move logic into separate npm module

* fix(npmrc): remove example registry url
  • Loading branch information
svnlto authored and bahmutov committed Jun 8, 2017
1 parent c0b72d5 commit e2b47bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
"del": "2.2.2",
"ggit": "1.13.4",
"lazy-ass": "1.5.0",
"local-or-home-npmrc": "1.0.0",
"q": "2.0.3",
"registry-url": "3.1.0",
"repo-url": "1.0.0",
"user-home": "2.0.0",
"verbal-expressions": "0.2.1"
},
"devDependencies": {
Expand Down
7 changes: 4 additions & 3 deletions src/set-auth-token.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
'use strict'

var registryUrl = require('registry-url')
var userHome = require('user-home')
var join = require('path').join
var npmrcFile = join(userHome, '.npmrc')
var fs = require('fs')
var q = require('q')
var formUrlToken = require('./form-auth-token')
var getPackage = require('./get-package')
var npmrcFile = require('local-or-home-npmrc')
var debug = require('debug')('npm-utils')

function updateNpmrc (data) {
var contents = ''

if (fs.existsSync(npmrcFile)) {
debug('using file:', npmrcFile)
contents = fs.readFileSync(npmrcFile, 'utf-8')
contents = contents.trim() + '\n'
}
Expand Down

0 comments on commit e2b47bf

Please sign in to comment.