From f456fca290a20cec4c465537f67030d1542d185a Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Thu, 7 Jun 2018 11:18:40 -0700 Subject: [PATCH] scripts: auto generate ignores --- .gitignore | 12 --- node_modules/.gitignore | 179 +++++++++++++++++++++++++++++++++++++ package.json | 1 + scripts/dep-update | 3 +- scripts/dev-dep-update | 1 + scripts/gen-dev-ignores.js | 5 ++ 6 files changed, 188 insertions(+), 13 deletions(-) create mode 100644 node_modules/.gitignore create mode 100644 scripts/gen-dev-ignores.js diff --git a/.gitignore b/.gitignore index faf93bc8382d7..065c0438da279 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ diff --git a/node_modules/.gitignore b/node_modules/.gitignore new file mode 100644 index 0000000000000..1de8ad6419413 --- /dev/null +++ b/node_modules/.gitignore @@ -0,0 +1,179 @@ +## Automatically generated dev dependency ignores +/acorn +/acorn-jsx +/ajv-keywords +/ansi-escapes +/argparse +/array-includes +/array-union +/array-uniq +/arrify +/babel-code-frame +/bind-obj-methods +/browser-request +/caller +/caller-path +/callsites +/chardet +/circular-json +/clean-yaml-object +/cli-cursor +/cli-width +/cloudant-follow +/coffee-script +/color-support +/connect +/contains-path +/core-js +/couchapp +/coveralls +/debug-log +/deep-equal +/deep-is +/define-properties +/deglob +/del +/diff +/doctrine +/ee-first +/encodeurl +/error-ex +/errs +/es-abstract +/es-to-primitive +/escape-html +/eslint +/eslint-config-standard +/eslint-config-standard-jsx +/eslint-import-resolver-node +/eslint-module-utils +/eslint-plugin-import +/eslint-plugin-node +/eslint-plugin-promise +/eslint-plugin-react +/eslint-plugin-standard +/eslint-scope +/eslint-visitor-keys +/espree +/esprima +/esquery +/esrecurse +/estraverse +/esutils +/events-to-array +/external-editor +/fast-levenshtein +/fbjs +/figures +/file-entry-cache +/finalhandler +/find-root +/flat-cache +/foreach +/foreground-child +/fs-exists-cached +/function-bind +/function-loop +/functional-red-black-tree +/get-stdin +/globals +/globby +/has +/has-ansi +/hock +/http-proxy +/ignore +/inquirer +/is-arrayish +/is-callable +/is-date-object +/is-path-cwd +/is-path-in-cwd +/is-promise +/is-regex +/is-resolvable +/is-symbol +/isomorphic-fetch +/js-tokens +/js-yaml +/json +/json-stable-stringify-without-jsonify +/jsx-ast-utils +/lcov-parse +/levn +/load-json-file +/lodash.isempty +/log-driver +/loose-envify +/marked +/marked-man +/nano +/natural-compare +/node-fetch +/npm-registry-couchapp +/npm-registry-mock +/nyc +/object-keys +/on-finished +/onetime +/optimist +/optionator +/own-or +/own-or-env +/parse-json +/parseurl +/path-parse +/path-type +/pinkie +/pinkie-promise +/pkg-conf +/pkg-config +/pkg-dir +/pkginfo +/pluralize +/prelude-ls +/progress +/promise +/prop-types +/querystring +/read-pkg +/read-pkg-up +/require-inject +/require-uncached +/resolve +/restore-cursor +/run-async +/run-parallel +/rx-lite +/rx-lite-aggregates +/setimmediate +/slice-ansi +/source-map +/source-map-support +/sprintf-js +/stack-utils +/standard +/standard-engine +/statuses +/strip-bom +/table +/tacks +/tap +/tap-mocha-reporter +/tap-parser +/tmatch +/tmp +/trivial-deferred +/tsame +/type-check +/ua-parser-js +/unicode-length +/uniq +/url +/utils-merge +/watch +/whatwg-fetch +/window-size +/wordwrap +/write +/yapool diff --git a/package.json b/package.json index 5de3bc8612ce8..33fd36c2ae1a8 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/scripts/dep-update b/scripts/dep-update index ec799b128710d..52abd518c317b 100755 --- a/scripts/dep-update +++ b/scripts/dep-update @@ -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 diff --git a/scripts/dev-dep-update b/scripts/dev-dep-update index 572f1c39c99d8..c8c9604759165 100755 --- a/scripts/dev-dep-update +++ b/scripts/dev-dep-update @@ -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 &&\ diff --git a/scripts/gen-dev-ignores.js b/scripts/gen-dev-ignores.js new file mode 100644 index 0000000000000..3f6dcb301bcdb --- /dev/null +++ b/scripts/gen-dev-ignores.js @@ -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')