chore: add prepare script so git-URL installs auto-build#6
Merged
Conversation
Consumers that install this package from a GitHub URL (e.g. `npm i github:escalated-dev/escalated-plugin-sdk#v0.1.0` from escalated-adonis) need the build/ artifacts to exist before import- resolution runs. npm calls the `prepare` lifecycle script right after cloning a git dep, so declaring it here makes the package usable from a git ref without committing build output to the repo. Also align `npm test` with what CI runs (`npx tsx --test ...`). The old `node --test tests/**/*.test.ts` failed locally because Node's module resolver with NodeNext can't load the `.js`-suffixed ESM imports in test files without tsx's type-stripping step.
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
Enable consumers to install the SDK from a GitHub URL (e.g.
npm install github:escalated-dev/escalated-plugin-sdk#v0.1.0) without committing build output to the repo. npm runs thepreparelifecycle immediately after cloning a git dep, so declaringprepare: npm run buildhere makes the git-ref install produce a workingbuild/tree automatically.This unblocks escalated-adonis#34: the adonis package has 6 direct TS2307 errors on
@escalated-dev/plugin-sdkplus ~39 cascading implicit-any errors downstream. Once this PR merges and we tag a release, adonis can reference the SDK as a real (non-stubbed, non-hacked) dep.Also aligns
npm testwith what CI runs (npx tsx --test ...). The oldnode --test tests/**/*.test.tsfailed locally because the test files use.jsESM imports that Node's NodeNext resolver can't load without tsx's type-stripping step.Test plan
rm -rf build/ && npm cinow produces a completebuild/tree via the newpreparehooknpm test— 5 tests passrun-tests.ymlis unchanged — still runsnpm ci && npm run build && npx tsx --test; the extra build afterprepareis a harmless double-build