386 Commits

Author SHA1 Message Date
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
Ryan Zimmerman
9bfd380021
Cleanup lib/util/ to remove unused code (#757)
Move function only used in tests to test files to avoid bundling it
2020-02-06 21:14:38 -05:00
Mani Maghsoudlou
3120c5cebf
copy*(): remove copyFileFallback (#755)
* copy: remove copyFileFallback

* copy-sync: remove copyFileFallback
2020-02-06 16:00:32 -05:00
Ryan Zimmerman
3c3865cad8
BREAKING: Drop old Node support (#751)
* BREAKING: Drop old Node support, require v10+

Update CI configs

* Remove references and test fencing for old Node versions

* Use object spread properties

* Use octal literal notation

* Use optional catch bindings
2020-02-04 17:30:40 -05:00
Maxime Bargiel
3dac36047a
Update dest atime after copy/copy-sync (#633) 2020-02-04 17:17:23 -05:00
Ryan Zimmerman
a6b1a441ef
Remove unused done param (#749)
Not sure why linter didn't catch this
2020-02-03 09:33:26 -05:00
Ryan Zimmerman
2e4fcaee51
Update fs promise shims to support latest Node functions (#747)
* Add promise support for fs.writev()

* Add promise support for fs.opendir()

Sort array to match Node docs

* Fix tests for fs.writev()

* Fix requested changes
2020-02-03 09:33:14 -05:00
Ryan Zimmerman
5d3f53325e
Improve ensurefile error (#744)
* Check createFileSync gives clear error if node in directory tree is a file

* Make error code check work in Node.js 6

* Throw ENOTDIR error when dir doesn't exist

* Add test for createFile

* Throw ENOTDIR error when dir doesn't exist for makeFile async

* Make stat call on parent directory instead of first checking exists

Co-authored-by: Luke Childs <lukechilds123@gmail.com>
2020-01-31 16:27:31 -05:00
nacd
76e48cb43f
fix a flaky test in ncp.test.js (#737) 2020-01-30 13:33:46 -05:00
nacd
d6478d2217 fix flaky test in remove.test.js (#736) 2019-12-13 10:06:20 -05:00
Tomoaki Abe
d1a01e735e Upgrade 'standard' and run 'standard --fix' (#720)
* Upgrade 'standard' and run 'standard --fix'

* Fix with double quotes

If single quotes are included, enclose them in double quotes.
2019-09-06 11:23:34 -04:00
Maxime Bargiel
391fb7365e Add heuristics to stats.ino comparison when bigint is not available 2019-07-27 13:32:18 -04:00
Tomoaki Abe
ca58cbc09f Upgrade 'standard' (#709)
I have fixed the following error.

```
  node-fs-extra/lib/ensure/symlink-paths.js:37:9: Unnecessarily quoted property 'toCwd' found.
  node-fs-extra/lib/ensure/symlink-paths.js:38:9: Unnecessarily quoted property 'toDst' found.
  node-fs-extra/lib/ensure/symlink-paths.js:48:11: Unnecessarily quoted property 'toCwd' found.
  node-fs-extra/lib/ensure/symlink-paths.js:49:11: Unnecessarily quoted property 'toDst' found.
  node-fs-extra/lib/ensure/symlink-paths.js:58:13: Unnecessarily quoted property 'toCwd' found.
  node-fs-extra/lib/ensure/symlink-paths.js:59:13: Unnecessarily quoted property 'toDst' found.
  node-fs-extra/lib/ensure/symlink-paths.js:73:7: Unnecessarily quoted property 'toCwd' found.
  node-fs-extra/lib/ensure/symlink-paths.js:74:7: Unnecessarily quoted property 'toDst' found.
  node-fs-extra/lib/ensure/symlink-paths.js:82:9: Unnecessarily quoted property 'toCwd' found.
  node-fs-extra/lib/ensure/symlink-paths.js:83:9: Unnecessarily quoted property 'toDst' found.
  node-fs-extra/lib/ensure/symlink-paths.js:89:9: Unnecessarily quoted property 'toCwd' found.
  node-fs-extra/lib/ensure/symlink-paths.js:90:9: Unnecessarily quoted property 'toDst' found.
  node-fs-extra/lib/mkdirs/__tests__/clobber.test.js:22:18: There should be no space after '['.
  node-fs-extra/lib/mkdirs/__tests__/clobber.test.js:22:29: There should be no space before ']'.
  node-fs-extra/lib/mkdirs/__tests__/race.test.js:24:18: There should be no space after '['.
  node-fs-extra/lib/mkdirs/__tests__/race.test.js:24:29: There should be no space before ']'.
```
2019-07-11 10:52:31 -04:00
Ryan Zimmerman
40c3d68eb4
Use graceful-fs everywhere (#700)
* Switch back to upgraded graceful-fs for copy & move

Fixes #664
Fixes #684

* Use graceful-fs for emptyDir*()
2019-06-28 12:18:50 -04:00
Ryan Zimmerman
f3a2eed496
Upgrade to standard v12 (#685) 2019-05-14 13:50:05 -04:00
Ryan Zimmerman
fa661f3664
Add support for fs.realpath.native in envs that support it (#682)
* Add support for fs.realpath.native in envs that support it

* Add test for realpathSync.native

* assert.equal -> assert.strictEqual
2019-05-14 13:12:27 -04:00
Mani Maghsoudlou
72278dcf14 util/stat: resolve paths before parsing 2019-05-13 01:18:22 -07:00
Mani Maghsoudlou
0bc36ffd5e v8 release (#667)
* Remove secure-random from dev-deps (#610)

* fix ensureDir() doc

* moveSync: refactor to use renameSync

* copy*(): fix copying bind-mounted directories (#618)

* copy*(): fix copying bind-mounted dirs

* copy*(): fix case-insensitive-paths tests

* copy*(): refactor to check paths more efficiently

* destructure stats object after checking err

* move*(): check paths before moving

* move*(): add case-insensitive paths test

* remove unnecessary done callback from test

* copy*(): add new option checkPathsBeforeCopying

* update copy*() docs to include checkPathsBeforeCopying

* some reformatting

* copy*(): use fs.stat with bigint option

* move*(): refactor to use the internal stat functions

* move*(): add test for prevent moving identical

* disable graceful-fs in copy and move tests

* fix parsing node version

* tiny reformat

* update copy*() docs

* refactor parsing node version

* use semver to parse node version in tests
2019-05-11 10:08:57 -04:00
Pete Gonzalez
ddc1a2f9d4 Fix removeSync() to eliminate spurious ENOTEMPTY errors on Windows (#646)
Fix removeSync() to measure its retry interval in milliseconds instead of CPU cycles
2018-11-07 07:43:31 -05:00
Ram Hejazi
1a4e88543b Add missing element for fs.lchmod promisification (#595) (#596) 2018-07-16 20:58:58 -04:00
Maxime Bargiel
384aae04e8 copy*: Set new directory mode only after copying files (MacOS fix) (#600)
Fixes #599
2018-07-16 20:57:29 -04:00
Mani Maghsoudlou
e340861b4f [BREAKING] copy*(): use ino to check identical paths (#582) 2018-07-16 20:52:21 -04:00
Miroslav Bajtoš
2ffb64cf8e Fix fs.promises ExperimentalWarning on Node 10.1.0 (#578) 2018-05-09 18:59:56 -04:00
Mani Maghsoudlou
bbbc2db97e copy*(): refactor copyDirItems() to avoid passing null param (#570) 2018-04-25 07:51:49 -04:00
Mani Maghsoudlou
b02eea6a37 Use strict assert in all tests (#569) 2018-04-19 07:28:45 -04:00
Mani Maghsoudlou
da69c573e3 copy & copySync: handle case-insensitive paths, check paths stricter before copying (#568) 2018-04-18 07:38:28 -04:00
Ryan Zimmerman
20c82ab4dd
Run stricter linter to cleanup problems and force ES6 usage (#566)
Also shorten fs.write() promise code
2018-04-10 08:12:12 -04:00
Ryan Zimmerman
5170b4f854 copy*() preserveTimestamps: false behavior is OS-dependent
Update docs and remove tests to reflect this
2018-04-06 12:55:53 -04:00
Mani Maghsoudlou
50c098ec0c copy & copySync: do not overwrite src & dest paths to avoid side effects (#554) 2018-04-06 11:31:19 -04:00
Mani Maghsoudlou
6b90ccf962 move: rewrite move to use fs.rename (#549)
* rewrite move to use fs.rename

* add old tests

* use strictEqual for error message assertion

* refactor move, remove comments

* fix move when overwrite is true and dest exists

* remove unnecessary checking of EPERM error
2018-04-06 11:25:57 -04:00
wontem
7e2aba069f remove extra step in reading loop 2018-02-26 13:33:16 +03:00
Igor Bykov
a0d44c1773 Fix function isSrcSubdir in the copy-sync.js and copy.js (#541) 2018-02-20 19:08:50 -05:00