monotonic-pi-extensions/scoped-packages.md

1.8 KiB

Scoped Packages

Step 1: Create the npm org

npm org create mostalive

This creates the @mostalive scope on npm. You'll need to pay the org fee (currently ~$7/month for the basic tier).

Alternatively, if you already have an account, you can use your username directly — scoped packages can use your personal account too:

# No separate org creation needed if @mostalive is your npm username

Check if the scope exists:

npm org list

Step 2: Rename the package

In packages/pi-turn-limit/package.json:

{
  "name": "@mostalive/pi-turn-limit",
  "version": "0.1.0",
  ...
}

Step 3: Publish

cd packages/pi-turn-limit
npm publish

Scoped packages require --access public on first publish (since npm defaults scoped packages to private):

npm publish --access public

Step 4: Users install

pi install npm:@mostalive/pi-turn-limit

Cheaper Alternative: Scoped Git Package

If you don't want to pay for an npm org, you can ship via git without scoping:

pi install git:github.com/mostalive/pi-turn-limit

No npm org needed. Users install directly from your GitHub repo. You'd still need to publish to npm for the npm: install path, but the git path is free.


Summary

Approach Cost User installs via
npm org create + scoped npm ~$7/mo pi install npm:@mostalive/pi-turn-limit
GitHub repo (no scope) Free pi install git:github.com/user/repo
Unscoped npm (pi-turn-limit) Free pi install npm:pi-turn-limit

If you already have a personal npm account named mostalive, the scope is free — scoped packages just use your existing account. The org fee only applies if you create a separate organization entity.