Skip to content

chore: track build/ in git for git-ref installs#7

Merged
mpge merged 1 commit into
masterfrom
chore/commit-build-for-git-installs
Apr 19, 2026
Merged

chore: track build/ in git for git-ref installs#7
mpge merged 1 commit into
masterfrom
chore/commit-build-for-git-installs

Conversation

@mpge
Copy link
Copy Markdown
Member

@mpge mpge commented Apr 19, 2026

Summary

Until @escalated-dev/plugin-sdk is published to npm, downstream consumers (notably escalated-adonis) install it via a git URL pinned to a tag:

\"@escalated-dev/plugin-sdk\": \"github:escalated-dev/escalated-plugin-sdk#v0.1.1\"

#6 added a prepare lifecycle hook so npm would build the SDK right after cloning the git dep. That worked on npm 10 but breaks on npm 11 (the bundled cli ships with mutually exclusive --prefer-offline and --prefer-online flags during git-prepare child installs — both are passed simultaneously, which the cli now rejects with an Exit prior to config file resolving error).

This PR tracks build/ in git so the consumer install path is just "clone the ref, read package.json's exports/main/types, done" with no on-install build step.

A new freshness check in run-tests.yml fails the build whenever committed build/ drifts from src/, so a stale build/ can never silently ship.

When the package is later published to npm, this build/-in-git arrangement can be unwound (revert this PR) and consumers can switch to a normal version range.

Test plan

  • npm ci && npm run build && npx tsx --test ... — 5/5 tests pass
  • git diff --quiet -- build returns clean immediately after npm run build
  • CI's freshness check is exercised in this PR (build was just regenerated)

Until this package is published to npm, downstream packages (notably
escalated-adonis) must consume it via a git URL pinned to a tag:
  "@escalated-dev/plugin-sdk": "github:escalated-dev/escalated-plugin-sdk#v0.1.1"

The previous setup added a `prepare` hook so npm would build the SDK
right after cloning the git dep. That works on npm 10 but breaks on
npm 11 (the cli ships with mutually exclusive --prefer-offline and
--prefer-online flags during git-prepare child installs - see
https://github.com/npm/cli for the open issue tracking this regression).

Track build/ in git so the consumer install path is "clone the ref,
read package.json's main/exports/types, done" with no on-install build
step. Run-tests CI now fails when the committed build/ drifts from src/,
so a stale build can never silently ship.
@mpge mpge merged commit 704d673 into master Apr 19, 2026
2 checks passed
@mpge mpge deleted the chore/commit-build-for-git-installs branch April 19, 2026 20:15
mpge added a commit that referenced this pull request Apr 19, 2026
Now that build/ ships in the repo (#7), the prepare lifecycle is
unneeded. Worse, leaving it in triggers an npm 11 bug for git-URL
consumers: npm spawns the prepare child install with both
--prefer-offline=false AND --prefer-online=false, which the cli now
rejects as mutually exclusive. Removing prepare bypasses that path
entirely and lets git-ref installs succeed on every npm version.

prepublishOnly is kept so an eventual `npm publish` still runs the
build before packaging.
mpge added a commit that referenced this pull request Apr 19, 2026
Now that build/ ships in the repo (#7), the prepare lifecycle is
unneeded. Worse, leaving it in triggers an npm 11 bug for git-URL
consumers: npm spawns the prepare child install with both
--prefer-offline=false AND --prefer-online=false, which the cli now
rejects as mutually exclusive. Removing prepare bypasses that path
entirely and lets git-ref installs succeed on every npm version.

prepublishOnly is kept so an eventual `npm publish` still runs the
build before packaging.
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.

1 participant