Skip to content

Commit 046038c

Browse files
committed
2 parents 532b6bb + 9bf1568 commit 046038c

1 file changed

Lines changed: 25 additions & 18 deletions

File tree

README.md

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,27 @@
88
[![npm](https://img.shields.io/npm/v/native-copyfiles.svg)](https://www.npmjs.com/package/native-copyfiles)
99
[![npm bundle size](https://img.shields.io/badge/gzip-1.85kB-1183c4)](https://bundlejs.com/?q=native-copyfiles)
1010

11-
## native-copyfiles
11+
## Native-Copyfiles
1212

1313
Copy files easily via JavaScript or the CLI and cross-platform usage using [cli-nano](https://www.npmjs.com/package/cli-nano) dependency for the CLI.
1414

15-
The library is very similar to the [copyfiles](https://www.npmjs.com/package/copyfiles) package, at least from the outside; however it is quite different internally. It uses native NodeJS as much as possible and so as a lot less dependencies (just 2 instead of 7), which makes this package a lot smaller compared to the original `copyfiles` project (1.8kB instead of 27.6kB gzip). 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+
The library is very similar to the [copyfiles](https://www.npmjs.com/package/copyfiles) package, at least from the outside; however it is quite different internally. It uses native NodeJS as much as possible and so as a lot less dependencies (just 2 instead of 7), which makes this package a lot smaller compared to the original `copyfiles` project (1.8kB instead of 27.6kB gzip). The options are nearly the same (except for `--soft`, which is not implemented), there's also some new features that were added in this project (mainly the copy & rename and also dry-run features, see below).
1616

17-
> **Note**: there is 1 noticeable difference with `copyfiles` package, all the CLI options must be provided as suffix and after the source/target directories command (the original `copyfiles` project has them as prefix).<br>
17+
> [!NOTE]
18+
> There is 1 noticeable difference with `copyfiles` package, all the CLI options must be provided as suffix and after the source/target directories command (the original `copyfiles` project has them as prefix).<br>
1819
> This mean calling: `copyfiles source target [options]` instead of `copyfiles [options] source target`
1920
> The JS API is also different since the destination is the 2nd function argument instead of the first argument.
2021
21-
> [!NOTE]
22-
> This project now requires Node.JS >= 22.17.0 so that we can use the native `fs.glob` and decrease the projet size. If you can't update your Node.JS just yet, then just stick with `native-copyfiles: ^1.3.7` until you can. The version 2.0 bumped Node requirement and changed the JS API arguments (see below).
23-
24-
### Advanced Glob Pattern Support
22+
### Major Changes
23+
#### version 1.0
24+
- similar to [copyfiles](https://www.npmjs.com/package/copyfiles) package except that options are suffixes instead of prefixes
2525

26-
`native-copyfiles` supports advanced glob patterns, including:
26+
#### version 1.0 to 2.0
27+
- see [Migration](https://github.com/ghiscoding/native-copyfiles/releases/tag/v2.0.0) details
28+
- drop `tinyglobby` and use `fs.glob` native code (requires Node.JS >=22.17)
29+
- change JS API arguments (sources and destination are now 2 separate arguments)
2730

28-
- **Brace expansion**: e.g. `src/*.{js,ts}`
29-
- **Negation**: e.g. `['src/**/*.js', '!src/**/*.test.js']`
30-
- **Extended wildcards**: e.g. `**/*.js`, `*bar?.js`
31-
- **Dotfiles**: Use `-a`/`--all` to include files starting with a dot
32-
33-
This makes it easier to match complex sets of files for copying, similar to Bash or advanced glob libraries.
31+
---
3432

3533
### Install
3634

@@ -73,8 +71,18 @@ copyfiles foo foobar foo/bar/*.js out
7371
you now have a directory called `"out"`, with the files `"foo"` and `"foobar"` in it, it also has a directory named `"foo"` with a directory named
7472
`"bar"` in it that has all the files from `"foo/bar"` that match the glob.
7573

74+
### Advanced Glob Pattern Support
75+
76+
`native-copyfiles` supports advanced glob patterns, including:
77+
78+
- **Brace expansion**: e.g. `src/*.{js,ts}`
79+
- **Negation**: e.g. `['src/**/*.js', '!src/**/*.test.js']`
80+
- **Extended wildcards**: e.g. `**/*.js`, `*bar?.js`
81+
- **Dotfiles**: Use `-a`/`--all` to include files starting with a dot
82+
83+
This makes it easier to match complex sets of files for copying, similar to Bash or advanced glob libraries.
7684

77-
#### Examples of advanced glob usage
85+
### Examples of advanced glob usage
7886

7987
**Brace expansion:**
8088
```bash
@@ -137,7 +145,7 @@ copyfiles "**/*.test.js" -f "./foo/**/*.js" out -e
137145
```
138146

139147
> [!NOTE]
140-
> By default the `.git/` and `node_modules/` directories will be excluded (when using globs). If you provide your own `--exclude` option, it will override the defaults and only use your patterns.
148+
> By default the `.git/` and `node_modules/` directories will be excluded (when using globs). Unless you provide your own `--exclude` option, which will override the defaults and only use your patterns.
141149
142150
Other options include
143151

@@ -178,8 +186,7 @@ This will copy:
178186
- `input/foo.css``output/foo.scss`
179187
- `input/bar/baz.css``output/bar/baz.scss`
180188

181-
The `*` in the destination is replaced with the base filename from the source.
182-
You can combine this with `--flat` or `--up` to control the output structure.
189+
The `*` in the destination is replaced with the source base filename. You can combine this with `--flat` or `--up` to control the output structure.
183190

184191
#### 2. Rename Using a Callback (JavaScript API)
185192

0 commit comments

Comments
 (0)