Lines 4-44javascript
6 * Scaffolds new Uniweb sites and foundations, builds projects, and generates docs.
12 * uniweb create [project-name]
13 * uniweb create --template marketing
14 * uniweb add foundation [name]
18 * Global install delegation:
19 * When installed globally, project-bound commands (build, docs, etc.) are
20 * delegated to the project-local CLI if one exists in node_modules. This
21 * ensures version alignment between the CLI and @uniweb/build.
24import { existsSync, readFileSync } from 'node:fs'
25import { execSync, spawn as spawnChild } from 'node:child_process'
26import { resolve, join, relative, dirname, basename } from 'node:path'
27import { fileURLToPath } from 'node:url'
28import prompts from 'prompts'
29// `doctor`, `add`, `publish`, and `deploy` are loaded lazily via
30// importProjectCommand() — each imports `@uniweb/build` at the top,
31// so a static import here would crash `npx uniweb@latest create …`
32// (no @uniweb/build in the npx scratch dir) before any command runs.
33// Same pattern as `build` and `docs`.
34import { i18n } from './commands/i18n.js'
35import { inspect } from './commands/inspect.js'
36import { invite } from './commands/invite.js'
37import { handoff } from './commands/handoff.js'
38import { update } from './commands/update.js'
39import { clone } from './commands/clone.js'
40import { template } from './commands/template.js'