Skip to content

Bug @codebuff/sdk compatibility with Node.js v22.18.0 by replacing deprecated fs.exists() #381

@crazyyanchao

Description

@crazyyanchao

Issue cause: The @codebuff/sdk@0.9.1 package internally uses the deprecated fs.exists() method, which is no longer available in Node.js v22.18.0.

Solution: I used pnpm's patch feature to fix this issue:

Create a patch: Used pnpm patch @codebuff/sdk@0.9.1 to create an editable copy.

Fix the code: Replaced all fs4.exists() calls with fs4.access():

Line 41054 (parseGitignore function)

Line 61485 (applyChanges function)

C:\Users\admin>node -v
v22.18.0

C:\Users\admin>
// node_modules\pnpm_patches\@codebuff\sdk@0.9.1\dist\index.mjs
// // raw
// if (!await fs4.exists(ignoreFilePath))
//   continue;

// // fix
// try {
//   await fs4.access(ignoreFilePath);
// } catch {
//   continue;
// }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions