Skip to content

Commit

Permalink
scripts: auto generate ignores
Browse files Browse the repository at this point in the history
  • Loading branch information
iarna committed Jun 8, 2018
1 parent f722029 commit f456fca
Show file tree
Hide file tree
Showing 6 changed files with 188 additions and 13 deletions.
12 changes: 0 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,3 @@ npm-debug.log
.jshintrc
.eslintrc
.nyc_output

# dev dependencies
/node_modules/deep-equal/
/node_modules/marked/
/node_modules/marked-man/
/node_modules/npm-registry-couchapp/
/node_modules/npm-registry-mock/
/node_modules/require-inject/
/node_modules/sprintf-js/
/node_modules/standard/
/node_modules/tap/
/node_modules/tacks/
179 changes: 179 additions & 0 deletions node_modules/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@
},
"scripts": {
"dumpconf": "env | grep npm | sort | uniq",
"postinstall": "node scripts/gen-dev-ignores.js",
"prepare": "node bin/npm-cli.js --no-audit --no-timing prune --prefix=. --no-global && rimraf test/*/*/node_modules && make -j4 doc",
"preversion": "bash scripts/update-authors.sh && git add AUTHORS && git commit -m \"update AUTHORS\" || true",
"tap": "tap --reporter=classic --timeout 300",
Expand Down
3 changes: 2 additions & 1 deletion scripts/dep-update
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
node . install --save $1@$2 &&\
git add node_modules/$1/ package.json package-lock.json &&\
node scripts/gen-dev-ignores.js &&\
git add node_modules package.json package-lock.json &&\
git commit -m"$1@$2" &&\
node . repo $1 &&\
git commit --amend
1 change: 1 addition & 0 deletions scripts/dev-dep-update
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
node . install --save --save-dev $1@$2 &&\
node scripts/gen-dev-ignores.js &&\
git add package.json package-lock.json &&\
git commit -m"$1@$2" &&\
node . repo $1 &&\
Expand Down
5 changes: 5 additions & 0 deletions scripts/gen-dev-ignores.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const fs = require('fs')
const plock = require('../package-lock.json')
fs.writeFileSync(`${__dirname}/../node_modules/.gitignore`,
'## Automatically generated dev dependency ignores\n' +
Object.keys(plock.dependencies).filter(_ => plock.dependencies[_].dev).map(_ => `/${_}`).join('\n') + '\n')

0 comments on commit f456fca

Please sign in to comment.