- Node.js installed (v14 or higher)
- npm account - Create one at npmjs.com
- Git repository (optional but recommended)
cd /Users/johnsonmmbaga/github-repos/zuru-ai-backend/express-generatornpm loginEnter your npm credentials when prompted.
npm search express-project-scaffolderIf results show up, the name is taken. Update package.json with a unique name like:
@yourusername/express-project-scaffolderexpress-api-scaffoldercreate-express-backend
{
"name": "your-unique-package-name",
"author": "Your Name <your.email@example.com>",
"repository": {
"type": "git",
"url": "https://github.com/yourusername/your-repo-name.git"
}
}# Install globally from local directory
npm install -g .
# Test the commands
create-express-app --help
express-quick --help
# Uninstall after testing
npm uninstall -g express-project-scaffoldernpm publish# Update package.json name to: "@yourusername/express-project-scaffolder"
npm publish --access publicFor future updates:
# Update version (patch: 1.0.0 -> 1.0.1)
npm version patch
# Update version (minor: 1.0.0 -> 1.1.0)
npm version minor
# Update version (major: 1.0.0 -> 2.0.0)
npm version major
# Publish the update
npm publishgit init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin https://github.com/yourusername/express-project-scaffolder.git
git push -u origin mainCreate .github/workflows/publish.yml:
name: Publish to NPM
on:
push:
tags:
- 'v*'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}# Development files
*.log
.DS_Store
.env*
coverage/
test/
# Source control
.git/
.gitignore
# IDE
.vscode/
.idea/
# Development dependencies
node_modules/
npm profile enable-2fa auth-and-writesnpm audit
npm audit fix✅ Test installation: npm install -g your-package-name
✅ Test commands: Run the CLI commands
✅ Check npm page: Visit npmjs.com/package/your-package-name
✅ Update documentation: Add installation instructions
✅ Share with community: Tweet, post in forums
Users can install it with:
# Global installation
npm install -g your-package-name
# One-time usage
npx your-package-nameError: Package already exists
- Change the package name in
package.json - Use a scoped package:
@yourusername/package-name
Error: Authentication failed
- Run
npm logoutthennpm login - Check 2FA settings
Error: Permission denied
- Use
sudofor global installs (not recommended) - Better: Configure npm to use a different directory
Error: Invalid package.json
- Validate JSON syntax
- Ensure required fields are present
-
Add badges to README:
 
-
Submit to awesome lists
-
Post on Reddit (r/node, r/javascript)
-
Share on Twitter/LinkedIn
-
Add to your GitHub profile
🎊 Congratulations! You're now an npm package publisher! 🎊