Skip to content

Latest commit

 

History

History
138 lines (93 loc) · 2.38 KB

File metadata and controls

138 lines (93 loc) · 2.38 KB

Publishing Guide

Pre-Publishing Checklist

  1. Update version in package.json

  2. Test the build:

    npm run build
  3. Test locally with preview:

    npm run preview

Publishing to npm

First-time Setup

  1. Create an npm account at https://www.npmjs.com/signup

  2. Login to npm:

    npm login
  3. Verify your login:

    npm whoami

Publishing

  1. Make sure package name is available (or update in package.json):

    npm search thesysai/chat-client
  2. Publish to npm:

    npm publish --access public

    Note: The --access public flag is required for scoped packages (@thesysai/chat-client)

  3. Verify the package:

Using via CDN

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>

Version Management

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.0

Then publish:

npm publish --access public

Unpublishing (Emergency Only)

You 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"

Testing Before Publishing

  1. Build the package:

    npm run build
  2. Pack it locally (creates a tarball):

    npm pack
  3. Test installation in another project:

    npm install /path/to/thesysai-chat-client-0.1.0.tgz
  4. Verify it works in the test project

  5. Clean up:

    rm thesysai-chat-client-0.1.0.tgz

Continuous Integration

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