Skip to content

Commit

Permalink
ignore .dotfiles. Avoids unsightly .DS_Store files on OS X.
Browse files Browse the repository at this point in the history
  • Loading branch information
dylang committed Oct 25, 2014
1 parent 99cb487 commit 6dc99c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion npmrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ function printNpmrcs () {
fs.readlink(NPMRC, function (err, link) {
link = link && path.basename(link)
fs.readdirSync(NPMRC_STORE).forEach(function (npmrc) {
console.log(' %s %s', link == npmrc ? '*' : ' ', npmrc)
if (npmrc[0] !== '.') {
console.log(' %s %s', link == npmrc ? '*' : ' ', npmrc)
}
})
})
}
Expand Down
3 changes: 3 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const test = require('tape')
, npmrc = path.join(homedir, '.npmrc')
, npmrcs = path.join(homedir, '.npmrcs')
, def = path.join(homedir, '.npmrcs/default')
, dotfile = path.join(homedir, '.npmrcs/.dotfile')


function cleanup (t) {
Expand Down Expand Up @@ -127,12 +128,14 @@ test('switch config', function (t) {


test('list config', function (t) {
fs.writeFileSync(dotfile, '.dotfile', 'utf8')
exec(cmd, options, function (err, stdout, stderr) {
t.notOk(err, 'no error')
t.equal(stderr, '', 'no stderr')
t.ok(/Available npmrcs/.test(stdout), 'got "available" msg')
t.ok((/\* default$/m).test(stdout), 'listed "default"')
t.ok((/ foobar$/m).test(stdout), 'listed "foobar"')
t.notOk((/\.dotfile$/m).test(stdout), 'listed "dotfile"')
t.end()
})
})
Expand Down

0 comments on commit 6dc99c9

Please sign in to comment.