This document explains how to publish the @sf-explorer/agentscript-migration-tool package to npm.
- npm account: Create an account at https://www.npmjs.com/
- Login: Run
npm loginin your terminal - Organization: If publishing under
@sf-explorerscope, ensure you have access to that organization
- Update version in
package.json(follow semantic versioning) - Run
npm run buildto ensure TypeScript compiles successfully - Run
npm testto ensure all tests pass - Review
README.mdfor accuracy - Verify
.npmignoreexcludes source files (onlydist/should be published) - Check that
package.jsonhas correctmain,types, andfilesfields
# Install dependencies
npm install
# Build the package
npm run build
# Run tests
npm test
# Check coverage
npm run test:coverageUpdate the version in package.json following semantic versioning:
- Patch (1.0.0 → 1.0.1): Bug fixes
- Minor (1.0.0 → 1.1.0): New features, backward compatible
- Major (1.0.0 → 2.0.0): Breaking changes
npm run buildTest the package locally before publishing:
# In this package directory
npm pack
# In another project
npm install /path/to/agentscript-migration-tool-1.0.0.tgz# Dry run (see what would be published)
npm publish --dry-run
# Publish to npm
npm publish --access publicNote: The --access public flag is required when publishing scoped packages (@sf-explorer/...) for the first time.
- Visit https://www.npmjs.com/package/@sf-explorer/agentscript-migration-tool
- Verify the package appears correctly
- Test installation:
npm install @sf-explorer/agentscript-migration-tool
- Create a GitHub release (if using GitHub)
- Update documentation if needed
- Announce the release (blog post, community forums, etc.)
For subsequent releases:
- Make your changes
- Update version in
package.json - Update
CHANGELOG.md(if you create one) - Run
npm run build - Run
npm test - Run
npm publish
- Ensure you're logged in:
npm whoami - Check organization access if using scoped package
- Verify package name doesn't conflict with existing packages
- Choose a different name or scope
- Or contact the maintainer of the existing package
- Ensure TypeScript compiles:
npm run build - Check
tsconfig.jsonsettings - Verify all dependencies are installed
The published package includes:
dist/
├── index.js # Compiled JavaScript
├── index.d.ts # TypeScript definitions
├── generator.js
├── generator.d.ts
├── types.js
└── types.d.ts
README.md
LICENSE
package.json
Source files (src/) are excluded via .npmignore.
Consider using npm version for version management:
# Patch version (1.0.0 → 1.0.1)
npm version patch
# Minor version (1.0.0 → 1.1.0)
npm version minor
# Major version (1.0.0 → 2.0.0)
npm version majorThis automatically:
- Updates
package.jsonversion - Creates a git commit
- Creates a git tag (if in a git repo)
Then publish with: npm publish