diff --git a/package.json b/package.json index 396ae9d6..24f782ab 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "jsonlint": "^1.6.3", "less": "^3.8.1", "lz-string-unsafe": "^1.4.4-fork-1", + "rimraf": "^2.6.2", "semver-bundle": "^0.1.1", "stylelint-bundle": "^8.0.0", "stylus-lang-bundle": "^0.54.5", @@ -23,7 +24,7 @@ "update": "npm run update-node && npm run update-main", "update-quick": "updates -u && npm update && npm run update-main", "update-main": "npm run update-versions && npm run update-codemirror", - "update-node": "updates -u && rm -rf node_modules && npm install", + "update-node": "updates -u && node tools/remove-modules.js && npm install", "update-codemirror": "node tools/update-libraries.js && node tools/update-codemirror-themes.js", "update-versions": "node tools/update-versions", "zip": "npm run update-versions && node tools/zip.js" diff --git a/tools/remove-modules.js b/tools/remove-modules.js new file mode 100644 index 00000000..c3b166ac --- /dev/null +++ b/tools/remove-modules.js @@ -0,0 +1,8 @@ +#!/usr/bin/env node +'use strict'; + +const fs = require('fs'); +const rimraf = require('rimraf'); + +// See https://github.com/isaacs/rimraf/issues/102#issuecomment-412310309 +rimraf('node_modules/!(rimraf|.bin)', fs, () => {});