Skip to content

feat: publish dcmjs 1.x under the unscoped dcmjs name too - #681

Merged
wayfarer3130 merged 4 commits into
mainfrom
feat/dcmjs-alias-package
Nov 28, 2026
Merged

wayfarer3130 merged 4 commits into
mainfrom
feat/dcmjs-alias-package

Conversation

@wayfarer3130

@wayfarer3130 wayfarer3130 commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR publishes dcmjs 1.x under the unscoped name dcmjs, in addition to @dcmjs-org/dcmjs. The new package packages/dcmjs has the name dcmjs. Each of its entries re-exports the same entry of @dcmjs-org/dcmjs. Thus an application that uses both names gets one copy of the code, and one copy of the reader state (the log level and the registerTag() entries).

This PR depends on two other PRs:

Changes

  • packages/dcmjs (new):
    • package.json: the name dcmjs, the dependency "@dcmjs-org/dcmjs": "workspace:^", and the same exports keys as the root package: ., ./eventStream, ./media, ./encapsulated, ./image, ./dictionary and ./package.json. On publish, pnpm writes ^<version>, so an app with a newer @dcmjs-org/dcmjs gets one copy. The unpkg and jsdelivr fields point at dist/dcmjs.js.
    • copy-umd.mjs (the build script, not published): copies the UMD build build/dcmjs.js and its map to dist/. The root pnpm run build runs it after rollup, and the publish job runs pnpm run build.
    • One ESM file (.mjs) and one CJS file (.cjs) for each entry. Each file re-exports the entry of @dcmjs-org/dcmjs. ./dictionary is ESM only, as in the root package.
    • README.md.
  • test/package-exports.test.js: the check of the dual dist build skips the alias, because the alias has no build. A new block checks two things. The alias has the same entry points as @dcmjs-org/dcmjs. Each entry file re-exports the same entry of @dcmjs-org/dcmjs.
  • .releaserc.json and RELEASE_PLAN.md: the 0.x entry has "channel": "release-0.x", the same as on the 0.x branch (ci: name the 0.x channel release-0.x; correct the 0.x release docs (reviews of #678 and #681) #682).
  • README.md, docs/MIGRATION.md and the README of the package-name codemod: the unscoped name publishes 1.x. The codemod is optional.

Release

The publish job needs no change:

  • pnpm -r publish publishes each workspace package that is not private, and this package is not private.
  • scripts/stamp-workspace-versions.mjs gives the package the same version as the other packages.
  • On npm, dcmjs already trusts publish-package.yml with the environment publish, with no branch restriction.

The title starts with feat:, so the merge releases 1.1.0. The first unscoped 1.x version is thus [email protected]. To release the package as a fix version, change the title to fix:. Each later release from main publishes dcmjs with latest.

Change that users can see

  • npm install dcmjs installs 1.x. Before, it installed 0.x.
  • A dependency range such as ^0.54.0 stays on 0.x. A range that allows 1.x (*, latest, >=0.54) moves to 1.x.
  • 1.x keeps the 0.52 names on the default export. A project that moves to 1.x can read docs/MIGRATION.md.
  • <script src="https://unpkg.com/dcmjs"> loads the 1.x UMD build, which sets the same global dcmjs. https://unpkg.com/[email protected] stays on 0.x. docs/MIGRATION.md says this.

Verification

  • The test of the alias fails when an entry file re-exports the wrong entry.
  • End to end: I stamped version 1.0.0 for a scratch pack, and packed the root package and the alias. Then I installed both tarballs with npm in an empty project. For each entry (., /eventStream, /media, /encapsulated, /image, /dictionary), import of dcmjs gives the same default export and the same named exports as import of @dcmjs-org/dcmjs. require gives the same object, except for /dictionary, which is ESM only. dcmjs.data.DicomMessage.readFile is a function.
  • The full test suite passes: 127 suites, 1480 tests (2 suites and 11 tests skipped, as before).

Until #679 merges, the diff of this PR also shows the commit of #679 (37ad5d0).

The review of this PR (B1, S1, S2, N1, N2, N3, Q1 to Q3) is applied in 2d97b91.

🤖 Generated with Claude Code

wayfarer3130 and others added 2 commits November 27, 2026 17:43
… links

- .releaserc.json: remove successComment: false, which was for the
  1.0.0 release only. The 0.x entry uses the range 0.54.x, as on the
  0.x branch (#648).
- RELEASE_PLAN.md: the same changes, and why semantic-release cannot
  use the range 0.x.
- codemods READMEs: link to docs on main, not master.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
packages/dcmjs is the package "dcmjs". Each entry re-exports the same
entry of @dcmjs-org/dcmjs, so an application that uses both names gets
one copy of the code. pnpm -r publish ships it with the other packages,
and the stamp script gives it the same version.

- packages/dcmjs: package.json, the ESM and CJS re-export files of
  ".", eventStream, media, encapsulated, image and dictionary, README.
- test/package-exports.test.js: the alias has the same entry points as
  @dcmjs-org/dcmjs, and each entry file re-exports the same entry.
- .releaserc.json, RELEASE_PLAN.md: the 0.x line publishes under the
  npm dist-tag 0.x, so that latest stays on 1.x.
- README, MIGRATION.md, package-name codemod README: the unscoped name
  publishes 1.x; the codemod is optional.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@netlify

netlify Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for dcmjs2 ready!

Name Link
🔨 Latest commit 41a9550
🔍 Latest deploy log https://app.netlify.com/projects/dcmjs2/deploys/6b0a2aa5b92afcdc80bcea21
😎 Deploy Preview https://deploy-preview-681--dcmjs2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

wayfarer3130 added a commit that referenced this pull request Nov 27, 2026
npm does not permit the dist-tag 0.x, so @semantic-release/npm
published the channel 0.x as release-0.x. With the channel
release-0.x, the config, the git notes, the GitHub label and the npm
dist-tag have one name. The git note of v0.54.2 already lists
release-0.x, so the first run does not try to add the channel to
v0.54.2 again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e-0.x (review of #681)

- packages/dcmjs: a build step copies build/dcmjs.js (and its map) to
  dist/, and the unpkg and jsdelivr fields point at it, so that
  https://unpkg.com/dcmjs keeps working in a browser after 1.x takes
  latest (review B1, Q1). The dependency is workspace:^, so an app
  with a newer @dcmjs-org/dcmjs gets one copy of the code (Q2).
- .releaserc.json, RELEASE_PLAN.md: the 0.x channel is release-0.x,
  the npm dist-tag that the 0.x line gets (Q3, S1).
- README, MIGRATION.md: the first unscoped 1.x is 1.1.0 (S2); one copy
  when one version satisfies both names (N1); the unpkg URL serves the
  1.x UMD build; the jest mapping also maps the dcmjs names (N2).
- test: each ESM target that the alias re-exports has a default export
  (N3).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
wayfarer3130 added a commit that referenced this pull request Nov 28, 2026
…eviews of #678 and #681) (#682)

* docs: correct the 0.x release rules and links (review of #678)

- The npm dist-tag of the 0.x line is release-0.x: npm refuses a
  dist-tag that is a version range, so semantic-release adds the
  prefix. [email protected] still installs the line, as a range.
- The 0.x examples are at 0-x--dcmjs2.netlify.app (Netlify writes the
  "." of the branch name as "-").
- The rule is for the commit that lands on 0.x: for a PR with one
  commit, the squash merge uses the commit title, not the PR title.
- Two ways to recover from a feat: commit: a revert, merged with
  "Rebase and merge" so that the revert message stays exact, or a
  ci: PR that raises the range to 0.55.x.
- examples/vtkDisplay loads [email protected], not the unversioned name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci: name the 0.x channel release-0.x (review of #681, Q3)

npm does not permit the dist-tag 0.x, so @semantic-release/npm
published the channel 0.x as release-0.x. With the channel
release-0.x, the config, the git notes, the GitHub label and the npm
dist-tag have one name. The git note of v0.54.2 already lists
release-0.x, so the first run does not try to add the channel to
v0.54.2 again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: 0.x requires a linear history; check the revert commit (review of #682)

- Each commit that lands on 0.x counts. The branch requires a linear
  history, so a PR merges with "Squash and merge" or "Rebase and
  merge" (review S1, Q2).
- The revert recovery tells the maintainer to check the title and the
  body of the revert commit before the merge (review S2).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@wayfarer3130
wayfarer3130 marked this pull request as ready for review November 28, 2026 01:12
# Conflicts:
#	.releaserc.json
#	RELEASE_PLAN.md
@wayfarer3130
wayfarer3130 merged commit ff19c2b into main Nov 28, 2026
9 checks passed
@wayfarer3130
wayfarer3130 deleted the feat/dcmjs-alias-package branch November 28, 2026 01:26
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant