Skip to content

Commit 2461127

Browse files
committed
Release tooling: Pass the namespaced tag prefix and commit message to pnpm's native version command
pnpm 11 implements `pnpm version` itself instead of proxying to `npm version`, so the `tag-version-prefix` and `message` entries in each package's `.npmrc` were never read. A dry run of the 3.7.0 bump therefore produced a plain `v3.7.0` tag and a bare "3.7.0" commit message, which the publish workflow's tag routing would have treated as a legacy tailwind-merge tag and which would have broken the per-package tag scheme for the vite package entirely. Both settings are pnpm rc options, but pnpm config lives repo-wide in `pnpm-workspace.yaml` while the prefix differs per package. Each package therefore gets a `release` script that wraps `pnpm version` with the right `--tag-version-prefix` and `--message` flags; the bump type is forwarded through `pnpm release <bump>`. Verified in a throwaway repository that this yields the namespaced annotated tag and commit message and still runs the version lifecycle hooks. The `.npmrc` files are removed since nothing reads them anymore, together with the packed-tarball guard that excluded them. The library manifest also drops its empty `dependencies` object: pnpm normalizes the manifest when writing the new version and would otherwise remove it inside the release commit. The release guide now documents the native command, the clean-working-tree requirement, and how to create the commit and tag locally without pushing by leaving `DANYS_MACHINE` unset.
1 parent 9d41508 commit 2461127

6 files changed

Lines changed: 4 additions & 10 deletions

File tree

‎agents/release-workflow.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Releases are per package. Each release belongs to exactly one workspace package
1111

1212
Tags without a package prefix (`v3.6.0` and earlier) are the pre-monorepo history and belong to `tailwind-merge`. The publish workflow's tag routing and `scripts/update-pinned-links.mjs` treat them that way via a fallback; release-drafter does not (see below), so the first namespaced tailwind-merge release needs its draft assembled by hand.
1313

14-
The tag and version-commit format comes from each package's `.npmrc` (`tag-version-prefix`, `message`), which `npm version` reads when `pnpm version` runs in the package directory. pnpm itself reads no settings from `.npmrc` — repo-level pnpm settings live in `pnpm-workspace.yaml` — so don't delete these files as stale.
14+
The tag and version-commit format is set by each package's `release` script, which wraps `pnpm version` with `--tag-version-prefix=<package-name>@` and `--message=<package-name>@%s`. pnpm 11 implements `pnpm version` natively instead of proxying to `npm version`, so it never reads npm's `tag-version-prefix`/`message` from `.npmrc`; running bare `pnpm version` yields a plain `v<version>` tag with a bare-version commit message, which the publish workflow's tag routing would treat as a legacy tailwind-merge tag. Both settings are pnpm rc options, but pnpm config is repo-wide (`pnpm-workspace.yaml`) while the prefix differs per package, hence the per-package script.
1515

1616
## Scope
1717

@@ -99,7 +99,7 @@ gh workflow run comment-released-prs-and-issues.yml \
9999

100100
## Commands
101101

102-
Bump a package's version with `pnpm version <version|patch|minor|major>` run inside the package directory (for the library: `packages/tailwind-merge/`). pnpm runs the existing `preversion`, `version`, and `postversion` lifecycle scripts and creates the version commit and namespaced tag from the package's `.npmrc`. The `version` step first re-pins tag-pinned links repo-wide via the shared `scripts/update-pinned-links.mjs` (see Release drafting notes above); for the library it then regenerates both the package README and the generated section of the repo-level README via its own `scripts/update-readme.mjs`, with links pinned to the new release tag.
102+
Bump a package's version with `pnpm release <version|patch|minor|major>` run inside the package directory (for the library: `packages/tailwind-merge/`); see Release model above for why it is not bare `pnpm version`. pnpm requires a clean working tree, so commit the changelog first. pnpm runs the existing `preversion`, `version`, and `postversion` lifecycle scripts — each stages the files it rewrites itself, because pnpm only stages the manifest — and creates the version commit and an annotated namespaced tag. pnpm also normalizes the manifest when writing the new version (an empty `dependencies` object gets dropped), so keep the manifest free of such fields. To create the commit and tag locally without pushing, run with the `DANYS_MACHINE` variable unset (`env -u DANYS_MACHINE pnpm release minor`): the `preversion` pull and the `postversion` push are gated on it. The `version` step first re-pins tag-pinned links repo-wide via the shared `scripts/update-pinned-links.mjs` (see Release drafting notes above); for the library it then regenerates both the package README and the generated section of the repo-level README via its own `scripts/update-readme.mjs`, with links pinned to the new release tag.
103103

104104
Fetch draft release:
105105

‎packages/tailwind-merge/.npmrc‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎packages/tailwind-merge/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@
6565
"test:types": "tsc --noEmit && tsc --noEmit --project tests/tsconfig.json",
6666
"test:types:compat": "node node_modules/typescript-compat/bin/tsc --project scripts/typescript-compatibility/tsconfig.json",
6767
"lint": "eslint --max-warnings 0 .",
68+
"release": "pnpm version --tag-version-prefix=tailwind-merge@ --message=tailwind-merge@%s",
6869
"preversion": "if [ -n \"$DANYS_MACHINE\" ]; then git checkout main && git pull; fi",
6970
"version": "node ../../scripts/update-pinned-links.mjs && zx scripts/update-readme.mjs",
7071
"postversion": "if [ -n \"$DANYS_MACHINE\" ]; then git push --follow-tags && open https://github.com/dcastil/tailwind-merge/releases; fi"
7172
},
72-
"dependencies": {},
7373
"devDependencies": {
7474
"@babel/core": "^8.0.1",
7575
"@babel/preset-env": "^8.0.2",

‎packages/vite/.npmrc‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎packages/vite/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"test:watch": "vitest",
5151
"test:types": "tsc --noEmit",
5252
"test:exports": "node scripts/test-packed-package.mjs",
53+
"release": "pnpm version --tag-version-prefix=@tailwind-merge/vite@ --message=@tailwind-merge/vite@%s",
5354
"version": "node ../../scripts/update-pinned-links.mjs"
5455
},
5556
"peerDependencies": {

‎packages/vite/scripts/test-packed-package.mjs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ async function assertTarballLayout(tarballPath) {
114114
'package/tsdown.config.ts',
115115
'package/vitest.config.mts',
116116
'package/eslint.config.mjs',
117-
'package/.npmrc',
118117
]
119118
for (const entry of entries) {
120119
for (const forbidden of forbiddenPatterns) {

0 commit comments

Comments
 (0)