@nextplus/addons-cli
Version:
NextPlus addons CLI
61 lines (40 loc) • 1.53 kB
Markdown
# @nextplus/addons-cli (npaddons)
A simple CLI to publish NextPlus Addons to the Addons Server.
## Install
```bash
npm i -g @nextplus/addons-cli
```
Verify:
```bash
npaddons --help
```
## Commands
- `npaddons set-server <url>`: Set the server base URL (defaults to `https://addons.nextplus.io`).
- `npaddons set-token <token>`: Set the authentication token used to talk to the server.
- `npaddons publish <folder>`: Publish the folder contents to the server using a presigned upload.
## Usage
1. Set the token (you receive it out-of-band):
```bash
npaddons set-token YOUR_TOKEN_HERE
```
2. Optional: Override the server URL (default is `https://addons.nextplus.io`):
```bash
npaddons set-server https://addons-test.nextplus.io
```
3. Publish a folder (absolute or relative path):
```bash
npaddons publish ./build
```
During publish, the CLI will:
- Validate the folder size is ≤ 50 MB (sum of file sizes).
- Validate `index.html` exists at the root of the provided folder.
- Validate there is no `node_modules` directory at the folder root.
- Request a signed upload from the server and upload all files recursively, showing a progress bar.
## Troubleshooting
- 401 Unauthorized: Ensure you ran `npaddons set-token` with a valid token.
- Invalid URL: Use `http://` or `https://` (e.g., `npaddons set-server https://addons.nextplus.io`).
- Validation errors: Ensure `index.html` exists, the total size ≤ 50MB, and no `node_modules` in the root.
## Uninstall
```bash
npm uninstall -g @nextplus/addons-cli
```