pkgprn 0.5.4 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/prune.js +6 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pkgprn",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "license": "MIT",
5
5
  "author": "Konstantin Shutkin",
6
6
  "bin": "./index.js",
package/prune.js CHANGED
@@ -52,6 +52,10 @@ export async function prunePkg(pkg, options, logger) {
52
52
  logger('cleanup is disabled, junk files may cause flatten to fail', 2);
53
53
  }
54
54
 
55
+ if (pkg.files && Array.isArray(pkg.files) && pkg.files.length > 0 && options.cleanupFiles) {
56
+ await cleanupDir(pkg, logger);
57
+ }
58
+
55
59
  if (options.flatten) {
56
60
  await flatten(pkg, options.flatten, logger, options.removeSourcemaps);
57
61
  }
@@ -209,8 +213,8 @@ export async function prunePkg(pkg, options, logger) {
209
213
  }
210
214
  }
211
215
 
212
- if (pkg.files && Array.isArray(pkg.files) && options.cleanupFiles) {
213
- await cleanupDir(pkg, logger);
216
+ if (options.cleanupFiles) {
217
+ pkg.files = undefined;
214
218
  }
215
219
  }
216
220
 
@@ -625,8 +629,6 @@ async function cleanupDir(pkg, logger) {
625
629
 
626
630
  await rm(entry, { recursive: true, force: true });
627
631
  }
628
-
629
- pkg.files = undefined;
630
632
  }
631
633
 
632
634
  async function cleanupSubDir(dir, filesEntries, alwaysIncludedFiles) {