@jcoder-stack/cli
v0.6.0
Published
The jc-abp CLI: gen (react-query client generation via an orval preset), add (copy registry shells in), and init (one-stop project setup)
Readme
@jcoder-stack/cli
The jc-abp CLI: gen (orval-preset react-query client generation) + add (copy a registry shell in) + init (one-stop setup).
One of the core packages of abp-react-start — a pure-React frontend framework for ABP backends. See the repository root README for the big picture.
Install
bun add -D @jcoder-stack/cli @jcoder-stack/registryadd and init take their shell sources from @jcoder-stack/registry, so the two are installed together.
Commands
jc-abp init [--no-admin] [--backend <url>] [--with <feature,...>]
One-stop setup: install the auth shell, install the shadcn admin blocks in dependency order, seed abp.api.config.ts and .env, and generate the route tree. --no-admin skips admin-pages and swaps in a minimal menu. --with installs optional features last, once everything else is in place.
In an interactive terminal, init asks one question — your ABP backend URL (Enter skips it). Answering fills AUTH_ISSUER, AUTH_ABP_BASE_URL, and the swagger input in one go, and a short reachability probe at the end tells you if the backend is down or its certificate is untrusted (informational only — init never fails because of it). --backend answers the question for scripts and CI.
Three preflight checks run before anything is written (has init run here before; can npm install the blocks; is src/features/index.ts free for the feature aggregator) — if any fails, init aborts without touching a file. A mid-run failure lists the steps already completed; init does not roll back.
jc-abp gen [--input <url|file>] [--output <dir>] [--config <file>]
Reads abp.api.config.{ts,js,json} (flags override) and generates endpoints/models/schemas plus the mutator via orval.
// abp.api.config.ts
import { defineApiConfig } from "@jcoder-stack/cli";
export default defineApiConfig({
input: "https://localhost:44316/swagger/v1/swagger.json",
output: "src/api",
zod: true,
});For multiple backends use the { targets: { identity: {...}, business: {...} } } shape; flags cannot land on one target there, so passing --input/--output is an error — edit the config file, or point --config at a single-target one.
The CLI requires Node ≥ 22.18: orval v8, which gen is built on, needs it, and every command loads it. The same version runs the .ts config directly via strip-types; under a runtime that cannot execute TypeScript, switch to abp.api.config.json (gen tells you the same when it happens).
jc-abp add <name> [--from <registryDir>] [--dest <dir>]
Copies a registry shell (e.g. auth) into the project, landing in src/<name> by default, and refuses to overwrite any existing file. Entries with a manifest are distributed to their declared target directories with relative imports rewritten. When <name> is an optional feature (see docs/guides/optional-features.en.md), it is installed into an initialized project instead. Rerunning skips the aggregator, root wiring and env keys that are already there, but reinstalls the feature's own files and the shadcn components it declares, so commit your edits first.
jc-abp help
Prints usage.
