|
2 | 2 | [](http://www.typescriptlang.org/) |
3 | 3 | [](https://vitest.dev/) |
4 | 4 | [](https://codecov.io/gh/ghiscoding/native-copyfiles) |
| 5 | +<a href="https://nodejs.org/en/about/previous-releases"><img src="https://img.shields.io/node/v/native-copyfiles.svg" alt="Node" /></a> |
| 6 | + |
5 | 7 | [](https://www.npmjs.com/package/native-copyfiles) |
6 | 8 | [](https://www.npmjs.com/package/native-copyfiles) |
7 | | -[](https://bundlephobia.com/result?p=native-copyfiles) |
8 | | -<a href="https://nodejs.org/en/about/previous-releases"><img src="https://img.shields.io/node/v/native-copyfiles.svg" alt="Node" /></a> |
| 9 | +[](https://bundlejs.com/?q=native-copyfiles) |
9 | 10 |
|
10 | 11 | ## native-copyfiles |
11 | 12 |
|
12 | 13 | Copy files easily via JavaScript or the CLI, it uses [tinyglobby](https://www.npmjs.com/package/tinyglobby) internally for glob patterns and [cli-nano](https://www.npmjs.com/package/cli-nano) for the CLI. |
13 | 14 |
|
14 | | -The library is very similar to the [copyfiles](https://www.npmjs.com/package/copyfiles) package, at least from the outside; however its internal is very different. It uses more native NodeJS code and a lot fewer dependencies (3 instead of 7), which makes this package a lot smaller compared to the original `copyfiles` project (1/3 of its size). The options are nearly the same (except for `--soft`, which is not implemented), new options were also added in this project here (mainly the rename feature, see below). |
| 15 | +The library is very similar to the [copyfiles](https://www.npmjs.com/package/copyfiles) package, at least from the outside; however its internal is quite different. It uses more native NodeJS code and a lot less dependencies (just 3 instead of 7), which makes this package a lot smaller compared to the original `copyfiles` project (1/4 of its size). The options are nearly the same (except for `--soft`, which is not implemented), there's also some new options that were added in this project (mainly the rename and dry-run features, see below). |
15 | 16 |
|
16 | | -> Note: there is 1 noticeable difference with `copyfiles`, any options must be provided as a suffix after the source/target directories command (the original `copyfiles` project has them as prefix).<br> |
| 17 | +> Note: there is 1 noticeable difference with `copyfiles`, all CLI options must be provided as a suffix after the source/target directories command (the original `copyfiles` project has them as prefix).<br> |
17 | 18 | > This mean calling: `copyfiles source target [options]` instead of `copyfiles [options] source target` |
18 | 19 |
|
19 | 20 | ### Install |
@@ -46,7 +47,7 @@ Positionals: |
46 | 47 | ``` |
47 | 48 |
|
48 | 49 | > [!NOTE] |
49 | | -> Options **must** be provided after the command directories as suffix (the original project has them as prefix) |
| 50 | +> Options **must** be provided after the command directories as suffix (the original project references them as prefix) |
50 | 51 |
|
51 | 52 | copy some files, give it a bunch of arguments, (which can include globs), the last one |
52 | 53 | is the out directory (which it will create if necessary). Note: on Windows globs must be **double quoted**, everybody else can quote however they please. |
@@ -98,17 +99,17 @@ does. |
98 | 99 |
|
99 | 100 | You could quote globstars as a part of input: |
100 | 101 | ```bash |
101 | | -copyfiles some.json "./some_folder/*.json" ./dist/ && echo 'JSON files copied.' |
| 102 | +copyfiles some.json "./some_folder/*.json" "./dist/" && echo 'JSON files copied.' |
102 | 103 | ``` |
103 | 104 |
|
104 | 105 | You can use the `-e` option to exclude some files from the pattern, so to exclude all files ending in `".test.js"` you could do |
105 | 106 |
|
106 | 107 | ```bash |
107 | | -copyfiles "**/*.test.js" -f ./foo/**/*.js out -e |
| 108 | +copyfiles "**/*.test.js" -f "./foo/**/*.js" out -e |
108 | 109 | ``` |
109 | 110 |
|
110 | 111 | > [!NOTE] |
111 | | -> By default the `.git/` and `node_modules/` directories will be excluded. |
| 112 | +> By default the `.git/` and `node_modules/` directories will be excluded when using globs. |
112 | 113 |
|
113 | 114 | Other options include |
114 | 115 |
|
@@ -206,14 +207,14 @@ and finally the third and last argument is a callback function which is executed |
206 | 207 |
|
207 | 208 | ```js |
208 | 209 | { |
209 | | - verbose: bool, // print more information to console |
210 | | - up: number, // slice a path off the bottom of the paths |
211 | | - exclude: string, // exclude pattern |
212 | | - all: bool, // include dot files |
213 | | - dryRun: bool, // show what would be copied, without actually copying anything |
214 | | - follow: bool, // follow symlinked directories when expanding ** patterns |
215 | | - error: bool // raise errors if no files copied |
216 | | - stat: bool // show statistics after execution (time + file count) |
| 210 | + verbose: boolean; // print more information to console |
| 211 | + up: number; // slice a path off the bottom of the paths |
| 212 | + exclude: string; // exclude pattern |
| 213 | + all: boolean; // include dot files |
| 214 | + dryRun: boolean; // show what would be copied, without actually copying anything |
| 215 | + follow: boolean; // follow symlinked directories when expanding ** patterns |
| 216 | + error: boolean; // raise errors if no files copied |
| 217 | + stat: boolean; // show statistics after execution (time + file count) |
217 | 218 | rename: (src, dest) => string; // callback to transform the destination filename(s) |
218 | 219 | } |
219 | 220 | ``` |
0 commit comments