Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: fs.rmdir -> fs.rm #133

Closed
wants to merge 1 commit into from
Closed

refactor: fs.rmdir -> fs.rm #133

wants to merge 1 commit into from

Conversation

erickzhao
Copy link
Member

@erickzhao erickzhao commented Mar 24, 2022

(node:23706) [DEP0147] DeprecationWarning: In future versions of Node.js, fs.rmdir(path, { recursive: true }) will be removed. Use fs.rm(path, { recursive: true }) instead
(Use `node --trace-deprecation ...` to show where the warning was created)

Node 16: https://nodejs.org/api/deprecations.html#DEP0147

@erickzhao erickzhao changed the title refactor: fs.rm -> fs.rmdir refactor: fs.rmdir -> fs.rm Mar 24, 2022
@codecov
Copy link

codecov bot commented Mar 24, 2022

Codecov Report

Merging #133 (d9354ee) into main (29e44a6) will not change coverage.
The diff coverage is 100.00%.

❗ Current head d9354ee differs from pull request most recent head 3f0503b. Consider uploading reports for the commit 3f0503b to get more accurate results

@@           Coverage Diff           @@
##             main     #133   +/-   ##
=======================================
  Coverage   75.43%   75.43%           
=======================================
  Files           1        1           
  Lines          57       57           
=======================================
  Hits           43       43           
  Misses         14       14           
Impacted Files Coverage Δ
src/index.js 75.43% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 29e44a6...3f0503b. Read the comment docs.

@malept
Copy link
Member

malept commented Mar 24, 2022

  1. Why didn't CI run for this PR? 😕
  2. fs.rm doesn't exist until Node 14, I think?

@eXhumer
Copy link

eXhumer commented May 19, 2024

I came across a deprecation warning (node:88445) [DEP0147] DeprecationWarning: In future versions of Node.js, fs.rmdir(path, { recursive: true }) will be removed. Use fs.rm(path, { recursive: true }) instead while trying to build darwin DMGs for my Electron app.

fsPromises.rm was added since 14.14.0 update. A check for the runtime node version using process.versions.node can be used to select the correct method

      const nodeVersion = process.versions.node.split('.').map(segment => parseInt(segment));
      await (nodeVersion[0] > 14 || (nodeVersion[0] === 14 && nodeVersion[1] >= 14) ?
        fs.rm :
        fs.rmdir)(specDir, { recursive: true, maxRetries: 2 });

NOTE: fsPromises.rmdir was added in v10.0.0, recursive was added since v12.10.0

@erickzhao
Copy link
Member Author

Will merge this after #178

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants