-
Update version in
package.json -
Test the build:
npm run build
-
Test locally with preview:
npm run preview
-
Create an npm account at https://www.npmjs.com/signup
-
Login to npm:
npm login
-
Verify your login:
npm whoami
-
Make sure package name is available (or update in package.json):
npm search thesysai/chat-client
-
Publish to npm:
npm publish --access public
Note: The
--access publicflag is required for scoped packages (@thesysai/chat-client) -
Verify the package:
- Visit: https://www.npmjs.com/package/thesysai/chat-client
- Check files are correct
After publishing, the package will be automatically available on jsDelivr:
<script type="module">
import { createChat } from "https://cdn.jsdelivr.net/npm/thesysai/chat-client/dist/chat.bundle.es.js";
createChat({
webhookUrl: "YOUR_WEBHOOK_URL",
});
</script>Follow semantic versioning:
- Major (1.0.0): Breaking changes
- Minor (0.1.0): New features, backwards compatible
- Patch (0.0.1): Bug fixes
Update version:
npm version patch # 0.1.0 -> 0.1.1
npm version minor # 0.1.1 -> 0.2.0
npm version major # 0.2.0 -> 1.0.0Then publish:
npm publish --access publicYou can unpublish within 72 hours of publishing:
npm unpublish thesysai/chat-client@<version>Note: Unpublishing is discouraged. Use npm deprecate instead:
npm deprecate thesysai/chat-client@<version> "reason for deprecation"-
Build the package:
npm run build
-
Pack it locally (creates a tarball):
npm pack
-
Test installation in another project:
npm install /path/to/thesysai-chat-client-0.1.0.tgz
-
Verify it works in the test project
-
Clean up:
rm thesysai-chat-client-0.1.0.tgz
Consider setting up GitHub Actions to automatically:
- Run tests on PR
- Build on merge to main
- Publish on release/tag
Example workflow location: .github/workflows/publish.yml