Skip to content

chore(perch-js): make @stellar-registry/perch publishable to npm - #30

Open
willemneal wants to merge 1 commit into
mainfrom
chore/publish-perch-js
Open

chore(perch-js): make @stellar-registry/perch publishable to npm#30
willemneal wants to merge 1 commit into
mainfrom
chore/publish-perch-js

Conversation

@willemneal

Copy link
Copy Markdown
Contributor

Turns the TS surface into a real, installable npm package, so consumers (e.g. nidohq/nido's @nidohq/testkit) can depend on it instead of vendoring canonical.ts — removing the drift risk that a vendored copy carries.

Changes

  • package.json — drop private: true; point main/types + exports at the built dist/, add files: ["dist"], sideEffects: false, publishConfig.access: public.
  • tsconfig.build.json — emits ESM + .d.ts to dist/ (NodeNext; every relative import already carries a .js suffix). Wired as npm run build + prepublishOnly.
  • README.md (package) — shown on the npm page.
  • .github/workflows/npm-publish.yml — publishes on a GitHub Release (or manual dispatch); SHA-pinned actions matching ci.yml; uses an org NPM_TOKEN secret.

Guarantees

  • The published doc_hash stays byte-identical to on-chain perch — the canonical form is unchanged.
  • npm pack --dry-run ships only dist/ (src/test excluded); npm run build + vitest (20 tests) green.

To actually publish (not done by this PR)

  1. Add the repo secret NPM_TOKEN — an npm automation token with publish rights to the @stellar-registry scope.
  2. Bump version if needed, then cut a GitHub Release (or run the workflow via Run workflow). It builds, tests, and npm publish --access public.

🤖 Generated with Claude Code

Turns the TS surface into a real, installable package so consumers (e.g.
nidohq/nido's testkit) can depend on it instead of vendoring canonical.ts.

- drop `private: true`; point main/types + `exports` at the built dist, add
  `files: ["dist"]`, `sideEffects: false`, and `publishConfig.access: public`.
- add a build: `tsconfig.build.json` emits ESM + .d.ts to dist (NodeNext; every
  relative import already carries a .js suffix), wired as `npm run build` and
  `prepublishOnly`.
- add a package README (shown on the npm page).
- add .github/workflows/npm-publish.yml — publishes on a GitHub Release (or
  manual dispatch), SHA-pinned actions matching ci.yml, using an org NPM_TOKEN
  secret.

The published doc_hash stays byte-identical to on-chain perch (canonical form
unchanged). `npm pack --dry-run` ships only dist/; build + 20 tests green.

First publish requires the NPM_TOKEN repo secret (@stellar-registry scope) and
cutting a release; this PR does not publish.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
run:
working-directory: packages/perch-js
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Publish (public)
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public
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.

2 participants