This guide explains how to publish the WebCake Data library to npm using the provided scripts.
- Node.js and npm installed on your system
- npm account - Sign up at npmjs.com
- Git repository (optional but recommended)
npm loginEnter your npm username, password, and email when prompted.
npm whoamiThis should display your npm username.
The package includes several scripts to make publishing easier:
# Publish with patch version bump (1.0.0 -> 1.0.1)
npm run publish:patch
# Publish with minor version bump (1.0.0 -> 1.1.0)
npm run publish:minor
# Publish with major version bump (1.0.0 -> 2.0.0)
npm run publish:major
# Publish beta prerelease (1.0.0 -> 1.0.1-beta.0)
npm run publish:beta
# Publish alpha prerelease (1.0.0 -> 1.0.1-alpha.0)
npm run publish:alpha
# Test publish without actually publishing
npm run publish:dry
# Unpublish current version
npm run unpublish
# Check for outdated packages and security issues
npm run check
# Clean install
npm run install:clean# Make script executable (first time only)
chmod +x publish.sh
# Publish with patch version bump
./publish.sh patch
# Publish with minor version bump
./publish.sh minor
# Publish with major version bump
./publish.sh major
# Publish beta prerelease
./publish.sh beta
# Publish alpha prerelease
./publish.sh alpha
# Test publish (dry run)
./publish.sh dry-run
# Unpublish current version
./publish.sh unpublish
# Show package information
./publish.sh info
# Check npm login and package status
./publish.sh check
# Show help
./publish.sh helpREM Publish with patch version bump
publish.bat patch
REM Publish with minor version bump
publish.bat minor
REM Publish with major version bump
publish.bat major
REM Publish beta prerelease
publish.bat beta
REM Publish alpha prerelease
publish.bat alpha
REM Test publish (dry run)
publish.bat dry-run
REM Unpublish current version
publish.bat unpublish
REM Show package information
publish.bat info
REM Check npm login and package status
publish.bat check
REM Show help
publish.bat help# Check everything is ready
npm run publish:dry
# Publish initial version
npm run publish:patchnpm run publish:patchnpm run publish:minornpm run publish:majornpm run publish:betanpm run publish:alphaThe package follows Semantic Versioning:
- MAJOR (1.0.0 -> 2.0.0): Breaking changes
- MINOR (1.0.0 -> 1.1.0): New features, backward compatible
- PATCH (1.0.0 -> 1.0.1): Bug fixes, backward compatible
- Alpha (1.0.0 -> 1.0.1-alpha.0): Early development
- Beta (1.0.0 -> 1.0.1-beta.0): Feature complete, testing
The scripts automatically run these checks before publishing:
- File Validation: Ensures all required files exist
- Linting: Runs ESLint if available
- Package.json Validation: Validates JSON syntax
- NPM Login: Verifies you're logged in
- Version Check: Ensures version is different from published version
If you prefer to publish manually:
# 1. Bump version
npm version patch # or minor, major
# 2. Publish
npm publish
# 3. Push to git (if using git)
git push origin main --tagsnpm login# Check if package exists
npm view webcake-data
# If it exists, you need to use a different name or unpublish# Check current version
npm view webcake-data version
# Bump version first
npm version patch# Check if you own the package
npm owner ls webcake-data
# Add yourself as owner if needed
npm owner add <your-username> webcake-datanpm login- Use a different package name in
package.json - Or unpublish the existing package (if you own it)
- Bump the version number first
- Use
npm version patch/minor/major
- You don't have permission to publish this package
- Contact the package owner or use a different name
# Check package on npm
npm view webcake-data
# Install and test
npm install webcake-data- Update README.md if needed
- Update CHANGELOG.md
- Tag release in git (if using git)
- Update project documentation
- Notify users of new features/fixes
- Update any dependent projects
# Run dry-run first
npm run publish:dry- Patch: Bug fixes only
- Minor: New features, no breaking changes
- Major: Breaking changes
Update CHANGELOG.md with each release.
Use beta/alpha versions for testing before stable releases.
git tag v1.0.0
git push origin v1.0.0- Don't commit
.npmrcwith tokens - Use environment variables for sensitive data
Enable two-factor authentication on your npm account.
npm audit
npm audit fixIf you encounter issues:
- Check this guide first
- Run
npm run checkto diagnose issues - Check npm status at status.npmjs.com
- Open an issue on GitHub if needed