Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

chore: replace fs-extra with native Node.js fs APIs#594

Open
roli-lpci wants to merge 1 commit into
ds300:masterds300/patch-package:masterfrom
roli-lpci:chore/replace-fs-extra-with-native-fsroli-lpci/patch-package:chore/replace-fs-extra-with-native-fsCopy head branch name to clipboard
Open

chore: replace fs-extra with native Node.js fs APIs#594
roli-lpci wants to merge 1 commit into
ds300:masterds300/patch-package:masterfrom
roli-lpci:chore/replace-fs-extra-with-native-fsroli-lpci/patch-package:chore/replace-fs-extra-with-native-fsCopy head branch name to clipboard

Conversation

@roli-lpci

Copy link
Copy Markdown

Summary

  • Replaces all fs-extra usage with native Node.js fs module equivalents
  • Adds inline copySync helper with file permission preservation and symlink dereferencing support
  • Removes fs-extra and @types/fs-extra from dependencies, bumps @types/node to ^14.14.0

Changes

Source files:

  • src/makePatch.ts β€” Added copySync helper using copyFileSync+chmodSync for permission preservation; replaced mkdirpSync β†’ mkdirSync({recursive}), removeSync β†’ rmSync({recursive, force})
  • src/patch/apply.ts β€” moveSync β†’ renameSync, ensureDirSync β†’ mkdirSync({recursive})
  • src/filterFiles.ts β€” removeSync β†’ rmSync({force})
  • src/applyPatches.ts, src/detectPackageManager.ts, src/getAppRootPath.ts, src/getPackageResolution.ts, src/patch/read.ts β€” Import swap from fs-extra to fs

Test files:

  • src/patch/read.test.ts β€” Updated mock from fs-extra to fs
  • property-based-tests/executeTestCase.ts β€” Rewrote mock to spread jest.requireActual("fs") with selective overrides
  • integration-tests/runIntegrationTest.ts β€” Replaced fs-extra+rimraf with native fs
  • integration-tests/newIntegrationTest.ts β€” mkdirpSync β†’ mkdirSync({recursive})

Dependencies:

  • package.json β€” Removed fs-extra, @types/fs-extra; bumped @types/node to ^14.14.0

Testing

  • 9 test suites pass (7 unit + 2 property-based), 467 tests passing
  • TypeScript compiles clean
  • All linting passes

Addresses #499

Replace fs-extra dependency with native fs module equivalents:
- copySync β†’ inline recursive copy helper with permission preservation
- mkdirpSync/ensureDirSync β†’ mkdirSync({ recursive: true })
- removeSync β†’ rmSync({ recursive: true, force: true })
- moveSync β†’ renameSync

Also removes @types/fs-extra and bumps @types/node to ^14.14.0
to match the engine requirement (Node >= 14).

Addresses ds300#499

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@james-pre

Copy link
Copy Markdown

@ds300 LGTM

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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.