Skip to content

[2.x] Use the published v1 node types in @codama/upgrade - #1201

Merged
lorisleiva merged 1 commit into
mainfrom
10-02-use_the_published_v1_node_types_in_codama_upgrade
Oct 9, 2026
Merged

lorisleiva merged 1 commit into
mainfrom
10-02-use_the_published_v1_node_types_in_codama_upgrade

Conversation

@lorisleiva

@lorisleiva lorisleiva commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

This PR replaces the hand-maintained copy of the v1 node types in @codama/upgrade with the published types of the last v1 release, installed under an exactly pinned alias:

"@codama/node-types-v1": "npm:@codama/node-types@1.11.0"

src/v1/index.ts now re-exports that alias, and the ~90 copied files under src/v1/ are deleted. The published 1.11.0 types are structurally identical to the copy they replace; the only addition is the deprecated ProgramVersion alias. Since the alias is type-only, it adds nothing to the runtime bundle.

While the workspace @codama/node-types is still versioned 1.11.0, TypeScript treats it and the alias as the same package and resolves both to the workspace v2 types. A paths mapping in packages/upgrade/tsconfig.json points the alias at its own files to work around this.

CONTRIBUTING.md and the package README are updated to describe pinning old node types instead of copying them.

@changeset-bot

changeset-bot Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9814a53

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@lorisleiva lorisleiva changed the title Use the published v1 node types in @codama/upgrade [2.x] Use the published v1 node types in @codama/upgrade Oct 2, 2026
@lorisleiva
lorisleiva force-pushed the 10-02-use_the_published_v1_node_types_in_codama_upgrade branch from 44a2217 to 5ce0092 Compare October 2, 2026 14:44
@lorisleiva
lorisleiva force-pushed the 10-02-add_v1_to_v2_upgrade_converters_for_types_and_values branch from 74545e7 to cd53890 Compare October 2, 2026 14:44
@lorisleiva

Copy link
Copy Markdown
Member Author

@trevor-cortex

@trevor-cortex trevor-cortex left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Replaces the ~90-file hand-maintained v1 node-types snapshot under packages/upgrade/src/v1/ with the published @codama/node-types@1.11.0, installed under an exactly pinned @codama/node-types-v1 npm alias. src/v1/index.ts becomes a one-line export type * from '@codama/node-types-v1', a paths mapping in packages/upgrade/tsconfig.json works around TypeScript's name@version package dedup while the workspace @codama/node-types is still at 1.11.0, and CONTRIBUTING.md / the package README / the v2/index.ts docblock are updated to describe the pin-instead-of-copy workflow.

This is a clear improvement — it removes a large surface of copied source, makes "the v1 types" unambiguously the thing that was actually published, and the port-forward-by-patch mechanism the snapshot existed for is no longer needed.

What I verified

  • tsconfig.declarations.json extends ./tsconfig.json, so the paths mapping applies to both tsc --noEmit and the declaration build. paths doesn't rewrite emitted specifiers, so dist/types/v1/index.d.ts will still say @codama/node-types-v1, which consumers resolve through the published dependencies entry. Correct that this lives in dependencies rather than devDependencies — consumers' type-checkers need it installed.
  • Root tsconfig.json sets no baseUrl, so the ./node_modules/... path is resolved relative to packages/upgrade/, and dist/types/index.d.ts matches the types entry of @codama/node-types on 1.x.
  • Spot-checked the 1.x branch: codamaVersion.ts is byte-identical to the deleted snapshot, and src/index.ts there exports brands/Docs/Version/generated plus the deprecated ProgramVersion, consistent with the PR's "identical except ProgramVersion" claim.
  • Consumer-side dedup is benign: a consumer still on @codama/node-types@1.11.0 (the exact audience of this package) would have TS dedupe the alias against their own copy, which is the same content; @codama/upgrade's own @codama/node-types@2.x dependency has a different version and won't collide.
  • No packages/upgrade/CHANGELOG.md exists, so the package hasn't shipped yet and this doesn't need its own changeset beyond whatever already covers the first release.

Things to watch

  • Dependabot will try to move the pin. .github/dependabot.yml runs daily npm updates with no ignore list, and Dependabot understands npm: aliases, so it will open PRs bumping @codama/node-types-v1 to 2.x (CI typecheck would reject those, but they're noise) and would happily land a future 1.11.1 docs-only patch, which contradicts the "moving the pin is a deliberate change" invariant in CONTRIBUTING.md. Suggest adding an ignore entry for it — see inline.
  • The paths workaround becomes a no-op as soon as the workspace @codama/node-types is versioned 2.0.0-rc.n (the "same-major invariant" release step). It's harmless to leave in place, but a one-line note in the comment about when it can be dropped would help the next person who wonders why it's there — see inline.

Notes for subsequent reviewers

  • The PR file list is truncated at 100 in the GitHub UI; the substantive changes not in that first page are packages/upgrade/src/v1/index.ts, packages/upgrade/src/v2/index.ts, packages/upgrade/tsconfig.json, and pnpm-lock.yaml. Worth opening those explicitly rather than assuming the diff is deletions-only.
  • Nothing to check at runtime: export type * is erased by both tsup/esbuild and vitest, so bundle output and the agadoo tree-shake test are unaffected.

Comment thread packages/upgrade/package.json
Comment thread packages/upgrade/tsconfig.json
@lorisleiva
lorisleiva force-pushed the 10-02-use_the_published_v1_node_types_in_codama_upgrade branch from 5ce0092 to da6ac69 Compare October 2, 2026 15:15
@lorisleiva
lorisleiva force-pushed the 10-02-add_v1_to_v2_upgrade_converters_for_types_and_values branch from cd53890 to f1c5fa8 Compare October 9, 2026 09:08
@lorisleiva
lorisleiva force-pushed the 10-02-use_the_published_v1_node_types_in_codama_upgrade branch from da6ac69 to c4ebdc4 Compare October 9, 2026 09:08
Base automatically changed from 10-02-add_v1_to_v2_upgrade_converters_for_types_and_values to main October 9, 2026 09:11
@lorisleiva
lorisleiva force-pushed the 10-02-use_the_published_v1_node_types_in_codama_upgrade branch from c4ebdc4 to 9814a53 Compare October 9, 2026 09:11
@lorisleiva
lorisleiva marked this pull request as ready for review October 9, 2026 09:12
@lorisleiva
lorisleiva merged commit e122de4 into main Oct 9, 2026
@lorisleiva
lorisleiva deleted the 10-02-use_the_published_v1_node_types_in_codama_upgrade branch October 9, 2026 09:12
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