Skip to content

chore: remove unnecessary fs dependency from example package.json files - #654

Closed
Harsh-H-Shah wants to merge 1 commit into
solana-foundation:mainfrom
Harsh-H-Shah:chore/remove-unnecessary-fs-dependency
Closed

chore: remove unnecessary fs dependency from example package.json files#654
Harsh-H-Shah wants to merge 1 commit into
solana-foundation:mainfrom
Harsh-H-Shah:chore/remove-unnecessary-fs-dependency

Conversation

@Harsh-H-Shah

Copy link
Copy Markdown

Summary

22 example package.json files list "fs": "^0.0.1-security" as a dependency. This isn't Node's built-in fs module — it's npm's official security-holding placeholder for a package name no longer in use. Per the registry:

This package name is not currently in use, but was formerly occupied by another package. To avoid malicious use, npm is hanging on to the package name, but loosely...

It resolves to a do-nothing stub and was never imported by any of these examples' source code — likely leftover from an old template that was copy-pasted forward.

Node's built-in fs/node:fs module — which several of these examples do use in their tests to read keypair fixtures off disk — is compiled into the Node runtime and resolves independently of node_modules, so it's completely unaffected by removing this npm entry.

Changes

  • Removed the fs line from dependencies in 22 package.json files (basics/ and tokens/, across native/pinocchio/asm variants)
  • Regenerated the corresponding pnpm-lock.yaml for each (pure removal — verified each lockfile diff is exactly the 8-line fs package entry, nothing else)

Test plan

Verified locally across all 22 affected examples:

  • pnpm install succeeds in all 22
  • cargo build-sbf + full test execution passes for all 12 examples this repo's CI actively tracks (not in .github/.ghaignore)
  • The 10 examples already excluded from CI (pre-existing, unrelated reasons — stale TypeScript peer deps, a Cargo workspace-membership issue in tokens/create-token/native and tokens/pda-mint-authority/native) show the same pre-existing behavior as main; confirmed via git diff main -- Cargo.toml Cargo.lock that this PR touches neither
  • Of the 7 examples whose tests actually use Node's built-in fs.readFileSync, 5 ran their full test suite successfully post-change (the other 2 hit the pre-existing, unrelated Cargo workspace issue before reaching that code path)
  • grep confirms no remaining "fs": references in any package.json in the repo

The npm package literally named "fs" is not Node's built-in fs module —
it's npm's official security-holding placeholder for a name no longer in
use (per the registry: "This package name is not currently in use...").
It resolves to a do-nothing stub and was never imported by any of these
examples' code.

Node's built-in fs/node:fs module (used by several of these examples to
read keypair fixtures in tests) is compiled into the Node runtime and is
unaffected by this change, since built-ins never resolve through
node_modules.

Verified locally across all 22 affected examples: pnpm install succeeds
in every one, and cargo build-sbf + test execution passes for all
examples this repo's CI currently tracks.
@Harsh-H-Shah
Harsh-H-Shah requested a review from dev-jodee as a code owner July 27, 2026 17:46
@greptile-apps

greptile-apps Bot commented Jul 27, 2026

Copy link
Copy Markdown

Greptile Summary

Removes the unused fs@0.0.1-security placeholder dependency from 22 standalone examples.

  • Updates each affected package.json manifest.
  • Regenerates the corresponding pnpm lockfiles to remove the direct dependency and package snapshot.
  • Preserves unrelated transitive fs.realpath dependencies.

Confidence Score: 5/5

The PR appears safe to merge because the removed package is unused and Node built-in node:fs imports remain independently resolvable.

The manifest and lockfile changes consistently remove an inert registry placeholder, while affected source code that performs filesystem operations imports Node’s built-in node:fs module rather than the removed package.

Important Files Changed

Filename Overview
basics/account-data/native/package.json Removes the unused npm fs placeholder without affecting Node built-in module resolution.
basics/cross-program-invocation/native/pnpm-lock.yaml Removes the placeholder package and records compatible libc selectors for existing LiteSVM platform packages.
basics/realloc/native/pnpm-lock.yaml Removes the placeholder package and records matching glibc/musl selectors for existing Bankrun platform packages.
tokens/token-2022/mint-close-authority/native/package.json Removes the unused placeholder while leaving the example’s functional dependencies unchanged.

Reviews (1): Last reviewed commit: "chore: remove unnecessary fs dependency ..." | Re-trigger Greptile

@dev-jodee

Copy link
Copy Markdown
Collaborator

Thanks @Harsh-H-Shah — closing as superseded by #656 (b0d0c181): its dead-dependency sweep removed fs (and several other unused packages) from these projects.

@dev-jodee dev-jodee closed this Jul 30, 2026
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