@wizestudio/cli
v0.1.2
Published
The WizeStudio command line: publish widget manifests, scaffold widgets, diagnose a setup.
Readme
@wizestudio/cli
The wize command line: publish widget manifests to the CMS, scaffold a widget, diagnose a setup.
Where this sits
WizeStudio is a visual page builder for headless CMS platforms. A widget is an ordinary React component plus a manifest; the components stay in your application and only the manifests ever reach the editor.
This is the tool that sends them. Build-time registration is the production path: with manifests stored in the CMS, the editor can populate its widget panel even when your frontend is unreachable, and what an author sees is pinned to a deployed version rather than to whatever happens to be running on someone's laptop.
Install
npm install --save-dev @wizestudio/cliNode 20.11 or later.
Usage
npx wize init # create wize.config.json
npx wize push [--dry-run] # publish widget manifests to the CMS
npx wize scaffold acme/pricing # create a widget file
npx wize doctor # diagnose the current setupConfiguration
wize.config.json, found by walking upward from the working directory. JSON rather than a JS module so the CLI can read it without executing project code.
{
"manifests": "./src/wizestudio/widgets.ts",
"cms": "http://localhost:1337",
"tokenEnv": "WIZE_CMS_TOKEN",
"canvasUrl": "http://localhost:3000/wizestudio/canvas"
}manifests points at a module exporting manifests — or a default export that is an array. tokenEnv names an environment variable, never a token: config files get committed, and a credential in one has a long tail. push reads the token from that variable and PUTs the bundle to <cms>/wizestudio/manifests.
doctor checks the things that actually break in practice — config present, manifests loadable and valid, CMS reachable, canvas route responding, token exported — and prints what to do about each.
Using it as a library
Every command is a plain function over an injectable environment, so a build pipeline can publish manifests without shelling out, and the CLI is testable without spawning a process or touching a network.
import { defaultEnvironment, push } from '@wizestudio/cli';
const code = await push(defaultEnvironment(), { dryRun: true });| Export | Purpose |
|---|---|
| push, init, scaffold, doctor | The four commands, as functions returning an exit code |
| defaultEnvironment, CommandEnvironment | The injectable side effects: cwd, logging, fetch, module import |
| buildBundle, BundleResult, BundleIssue, BundleError | Validates and hashes a manifest set |
| loadConfig, resolveToken, WizeConfig, ConfigError | Configuration loading |
Licence
MIT.
WizeStudio is open core. This package sits in the build pipeline that produces a customer's live site, so it is MIT deliberately and contains no licensing code of any kind — as do schema, core, canvas-bridge, renderer-react and renderer-next. That is what makes "a lapsed subscription cannot break your live site" a property of the build rather than a promise. The authoring side — editor, plugin-strapi, components, cms-strapi — is commercial.
