Package Publishing Guide
This guide explains how to build and publish Robota SDK packages to npm.
Overview
Robota SDK uses a monorepo structure with multiple packages:
@robota-sdk/core
: Core functionality@robota-sdk/openai
: OpenAI provider@robota-sdk/anthropic
: Anthropic provider@robota-sdk/mcp
: Model Context Protocol provider@robota-sdk/tools
: Utility tools
All packages are published under the @robota-sdk
scope on npm.
Prerequisites
- Node.js 18 or newer
- PNPM 8.0.0 or newer
- npm account with access to the
@robota-sdk
organization
Publishing Process
The publishing process consists of these main steps:
- Building packages
- Copying README files from the docs directory
- Publishing packages with changesets
- Pushing git tags
- Cleaning up temporary README files
Build Packages
Before publishing, ensure all packages are built:
pnpm build
Creating a Changeset
Create a changeset to describe your changes and specify version bumps:
pnpm changeset
Follow the interactive prompts to:
- Select packages to include
- Choose version bump types (patch, minor, or major)
- Write a summary of changes
Version Packages
Update package versions based on changesets:
pnpm changeset version
This command will:
- Update package.json versions
- Update dependencies between packages
- Update CHANGELOG.md files
- Remove consumed changeset files
Publish Packages
We've simplified the publishing process with a single command:
pnpm publish-packages
This command performs the following steps:
- Copies README files from the docs directory to each package directory
- Publishes the packages to npm using changesets
- Pushes git tags to the remote repository
- Cleans up temporary README files
README Management
The README files are managed centrally in the apps/docs/docs/packages
directory. During publishing:
- README files are copied to package directories
- Packages are published with the README files
- Temporary README files are removed from package directories
This approach ensures consistency between documentation and npm package README files.
Script Implementation
The publishing process is implemented with two main scripts:
copy-readme.js
Copies README files from the docs directory to package directories.
cleanup-readme.js
Removes temporary README files from package directories after publishing.
Troubleshooting
Authentication Issues
If you encounter authentication issues with npm:
npm login --scope=@robota-sdk
Publish Failed
If publishing fails:
- Check if you have the right permissions on npm
- Verify that all changesets have been properly applied
- Ensure git working directory is clean
Conclusion
Following this standardized process ensures consistent package publishing and versioning across the Robota SDK ecosystem.