feat: per-package build + prepublishOnly hook (closes #80)#81
Merged
Conversation
Mirrors the engine's PR #154 shape so post-machine-js releases stop risking stale-dist publishes: - `scripts/build-node-entries.mjs`: cwd-portable (paths resolve via REPO_ROOT from import.meta.url) + optional `--package=<scoped-name>` filter. Same shape as the engine script. - `packages/machine/package.json`: new `scripts` block with per-package `build` (passes `--package=@post-machine-js/machine` so this single- package monorepo's flow matches the engine's multi-package flow) and `prepublishOnly: "npm run build"`. `npm publish` (or `lerna publish from-package`) from packages/machine/ now auto-builds first. - `lerna.json` version synced 6.0.0 β 6.4.0 (was stale; hand-edited bumps don't touch lerna.json, so it had drifted across releases). After this lands, post-machine-js's release workflow aligns fully with the engine: - Bump: `npx lerna version <X.Y.Z> --no-git-tag-version --no-push --yes` - Publish: `npx lerna publish from-package --yes` (from repo root) - GH release: `gh release create vX.Y.Z --target master --title vX.Y.Z --notes-file <path>` Same commands as turing-machine-js; per-repo branch-name conventions are the only difference (`chore/release-X.Y.Z` for turing, `vX-Y-Z` for post). Umbrella `mellonis/machines/CLAUDE.md`'s Release / delivery process section will be updated to reflect the uniform flow (separate direct push to umbrella master β umbrella allows direct). No source/API changes. Infrastructure only. No version bump. Verified locally: - `cd packages/machine && rm -rf dist && npm publish --dry-run` triggers prepublishOnly, rebuilds dist, prepares correct tarball (50.9 kB, 15 files, version 6.4.0). - `npx lerna list --json` from root reports @post-machine-js/machine at 6.4.0 β `lerna publish from-package` will publish it. - npm test 267/267, typecheck/lint/build clean.
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
Mirrors turing-machine-js#154 shape so post-machine-js releases stop risking stale-`dist/` publishes, and aligns the release workflow uniformly across both repos.
Discovered just before v6.4.0 publish: `packages/machine/package.json` had no `scripts` block. Manual `npm run build` from root before `npm publish` was the only thing keeping dist current. After a session of edits, `dist/` was 105 minutes older than source β would have shipped stale code without the manual rebuild.
What changes
```json
"scripts": {
"build": "tsc --build --verbose tsconfig.build.json && node ../../scripts/build-node-entries.mjs --package=@post-machine-js/machine",
"prepublishOnly": "npm run build"
}
```
`npm publish` (or `lerna publish from-package`) from `packages/machine/` now auto-builds first.
After this lands β uniform release workflow across both repos
Same commands for both repos; per-repo branch-name conventions remain the only difference (`chore/release-X.Y.Z` for turing-machine-js, `vX-Y-Z` for post-machine-js).
Umbrella docs update
The umbrella `mellonis/machines/CLAUDE.md`'s "Release / delivery process" section will be updated to reflect the uniform flow. Direct push to umbrella master (per the established pattern β umbrella allows direct).
Compatibility
Test plan