@smoothcdn/cli
v1.6.4
Published
Smooth CDN CLI is a command-line tool for managing projects and assets on Smooth CDN.
Maintainers
Readme
Smooth CDN – CLI Tool
Smooth CDN CLI is a command-line tool for managing projects and assets on Smooth CDN.
It helps you initialize projects, upload assets, optionally manage versions, and control access to protected resources.
The CLI uses a local configuration file (.scdn.json) to define project settings, asset sources, and ignore patterns.
For CI/CD, you can provide the SCDN_TOKEN environment variable to authenticate the CLI in non-interactive environments.
Requirements
- Smooth CDN account – create an account
- Node.js ≥ 18.17.0 (recommended: Node.js 20 LTS)
Installation
npm install -g @smoothcdn/cliCommands
scdn loginLogs in to your Smooth CDN account.
scdn logoutLogs out from your Smooth CDN account.
scdn initInitializes a new project and creates a local configuration file.
scdn loadLoads an existing project into the local config file.
scdn create-version [version]Creates a new version and sets it as the active deployment target.
If no version is provided, the version from the config file will be used.
scdn publish-version [version]Publishes the selected version.
If no version is provided, the version from the config file will be published.
Optionally add --blank to create blank version (without any assets from previous version).
scdn pushUploads assets to Smooth CDN.
Use the --sync flag to remove assets from CDN that no longer exist in the project.
Use --concurrency <number> to set parallel upload workers (default: 4).
Use --optimize=local to optimize assets in the CLI before upload (default).
Local audio and video optimization require ffmpeg, and local PDF optimization requires Ghostscript (gs).
Use --optimize=remote to queue assets optimization on Smooth CDN level.
If you want to create multiple image variants, add the imageVariants field to .scdn.json. The CLI will automatically generate and upload resized variants for images, linked to the original asset.
Example .scdn.json:
{
"imageVariants": {
"mobile": 360,
"tablet": 720,
"desktop": 1600
}
}For original.png, this creates variants such as original_mobile.png, original_tablet.png and original_desktop.png, but only when the source image is wider than the configured variant.
scdn get-snippetOutputs an embed snippet for the selected asset.
For images with configured imageVariants, the command can generate either a single-image snippet or a responsive <img> snippet with srcset.
scdn check-assetsValidates asset paths and lists assets before deployment.
scdn grant-accessGrants an access token for protected assets.
scdn revoke-accessRevokes a previously granted access token.
scdn statusDisplays account status, including current user, plan, and limits.
Quick example
scdn login
scdn init