diff options
author | isaacs <i@izs.me> | 2020-07-23 20:58:04 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2020-07-29 21:53:42 +0300 |
commit | ad5e07d8bd86d1dbe2b03dc142f8c8d6f4828ffe (patch) | |
tree | 97b66f97d77f35774f10a5e3e9957b1897d150bb /node_modules/npm-packlist/index.js | |
parent | a16994cfdd2f255016f3d8ee60d03473d80eabd8 (diff) |
Full dependency reboot
Reinstall everything from a clean node_modules and package-lock.json
state.
Re-generate list of bundleDependencies and node_modules/.gitignore with
a script that does the right thing based on actual dependency state.
Diffstat (limited to 'node_modules/npm-packlist/index.js')
-rw-r--r-- | node_modules/npm-packlist/index.js | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/node_modules/npm-packlist/index.js b/node_modules/npm-packlist/index.js index 192f40f61..3bda08330 100644 --- a/node_modules/npm-packlist/index.js +++ b/node_modules/npm-packlist/index.js @@ -83,13 +83,23 @@ const npmWalker = Class => class Walker extends Class { opt.path = opt.path || process.cwd() const dirName = path.basename(opt.path) const parentName = path.basename(path.dirname(opt.path)) - opt.follow = - dirName === 'node_modules' || - (parentName === 'node_modules' && /^@/.test(dirName)) + + // only follow links in the root node_modules folder, because if those + // folders are included, it's because they're bundled, and bundles + // should include the contents, not the symlinks themselves. + // This regexp tests to see that we're either a node_modules folder, + // or a @scope within a node_modules folder, in the root's node_modules + // hierarchy (ie, not in test/foo/node_modules/ or something). + const followRe = /^(?:\/node_modules\/(?:@[^\/]+\/[^\/]+|[^\/]+)\/)*\/node_modules(?:\/@[^\/]+)?$/ + const rootPath = opt.parent ? opt.parent.root : opt.path + const followTestPath = opt.path.replace(/\\/g, '/').substr(rootPath.length) + opt.follow = followRe.test(followTestPath) + super(opt) // ignore a bunch of things by default at the root level. - // also ignore anything in node_modules, except bundled dependencies + // also ignore anything in the main project node_modules hierarchy, + // except bundled dependencies if (!this.parent) { this.bundled = opt.bundled || [] this.bundledScopes = Array.from(new Set( |