From 5e8096883080d8d1650d4558fb62e34ce61d0dda Mon Sep 17 00:00:00 2001 From: Nathan Fritz Date: Mon, 3 Oct 2022 11:04:26 -0700 Subject: [PATCH] feat: npm-shrinkwrap.json files can now be ignored (#131) BREAKING CHANGE: if npm-shrinkwrap.json is included in your .npmignore, the shrinkwrap will now be excluded from your packlist. --- lib/index.js | 1 - ...{cannot-exclude-shrinkwrap.js => can-exclude-shrinkwrap.js} | 3 +-- test/package-json.js | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) rename test/{cannot-exclude-shrinkwrap.js => can-exclude-shrinkwrap.js} (87%) diff --git a/lib/index.js b/lib/index.js index 1b2cdbb..853a99c 100644 --- a/lib/index.js +++ b/lib/index.js @@ -285,7 +285,6 @@ class PackWalker extends IgnoreWalker { const strict = [ ...strictDefaults, '!/package.json', - '!/npm-shrinkwrap.json', '/.git', '/node_modules', '/package-lock.json', diff --git a/test/cannot-exclude-shrinkwrap.js b/test/can-exclude-shrinkwrap.js similarity index 87% rename from test/cannot-exclude-shrinkwrap.js rename to test/can-exclude-shrinkwrap.js index 608659d..9513081 100644 --- a/test/cannot-exclude-shrinkwrap.js +++ b/test/can-exclude-shrinkwrap.js @@ -1,4 +1,4 @@ -// cannot exclude npm-shrinkwrap.json in the root +// can exclude npm-shrinkwrap.json in the root 'use strict' const Arborist = require('@npmcli/arborist') @@ -19,7 +19,6 @@ t.test('package with negated files', async (t) => { const files = await packlist(tree) t.same(files, [ '.npmignore', - 'npm-shrinkwrap.json', 'package.json', ]) }) diff --git a/test/package-json.js b/test/package-json.js index 141f794..760a402 100644 --- a/test/package-json.js +++ b/test/package-json.js @@ -52,7 +52,6 @@ t.test('follows npm package ignoring rules', async (t) => { t.same(files, [ 'deps/foo/config/config.gypi', 'elf.js', - 'npm-shrinkwrap.json', 'package.json', ]) })