Skip to content

EA-2893 make TypeScript examples installable from public npmjs - #230

Open
Fysyx wants to merge 3 commits into
mainfrom
TH-EA-2893
Open

Fysyx wants to merge 3 commits into
mainfrom
TH-EA-2893

Conversation

@Fysyx

@Fysyx Fysyx commented Nov 6, 2026 •

Copy link
Copy Markdown

Summary

Makes the TypeScript examples installable by anyone with a plain npm install, with no b.well credentials needed, and adds a CI check so they stay that way.

The committed lockfiles for bwell-typescript-react and bwell-react-native resolved 663 packages from a private npm mirror: 43 in the React app, including @icanbwell/bwell-sdk-ts, and 620 in React Native. Anyone outside b.well got:

npm error code E401
npm error Incorrect or missing password.

npm's message points at npmjs.com and npm login, but the real cause was the lockfile URLs.

Companion PR: icanbwell/bwell-sdk#1060 (internal) documents testing local SDK builds in these examples.

Changes

  • Lockfiles (bwell-typescript-react/package-lock.json, bwell-react-native/package-lock.json): every private-mirror resolved URL is rewritten to its registry.npmjs.org tarball. Each entry was checked before rewriting to have an identical integrity hash on npmjs. Only resolved lines change; no versions move and no packages are added or removed.
  • CI check (.github/workflows/check_public_npm_registry.yml, .github/scripts/check-public-npm-registry.sh): runs on pull requests and pushes to main. It fails if a committed lockfile resolves from any host other than registry.npmjs.org, or if package.json or a lockfile references a local yalc build. Errors annotate the offending line. The script also runs locally from the repo root.
  • .gitignore: ignores .npmrc, so local registry config with credentials can't be committed.
  • Root README.md: adds "Contributing: keep lockfiles on public npmjs", explaining the rule and how to run the check locally.

Developers who install through a private mirror are unaffected. npm swaps the registry.npmjs.org host for the configured registry at install time.

Testing

Clean installs (npm ci, empty cache) in throwaway copies of each app:

App No .npmrc With mirror .npmrc
bwell-typescript-react ✅ 540 downloads, all from registry.npmjs.org ✅ 540 downloads, all through the mirror
bwell-react-native ✅ 919 downloads, all from registry.npmjs.org ✅ 919 downloads, all through the mirror

These runs used --ignore-scripts and didn't start the apps; they confirm every dependency resolves and installs.

CI check, run in a scratch repo:

Case Result
This branch's lockfiles ✅ passes
main's original React Native lockfile ❌ fails, flagging all 620 mirror URLs
package.json with a yalc link ❌ fails
GitHub Actions output ✅ errors annotate the correct file and line

Notes for reviewers

  • Make the check required: to block merges, a repo admin needs to add Check Public npm Registry as a required status check on main.
  • Action pinning: the workflow uses actions/checkout@v4 by tag, matching the repo's other workflows. Happy to pin it to a commit SHA if preferred.
  • No app code changes.

The committed lockfiles for bwell-typescript-react and bwell-react-native
resolved 663 packages from a private npm mirror, so `npm install` failed
with E401 for anyone without b.well credentials.

- Rewrite those "resolved" URLs to registry.npmjs.org. Every entry was
  checked to have an identical integrity hash on npmjs; no versions or
  packages change.
- Add a CI check (check_public_npm_registry.yml) that fails if a lockfile
  resolves from any other registry or references a local yalc build.
- Gitignore .npmrc and document the lockfile rule in the root README.
@Fysyx
Fysyx requested a review from wfieldx November 6, 2026 22:00
@Fysyx
Fysyx requested review from a team as code owners November 6, 2026 22:00

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

Comment thread .gitignore Resolved
@wfieldx

wfieldx commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Lockfile fix checks out: all 663 rewritten entries match npmjs on integrity and tarball URL, and no versions moved. Inline comments are about tightening the guard. Separately, bwell-typescript-react/package-lock.json has 237 entries with no resolved or integrity (same on main), which is worth a ticket.

@wfieldx wfieldx left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See inline comments.

@Fysyx

Fysyx commented Nov 9, 2026

Copy link
Copy Markdown
Author

Lockfile fix checks out: all 663 rewritten entries match npmjs on integrity and tarball URL, and no versions moved. Inline comments are about tightening the guard. Separately, bwell-typescript-react/package-lock.json has 237 entries with no resolved or integrity (same on main), which is worth a ticket.

Made a ticket here: https://icanbwell.atlassian.net/browse/EA-2907

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