# Publish Process

## Publish

### Development and Testing

-   Update version

```sh
npm version 1.x.x-alpha.x
```

-   Publish

```sh
npm publish --otp=<otpCode> --tag alpha.x
```

### Production

-   Update version

```sh
npm version 1.x.x
```

-   Publish

```sh
npm publish --otp=<otpCode>
```

## Unpublish

If published package less than 72 hours and you want to revert/unpublish the chatbot package, try this command.

```sh
npm unpublish custom-chatbot-widget@1.x.x
```

## Some Important Notes

### Versi Stabil vs. Prerelease

Stable versions (a.b.c) cannot be republished after being unpublished because NPM retains the metadata of stable versions permanently.

For prerelease versions (a.b.c-alpha.x), the metadata is not stored permanently after unpublishing, so you can republish the same version.

You must first unpublish the version a.b.c-alpha.x.
As long as the version no longer exists in the registry, you can republish it with the same version number.

### Check published version

To check all versions that may not be displayed in the NPM registry

```sh
npm info custom-chatbot-widget --json
```

To check all versions that are already displayed in the NPM registry

```sh
npm view custom-chatbot-widget versions
```
