This guide explains how to publish new versions of JsonFileCRUD to npm.
-
npm account: Make sure you have an npm account and are logged in
npm login
-
npm token: For GitHub Actions, add your npm token to repository secrets as
NPM_TOKEN -
Repository access: Make sure you have push access to the GitHub repository
-
Update version and changelog:
npm version patch # for bug fixes npm version minor # for new features npm version major # for breaking changes
-
Verify everything works:
npm test npm run examples -
Check what will be published:
npm pack --dry-run
-
Publish to npm:
npm publish
-
Create a new release on GitHub:
- Go to the repository on GitHub
- Click "Releases" → "Create a new release"
- Tag version:
v1.0.0(match package.json version) - Release title:
Version 1.0.0 - Description: Copy from CHANGELOG.md
-
GitHub Actions will automatically:
- Run all tests
- Run examples
- Publish to npm (if tests pass)
# This will:
# 1. Run tests
# 2. Run examples
# 3. Update version in package.json
# 4. Create git tag
# 5. Push to GitHub
npm version patchThen create a GitHub release for the new tag to trigger npm publishing.
- Patch (1.0.X): Bug fixes, documentation updates
- Minor (1.X.0): New features, non-breaking changes
- Major (X.0.0): Breaking changes
- All tests pass (
npm test) - Examples work (
npm run examples) - CHANGELOG.md updated
- README.md updated if needed
- Version number updated in package.json
- Git changes committed and pushed
-
Verify the package:
npm view json-file-crud
-
Test installation:
mkdir test-install cd test-install npm init -y npm install json-file-crud -
Update documentation if needed
- 403 Forbidden: Make sure you're logged in and have permission to publish
- Version already exists: Update the version number
- Tests fail: Fix issues before publishing
- Missing files: Check .npmignore and package.json files array