Skip to content

chore: remove unused dependencies from non-Anchor example packages - #678

Open
amilz wants to merge 1 commit into
mainfrom
chore/remove-dead-deps-non-anchor
Open

chore: remove unused dependencies from non-Anchor example packages#678
amilz wants to merge 1 commit into
mainfrom
chore/remove-dead-deps-non-anchor

Conversation

@amilz

@amilz amilz commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Removes dependencies that are declared in package.json but imported nowhere in that package. Non-Anchor packages only — Anchor packages were left untouched.

Every candidate was re-verified by hand (grep across all .ts/.tsx/.js/.mjs/.json/.css plus config files, subpath imports, CSS @import, and pnpm why for peer/transitive requirements). Three of the original candidates turned out to be in use and were kept — see below.

Removed

Package Dep removed How it was verified unused
basics/hello-solana/native @solana-program/system Only source file is tests/index.test.ts; it imports @solana/kit, chai, litesvm only. pnpm build-and-test (cargo build-sbf + mocha) passes.
games/gacha/pinocchio/clients/typescript @solana/kit-plugin-rpc, @solana/kit-plugin-signer No import in src/, test/, tsup.config.ts, or the Codama-generated src/generated/ (generated fresh and re-grepped). pnpm build (incl. DTS emit) + pnpm test (8 pass).
games/world-cup/pinocchio/clients/typescript @solana/kit-plugin-rpc, @solana/kit-plugin-signer Same check; generated client imports only @solana/kit and @solana/program-client-core. pnpm build (incl. DTS emit) + pnpm test (54 pass).
games/world-cup/pinocchio/webapp/api @solana-program/system server.ts, lib/bpf-loader.ts, lib/deploy-builder.ts, lib/program-status.ts import @solana/kit and node builtins only. Typechecks clean.
games/world-cup/pinocchio/webapp/scripts @solana-program/system, @solana-program/token, @solana-program/token-2022 All four scripts import only @solana/kit and node builtins; token operations shell out via spawn. Typechecks clean.
games/world-cup/pinocchio/webapp next-themes Zero references in source, CSS, vite.config.ts, or tsconfigs. pnpm why -r next-themes shows no other dependent — nothing peer-requires it (sonner peers only React). pnpm build + pnpm test pass.

Deliberately left in

Package Dep kept Why
tokens/token-2022/transfer-hook/block-list/pinocchio @solana/kit In use. pnpm generate-sdks renders a Codama TS client into sdk/ts/src (gitignored), and build-and-test then runs tsc --noEmit over **/*.ts, which includes that generated code. Confirmed by running generate-sdks — the emitted files import @solana/kit. Removing it would break build-and-test.
games/world-cup/pinocchio/webapp @vercel/og In use. webapp/api/og.tsx imports ImageResponse from @vercel/og. The file lives under api/ but imports ../src/..., so it resolves against the webapp's package.json.
games/world-cup/pinocchio/webapp @base-ui/react Required peer. It is a peer dependency of @solana/design-system ("@base-ui/react": "^1.1.0"), which the app uses. Not a bare-specifier import, but removing it would leave the peer unmet.

Note on the world-cup lockfile diff

games/world-cup/pinocchio/pnpm-lock.yaml grows more than the removals alone suggest. Cause: webapp/scripts pins every dep with "latest". The removed @solana-program/* packages peer-ranged @solana/kit to ^6.x, which was transitively holding "@solana/kit": "latest" at 6.10.0. With them gone, latest re-resolves to @solana/kit 7.0.0 for that package, and @solana/sysvars shifts to 7.0.0 for the webapp's @solana-program/token-2022@0.9.0 peer.

I confirmed the baseline is otherwise stable (regenerating the lockfile with no package.json changes produces a zero-line diff), so this is entirely downstream of the removals. All builds and tests pass on the new tree. I deliberately did not pin the "latest" specifiers, since changing version ranges is outside this PR's scope — but replacing "latest" in webapp/scripts/package.json with real ranges is worth a follow-up, as that workspace's lockfile will otherwise drift on any future dependency change.

Verification run

  • basics/hello-solana/nativepnpm build-and-test (1 passing) + tsc --noEmit
  • games/gacha/pinocchio/clients/typescriptpnpm build + pnpm test (8 pass)
  • games/world-cup/pinocchio/clients/typescriptpnpm build + pnpm test (54 pass)
  • games/world-cup/pinocchio/webapppnpm build (tsc -b + vite build) + pnpm test (5 pass)
  • games/world-cup/pinocchio/webapp/{api,scripts} — no test or build script exists; verified with an ad-hoc tsc --noEmit over their sources (clean)
  • tokens/token-2022/transfer-hook/block-list/pinocchio — unchanged

Lockfiles regenerated with pnpm install --lockfile-only followed by pnpm install in each touched workspace.

Part of DEV-838

Drop dependencies declared in package.json but imported nowhere in their
package, across the non-Anchor examples. Regenerate the affected lockfiles.
@amilz
amilz requested a review from dev-jodee as a code owner August 6, 2026 17:37
@linear

linear Bot commented Aug 6, 2026

Copy link
Copy Markdown

DEV-838

@amilz amilz self-assigned this Aug 6, 2026
@greptile-apps

greptile-apps Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Removes unused dependencies from several non-Anchor example packages and regenerates their lockfiles.

  • Cleans up native hello-solana and generated TypeScript client manifests.
  • Removes unused system/token helpers from World Cup API and script packages.
  • Removes the unused next-themes webapp dependency.
  • Re-resolves World Cup script dependencies after removing packages that constrained Solana Kit versions.

Confidence Score: 5/5

The PR appears safe to merge because the removed dependencies have no identified package-owned imports or required generated-client usage.

The dependency removals match the affected packages’ source and generation boundaries, and the commit contains an SSH signature as required.

Important Files Changed

Filename Overview
basics/hello-solana/native/package.json Removes an unused System Program client dependency; the package test imports only Solana Kit, Chai, and LiteSVM.
games/gacha/pinocchio/clients/typescript/package.json Removes Kit RPC and signer plugins that are neither imported by the client nor emitted by its Codama generator.
games/world-cup/pinocchio/clients/typescript/package.json Removes unused Kit plugins without affecting generated or handwritten client imports.
games/world-cup/pinocchio/webapp/api/package.json Removes an unused System Program dependency from an API package whose code uses Solana Kit directly.
games/world-cup/pinocchio/webapp/scripts/package.json Removes unused program helpers; the scripts retain Solana Kit, which supplies their imported RPC and address APIs.
games/world-cup/pinocchio/webapp/package.json Removes next-themes, for which no source, configuration, CSS, or peer requirement was identified.
games/world-cup/pinocchio/pnpm-lock.yaml Regenerates importer and dependency snapshots, including the acknowledged Solana Kit and sysvars re-resolutions, with no concrete failure established.

Reviews (1): Last reviewed commit: "chore: remove unused dependencies from n..." | Re-trigger Greptile

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