remove-glob 1.2.0 → 1.2.1

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/README.md +27 -19
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -2,19 +2,27 @@
2
2
  [![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)
3
3
  [![Vitest](https://img.shields.io/badge/tested%20with-vitest-fcc72b.svg?logo=vitest)](https://vitest.dev/)
4
4
  [![codecov](https://codecov.io/gh/ghiscoding/remove-glob/branch/main/graph/badge.svg)](https://codecov.io/gh/ghiscoding/remove-glob)
5
- [![npm](https://img.shields.io/npm/v/remove-glob.svg)](https://www.npmjs.com/package/remove-glob)
6
- [![npm](https://img.shields.io/npm/dy/remove-glob)](https://www.npmjs.com/package/remove-glob)
7
- [![npm bundle size](https://img.shields.io/bundlephobia/minzip/remove-glob?color=success&label=gzip)](https://bundlephobia.com/result?p=remove-glob)
8
5
  <a href="https://nodejs.org/en/about/previous-releases"><img src="https://img.shields.io/node/v/remove-glob.svg" alt="Node" /></a>
9
6
 
10
- ## remove-glob
7
+ [![npm](https://img.shields.io/npm/dy/remove-glob)](https://www.npmjs.com/package/remove-glob)
8
+ [![npm](https://img.shields.io/npm/v/remove-glob.svg)](https://www.npmjs.com/package/remove-glob)
9
+ [![npm bundle size](https://img.shields.io/badge/API%20only%20(gzip)-1.05kB-1183c4)](https://bundlejs.com/?q=remove-glob)
10
+ [![npm bundle size](https://img.shields.io/badge/API+CLI%20(gzip)-4.08kB-1183c4)](https://bundlejs.com/?q=remove-glob%2Cremove-glob%2Fdist%2Fcli.js)
11
+
12
+ ## Remove-Glob
11
13
 
12
14
  A tiny cross-platform utility to remove items or directories recursively, it also accepts an optional glob pattern. There's also a CLI for easy, cross-platform usage using [cli-nano](https://www.npmjs.com/package/cli-nano) which is the only external dependency.
13
15
 
14
16
  Inspired by [rimraf](https://www.npmjs.com/package/rimraf) and [premove](https://www.npmjs.com/package/premove) but also supports glob pattern to remove multiple files or directories.
15
17
 
16
- > [!NOTE]
17
- > This project now requires Node.JS >= 22.17.0 so that we can use the native `fs.glob`, however if you can't update your Node.JS just yet, then just stick with `remove-glob: ^0.4.10` since that is the only change in v1.0.0
18
+ ### Major Changes
19
+ #### version 0.x
20
+ - works with Node.JS 20.x by using `tinyglobby` for glob matching
21
+
22
+ #### version 1.0
23
+ - drop `tinyglobby` and use `fs.glob` native code (requires Node.JS >=22.17)
24
+
25
+ ---
18
26
 
19
27
  ### Install
20
28
  ```sh
@@ -50,8 +58,7 @@ Options:
50
58
  -v, --version Show version number [boolean]
51
59
  ```
52
60
 
53
- When `exclude` glob pattern(s) are provided, it will override the default exclude of: [`"**/.git/**", "**/.git", "**/node_modules/**", "**/node_modules"`].
54
-
61
+ When `exclude` glob pattern(s) are provided, it will override the default exclude [`"**/.git/**", "**/.git", "**/node_modules/**", "**/node_modules"`].
55
62
 
56
63
  The `--all`/`-a` option includes dotfiles (files starting with a dot) in glob matches. By default, dotfiles are excluded unless explicitly matched or this option is used.
57
64
 
@@ -87,11 +94,12 @@ $ remove foo bar
87
94
  $ remove --glob \"dist/**/*.{js,map}\"
88
95
  ```
89
96
 
90
- When using the `--glob` option, it will skip `.git/` and `node_modules/` directories by default (using the default `--exclude` patterns). If you want to allow deletion of these directories, you can override the default by providing your own `--exclude` option (including an empty array to disable exclusion):
97
+ When using the `--glob` option, it will skip `.git/` and `node_modules/` directories by default (internally it just set that as the default `exclude`). If you want to allow deletion of these directories, you can override the default by providing your own `--exclude` option (including an empty array to disable exclusion), for example:
91
98
 
92
99
  ```sh
93
100
  # Remove everything, including .git and node_modules
94
101
  $ npx remove --glob "**/*" --exclude ""
102
+
95
103
  # Or exclude only .git, but allow node_modules to be deleted
96
104
  $ npx remove --glob "**/*" --exclude "**/.git/**" --exclude "**/.git"
97
105
  ```
@@ -114,7 +122,7 @@ const dir = resolve('./foo/bar');
114
122
  await removeSync({ paths: ['hello.txt'], cwd: dir });
115
123
  ```
116
124
 
117
- ### JavaScript API
125
+ ## JavaScript API
118
126
 
119
127
  ```js
120
128
  import { removeSync } from 'remove-glob';
@@ -126,14 +134,14 @@ The first argument is an object holding any of the options shown below. The last
126
134
 
127
135
  ```js
128
136
  {
129
- cwd: string; // directory to resolve your `filepath` from, defaults to `process.cwd()`
130
- dryRun: boolean; // show what would be removed, without actually removing anything
131
- paths: string | string[]; // filepath(s) to remove – may be a file or a directory.
132
- glob: string | string[]; // glob pattern(s) to find which files/directories to remove
133
- exclude: string | string[]; // glob pattern(s) to exclude from deletion
134
- all: boolean; // include dotfiles (files starting with a dot) in glob matches
135
- stat: boolean; // show some statistics after execution (time + file count)
136
- verbose: boolean; // print more information to console when executing the removal
137
+ cwd: string; // directory to resolve your `filepath` from, defaults to `process.cwd()`
138
+ dryRun: boolean; // show what would be removed, without actually removing anything
139
+ paths: string | string[]; // filepath(s) to remove – may be a file or a directory.
140
+ glob: string | string[]; // glob pattern(s) to find which files/directories to remove
141
+ exclude: string | string[]; // glob pattern(s) to exclude from deletion
142
+ all: boolean; // include dotfiles (files starting with a dot) in glob matches
143
+ stat: boolean; // show some statistics after execution (time + file count)
144
+ verbose: boolean; // print more information to console when executing the removal
137
145
  }
138
146
  ```
139
147
 
@@ -141,7 +149,7 @@ The first argument is an object holding any of the options shown below. The last
141
149
  > [!NOTE]
142
150
  > The first argument is required and it **must** include either a `paths` or a `glob`, but it cannot include both options simultaneously. A
143
151
 
144
- When an `exclude` glob pattern is provided, it will override the default exclusion of: [`"**/.git/**", "**/.git", "**/node_modules/**", "**/node_modules"`].
152
+ When an `exclude` glob pattern is provided, it will override the default exclusion [`"**/.git/**", "**/.git", "**/node_modules/**", "**/node_modules"`].
145
153
 
146
154
  #### Advanced glob usage
147
155
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remove-glob",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "A tiny utility to remove items or directories recursively, also supports glob",
5
5
  "bin": {
6
6
  "remove": "dist/cli.js"
@@ -35,7 +35,7 @@
35
35
  "url": "https://github.com/ghiscoding/remove-glob/issues"
36
36
  },
37
37
  "dependencies": {
38
- "cli-nano": "^1.2.2"
38
+ "cli-nano": "^1.4.0"
39
39
  },
40
40
  "engines": {
41
41
  "node": "^22.17.0 || >=24.0.0"