fix(release): unblock parallel publish race; manual fallback skips already-published#4
Merged
Merged
Conversation
…ready-published Two coupled fixes after the v0.3.0 publish run dropped @atriumjs/express on the floor: 1. core/express build no longer does `rimraf dist && tsc`. Changesets publishes packages in parallel. Each package's prepublishOnly runs `pnpm run build`. The combined effect was: - core/build: rimraf core/dist → tsc emits core/dist/*.d.ts - express/build: rimraf express/dist → tsc reads ../core/dist When the two rimrafs interleaved, express's tsc saw core's dist mid-rebuild and failed with "Cannot find module '@atriumjs/core'". Fix: drop `rimraf` from the build script — tsc overwrites files, stale `.js` left over from removed sources is a non-issue for a short-lived publish run. Move the destructive clean into a separate `clean` script for anyone who needs it. Symptom in the v0.3.0 run: 5 of 6 packages published successfully; @atriumjs/express stayed at 0.2.0 on npm. 2. workflow_dispatch fallback now skips already-published versions. The previous loop ran `npm publish` unconditionally and `set -e` would halt on the first 403 (version already on npm), so a retry after a partial publish couldn't proceed past the first already-published package. Now we `npm view` first and skip when the registry already has that exact version. After this lands on main, trigger `Publish to npm` via workflow_dispatch to ship @atriumjs/express@0.3.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
v0.3.0 publish ran via the changesets path (tag push) and 5/6 packages published cleanly: protocol, core, react, worker, cli all at 0.3.0. @atriumjs/express stalled with:
```
src/index.ts(15,8): error TS2307: Cannot find module '@atriumjs/core' or its corresponding type declarations.
src/middleware.ts(5,49): error TS2307: ...
src/middleware.ts(74,31): error TS7006: Parameter 'v' implicitly has an 'any' type.
```
Root cause
Changesets fires each package's `prepublishOnly` in parallel. `@atriumjs/core` and `@atriumjs/express` both had:
```json
"build": "rimraf dist && tsc -p tsconfig.json"
```
So two rimrafs ran concurrently:
When core's `rimraf` won the race, express's tsc resolved `@atriumjs/core` against a directory that had been wiped and not yet rebuilt → the typechecker fell through to "implicit any" / "module not found" errors and express's prepublishOnly exited 2.
Fixes
Drop `rimraf dist` from `@atriumjs/core` and `@atriumjs/express` builds. `tsc` overwrites files; the only loss is that a stale `.js` left over from a deleted `.ts` would linger, which is irrelevant for a one-shot publish run. The destructive clean moves to a separate `pnpm run clean` script for anyone who needs it (CI doesn't).
`workflow_dispatch` fallback skips already-published versions. The previous loop ran `npm publish` unconditionally with `set -e`, so a retry after a partial publish (like this one) halts on the first 403 and never reaches the missing package. Now we `npm view` first and skip when the registry already has that exact version.
How to ship @atriumjs/express@0.3.0 after this merges
Test plan