417 Commits

Author SHA1 Message Date
Matt Haynie
ddc46f7cb9
Fix symlink copy failing when source and dest symlinks point to same target (#1060)
Fixes #1019
Fixes #1027

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: mhaynie <mhaynie@pazer.us>
2025-12-17 19:19:07 -05:00
Ryan Zimmerman
47f1095d4b
Fix UnhandledPromiseRejectionWarning in copy (#1058) 2025-09-15 11:11:57 -04:00
Jia Zhai
b897b36648
fix incorrect identical result for windows node v22+ (#1050)
Co-authored-by: jayzhai <jayzhai@global.tencent.com>
2025-08-04 10:56:14 -04:00
Ryan Zimmerman
22583f7bbe
Test on more modern Node versions (#1051)
* Test on more modern Node versions

* Fix tests and note that deprecated constants are not exported

Since https://github.com/nodejs/node/pull/49686, they are not
enumerable properties, so Object.assign doesn't re-export them.
Attempting to directly export them would trigger the deprecation
warning.
2025-08-04 10:55:19 -04:00
Ryan Zimmerman
83ff8ca965
Do not mutate args in ensure symlink tests (#1052) 2025-08-01 10:46:18 -04:00
Ryan Zimmerman
e75b9bf3a0
Add promise support for missing fs methods (#1045)
* Add promise support for missing fs methods

Fixes #1044

* Try specifying macOS runner explicitly
2025-01-14 11:52:45 -05:00
Sukka
1d931c88b2
Refactor copy to use opendir (#1028)
* refactor(copy): backport https://github.com/nodejs/node/pull/41351

* perf(copy): parallel copy

* perf(copy): run filter in parallel as well
2024-02-10 13:11:25 -05:00
Thomas Kaul
acf5585558
Fix wording in copy-sync-dir.test.js (#1031) 2023-12-15 17:11:41 -05:00
Sukka
d293448717
perf: copy dir contents in parallel (#1026) 2023-11-27 19:40:02 -05:00
Sukka
a277cbbdf6
Refactor move API to async/await (#1025) 2023-10-26 10:32:00 -04:00
Sukka
40c516134d
Refactor copy API to async/await (#1021) 2023-10-24 18:34:29 -04:00
Sukka
6f2b2bc995
Refactor create*/ensure* API to async/await (#1023)
* Refactor `createFile`
* Refactor `createLink`
* Refactor `createSymlink`
2023-10-24 18:32:43 -04:00
Sukka
426bb46067
Refactor outputFile API to async/await (#1024) 2023-10-24 18:31:58 -04:00
Mikhail
47bc43d036
Simplify reduce for checking match (#1016) 2023-09-20 13:41:36 -04:00
Ryan Zimmerman
055e0b8a09
Unify cross-device move test configuration/logic (#1001) 2023-03-16 14:43:21 -04:00
Kostiantyn Popovych
0e7de32aac
Preserve timestamp when moving across devices (#994)
Fixes #992

Co-authored-by: Ryan Zimmerman <opensrc@ryanzim.com>
2023-03-06 13:43:10 -05:00
Ryan Zimmerman
fd50986b4c
BREAKING: ESM support (#974)
* Remove process.cwd() trick from test files

* BREAKING: Switch from main to exports

* Add fs-extra/esm ESM named import module, with just fs-extra methods

Fixes #746
2022-11-28 13:50:33 -05:00
Ryan Zimmerman
1a3205db94
Remove unneeded and buggy stats check (#976)
As per https://github.com/nodejs/node/pull/39372#discussion_r1001179295

Resolves https://github.com/jprichardson/node-fs-extra/issues/918
2022-11-19 13:09:05 -05:00
Ryan Zimmerman
b3146f0655
Run copy*() filter before running fs.stat() on items (#971)
Fixes #965
2022-10-31 15:06:31 -04:00
Ryan Zimmerman
9dbf173f75
Add promise support for fs.readv (#970) 2022-10-31 14:25:13 -04:00
Ryan Zimmerman
5623ba3d5b
BREAKING: Drop Node v12 support; require v14.14+ (#969)
Resolves #968
2022-10-31 14:19:52 -04:00
Lam Wei Li
baa9934b79
refactor: replace console.warn with process.emitWarning (#954)
Signed-off-by: Lam Wei Li <peteriman@mail.com>
2022-04-16 13:15:34 -04:00
Ryan Zimmerman
5cadd767cc
Allow passing undefined opts to move() (#955)
Fixes #947

Closes #948
2022-04-16 13:00:34 -04:00
Lam Wei Li
7bb0120cec
Check and warn for the absence of fs.realpath.native (#953)
* Revert "Remove check for fs.realpath.native support, since it's everywhere (#887)"

This reverts commit f4a880d29c3a699c0695755fe8533d786c55f65f.

* Added warning and fallback support for missing fs.realpath.native

Signed-off-by: Lam Wei Li <peteriman@mail.com>

* Removed NodeJS check and fs.realpath.native fallback

Signed-off-by: Lam Wei Li <peteriman@mail.com>

* Leaving original listener intact during test and better phasing for warning

Signed-off-by: Lam Wei Li <peteriman@mail.com>

* Using done() for proper async test

Signed-off-by: Lam Wei Li <peteriman@mail.com>

* Updated comments for clarity

Co-authored-by: Ryan Zimmerman <17342435+RyanZim@users.noreply.github.com>

Co-authored-by: Ryan Zimmerman <17342435+RyanZim@users.noreply.github.com>
2022-04-16 13:00:15 -04:00
CommanderRoot
e0d298d297
refactor: replace deprecated String.prototype.substr() (#950)
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
2022-03-28 13:16:59 -04:00
Ryan Zimmerman
8f79dcd221
Refactor folder structure (#922)
* Rename lib/output/ to lib/output-file/

* Refactor lib/ensure/index.js

* Collapse copy-sync/ and move-sync/ into the async folders
2021-09-22 20:37:35 -04:00
Dan Čermák
e6a95058c9
Skip the ncp / error / dest-permission test if running as root (#899)
This test tries to create a directory where the current user does not have the
permissions to do so and expects a failure. However, the root user is by design
always allowed to do that (ignoring file permissions). So we must skip the test
in these cases then.

Fixes #898

Co-authored-by: Ryan Zimmerman <opensrc@ryanzim.com>
2021-05-07 18:21:11 -04:00
Mani Maghsoudlou
289d9aafff
move: do not create parent directory if it is root (#897)
* move: do not create parent directory if it is root

* fix move-sync test

* move-sync test: remove dest after test is done

* remove debug log

* remove dest in afterEach

* call done() after test is done
2021-05-03 16:36:53 -04:00
Ryan Zimmerman
21b01f4b80
Implement GH actions (#881)
* Implement GH actions

* Only build pushes to master

* Don't test Node's own behavior

* Test on Node 16
2021-05-01 10:52:10 -04:00
Ryan Zimmerman
588d77049c
BREAKING: Use bigint everywhere (#895)
Refs #886
2021-04-30 16:21:24 -04:00
Ryan Zimmerman
c551140f81
BREAKING: Use native fs.mkdir recursive everywhere (#894)
Moved last bit of make-dir code to its own file
2021-04-30 16:20:50 -04:00
Ryan Zimmerman
05d2e93d99
BREAKING: Remove special handling of fs.promises (#890)
* Remove special handling of fs.promises

Refs #886

* Fix tests
2021-04-30 16:19:58 -04:00
Ryan Zimmerman
af354012a6
Ensure copy filter fn is not called more than needed (#883)
Fixes #809
2021-04-16 13:01:52 -04:00
Ryan Zimmerman
c8815e3ccf
BREAKING: Use fs.rm/rmSync where supported (#882)
Fixes #806

Technically a breaking change since this removes the undocumented
ability to pass options to remove*()
2021-04-08 13:36:04 -04:00
Ryan Zimmerman
f4a880d29c
Remove check for fs.realpath.native support, since it's everywhere (#887) 2021-04-06 09:02:26 -04:00
Ryan Zimmerman
04282cd888
Convert emptyDir() to async function; remove items in parallel (#885) 2021-04-06 09:02:07 -04:00
Ryan Zimmerman
2fca5b213c
BREAKING: copy*(): Error when unknown file type is encountered (#880)
Replaces & closes #812
2021-04-02 07:52:47 -04:00
Ryan Zimmerman
452352686e
BREAKING: Ensure existing dest correct type/target in ensureLink/Symlink (#826)
Fixes #786
Fixes #870
2021-04-02 07:52:13 -04:00
Mani Maghsoudlou
c8bd3830fc move: support changing case in case-insensitive systems (#801)
Resolves #759
2021-04-01 16:26:01 -04:00
Mani Maghsoudlou
f21048b21d BREAKING: copy*(): allow copying broken symlinks (#779) 2021-04-01 16:13:21 -04:00
Anton
7498c9c9eb
Improve code quality (#873) 2021-03-15 10:43:45 -04:00
Сковорода Никита Андреевич
76d38fc127
tests: fix birthtime not available on tmpfs on Linux (#861) 2021-01-19 10:09:24 -05:00
Ryan Zimmerman
d409cf8a4a
Add promise support for fs.rm() (#860)
Fixes #841
2021-01-19 09:51:08 -05:00
Federico Bozzini
f86c09949c
Do not check errors with instanceof (#805)
This fixes cross-VM type issues in Jest.

Backport of aa50e0298f
2020-06-03 16:11:23 -04:00
Ryan Zimmerman
28173ed31b
Fix tests on Node 14 (#800)
* Fix tests on Node 14

Fixes #798

writeFileSync requires a data parameter

* Add Node 14 to CI
2020-05-14 10:24:23 -04:00
Ryan Zimmerman
a2738d3906
Don't use deprecated process.umask() (#791)
* Don't use deprecated process.umask()

Refs https://github.com/sindresorhus/make-dir/issues/27

* Remove unneeded umask tests

No need to test Node.js core's behavior (which is all these tests do)
2020-04-24 07:32:54 -04:00
Ryan Zimmerman
a149f822c3
JSON updates (#768)
* Upgrade jsonfile

Fixes #745

* Test from main entry point

* Make outputJson() mutation-proof

Fixes #702

* Update outputJsonSync() to match async implementation
2020-03-11 15:18:23 -04:00
Ryan Zimmerman
ab92b24370
BREAKING: Use internal fork of make-dir for mkdirs implementation (#756)
* BREAKING: Use internal fork of make-dir for mkdirs implementation

Resolves #619

Everything should work similarly to how it did before; except that
we no longer return a file path on success (to match fs.mkdir).
Also, errors may be different.

* Hopefully fix Windows tests

- Error codes are different
- Match fs.mkdir behavior on Windows when creating root

* Port https://github.com/sindresorhus/make-dir/pull/24

* Add comment for clarity

* Use at-least-node for version sniffing

* Consistent error codes across OSes

* Allow different error codes on different Node versions
2020-02-18 11:41:04 -05:00
Ryan Zimmerman
075c2d1016
Refactor internal stat utils (#764)
* Refactor internal getStats() util

Fixes #762

* Proper promise tests for copy()

Our hacky tests don't play well with multiple layers of
callback/promise switching

* Simplify internal checkParentPaths()

* Port improvments to sync methods
2020-02-17 08:17:31 -05:00
Ryan Zimmerman
cdc7745c9f
Use at-least-node instead of homespun version sniffing (#760)
* Use at-least-node instead of homespun version sniffing

* Remove semver devDep; use at-least-node in tests
2020-02-13 17:31:21 -05:00