remove-glob 0.3.3 → 0.3.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.
package/README.md CHANGED
@@ -59,6 +59,9 @@ $ remove foo bar
59
59
  $ remove --glob \"dist/**/*.{js,map}\"
60
60
  ```
61
61
 
62
+ > [!NOTE]
63
+ > When using the `--glob` option, it will skips `.git/` and `node_modules/` directories by default.
64
+
62
65
  ### Usage
63
66
 
64
67
  ```ts
package/dist/cli.js CHANGED
@@ -71,8 +71,6 @@ try {
71
71
  describe: 'If true, it will log each file or directory being removed',
72
72
  },
73
73
  },
74
- helpOptLength: 16,
75
- helpDescLength: 73,
76
74
  version: readPackage().version,
77
75
  };
78
76
  const results = parseArgs(config);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAWrD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,GAAE,aAAkB,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,qBAoElF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAWrD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,GAAE,aAAkB,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,qBA0ElF"}
package/dist/index.js CHANGED
@@ -32,7 +32,13 @@ export function removeSync(opts = {}, callback) {
32
32
  }
33
33
  const requiresCwdChange = !!(paths.length && opts.cwd);
34
34
  if (!paths.length && opts.glob) {
35
- paths = globSync(opts.glob, { cwd: opts.cwd, dot: true, onlyFiles: false, absolute: true });
35
+ paths = globSync(opts.glob, {
36
+ cwd: opts.cwd,
37
+ dot: true,
38
+ onlyFiles: false,
39
+ absolute: true,
40
+ ignore: ['**/.git/**', '**/node_modules/**'],
41
+ });
36
42
  }
37
43
  opts.stat && console.time('Duration');
38
44
  opts.dryRun && console.log('=== dry-run ===');
@@ -52,7 +58,7 @@ export function removeSync(opts = {}, callback) {
52
58
  readdirSync(path).forEach(name => {
53
59
  removeSync({ paths: join(path, name) }); // recursively remove content
54
60
  });
55
- rmSync(path, { recursive: true, force: true });
61
+ rmSync(path, { recursive: true, force: true, maxRetries: process.platform === 'win32' ? 10 : 0 });
56
62
  }
57
63
  }
58
64
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remove-glob",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "A tiny utility to remove items or directories recursively, also supports glob",
5
5
  "bin": {
6
6
  "remove": "dist/cli.js"
package/src/cli.ts CHANGED
@@ -76,8 +76,6 @@ try {
76
76
  describe: 'If true, it will log each file or directory being removed',
77
77
  },
78
78
  },
79
- helpOptLength: 16,
80
- helpDescLength: 73,
81
79
  version: readPackage().version,
82
80
  } as const;
83
81
 
package/src/index.ts CHANGED
@@ -43,7 +43,13 @@ export function removeSync(opts: RemoveOptions = {}, callback?: (e?: Error) => v
43
43
  }
44
44
  const requiresCwdChange = !!(paths.length && opts.cwd);
45
45
  if (!paths.length && opts.glob) {
46
- paths = globSync(opts.glob, { cwd: opts.cwd, dot: true, onlyFiles: false, absolute: true });
46
+ paths = globSync(opts.glob, {
47
+ cwd: opts.cwd,
48
+ dot: true,
49
+ onlyFiles: false,
50
+ absolute: true,
51
+ ignore: ['**/.git/**', '**/node_modules/**'],
52
+ });
47
53
  }
48
54
  opts.stat && console.time('Duration');
49
55
  opts.dryRun && console.log('=== dry-run ===');
@@ -64,7 +70,7 @@ export function removeSync(opts: RemoveOptions = {}, callback?: (e?: Error) => v
64
70
  readdirSync(path).forEach(name => {
65
71
  removeSync({ paths: join(path, name) }); // recursively remove content
66
72
  });
67
- rmSync(path, { recursive: true, force: true });
73
+ rmSync(path, { recursive: true, force: true, maxRetries: process.platform === 'win32' ? 10 : 0 });
68
74
  }
69
75
  } else {
70
76
  // files