This guide explains how to publish the @orchestro/init package to npm registry.
- npm Account: Create one here if you don't have one
- npm CLI: Already installed with Node.js
- Organization (Optional): Create
@orchestroorganization on npm
npm loginEnter your credentials when prompted.
If publishing under @orchestro scope, create the organization:
- Go to https://www.npmjs.com/org/create
- Create organization named
orchestro - Choose free plan (for open source)
Alternatively, change the package name in package.json to unscoped:
{
"name": "orchestro-init", // instead of @orchestro/init
...
}Before publishing, update package.json:
{
"name": "@orchestro/init",
"version": "1.0.0",
"repository": {
"type": "git",
"url": "https://github.com/YOUR_USERNAME/orchestro.git", // UPDATE THIS
"directory": "packages/init"
},
"homepage": "https://github.com/YOUR_USERNAME/orchestro#readme" // UPDATE THIS
}Also update the git clone URL in index.js:
// Line ~107
execSync(
`git clone --depth 1 https://github.com/YOUR_USERNAME/orchestro.git "${installDir}"`,
{ stdio: 'ignore' }
);cd packages/init
# Test the installer
node index.js
# Or test with npm link
npm link
npx @orchestro/init # This should work
npm unlink -g @orchestro/initcd packages/init
# For scoped package (first time)
npm publish --access public
# For subsequent updates
npm publish# Search for your package
npm search @orchestro/init
# View package page
npm view @orchestro/init
# Test installation
npx @orchestro/initWhen making changes:
-
Update version in package.json:
# Patch release (bug fixes): 1.0.0 → 1.0.1 npm version patch # Minor release (new features): 1.0.0 → 1.1.0 npm version minor # Major release (breaking changes): 1.0.0 → 2.0.0 npm version major
-
Publish the update:
npm publish
Create .github/workflows/publish-init.yml:
name: Publish @orchestro/init
on:
push:
tags:
- 'init-v*'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: |
cd packages/init
npm install
- name: Publish to npm
run: |
cd packages/init
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}Then create releases with tags:
git tag init-v1.0.0
git push origin init-v1.0.0npm unpublish @orchestro/init@1.0.0 # Specific version
npm unpublish @orchestro/init --force # Entire package (dangerous!)npm deprecate @orchestro/init@1.0.0 "This version has critical bugs, please upgrade"npm owner add USERNAME @orchestro/init
npm owner rm USERNAME @orchestro/init- Make sure you're logged in:
npm whoami - Check organization membership (for scoped packages)
- Verify package name isn't taken:
npm view @orchestro/init
- npm prevents similar names to avoid confusion
- Choose a more unique name or use a scope
- You tried to publish the same version twice
- Bump the version number in package.json first
- Always test locally before publishing
- Use semantic versioning (MAJOR.MINOR.PATCH)
- Keep README up to date - it shows on npm page
- Add keywords for discoverability
- Include LICENSE file (MIT recommended)
- Set up 2FA on your npm account for security
- ✅ Package created locally
- ✅ Tested and working
- ⏳ Ready to publish
- ⏳ Update GitHub URLs before publishing
- ⏳ Create npm organization (if using @orchestro scope)
- npm login
- Update GitHub URLs in package.json and index.js
- Test locally with
node index.js - Test with
npm linkandnpx @orchestro/init - Bump version if needed
-
npm publish --access public - Verify with
npm view @orchestro/init - Test installation:
npx @orchestro/init - Update main README with correct npm command
- Create git tag:
git tag init-v1.0.0 - Push tag:
git push origin init-v1.0.0