open-index/open-npm huggingface dataset:
npm package: @safaricom-mxl/web-cli
Description: MXL Web CLI for uploading sourcemaps and versioning bundles
Author: MXL
Latest version: 0.0.11

# MXL Web SDK CLI

This tool is intended to help with build-time tasks for the [MXL Web SDK](../web-sdk/README.md).

## Quick Start

npm:

```sh
npm install --save-dev @safaricom-mxl/web-cli
```

yarn:

```sh
yarn add -D @safaricom-mxl/web-cli
```

## Upload sourcemaps

To upload sourcemaps to MXL as part of your build process you will require the following:
* Your MXL App ID
* Your MXL `Symbol Upload` API token (found in your MXL dashboard in
[Settings->API](https://mxl.apps.ocpthikadev01.safaricom.net/settings/organization/api))
* The path to where the built JS files live

```sh
npx mxl-web-cli upload -a "YOUR_MXL_APP_ID" -t "YOUR_MXL_UPLOAD_API_TOKEN" -p "BUILD_PATH"
```

> [!WARNING]
> The CLI must be run BEFORE the files are packaged (e.g., before creating a Docker image or deployment archive).
> The CLI injects a comment and a short function to the end of bundle files to enable symbolication, so it needs to
> happen before packaging.

## Setting app version

The same `upload` sub-command as above can be used to inject your app's version into your bundle if the value is only
known at build time. If the version is known prior to build time you can provide it when initializing the SDK as
described in [Keeping your app version up-to-date](../web-sdk/README.md#keeping-your-app-version-up-to-date).
Execute the same command as above while also providing your app's version:

```sh
npx mxl-web-cli upload -a "YOUR_MXL_APP_ID" -t "YOUR_MXL_UPLOAD_API_TOKEN" -p "BUILD_PATH" --app-version "APP_VERSION"
```