Connect a project
How another Ziteox project installs and updates @ziteox/ui through Core’s npm proxy, and how to link a local Forge build for development.
Connect a project
What this is
How another Ziteox project consumes @ziteox/ui (and later other Forge packages). Forge stays the source. Consumer repos install a published version through Core’s npm registry proxy, or temporarily a packed local build while you develop.
Full proxy details: Install packages through Core.
Chosen approach
One approach only:
- Versioned private
@ziteox/uion GitHub Packages (npm.pkg.github.com, scope@ziteox) — upstream storage. - Versions managed with Changesets.
- Published only by the manual Release workflow (
.github/workflows/release.yml), using the workflow’sGITHUB_TOKENwithpackages: write. - Consumers install through Core (
/npm/*) with a project token scopedpackages:read. Env var:ZITEOX_CORE_NPM_TOKEN— never committed. Core holds the upstream Packages credential. - Version bumps in consumers via Dependabot (or Renovate) once Core/registry access is wired for that host.
- Local dev:
forge-connect linkinstalls a packed tarball (file:), not a symlink. The consumer keeps a single copy of React/Next. Symlinked packages cause duplicate React / hook errors and needtranspilePackagesplus outside-root config.
Deprecated: putting a shared GITHUB_PACKAGES_TOKEN (classic PAT) in consumer .npmrc / host env. Prefer Core; see From package token to connector.
Why not the alternatives
| Approach | Why not |
|---|---|
| Git dependencies | No real semver, slow installs, needs a build on install |
| npm public registry | The code is private |
pnpm / npm link symlinks for daily use | Duplicate React; Next/Turbopack outside-root issues |
| Copying source into the consumer | Drift from Forge |
Sources
- Working with the npm registry (GitHub Packages)
- About permissions for GitHub Packages
- Configuring a package’s access control and visibility
- Publishing and installing a package with GitHub Actions
- Intro to using Changesets
- pnpm + Changesets
- changesets/action
- pnpm link
- pnpm issue #6804 (link / duplicate deps)
- Next.js discussion #61800 (outside-root / transpile)
- Renovate private packages
Tokens per place
Production Core (https://core.ziteox.com) is not live yet. Local Core: http://localhost:8787. Mint tokens via admin POST /v1/admin/tokens with scopes: ["packages:read"] — see Install packages through Core.
| Place | What to use |
|---|---|
| Local Mac | ZITEOX_CORE_NPM_TOKEN = zxcore_… with packages:read; .npmrc points at local or future Core /npm/ |
| Vercel / Railway / other hosts | Same env var at build time; registry host = Core (not npm.pkg.github.com) |
| GitHub Actions in a consumer repo | Store the project token as a repo secret (ZITEOX_CORE_NPM_TOKEN); do not use a shared GitHub Packages PAT |
Never commit a token. The .npmrc line uses ${ZITEOX_CORE_NPM_TOKEN}, not a literal value.
Using the helper
From Forge:
pnpm forge-connect --helpOr:
node <forge>/scripts/forge-connect.mjs [--cwd <dir>] <command> [options]setup
pnpm forge-connect --cwd <consumer> setup [--version <range>] [--workspace <name>] [--dry-run] [--with-peers]Merges .npmrc for the @ziteox scope, requires an install token, installs @ziteox/ui (default ^0.1.1), and reports peer gaps. Pass --with-peers to install missing peers.
Target .npmrc (Core) — production host not live yet; local example:
@ziteox:registry=http://localhost:8787/npm/
//localhost:8787/:_authToken=${ZITEOX_CORE_NPM_TOKEN}Production shape when Core is live:
@ziteox:registry=https://core.ziteox.com/npm/
//core.ziteox.com/:_authToken=${ZITEOX_CORE_NPM_TOKEN}Host-root _authToken covers both /npm/ packuments and /download tarballs. Do not set replace-registry-host=always — npm only rewrites lockfile hosts against the default registry, not a scoped @ziteox:registry (with always, @ziteox tarballs were rewritten to registry.npmjs.org → 404). Commit lockfile @ziteox resolved hosts as https://core.ziteox.com/download/... (path + integrity unchanged). Never commit localhost lockfile URLs — local Core overrides stay per-machine. Details: Install packages through Core.
forge-connect setup may still write the older GitHub Packages lines until the helper is updated — prefer the Core lines above (or npmrcFor from @ziteox/core-client). Existing unrelated .npmrc lines are kept. A literal auth token value (not ${…}) is an error.
Deprecated .npmrc (do not use for new hosts):
@ziteox:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_PACKAGES_TOKEN}link
pnpm forge-connect --cwd <consumer> link [--forge <path>] [--workspace <name>] [--no-build] [--gitignore]Builds @ziteox/ui in the Forge checkout (unless --no-build), packs it into .forge-link/, installs the tarball as a file: dependency, then prefers a package.json path relative to the target package. Re-run to refresh. Unlink before committing.
link does not need ZITEOX_CORE_NPM_TOKEN (or the deprecated GITHUB_PACKAGES_TOKEN).
unlink
pnpm forge-connect --cwd <consumer> unlink [--workspace <name>]Restores the original @ziteox/ui spec from .forge-link/state.json and removes .forge-link/. If the original was a registry range, unlink reinstalls from the registry and therefore needs the token (same exit 2 message if missing). If the original was absent, it uninstalls the package and does not need the token.
status
pnpm forge-connect --cwd <consumer> status [--workspace <name>]Prints package manager, lock root, package.json path, @ziteox/ui spec and installed version, .npmrc status, and whether link mode is active.
Link hygiene
- Add
.forge-link/to.gitignore(or pass--gitignoreonlink). - Do not commit a linked
file:spec or the tarball directory. Unlink before committing.
Peers
Exact peerDependencies from packages/ui/package.json (current Forge):
{
"motion": "^12.0.0 || ^13.0.0 || ^14.0.0",
"next-themes": "^0.4.0",
"react": "^18.0.0 || ^19.0.0",
"react-dom": "^18.0.0 || ^19.0.0",
"web-haptics": "^0.0.6"
}Current facts (B5)
- Admin portal workspaces (
ziteox-admin,ziteox-client,ziteox-auth) declare@ziteox/ui ^0.1.0. The lockfile resolves 0.1.1 fromnpm.pkg.github.com. - This Forge repo is at 0.1.2, not published yet.
- The read token secret per host and the consumer CI setup do not exist yet (Laki / Clerk decision).
Per-project steps
Admin portal (portal)
npm workspaces: ziteox-admin, ziteox-client, ziteox-auth. Already has the root .npmrc for GitHub Packages.
# From Forge, once the read token is available:
pnpm forge-connect --cwd <portal> setup --workspace ziteox-admin --version ^0.1.2
pnpm forge-connect --cwd <portal> setup --workspace ziteox-client --version ^0.1.2
pnpm forge-connect --cwd <portal> setup --workspace ziteox-auth --version ^0.1.2Bump each app to the published version when 0.1.2 (or later) is on the registry.
For local Forge work without publishing:
pnpm forge-connect --cwd <portal> link --forge <forge> --workspace ziteox-admin
# …repeat per workspace as needed; unlink before commitNext: transpilePackages is not needed for the built dist package from the registry or a packed tarball. Add it only if the build complains.
MultiStrom (Projects/MultiStrom)
npm, Next 16, Payload. Uses motion ^14. Older @ziteox/ui 0.1.1 peers only motion ^12, which causes npm ERESOLVE. This branch widened the peer to ^12.0.0 || ^13.0.0 || ^14.0.0 (commit 1a9f9fc, tested against motion 14.9.0), so the first publish (0.1.2) installs cleanly.
MultiStrom has no next-themes / web-haptics in package.json. npm may auto-install peers; list them explicitly with setup:
pnpm forge-connect --cwd <MultiStrom> setup --version ^0.1.2 --with-peersNo .npmrc yet — setup writes it. For local Forge:
pnpm forge-connect --cwd <MultiStrom> link --forge <forge>
pnpm forge-connect --cwd <MultiStrom> unlinklaborbusser-web
pnpm 10. The helper detects pnpm. Keep existing .npmrc lines (for example only-built-dependencies); setup appends the @ziteox registry lines idempotently.
pnpm forge-connect --cwd <laborbusser-web> setup --version ^0.1.2 --with-peersziteox-website
Path and stack are not confirmed here — see Open questions. Generic steps once you know the lock root:
pnpm forge-connect --cwd <ziteox-website> setup --version ^0.1.2 --with-peers
# or link for local Forge work, then unlink before commitReleasing a new version
For Laki, in this Forge repo:
pnpm changeset— record the bump.- Commit the changeset.
- Run the Release workflow manually in GitHub Actions (
workflow_dispatchonly — nothing runs on push).
Nothing has been published from this repo yet. The first release would publish 0.1.2. Needs Laki’s OK.
Installs go through Core (packages:read) — see Install packages through Core. Design history: From package token to connector.
Tested locally
Throwaway copies under /tmp/forge-proof (real repos untouched). Against this branch’s unpublished @ziteox/ui 0.1.2 built in a clean Forge copy. Link / negative checks did not need a registry token.
Admin portal copy (npm workspaces, Next 15.5.28):
- Before linking, a page importing
HamburgerButtonwithmaterial="emboss"and@ziteox/ui/materialsfailed typecheck against installed 0.1.1 (no./materialsexport, nomaterialprop). - After
forge-connect link --forge <clean copy> --workspace ziteox-admin:package.jsonspecfile:../.forge-link/ziteox-ui-0.1.2.tgz, installed 0.1.2,tsc --noEmitexit 0,next buildexit 0 with route/forge-proof.
MultiStrom copy (npm, Next 16.2.10, motion 14.9.0):
- First link failed with
ERESOLVEon the oldmotion ^12peer. - After the peer widening, link exit 0,
tsc --noEmitexit 0,next buildexit 0 with route/forge-proof. unlinkrestored the original state (no@ziteox/ui).
Without a registry token:
setup/unlinkthat reinstall from the registry exit 2 when the expected token env var is unset.- A direct
npm view @ziteox/uiagainst GitHub Packages returnsE401with no auth; against Core/npm/returns401 token_invalidwithout a Bearer token.
Not proven yet against production Core: end-to-end install (Core URL not live). Local Core e2e covers packument/tarball proxy against a mock upstream.
link needs no token. Keep .forge-link/ gitignored and unlink before committing.