43 Commits

Author SHA1 Message Date
Sukka
a277cbbdf6
Refactor move API to async/await (#1025) 2023-10-26 10:32:00 -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
5cadd767cc
Allow passing undefined opts to move() (#955)
Fixes #947

Closes #948
2022-04-16 13:00:34 -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
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
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
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
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
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
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
Mani Maghsoudlou
b02eea6a37 Use strict assert in all tests (#569) 2018-04-19 07:28:45 -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
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
Mani Maghsoudlou
fe0bfe2931 Rewrite copy to use recursive pattern for dirs, add more tests 2017-10-20 13:43:08 -07:00
Mani Maghsoudlou
d99d8a19d6 Fix isSrcSubdir() split bug 2017-07-09 22:30:01 -07:00
Mani Maghsoudlou
f8f441ae63 Refactor isSrcSubdir() in move 2017-07-09 22:22:07 -07:00
Mani Maghsoudlou
16dc81e1f8 Fix the issue of moving into itself 2017-07-09 21:31:44 -07:00
RyanZim
5bfcb64b21 move() should error when src & dest are the same and src doesn't exist
Fixes #414; bug introduced in #378
2017-05-02 19:29:51 -04:00
RyanZim
03b2080b7e Universalify fs-extra methods 2017-04-26 10:04:07 -04:00
RyanZim
afab94b7eb Don't override move & moveSync test's timeouts 2017-03-27 10:49:09 -04:00
JP Richardson
efe0d80be4 Merge pull request #378 from jdalton/move-check
Don't move when source and dest paths are the same.
2017-03-14 01:01:57 -05:00
John-David Dalton
8d978db84d Don't move when source and dest paths are the same. 2017-03-13 10:48:58 -07:00
Mani Maghsoudlou
a4f6481ebf docs/readJson.md: Refactor example for readJson method, refactor move and moveSync tests descriptions 2017-03-08 14:38:25 -08:00
Tony Valderrama
3a3912ab23 move(): fall back to streams when hard links aren't supported 2017-03-02 14:07:25 -08:00
JPeer264
ebd22661a3 Refactor test move 2017-02-25 17:24:48 +01:00
JPeer264
3843d5fb52 Refactor move 2017-02-18 18:30:02 +01:00
JP Richardson
cc1aaa949e Merge pull request #335 from jprichardson/move-tests
Refactor move() tests
2017-01-01 13:24:57 -06:00
RyanZim
fde5b026d5 Refactor move() tests
- Refactor legacy setup
- Merge move-clobber.test.js into move.test.js
- Add more complete testing for overwrite option
- Remove fixtures directory, create fixtures with code
2016-12-31 13:45:41 -05:00
RyanZim
90cbf82510 Cleanup lib/move/index.js 2016-12-31 11:26:19 -05:00
RyanZim
5be5ae3053 Rename clobber to overwrite
Keep clobber for backwards compatibility

Fixes #172
2016-12-29 17:38:45 -05:00
RyanZim
fd3c9e6998 Remove move()'s broken limit option 2016-11-14 16:55:14 -05:00
Nathan Phillip Brink
57d5a39931 Fix move clobber tests to work around graceful-fs bug.
When trying to rename a directory over another directory, graceful-fs-4.1.10
(maybe other versions?) takes 1 minute to fail the call with an error.
This causes the test to timeout. The workaround is to increase the timeout
of that one test to 1m30s.

See https://github.com/isaacs/node-graceful-fs/issues/98
2016-11-14 11:11:52 -05:00
RyanZim
a837927988 Inline rimraf
We aren't using rimraf's glob support, and glob is a rather large
dependency.

Changes:

- Remove glob support from rimraf
- Remove move()'s dependency on rimraf; use fs-extra.remove instead
- Make rimraf a devDependency; it is used in the tests
2016-10-28 15:46:30 -04:00
bartland
22c19fe1d0 move.test modified to support testing files with both LF (NIX) and
CRLF (Windows) line endings. This commit fixes #188.
2015-10-31 12:36:12 +11:00
Nick Santos
24948a4e0c More robust handling of errors moving across virtual drives
Discovered while investigating
https://github.com/Medium/phantomjs/issues/341
where moving a directory across virtual drives caused an
EXDEV error that shunted things down the "move file"
instead of "move directory" codepath
2015-08-06 23:52:15 -04:00
JP Richardson
49726e8718 lib/move/__tests__: moved 2015-06-24 10:39:45 -05:00
JP Richardson
3304feb1bb lib/move/index: fix regression (forgot to export move) 2015-06-17 06:59:58 -05:00
JP Richardson
acc4def0de lib/move: moved default options 2015-06-17 06:49:17 -05:00
JP Richardson
bcc1b77591 lib/move/index: from lib/move 2015-06-17 06:39:42 -05:00