@benshi.ai/js-sdk
Version:
Benshi SDK
43 lines (29 loc) • 1.64 kB
Markdown
# Publishing
The library must be available in two different locations:
* `npm registry`
* `CDN`
Applications will always get their instance from the `npm registry`. Then, the dynamic loading mechanism will download a `patch-compatible` version, according to [Semantic versioning rules](https://semver.org/) from the CDN.
### Publishing to npm
To make the library available in an `npm` repository, follow next steps:
1) update the version in `package.json`
2) run `npm run build`, to create the target files. It will appear in the `lib` folder
3) run `npm publish` to publish the package to the npm repository
> :warning: make sure you run `npm run build` **after** updating the `package.json version`. Otherwise, the logs sent by the library will contain an erroneous version number
Some useful command regarding `npm` usage:
* Check current user: `npm whoami`
* If not logged: `npm login`
* Check current configured `npm registry`: `npm config get registry`
### Publishing to CDN
To publish the target files to the CDN, just add them to the repository https://github.com/benshi-ai/cdn. There, there will be a Github Action that copy the whole repository into an Azure Static Page, available in: https://cdn.benshi.ai
It is also required to update the `manifest.json` file, which has this format:
```js
{
"lastUpdate":1124134,
"files":[
"sdk-1.0.0-beta.7.9.4.js",
"sdk-1.0.0-beta.7.9.11.js"
]
}
```
Currently, this step is performed automatically by a Github Action in the `js-sdk` repository: https://github.com/benshi-ai/js-sdk/blob/develop/.github/workflows/cdn-publisher.yml
[Back](./Readme.md)