@sukujs/cli 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +49 -2
- package/dist/bin.d.mts +1 -0
- package/dist/bin.mjs +9 -0
- package/dist/bin.mjs.map +1 -0
- package/dist/index.d.mts +173 -0
- package/dist/index.mjs +3 -0
- package/dist/src-HqwuVoct.mjs +1371 -0
- package/dist/src-HqwuVoct.mjs.map +1 -0
- package/package.json +52 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"src-HqwuVoct.mjs","names":[],"sources":["../src/errors.ts","../src/deploy.ts","../src/names.ts","../src/plan.ts","../src/project.ts","../src/run.ts","../src/register.ts","../src/schematics.ts","../src/starter.ts","../src/commands.ts","../src/prompts.ts","../src/index.ts"],"sourcesContent":["/** A mistake in how the CLI was used. Printed without a stack trace, exit code 1. */\nexport class CliError extends Error {\n override readonly name = 'CliError';\n}\n","import { CliError } from './errors.js';\nimport type { Runtime } from './project.js';\n\nexport const DEPLOY_TARGETS = {\n docker: { label: 'Docker', hint: 'Dockerfile and docker-compose.yml' },\n pm2: { label: 'VPS with PM2', hint: 'ecosystem.config.cjs' },\n systemd: { label: 'VPS with systemd', hint: 'a unit file' },\n cloudflare: { label: 'Cloudflare Workers', hint: 'src/worker.ts and wrangler.jsonc' },\n vercel: { label: 'Vercel', hint: 'api/index.ts and vercel.json' },\n} as const;\n\nexport type DeployTarget = keyof typeof DEPLOY_TARGETS;\n\n/** Parses `docker,pm2` or repeated flags into known targets. `none` means an empty list. */\nexport function parseDeployTargets(input: string[]): DeployTarget[] {\n const out = new Set<DeployTarget>();\n for (const name of input.flatMap((value) => value.split(',')).map((value) => value.trim())) {\n if (name === '' || name === 'none') continue;\n if (!(name in DEPLOY_TARGETS)) {\n throw new CliError(\n `Unknown deployment target \"${name}\". Use any of: ${Object.keys(DEPLOY_TARGETS).join(', ')}, or none.`,\n );\n }\n out.add(name as DeployTarget);\n }\n return [...out];\n}\n\nexport interface DeployFiles {\n files: Record<string, string>;\n scripts: Record<string, string>;\n devDependencies: Record<string, string>;\n /** One README section per target. */\n readme: string[];\n}\n\n/** The files, scripts and README notes each chosen deployment target adds to a new project. */\nexport function deployFiles(name: string, runtime: Runtime, targets: DeployTarget[]): DeployFiles {\n const out: DeployFiles = { files: {}, scripts: {}, devDependencies: {}, readme: [] };\n const bun = runtime === 'bun';\n const startCommand = bun ? 'bun dist/main.js' : 'node dist/main.js';\n\n if (targets.includes('docker')) {\n out.files.Dockerfile = `# syntax=docker/dockerfile:1\nFROM oven/bun:1 AS build\nWORKDIR /app\nCOPY package.json bun.lock* ./\nRUN bun install\nCOPY . .\nRUN bun run build\n\nFROM ${bun ? 'oven/bun:1-alpine' : 'node:22-alpine'} AS runner\nWORKDIR /app\nENV NODE_ENV=production\nENV PORT=3000\n# The bundle carries its dependencies, so the image needs only this.\nCOPY --from=build /app/package.json ./\nCOPY --from=build /app/dist ./dist\nUSER ${bun ? 'bun' : 'node'}\nEXPOSE 3000\nCMD [${startCommand\n .split(' ')\n .map((part) => `\"${part}\"`)\n .join(', ')}]\n`;\n out.files['.dockerignore'] = 'node_modules\\ndist\\n.git\\n.env\\n';\n out.files['docker-compose.yml'] = `services:\n api:\n build: .\n ports:\n - '3000:3000'\n environment:\n PORT: 3000\n restart: unless-stopped\n stop_grace_period: 15s\n healthcheck:\n test: ['CMD', 'wget', '-qO-', 'http://127.0.0.1:3000/health']\n interval: 30s\n timeout: 3s\n retries: 3\n`;\n out.readme.push(`### Docker\n\n\\`\\`\\`bash\ndocker compose up -d --build\ncurl http://localhost:3000/health\n\\`\\`\\``);\n }\n\n if (targets.includes('pm2')) {\n out.files['ecosystem.config.cjs'] = `module.exports = {\n apps: [\n {\n name: '${name}',\n script: 'dist/main.js',\n${\n bun\n ? ` interpreter: 'bun',\n instances: 1,\n exec_mode: 'fork',`\n : ` instances: 'max', // one worker per CPU core\n exec_mode: 'cluster',`\n}\n kill_timeout: 15000, // longer than the shutdown deadline in src/main.ts\n max_memory_restart: '512M',\n env: {\n NODE_ENV: 'production',\n PORT: 3000,\n },\n },\n ],\n};\n`;\n out.readme.push(`### VPS with PM2\n\n\\`\\`\\`bash\nbun install && bun run build\npm2 startOrReload ecosystem.config.cjs\npm2 save\n\\`\\`\\``);\n }\n\n if (targets.includes('systemd')) {\n out.files[`deploy/${name}.service`] = `[Unit]\nDescription=${name}\nAfter=network-online.target\nWants=network-online.target\n\n[Service]\nType=simple\nUser=www-data\nWorkingDirectory=/var/www/${name}\nEnvironment=NODE_ENV=production\nEnvironmentFile=/var/www/${name}/.env\nExecStart=${bun ? '/usr/local/bin/bun' : '/usr/bin/node'} dist/main.js\nRestart=on-failure\nRestartSec=5\nKillSignal=SIGTERM\nTimeoutStopSec=30\nNoNewPrivileges=true\nPrivateTmp=true\n\n[Install]\nWantedBy=multi-user.target\n`;\n out.readme.push(`### VPS with systemd\n\nCopy the project to \\`/var/www/${name}\\`, build it, then install the unit:\n\n\\`\\`\\`bash\nsudo cp deploy/${name}.service /etc/systemd/system/\nsudo systemctl daemon-reload\nsudo systemctl enable --now ${name}\n\\`\\`\\``);\n }\n\n if (targets.includes('cloudflare')) {\n out.files['src/worker.ts'] = `import { Suku, type SukuApplication } from '@sukujs/core';\nimport { AppFeature } from './app.feature';\nimport { Env } from './config';\n\n// Bindings arrive with the first request, so the app is created then and kept.\nlet app: Promise<SukuApplication> | undefined;\n\nconst createApp = async (env: Record<string, unknown>) =>\n Suku.create({ features: [await Env.load({ ...env }), AppFeature] });\n\nexport default {\n async fetch(request: Request, env: Record<string, unknown>): Promise<Response> {\n app ??= createApp(env);\n const { handle } = await app;\n const remoteAddress = request.headers.get('cf-connecting-ip') ?? undefined;\n return handle(request, remoteAddress ? { remoteAddress } : undefined);\n },\n};\n`;\n out.files['wrangler.jsonc'] = `{\n \"$schema\": \"node_modules/wrangler/config-schema.json\",\n \"name\": \"${name}\",\n // Bun bundles the Worker first, because it keeps the decorator metadata that\n // constructor injection needs.\n \"main\": \"dist/worker.js\",\n \"compatibility_date\": \"${new Date().toISOString().slice(0, 10)}\",\n \"build\": {\n \"command\": \"bun run build:worker\"\n }\n}\n`;\n out.scripts['build:worker'] =\n 'bun build src/worker.ts --target browser --format esm --outfile dist/worker.js';\n out.scripts['dev:worker'] = 'wrangler dev';\n out.scripts['deploy:cloudflare'] = 'wrangler deploy';\n out.devDependencies.wrangler = '^4.0.0';\n out.readme.push(`### Cloudflare Workers\n\n\\`\\`\\`bash\nbun run dev:worker # run locally in the Workers runtime\nbun run deploy:cloudflare\n\\`\\`\\``);\n }\n\n if (targets.includes('vercel')) {\n out.files['api/index.ts'] = `import { Suku } from '@sukujs/core';\nimport { AppFeature } from '../src/app.feature';\nimport { Env } from '../src/config';\n\nconst app = await Suku.create({ features: [Env.load(), AppFeature] });\n\n// One function for the whole API. vercel.json sends every path here.\nexport default {\n fetch: (request: Request) => app.handle(request),\n};\n`;\n out.files['vercel.json'] = `${JSON.stringify(\n { rewrites: [{ source: '/(.*)', destination: '/api' }] },\n null,\n 2,\n )}\\n`;\n out.scripts['dev:vercel'] = 'vercel dev';\n out.scripts['deploy:vercel'] = 'vercel deploy';\n out.devDependencies.vercel = 'latest';\n out.readme.push(`### Vercel\n\n\\`\\`\\`bash\nbun run dev:vercel\nbun run deploy:vercel\n\\`\\`\\``);\n }\n\n return out;\n}\n","import { CliError } from './errors.js';\n\nexport interface Names {\n /** `user-profiles`: file and folder names, URL prefixes. */\n kebab: string;\n /** `UserProfiles`: classes and exported features. */\n pascal: string;\n /** `userProfiles`: variables. */\n camel: string;\n}\n\nconst cap = (word: string) => word.charAt(0).toUpperCase() + word.slice(1);\n\n/** Turns any spelling (`userProfiles`, `user_profiles`, `User Profiles`) into every casing. */\nexport function names(input: string): Names {\n const words = input\n .replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n .split(/[^a-zA-Z0-9]+/)\n .filter(Boolean)\n .map((word) => word.toLowerCase());\n if (words.length === 0) throw new CliError(`\"${input}\" is not a usable name.`);\n if (/^[0-9]/.test(words[0] as string)) {\n throw new CliError(`\"${input}\" starts with a digit, which is not a valid identifier.`);\n }\n const pascal = words.map(cap).join('');\n return {\n kebab: words.join('-'),\n pascal,\n camel: pascal.charAt(0).toLowerCase() + pascal.slice(1),\n };\n}\n\n/** `users` -> `user`, `categories` -> `category`, `addresses` -> `address`. Good enough for a type name. */\nexport function singular(word: string): string {\n if (/ies$/i.test(word)) return word.replace(/ies$/i, 'y');\n if (/(ss|x|ch|sh)es$/i.test(word)) return word.replace(/es$/i, '');\n if (/s$/i.test(word) && !/ss$/i.test(word)) return word.slice(0, -1);\n return word;\n}\n\n/** Splits `admin/users` into the folder `admin` and the name `users`. */\nexport function splitPath(input: string): { dir: string; name: string } {\n const parts = input.split(/[\\\\/]+/).filter(Boolean);\n const name = parts.pop();\n if (!name) throw new CliError('A name is required.');\n if (parts.some((part) => part === '..')) throw new CliError('The name cannot contain \"..\".');\n return { dir: parts.join('/'), name };\n}\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { dirname, join, relative } from 'node:path';\nimport { CliError } from './errors.js';\n\nexport interface Change {\n action: 'CREATE' | 'UPDATE';\n /** Relative to the plan's root, with forward slashes. */\n path: string;\n content: string;\n}\n\nexport interface CommitOptions {\n dryRun?: boolean;\n force?: boolean;\n log?: (line: string) => void;\n}\n\n/**\n * Collects every file a command wants to write, then writes them together. Nothing touches\n * the disk until `commit`, so a command either does all of its work or none of it.\n */\nexport class Plan {\n readonly changes: Change[] = [];\n readonly notes: string[] = [];\n\n constructor(readonly root: string) {}\n\n private key(path: string): string {\n return relative(this.root, join(this.root, path)).split('\\\\').join('/');\n }\n\n exists(path: string): boolean {\n return this.read(path) !== undefined;\n }\n\n /** The planned content of a file if this plan changes it, otherwise what is on disk. */\n read(path: string): string | undefined {\n const key = this.key(path);\n const planned = this.changes.find((change) => change.path === key);\n if (planned) return planned.content;\n const absolute = join(this.root, key);\n return existsSync(absolute) ? readFileSync(absolute, 'utf8') : undefined;\n }\n\n create(path: string, content: string): void {\n this.changes.push({ action: 'CREATE', path: this.key(path), content });\n }\n\n update(path: string, content: string): void {\n const key = this.key(path);\n const planned = this.changes.find((change) => change.path === key);\n if (planned) planned.content = content;\n else this.changes.push({ action: 'UPDATE', path: key, content });\n }\n\n note(message: string): void {\n this.notes.push(message);\n }\n\n commit(options: CommitOptions = {}): void {\n const log = options.log ?? console.log;\n if (!options.force) {\n const taken = this.changes.filter(\n (change) => change.action === 'CREATE' && existsSync(join(this.root, change.path)),\n );\n if (taken.length > 0) {\n throw new CliError(\n `Refusing to overwrite ${taken.map((change) => change.path).join(', ')}. Pass --force to replace.`,\n );\n }\n }\n for (const change of this.changes) {\n if (!options.dryRun) {\n const absolute = join(this.root, change.path);\n mkdirSync(dirname(absolute), { recursive: true });\n writeFileSync(absolute, change.content);\n }\n log(`${change.action} ${change.path} (${Buffer.byteLength(change.content)} bytes)`);\n }\n for (const note of this.notes) log(`NOTE ${note}`);\n if (options.dryRun) log('Dry run: nothing was written.');\n }\n}\n","import { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join, relative } from 'node:path';\nimport { CliError } from './errors.js';\n\nexport type Runtime = 'node' | 'bun';\n\nexport interface Project {\n root: string;\n /** Folder that holds the source, relative to the root. Default `src`. */\n sourceRoot: string;\n /** File the app starts from, relative to the root. Default `src/main.ts`. */\n entry: string;\n /** What runs the built app in production. Default `node`. */\n runtime: Runtime;\n /** `.js` when the project writes relative imports with an extension, otherwise empty. */\n importExtension: '' | '.js';\n dependencies: Record<string, string>;\n}\n\ninterface PackageJson {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n suku?: { sourceRoot?: string; entry?: string; runtime?: string };\n}\n\n/** Reads the project in `cwd`. Settings come from the `suku` field of its `package.json`. */\nexport function loadProject(cwd: string): Project {\n const file = join(cwd, 'package.json');\n if (!existsSync(file)) {\n throw new CliError(\n 'No package.json here. Run this from the root of a Suku project, or create one with `suku new <name>`.',\n );\n }\n let pkg: PackageJson;\n try {\n pkg = JSON.parse(readFileSync(file, 'utf8')) as PackageJson;\n } catch {\n throw new CliError('package.json is not valid JSON.');\n }\n const settings = pkg.suku ?? {};\n const sourceRoot = settings.sourceRoot ?? 'src';\n const entry = settings.entry ?? `${sourceRoot}/main.ts`;\n const runtime = settings.runtime ?? 'node';\n if (runtime !== 'node' && runtime !== 'bun') {\n throw new CliError(`\"suku.runtime\" in package.json must be \"node\" or \"bun\", not \"${runtime}\".`);\n }\n return {\n root: cwd,\n sourceRoot,\n entry,\n runtime,\n importExtension: detectExtension(join(cwd, entry)),\n dependencies: { ...pkg.dependencies, ...pkg.devDependencies },\n };\n}\n\nfunction detectExtension(entryFile: string): '' | '.js' {\n if (!existsSync(entryFile)) return '';\n return /from\\s+['\"]\\.{1,2}\\/[^'\"]+\\.js['\"]/.test(readFileSync(entryFile, 'utf8')) ? '.js' : '';\n}\n\n/** The specifier to import `to` from `from`, both relative to the project root, without `.ts`. */\nexport function importPath(from: string, to: string, extension: string): string {\n const path = relative(dirname(from), to).split('\\\\').join('/').replace(/\\.ts$/, '');\n return `${path.startsWith('.') ? path : `./${path}`}${extension}`;\n}\n","import { spawn, spawnSync } from 'node:child_process';\nimport { CliError } from './errors.js';\n\n/** Runs a command with the terminal attached and resolves with its exit code. */\nexport function exec(\n command: string,\n args: string[],\n options: { cwd?: string; env?: Record<string, string | undefined> } = {},\n): Promise<number> {\n return new Promise((resolve, reject) => {\n const child = spawn(command, args, {\n cwd: options.cwd,\n env: { ...process.env, ...options.env },\n stdio: 'inherit',\n });\n // The child shares the terminal, so it receives Ctrl+C itself. Wait for it to finish.\n const ignore = () => {};\n process.on('SIGINT', ignore);\n process.on('SIGTERM', () => child.kill('SIGTERM'));\n child.on('error', (error: NodeJS.ErrnoException) => {\n process.off('SIGINT', ignore);\n reject(\n error.code === 'ENOENT'\n ? new CliError(\n command === 'bun'\n ? 'Bun is required for this command and was not found. Install it from https://bun.sh.'\n : `Could not find \\`${command}\\` on your PATH.`,\n )\n : error,\n );\n });\n child.on('exit', (code, signal) => {\n process.off('SIGINT', ignore);\n resolve(code ?? (signal ? 1 : 0));\n });\n });\n}\n\n/** The version a tool reports, or `undefined` when it is not installed. */\nexport function versionOf(command: string): string | undefined {\n const result = spawnSync(command, ['--version'], { encoding: 'utf8' });\n if (result.error || result.status !== 0) return undefined;\n return result.stdout.trim().split('\\n')[0];\n}\n","/** Small, text-based edits that wire a generated file into an existing one. */\n\n/** Adds `import { name } from 'from';` after the last import, unless it is already imported. */\nexport function addImport(source: string, name: string, from: string): string {\n const already = new RegExp(`import\\\\s*\\\\{[^}]*\\\\b${name}\\\\b[^}]*\\\\}\\\\s*from`).test(source);\n if (already) return source;\n const line = `import { ${name} } from '${from}';`;\n const imports = [...source.matchAll(/^import[\\s\\S]*?from\\s*['\"][^'\"]+['\"];?[ \\t]*$/gm)];\n const last = imports.at(-1);\n if (!last || last.index === undefined) return `${line}\\n\\n${source}`;\n const end = last.index + last[0].length;\n return `${source.slice(0, end)}\\n${line}${source.slice(end)}`;\n}\n\n/**\n * Appends `item` to the first `key: [...]` array in `source`. Returns `undefined` when there\n * is no such array, so the caller can tell the user to register by hand.\n */\nexport function addToArray(source: string, key: string, item: string): string | undefined {\n const match = new RegExp(`(\\\\b${key}\\\\s*:\\\\s*\\\\[)([^\\\\]]*)(\\\\])`).exec(source);\n if (!match) return undefined;\n const [whole, open = '', body = '', close = ''] = match;\n if (new RegExp(`\\\\b${item}\\\\b`).test(body)) return source;\n let next: string;\n if (body.trim() === '') {\n next = `${open}${item}${close}`;\n } else if (body.includes('\\n')) {\n const indent = /\\n([ \\t]*)\\S/.exec(body)?.[1] ?? ' ';\n const closing = /\\n([ \\t]*)$/.exec(body)?.[1] ?? '';\n next = `${open}${body.trimEnd().replace(/,$/, '')},\\n${indent}${item},\\n${closing}${close}`;\n } else {\n next = `${open}${body.trim().replace(/,$/, '')}, ${item}${close}`;\n }\n return source.slice(0, match.index) + next + source.slice(match.index + whole.length);\n}\n\n/**\n * Adds `key: [item]` as the first property of the options object passed to `feature(...)`,\n * for a feature that does not have that array yet.\n */\nexport function addArrayToFeature(source: string, key: string, item: string): string | undefined {\n const match = /feature\\(\\s*['\"][^'\"]*['\"]\\s*,\\s*\\{/.exec(source);\n if (!match) return undefined;\n const at = match.index + match[0].length;\n const rest = source.slice(at);\n if (/^\\s*\\}/.test(rest)) return `${source.slice(0, at)} ${key}: [${item}] ${rest.trimStart()}`;\n const indent = /^\\n([ \\t]*)/.exec(rest)?.[1];\n return indent === undefined\n ? `${source.slice(0, at)} ${key}: [${item}],${rest}`\n : `${source.slice(0, at)}\\n${indent}${key}: [${item}],${rest}`;\n}\n","import { CliError } from './errors.js';\nimport { type Names, names, singular, splitPath } from './names.js';\nimport type { Plan } from './plan.js';\nimport { importPath, type Project } from './project.js';\nimport { addArrayToFeature, addImport, addToArray } from './register.js';\n\nexport interface GenerateOptions {\n /** Functions instead of classes: `route.group` and `service()`. */\n classless?: boolean;\n /** Do not create a folder named after the thing. */\n flat?: boolean;\n /** Do not edit other files to register what was generated. */\n skipImport?: boolean;\n /** `resource` only: do not generate a test file. */\n skipTests?: boolean;\n}\n\nexport const SCHEMATICS = {\n feature: { alias: 'f', description: 'A feature: a named group of routes and services' },\n routes: { alias: 'r', description: 'A routes class (or a route group with --classless)' },\n service: { alias: 's', description: 'A service class (or service() with --classless)' },\n middleware: { alias: 'mw', description: 'A middleware' },\n resource: { alias: 'res', description: 'A CRUD feature: routes, service, schemas and a test' },\n} as const;\n\nexport type Schematic = keyof typeof SCHEMATICS;\n\nexport function resolveSchematic(input: string): Schematic {\n for (const [name, { alias }] of Object.entries(SCHEMATICS)) {\n if (input === name || input === alias) return name as Schematic;\n }\n throw new CliError(\n `Unknown schematic \"${input}\". Available: ${Object.entries(SCHEMATICS)\n .map(([name, { alias }]) => `${name} (${alias})`)\n .join(', ')}.`,\n );\n}\n\ninterface Target {\n n: Names;\n /** Folder for the generated files, relative to the project root. */\n dir: string;\n file: (suffix: string) => string;\n}\n\nfunction target(\n project: Project,\n input: string,\n options: GenerateOptions,\n ownFolder = true,\n): Target {\n const { dir, name } = splitPath(input);\n const n = names(name);\n const parts = [project.sourceRoot, dir, ownFolder && !options.flat ? n.kebab : ''].filter(\n Boolean,\n );\n const folder = parts.join('/');\n return { n, dir: folder, file: (suffix) => `${folder}/${n.kebab}.${suffix}.ts` };\n}\n\n/** Edits `file` so it imports `symbol` and lists it under `key`. Leaves a note when it cannot. */\nfunction register(\n plan: Plan,\n project: Project,\n options: GenerateOptions,\n file: string,\n key: string,\n symbol: string,\n from: string,\n): void {\n if (options.skipImport) return;\n const source = plan.read(file);\n if (source === undefined) return;\n const listed = addToArray(source, key, symbol) ?? addArrayToFeature(source, key, symbol);\n if (listed === undefined) {\n plan.note(`Could not find where to add ${symbol} in ${file}. Add it to \\`${key}\\` by hand.`);\n return;\n }\n plan.update(file, addImport(listed, symbol, importPath(file, from, project.importExtension)));\n}\n\n/** Registers a feature with the app: in `app.feature.ts` if there is one, else in the entry file. */\nfunction registerFeature(\n plan: Plan,\n project: Project,\n options: GenerateOptions,\n symbol: string,\n from: string,\n): void {\n if (options.skipImport) return;\n const appFeature = `${project.sourceRoot}/app.feature.ts`;\n if (plan.exists(appFeature)) {\n register(plan, project, options, appFeature, 'imports', symbol, from);\n } else if (plan.exists(project.entry)) {\n register(plan, project, options, project.entry, 'features', symbol, from);\n } else {\n plan.note(`Add ${symbol} to your app's features.`);\n }\n}\n\nfunction featureFile(t: Target): string {\n return `import { feature } from '@sukujs/core';\n\nexport const ${t.n.pascal}Feature = feature('${t.n.kebab}', {\n routes: [],\n services: [],\n});\n`;\n}\n\nfunction routesFile(t: Target, options: GenerateOptions): { symbol: string; content: string } {\n if (options.classless) {\n return {\n symbol: `${t.n.camel}Routes`,\n content: `import { route } from '@sukujs/core';\n\nexport const ${t.n.camel}Routes = route.group('/${t.n.kebab}', {\n list: route.get('/', {\n handle: () => [],\n }),\n});\n`,\n };\n }\n return {\n symbol: `${t.n.pascal}Routes`,\n content: `import { Routes, route } from '@sukujs/core';\n\n@Routes('/${t.n.kebab}')\nexport class ${t.n.pascal}Routes {\n list = route.get('/', {\n handle: () => [],\n });\n}\n`,\n };\n}\n\nfunction serviceFile(t: Target, options: GenerateOptions): { symbol: string; content: string } {\n if (options.classless) {\n return {\n symbol: `${t.n.pascal}Service`,\n content: `import { service } from '@sukujs/core';\n\nexport const ${t.n.pascal}Service = service('${t.n.kebab}', () => ({\n // methods go here\n}));\n`,\n };\n }\n return {\n symbol: `${t.n.pascal}Service`,\n content: `import { Service } from '@sukujs/core';\n\n@Service()\nexport class ${t.n.pascal}Service {}\n`,\n };\n}\n\nfunction middlewareFile(t: Target): string {\n return `import { middleware } from '@sukujs/core';\n\nexport const ${t.n.camel} = middleware(async (ctx, next) => {\n // before the handler\n const response = await next();\n // after the handler\n return response;\n});\n`;\n}\n\nfunction resourceFiles(t: Target, project: Project): Record<string, string> {\n const ext = project.importExtension;\n const one = names(singular(t.n.kebab));\n const { kebab, pascal } = t.n;\n return {\n schemas: `import { z } from 'zod';\n\nexport const Create${one.pascal} = z.object({\n name: z.string().min(1),\n});\nexport type Create${one.pascal} = z.infer<typeof Create${one.pascal}>;\n\nexport const Update${one.pascal} = Create${one.pascal}.partial();\nexport type Update${one.pascal} = z.infer<typeof Update${one.pascal}>;\n\nexport const ${one.pascal}Id = z.object({ id: z.coerce.number().int().positive() });\n\nexport interface ${one.pascal} extends Create${one.pascal} {\n id: number;\n}\n`,\n service: `import { NotFoundException, Service } from '@sukujs/core';\nimport type { Create${one.pascal}, ${one.pascal}, Update${one.pascal} } from './${kebab}.schemas${ext}';\n\n/** Keeps ${kebab} in memory. Replace the map with a repository when you add a database. */\n@Service()\nexport class ${pascal}Service {\n private readonly items = new Map<number, ${one.pascal}>();\n private nextId = 1;\n\n findAll(): ${one.pascal}[] {\n return [...this.items.values()];\n }\n\n findOne(id: number): ${one.pascal} {\n const item = this.items.get(id);\n if (!item) throw new NotFoundException(\\`${one.pascal} \\${id} not found\\`);\n return item;\n }\n\n create(input: Create${one.pascal}): ${one.pascal} {\n const item = { id: this.nextId++, ...input };\n this.items.set(item.id, item);\n return item;\n }\n\n update(id: number, input: Update${one.pascal}): ${one.pascal} {\n const item = { ...this.findOne(id), ...input } as ${one.pascal};\n this.items.set(id, item);\n return item;\n }\n\n remove(id: number): void {\n this.findOne(id);\n this.items.delete(id);\n }\n}\n`,\n routes: `import { Routes, route } from '@sukujs/core';\nimport { Create${one.pascal}, ${one.pascal}Id, Update${one.pascal} } from './${kebab}.schemas${ext}';\nimport { ${pascal}Service } from './${kebab}.service${ext}';\n\n@Routes('/${kebab}')\nexport class ${pascal}Routes {\n constructor(private readonly ${t.n.camel}: ${pascal}Service) {}\n\n list = route.get('/', {\n handle: () => this.${t.n.camel}.findAll(),\n });\n\n findOne = route.get('/:id', {\n params: ${one.pascal}Id,\n handle: ({ params }) => this.${t.n.camel}.findOne(params.id),\n });\n\n create = route.post('/', {\n body: Create${one.pascal},\n handle: ({ body }) => this.${t.n.camel}.create(body),\n });\n\n update = route.patch('/:id', {\n params: ${one.pascal}Id,\n body: Update${one.pascal},\n handle: ({ params, body }) => this.${t.n.camel}.update(params.id, body),\n });\n\n remove = route.delete('/:id', {\n params: ${one.pascal}Id,\n handle: ({ params }) => this.${t.n.camel}.remove(params.id),\n });\n}\n`,\n feature: `import { feature } from '@sukujs/core';\nimport { ${pascal}Routes } from './${kebab}.routes${ext}';\nimport { ${pascal}Service } from './${kebab}.service${ext}';\n\nexport const ${pascal}Feature = feature('${kebab}', {\n routes: [${pascal}Routes],\n services: [${pascal}Service],\n});\n`,\n test: `import { expect, test } from 'bun:test';\nimport { Suku } from '@sukujs/core';\nimport { ${pascal}Feature } from './${kebab}.feature${ext}';\n\nconst json = (method: string, path: string, body?: unknown) =>\n new Request(\\`http://test\\${path}\\`, {\n method,\n headers: { 'content-type': 'application/json' },\n ...(body === undefined ? {} : { body: JSON.stringify(body) }),\n });\n\ntest('${kebab}: create, read, update and delete', async () => {\n const app = await Suku.create({ features: [${pascal}Feature] });\n\n const created = await app.handle(json('POST', '/${kebab}', { name: 'First' }));\n expect(created.status).toBe(201);\n expect(await created.json()).toEqual({ id: 1, name: 'First' });\n\n const updated = await app.handle(json('PATCH', '/${kebab}/1', { name: 'Renamed' }));\n expect(await updated.json()).toEqual({ id: 1, name: 'Renamed' });\n\n expect(await (await app.handle(json('GET', '/${kebab}'))).json()).toHaveLength(1);\n expect((await app.handle(json('POST', '/${kebab}', {}))).status).toBe(400);\n\n expect((await app.handle(json('DELETE', '/${kebab}/1'))).status).toBe(204);\n expect((await app.handle(json('GET', '/${kebab}/1'))).status).toBe(404);\n});\n`,\n };\n}\n\n/** Adds the files for one schematic to `plan`, and the edits that register them. */\nexport function generate(\n plan: Plan,\n project: Project,\n schematic: Schematic,\n input: string,\n options: GenerateOptions = {},\n): void {\n switch (schematic) {\n case 'feature': {\n const t = target(project, input, options);\n plan.create(t.file('feature'), featureFile(t));\n registerFeature(plan, project, options, `${t.n.pascal}Feature`, t.file('feature'));\n return;\n }\n case 'routes': {\n const t = target(project, input, options);\n const { symbol, content } = routesFile(t, options);\n plan.create(t.file('routes'), content);\n register(plan, project, options, t.file('feature'), 'routes', symbol, t.file('routes'));\n return;\n }\n case 'service': {\n const t = target(project, input, options);\n const { symbol, content } = serviceFile(t, options);\n plan.create(t.file('service'), content);\n register(plan, project, options, t.file('feature'), 'services', symbol, t.file('service'));\n return;\n }\n case 'middleware': {\n // A bare name goes to `middlewares/`; `admin/audit` goes next to the admin code.\n const bare = !/[\\\\/]/.test(input);\n const t = target(project, bare ? `middlewares/${input}` : input, options, false);\n plan.create(t.file('middleware'), middlewareFile(t));\n return;\n }\n case 'resource': {\n const t = target(project, input, options);\n const files = resourceFiles(t, project);\n for (const [suffix, content] of Object.entries(files)) {\n if (suffix === 'test' && options.skipTests) continue;\n plan.create(t.file(suffix), content);\n }\n registerFeature(plan, project, options, `${t.n.pascal}Feature`, t.file('feature'));\n if (!project.dependencies.zod) {\n plan.note('The schemas use zod, which is not in package.json. Install it: bun add zod');\n }\n return;\n }\n }\n}\n","import { type DeployTarget, deployFiles } from './deploy.js';\nimport type { Runtime } from './project.js';\n\nexport interface StarterOptions {\n /** The package name, already validated. */\n name: string;\n runtime: Runtime;\n /** The Suku version every `@sukujs/*` dependency is pinned to. */\n version: string;\n /** Used in the README's commands. Default `bun`. */\n packageManager?: string;\n /** Deployment targets to add files for. */\n deploy?: DeployTarget[];\n}\n\n/** The files of a new project, keyed by path. */\nexport function starter(options: StarterOptions): Record<string, string> {\n const { name, runtime, version, packageManager = 'bun', deploy = [] } = options;\n const extra = deployFiles(name, runtime, deploy);\n const pm = packageManager;\n const pmx = pm === 'bun' ? 'bunx' : pm === 'pnpm' ? 'pnpm exec' : pm === 'yarn' ? 'yarn' : 'npx';\n // Vercel compiles the function itself, so the starter lists dependencies explicitly there.\n const explicitInject = deploy.includes('vercel');\n const platform = runtime === 'bun' ? 'platform-bun' : 'platform-node';\n const adapter = runtime === 'bun' ? 'bunAdapter' : 'nodeAdapter';\n const range = `^${version}`;\n\n const pkg = {\n name,\n version: '0.0.1',\n private: true,\n type: 'module',\n scripts: {\n dev: 'suku dev',\n build: 'suku build',\n start: 'suku start',\n test: 'bun test',\n typecheck: 'tsc --noEmit',\n ...extra.scripts,\n },\n suku: { runtime },\n dependencies: {\n '@sukujs/core': range,\n [`@sukujs/${platform}`]: range,\n zod: '^4.0.0',\n },\n devDependencies: {\n '@sukujs/cli': range,\n '@types/bun': 'latest',\n '@types/node': '^22.0.0',\n typescript: '^5.9.0',\n ...extra.devDependencies,\n },\n };\n\n const tsconfig = {\n compilerOptions: {\n target: 'ES2022',\n module: 'ESNext',\n moduleResolution: 'Bundler',\n lib: ['ES2023'],\n types: ['node', 'bun'],\n strict: true,\n experimentalDecorators: true,\n emitDecoratorMetadata: true,\n useDefineForClassFields: false,\n skipLibCheck: true,\n noEmit: true,\n },\n include: deploy.includes('vercel') ? ['src', 'api'] : ['src'],\n };\n\n const files: Record<string, string> = {\n 'package.json': `${JSON.stringify(pkg, null, 2)}\\n`,\n 'tsconfig.json': `${JSON.stringify(tsconfig, null, 2)}\\n`,\n '.gitignore': 'node_modules/\\ndist/\\n.env\\n.DS_Store\\n',\n '.env.example': 'PORT=3000\\n',\n 'README.md': `# ${name}\n\nA [Suku](https://github.com/sukujs/sukujs) API.\n\n\\`\\`\\`bash\n${pm} run dev # start with reload on change\n${pm} run test # run the tests\n${pm} run build # bundle to dist/\n${pm} run start # run the bundle with ${runtime === 'bun' ? 'Bun' : 'Node'}\n\\`\\`\\`\n\nThe \\`dev\\`, \\`build\\` and \\`test\\` commands use [Bun](https://bun.sh).\n\n## Generate code\n\n\\`\\`\\`bash\n${pmx} suku generate resource products # a CRUD feature with a test\n${pmx} suku generate feature billing\n${pmx} suku generate routes billing\n${pmx} suku generate service billing\n${pmx} suku generate middleware audit\n\\`\\`\\`\n${extra.readme.length > 0 ? `\\n## Deploy\\n\\n${extra.readme.join('\\n\\n')}\\n` : ''}`,\n 'src/main.ts': `import { Suku } from '@sukujs/core';\nimport { ${adapter} } from '@sukujs/${platform}';\nimport { AppFeature } from './app.feature';\nimport { Env } from './config';\n\nconst app = await Suku.create({ features: [Env.load(), AppFeature], adapter: ${adapter}() });\n\nconst server = await app.listen(app.get(Env).PORT);\nconsole.log(\\`listening on \\${server.url}\\`);\n\n// Finish requests in flight, then close. Give up after ten seconds.\nlet closing = false;\nfor (const signal of ['SIGINT', 'SIGTERM'] as const) {\n process.on(signal, () => {\n if (closing) return;\n closing = true;\n const deadline = setTimeout(() => void app.close({ force: true }), 10_000);\n void app.close().finally(() => {\n clearTimeout(deadline);\n process.exit(0);\n });\n });\n}\n`,\n 'src/config.ts': `import { defineConfig } from '@sukujs/core';\nimport { z } from 'zod';\n\n/** Validated when the app starts. A missing or malformed variable stops it before it listens. */\nexport const Env = defineConfig(\n 'env',\n z.object({\n PORT: z.coerce.number().int().min(0).default(3000),\n }),\n);\n`,\n 'src/app.feature.ts': `import { feature, route } from '@sukujs/core';\nimport { HelloFeature } from './hello/hello.feature';\n\nexport const health = route.get('/health', {\n handle: () => ({ status: 'ok' }),\n});\n\n/** The root feature. \\`suku generate feature\\` and \\`resource\\` add theirs to \\`imports\\`. */\nexport const AppFeature = feature('app', {\n imports: [HelloFeature],\n routes: [health],\n});\n`,\n 'src/hello/hello.feature.ts': `import { feature } from '@sukujs/core';\nimport { HelloRoutes } from './hello.routes';\nimport { HelloService } from './hello.service';\n\nexport const HelloFeature = feature('hello', {\n routes: [HelloRoutes],\n services: [HelloService],\n});\n`,\n 'src/hello/hello.service.ts': `import { Service } from '@sukujs/core';\n\n@Service()\nexport class HelloService {\n greet(name: string): string {\n return \\`Hello, \\${name}!\\`;\n }\n}\n`,\n 'src/hello/hello.routes.ts': `import { Routes, route } from '@sukujs/core';\nimport { z } from 'zod';\nimport { HelloService } from './hello.service';\n\n@Routes('/hello')\nexport class HelloRoutes {${explicitInject ? '\\n static inject = [HelloService];\\n' : ''}\n constructor(private readonly hello: HelloService) {}\n\n greet = route.get('/:name', {\n params: z.object({ name: z.string().min(1).max(50) }),\n handle: ({ params }) => ({ message: this.hello.greet(params.name) }),\n });\n}\n`,\n 'src/app.test.ts': `import { expect, test } from 'bun:test';\nimport { Suku } from '@sukujs/core';\nimport { AppFeature } from './app.feature';\n\n// No adapter and no port: app.handle runs a request through the whole app in process.\nconst app = await Suku.create({ features: [AppFeature] });\nconst get = (path: string) => app.handle(new Request(\\`http://test\\${path}\\`));\n\ntest('GET /health', async () => {\n const response = await get('/health');\n expect(response.status).toBe(200);\n expect(await response.json()).toEqual({ status: 'ok' });\n});\n\ntest('GET /hello/:name', async () => {\n expect(await (await get('/hello/Ada')).json()).toEqual({ message: 'Hello, Ada!' });\n});\n`,\n };\n return { ...files, ...extra.files };\n}\n","import { existsSync, readdirSync, readFileSync } from 'node:fs';\nimport { basename, join, resolve } from 'node:path';\nimport { DEPLOY_TARGETS, type DeployTarget, parseDeployTargets } from './deploy.js';\nimport { CliError } from './errors.js';\nimport { names } from './names.js';\nimport { Plan } from './plan.js';\nimport { loadProject, type Runtime } from './project.js';\nimport type { Prompter } from './prompts.js';\nimport { exec, versionOf } from './run.js';\nimport { type GenerateOptions, generate, resolveSchematic } from './schematics.js';\nimport { starter } from './starter.js';\n\nexport interface Io {\n cwd: string;\n log: (line: string) => void;\n /** Present when questions can be asked: a terminal is attached. */\n prompter?: Prompter;\n}\n\n/** The version of this CLI, which is the version of every `@sukujs/*` package. */\nexport function cliVersion(): string {\n const file = new URL('../package.json', import.meta.url);\n return (JSON.parse(readFileSync(file, 'utf8')) as { version: string }).version;\n}\n\nfunction asRuntime(value: string | undefined, fallback: Runtime): Runtime {\n if (value === undefined) return fallback;\n if (value !== 'node' && value !== 'bun') {\n throw new CliError(`The runtime must be \"node\" or \"bun\", not \"${value}\".`);\n }\n return value;\n}\n\nexport interface NewOptions {\n runtime?: string;\n packageManager?: string;\n /** Deployment targets, as given on the command line: `['docker,pm2']`. */\n deploy?: string[];\n skipInstall?: boolean;\n skipGit?: boolean;\n /** Accept the default for every question that a flag did not answer. */\n yes?: boolean;\n dryRun?: boolean;\n force?: boolean;\n}\n\nconst MANAGERS = ['bun', 'npm', 'pnpm', 'yarn'];\n\n/**\n * Creates a project. In a terminal it asks for whatever the flags left open; with `--yes`,\n * or when there is no terminal, it uses the defaults: Node, Bun as the package manager, no\n * deployment files, a git repository and an install.\n */\nexport async function newProject(\n io: Io,\n input: string | undefined,\n options: NewOptions,\n): Promise<number> {\n const ask = options.yes ? undefined : io.prompter;\n\n const target = input ?? (ask ? await ask.text('Project name', 'my-api') : undefined);\n if (!target) throw new CliError('Usage: suku new <name>');\n const root = resolve(io.cwd, target);\n const name = names(basename(root)).kebab;\n if (existsSync(root) && readdirSync(root).length > 0 && !options.force) {\n throw new CliError(`${target} already exists and is not empty. Pass --force to write into it.`);\n }\n\n const runtime = asRuntime(\n options.runtime ??\n (ask\n ? await ask.select('Production runtime', [\n { value: 'node', label: 'Node.js', hint: 'bundled with Bun, run with Node' },\n { value: 'bun', label: 'Bun' },\n ])\n : undefined),\n 'node',\n );\n\n const manager =\n options.packageManager ??\n (ask\n ? await ask.select(\n 'Package manager',\n MANAGERS.map((value) => ({\n value,\n label: value,\n ...(value === 'bun' ? { hint: 'default' } : {}),\n })),\n )\n : 'bun');\n if (!MANAGERS.includes(manager)) {\n throw new CliError(`Unknown package manager \"${manager}\". Use one of: ${MANAGERS.join(', ')}.`);\n }\n\n const deploy = options.deploy\n ? parseDeployTargets(options.deploy)\n : ask\n ? await ask.multiselect(\n 'Deployment targets',\n Object.entries(DEPLOY_TARGETS).map(([value, { label, hint }]) => ({\n value: value as DeployTarget,\n label,\n hint,\n })),\n )\n : [];\n\n const git =\n options.skipGit === undefined && ask\n ? await ask.confirm('Initialise a git repository?')\n : !options.skipGit;\n const install =\n options.skipInstall === undefined && ask\n ? await ask.confirm(`Install dependencies with ${manager}?`)\n : !options.skipInstall;\n\n const plan = new Plan(root);\n const files = starter({ name, runtime, version: cliVersion(), packageManager: manager, deploy });\n for (const [path, content] of Object.entries(files)) plan.create(path, content);\n if (ask) io.log('');\n plan.commit({\n log: io.log,\n ...(options.dryRun ? { dryRun: true } : {}),\n force: options.force === true,\n });\n if (options.dryRun) return 0;\n\n if (git && versionOf('git')) {\n await exec('git', ['init', '--quiet'], { cwd: root }).catch(() => 1);\n }\n if (install) {\n io.log(`\\nInstalling dependencies with ${manager}...`);\n const code = await exec(manager, ['install'], { cwd: root });\n if (code !== 0) {\n io.log(`\\nThe install failed. Run \\`${manager} install\\` in ${target} once it is fixed.`);\n return code;\n }\n }\n io.log(`\\nCreated ${name}. Next:\\n\\n cd ${target}`);\n if (!install) io.log(` ${manager} install`);\n io.log(` ${manager} run dev\\n`);\n return 0;\n}\n\nexport interface GenerateCommandOptions extends GenerateOptions {\n dryRun?: boolean;\n force?: boolean;\n}\n\nexport function generateCommand(\n io: Io,\n schematic: string,\n name: string,\n options: GenerateCommandOptions,\n): number {\n const project = loadProject(io.cwd);\n const plan = new Plan(project.root);\n generate(plan, project, resolveSchematic(schematic), name, options);\n plan.commit({\n log: io.log,\n ...(options.dryRun ? { dryRun: true } : {}),\n force: options.force === true,\n });\n return 0;\n}\n\nfunction entryOf(io: Io, override?: string): string {\n const entry = override ?? loadProject(io.cwd).entry;\n if (!existsSync(join(io.cwd, entry))) throw new CliError(`Entry file ${entry} does not exist.`);\n return entry;\n}\n\n/** Runs the app with Bun and restarts it when a source file changes. */\nexport function dev(io: Io, options: { entry?: string }, passthrough: string[]): Promise<number> {\n const entry = entryOf(io, options.entry);\n return exec('bun', ['--watch', entry, ...passthrough], {\n cwd: io.cwd,\n env: { NODE_ENV: process.env.NODE_ENV ?? 'development' },\n });\n}\n\nexport interface BuildOptions {\n entry?: string;\n target?: string;\n outdir?: string;\n minify?: boolean;\n sourcemap?: boolean;\n external?: string[];\n}\n\n/** Bundles the app, with its dependencies, into one file that the runtime can start. */\nexport async function build(io: Io, options: BuildOptions): Promise<number> {\n const project = loadProject(io.cwd);\n const entry = entryOf(io, options.entry);\n const target = asRuntime(options.target, project.runtime);\n const outdir = options.outdir ?? 'dist';\n const args = ['build', entry, '--target', target, '--outdir', outdir];\n if (options.minify) args.push('--minify');\n if (options.sourcemap) args.push('--sourcemap=linked');\n for (const name of options.external ?? []) args.push('--external', name);\n const code = await exec('bun', args, { cwd: io.cwd });\n if (code === 0) io.log(`\\nBuilt for ${target}. Start it with: suku start`);\n return code;\n}\n\n/** Runs the built app with the project's production runtime. */\nexport function start(\n io: Io,\n options: { entry?: string; outdir?: string; runtime?: string },\n passthrough: string[],\n): Promise<number> {\n const project = loadProject(io.cwd);\n const runtime = asRuntime(options.runtime, project.runtime);\n const source = options.entry ?? project.entry;\n const file = join(options.outdir ?? 'dist', basename(source).replace(/\\.[cm]?tsx?$/, '.js'));\n if (!existsSync(join(io.cwd, file))) {\n throw new CliError(`${file} does not exist. Run \\`suku build\\` first.`);\n }\n return exec(runtime, [file, ...passthrough], {\n cwd: io.cwd,\n env: { NODE_ENV: process.env.NODE_ENV ?? 'production' },\n });\n}\n\n/** Prints the versions that matter when reporting a problem. */\nexport function info(io: Io): number {\n io.log(`Suku CLI ${cliVersion()}`);\n io.log(`Node ${process.version.replace(/^v/, '')}`);\n io.log(`Bun ${versionOf('bun') ?? 'not installed'}`);\n io.log(`Platform ${process.platform} ${process.arch}`);\n if (!existsSync(join(io.cwd, 'package.json'))) return 0;\n const project = loadProject(io.cwd);\n const packages = Object.entries(project.dependencies).filter(([name]) =>\n name.startsWith('@sukujs/'),\n );\n io.log(`Runtime ${project.runtime}`);\n io.log(`Entry ${project.entry}`);\n for (const [name, range] of packages.sort()) {\n const installed = join(io.cwd, 'node_modules', name, 'package.json');\n const version = existsSync(installed)\n ? (JSON.parse(readFileSync(installed, 'utf8')) as { version: string }).version\n : 'not installed';\n io.log(`${name.padEnd(24)} ${version} (wanted ${range})`);\n }\n return 0;\n}\n","import { emitKeypressEvents } from 'node:readline';\nimport { CliError } from './errors.js';\n\nexport interface Choice<T> {\n value: T;\n label: string;\n hint?: string;\n}\n\ninterface Key {\n name?: string;\n ctrl?: boolean;\n sequence?: string;\n}\n\ntype Input = NodeJS.ReadableStream & { setRawMode?: (mode: boolean) => unknown; isTTY?: boolean };\ntype Output = { write: (text: string) => unknown };\n\nconst dim = (text: string) => `\\x1b[2m${text}\\x1b[22m`;\nconst cyan = (text: string) => `\\x1b[36m${text}\\x1b[39m`;\nconst bold = (text: string) => `\\x1b[1m${text}\\x1b[22m`;\n\n/**\n * Questions for the terminal: arrow keys to move, space to toggle, enter to confirm. It has\n * no dependencies and reads keys from any stream, which is how the tests drive it.\n */\nexport class Prompter {\n constructor(\n private readonly input: Input = process.stdin,\n private readonly output: Output = process.stdout,\n ) {}\n\n /** Runs one question: draws it, feeds it keys until it returns a value, then tidies up. */\n private ask<T>(\n render: () => string[],\n onKey: (key: Key, text: string) => { done: T } | undefined,\n summary: (value: T) => string,\n ): Promise<T> {\n return new Promise((resolve, reject) => {\n const { input, output } = this;\n let lines = 0;\n const draw = (content: string[]) => {\n if (lines > 0) output.write(`\\x1b[${lines}A\\x1b[0J`);\n output.write(`${content.join('\\n')}\\n`);\n lines = content.length;\n };\n const finish = () => {\n input.off('keypress', listener);\n input.setRawMode?.(false);\n input.pause();\n };\n const listener = (text: string | undefined, key: Key = {}) => {\n if (key.ctrl && key.name === 'c') {\n finish();\n output.write('\\n');\n reject(new CliError('Cancelled.'));\n return;\n }\n const result = onKey(key, text ?? '');\n if (result) {\n finish();\n draw([summary(result.done)]);\n resolve(result.done);\n } else {\n draw(render());\n }\n };\n emitKeypressEvents(input);\n input.setRawMode?.(true);\n input.resume();\n input.on('keypress', listener);\n draw(render());\n });\n }\n\n /** Free text. Enter with nothing typed accepts the default. */\n text(question: string, fallback = ''): Promise<string> {\n let value = '';\n return this.ask<string>(\n () => [`${bold(question)} ${value || dim(fallback)}`],\n (key, text) => {\n if (key.name === 'return' || key.name === 'enter')\n return { done: value.trim() || fallback };\n if (key.name === 'backspace') value = value.slice(0, -1);\n else if (text.length === 1 && text >= ' ') value += text;\n return undefined;\n },\n (answer) => `${bold(question)} ${cyan(answer)}`,\n );\n }\n\n /** Yes or no. */\n confirm(question: string, fallback = true): Promise<boolean> {\n return this.ask<boolean>(\n () => [`${bold(question)} ${dim(fallback ? '(Y/n)' : '(y/N)')}`],\n (key) => {\n if (key.name === 'return' || key.name === 'enter') return { done: fallback };\n if (key.name === 'y') return { done: true };\n if (key.name === 'n') return { done: false };\n return undefined;\n },\n (answer) => `${bold(question)} ${cyan(answer ? 'Yes' : 'No')}`,\n );\n }\n\n /** Pick one. The first choice is the default. */\n select<T>(question: string, choices: Choice<T>[]): Promise<T> {\n let at = 0;\n const move = (by: number) => {\n at = (at + by + choices.length) % choices.length;\n };\n return this.ask<T>(\n () => [\n `${bold(question)} ${dim('(arrows to move, enter to choose)')}`,\n ...choices.map((choice, index) => {\n const hint = choice.hint ? ` ${dim(choice.hint)}` : '';\n return index === at ? `${cyan(`> ${choice.label}`)}${hint}` : ` ${choice.label}${hint}`;\n }),\n ],\n (key) => {\n if (key.name === 'up' || key.name === 'k') move(-1);\n else if (key.name === 'down' || key.name === 'j') move(1);\n else if (key.name === 'return' || key.name === 'enter') {\n return { done: (choices[at] as Choice<T>).value };\n }\n return undefined;\n },\n (answer) =>\n `${bold(question)} ${cyan(choices.find((choice) => choice.value === answer)?.label ?? '')}`,\n );\n }\n\n /** Pick any number, including none. */\n multiselect<T>(question: string, choices: Choice<T>[]): Promise<T[]> {\n let at = 0;\n const picked = new Set<number>();\n return this.ask<T[]>(\n () => [\n `${bold(question)} ${dim('(space to toggle, enter to confirm)')}`,\n ...choices.map((choice, index) => {\n const box = picked.has(index) ? '[x]' : '[ ]';\n const hint = choice.hint ? ` ${dim(choice.hint)}` : '';\n const line = `${box} ${choice.label}`;\n return index === at ? `${cyan(`> ${line}`)}${hint}` : ` ${line}${hint}`;\n }),\n ],\n (key) => {\n if (key.name === 'up' || key.name === 'k') at = (at - 1 + choices.length) % choices.length;\n else if (key.name === 'down' || key.name === 'j') at = (at + 1) % choices.length;\n else if (key.name === 'space') {\n if (picked.has(at)) picked.delete(at);\n else picked.add(at);\n } else if (key.name === 'return' || key.name === 'enter') {\n return {\n done: [...picked]\n .sort((a, b) => a - b)\n .map((index) => (choices[index] as Choice<T>).value),\n };\n }\n return undefined;\n },\n (answer) => {\n const labels = choices\n .filter((choice) => answer.includes(choice.value))\n .map((c) => c.label);\n return `${bold(question)} ${cyan(labels.length > 0 ? labels.join(', ') : 'None')}`;\n },\n );\n }\n}\n","import { parseArgs } from 'node:util';\nimport {\n build,\n cliVersion,\n dev,\n generateCommand,\n type Io,\n info,\n newProject,\n start,\n} from './commands.js';\nimport { CliError } from './errors.js';\nimport { SCHEMATICS } from './schematics.js';\n\nexport { DEPLOY_TARGETS, type DeployTarget } from './deploy.js';\nexport { CliError } from './errors.js';\nexport { type Names, names } from './names.js';\nexport { type Change, Plan } from './plan.js';\nexport { loadProject, type Project, type Runtime } from './project.js';\nexport { type Choice, Prompter } from './prompts.js';\nexport { type GenerateOptions, generate, SCHEMATICS, type Schematic } from './schematics.js';\nexport { starter } from './starter.js';\n\nconst HELP = `Suku CLI\n\nUsage: suku <command> [options]\n\nCommands:\n new [name] Create a project, asking for the options\n generate <schematic> <name> Generate code (alias: g)\n dev Run the app and restart on change\n build Bundle the app into dist/\n start Run the built app\n info Print versions, for bug reports\n\nSchematics:\n${Object.entries(SCHEMATICS)\n .map(([name, { alias, description }]) => ` ${`${name} (${alias})`.padEnd(18)} ${description}`)\n .join('\\n')}\n\nOptions for new (in a terminal, anything you leave out is asked):\n --runtime <node|bun> Production runtime (default: node)\n --package-manager <name> bun, npm, pnpm or yarn (default: bun)\n --deploy <targets> docker, pm2, systemd, cloudflare, vercel or none\n (comma-separated or repeated)\n --skip-install Do not install dependencies\n --skip-git Do not run git init\n -y, --yes Ask nothing, use the defaults\n\nOptions for generate:\n --classless Functions instead of classes\n --flat Do not create a folder for it\n --skip-import Do not register it in other files\n --skip-tests resource: do not generate a test\n\nOptions for dev, build and start:\n --entry <file> Entry file (default: src/main.ts)\n --target <node|bun> build: what the bundle runs on\n --outdir <dir> build, start: output folder (default: dist)\n --minify, --sourcemap build\n --external <package> build: leave a package out of the bundle (repeatable)\n\nEverywhere:\n -d, --dry-run Show what would be written, write nothing\n --force Overwrite existing files\n -h, --help, -v, --version\n\nArguments after -- are passed to your app: suku dev -- --port 4000\n`;\n\nconst OPTIONS = {\n runtime: { type: 'string' },\n 'package-manager': { type: 'string' },\n 'skip-install': { type: 'boolean' },\n 'skip-git': { type: 'boolean' },\n deploy: { type: 'string', multiple: true },\n yes: { type: 'boolean', short: 'y' },\n classless: { type: 'boolean' },\n flat: { type: 'boolean' },\n 'skip-import': { type: 'boolean' },\n 'skip-tests': { type: 'boolean' },\n entry: { type: 'string' },\n target: { type: 'string' },\n outdir: { type: 'string' },\n minify: { type: 'boolean' },\n sourcemap: { type: 'boolean' },\n external: { type: 'string', multiple: true },\n 'dry-run': { type: 'boolean', short: 'd' },\n force: { type: 'boolean' },\n help: { type: 'boolean', short: 'h' },\n version: { type: 'boolean', short: 'v' },\n} as const;\n\n/** Drops keys whose value is `undefined`, so optional properties stay absent. */\nfunction defined<T extends Record<string, unknown>>(\n object: T,\n): { [K in keyof T]?: NonNullable<T[K]> } {\n return Object.fromEntries(Object.entries(object).filter(([, value]) => value !== undefined)) as {\n [K in keyof T]?: NonNullable<T[K]>;\n };\n}\n\n/**\n * Runs the CLI with `argv` (without `node` and the script path) and resolves with the exit\n * code. Usage mistakes are printed and return `1`; they do not throw. Questions are asked\n * only when `io.prompter` is given.\n */\nexport async function run(argv: string[], io: Partial<Io> = {}): Promise<number> {\n // No prompter means no questions. The executable passes one when it has a terminal; this\n // function never looks at the terminal itself, so embedding it and testing it cannot hang.\n const out: Io = {\n cwd: io.cwd ?? process.cwd(),\n log: io.log ?? console.log,\n ...(io.prompter ? { prompter: io.prompter } : {}),\n };\n const split = argv.indexOf('--');\n const own = split === -1 ? argv : argv.slice(0, split);\n const passthrough = split === -1 ? [] : argv.slice(split + 1);\n\n try {\n let parsed: ReturnType<typeof parseArgs<{ options: typeof OPTIONS; allowPositionals: true }>>;\n try {\n parsed = parseArgs({ args: own, options: OPTIONS, allowPositionals: true });\n } catch (error) {\n throw new CliError(`${(error as Error).message.split('. ')[0]}. Run \\`suku --help\\`.`);\n }\n const { values, positionals } = parsed;\n const [command, first, second] = positionals;\n\n if (values.version) {\n out.log(cliVersion());\n return 0;\n }\n if (values.help || command === undefined || command === 'help') {\n out.log(HELP);\n return 0;\n }\n\n const write = defined({ dryRun: values['dry-run'], force: values.force });\n switch (command) {\n case 'new':\n case 'n': {\n return await newProject(out, first, {\n ...write,\n ...defined({\n runtime: values.runtime,\n packageManager: values['package-manager'],\n deploy: values.deploy,\n yes: values.yes,\n skipInstall: values['skip-install'],\n skipGit: values['skip-git'],\n }),\n });\n }\n case 'generate':\n case 'g': {\n if (!first || !second) throw new CliError('Usage: suku generate <schematic> <name>');\n return generateCommand(out, first, second, {\n ...write,\n ...defined({\n classless: values.classless,\n flat: values.flat,\n skipImport: values['skip-import'],\n skipTests: values['skip-tests'],\n }),\n });\n }\n case 'dev':\n return await dev(out, defined({ entry: values.entry }), passthrough);\n case 'build':\n return await build(\n out,\n defined({\n entry: values.entry,\n target: values.target,\n outdir: values.outdir,\n minify: values.minify,\n sourcemap: values.sourcemap,\n external: values.external,\n }),\n );\n case 'start':\n return await start(\n out,\n defined({ entry: values.entry, outdir: values.outdir, runtime: values.runtime }),\n passthrough,\n );\n case 'info':\n case 'i':\n return info(out);\n default:\n throw new CliError(`Unknown command \"${command}\". Run \\`suku --help\\`.`);\n }\n } catch (error) {\n if (error instanceof CliError) {\n out.log(`Error: ${error.message}`);\n return 1;\n }\n throw error;\n }\n}\n"],"mappings":";;;;;;;;AACA,IAAa,WAAb,cAA8B,MAAM;;;cACT;;AAC3B;;;ACAA,MAAa,iBAAiB;CAC5B,QAAQ;EAAE,OAAO;EAAU,MAAM;CAAoC;CACrE,KAAK;EAAE,OAAO;EAAgB,MAAM;CAAuB;CAC3D,SAAS;EAAE,OAAO;EAAoB,MAAM;CAAc;CAC1D,YAAY;EAAE,OAAO;EAAsB,MAAM;CAAmC;CACpF,QAAQ;EAAE,OAAO;EAAU,MAAM;CAA+B;AAClE;;AAKA,SAAgB,mBAAmB,OAAiC;CAClE,MAAM,sBAAM,IAAI,IAAkB;CAClC,KAAK,MAAM,QAAQ,MAAM,SAAS,UAAU,MAAM,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,UAAU,MAAM,KAAK,CAAC,GAAG;EAC1F,IAAI,SAAS,MAAM,SAAS,QAAQ;EACpC,IAAI,EAAE,QAAQ,iBACZ,MAAM,IAAI,SACR,8BAA8B,KAAK,iBAAiB,OAAO,KAAK,cAAc,CAAC,CAAC,KAAK,IAAI,EAAE,WAC7F;EAEF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AC,GAC/E,WACF;GACF,KAAK;GACL,KAAK,KACH,OAAO,KAAK,GAAG;GACjB,SACE,MAAM,IAAI,SAAS,oBAAoB,QAAQ,wBAAwB;EAC3E;CACF,SAAS,OAAO;EACd,IAAI,iBAAiB,UAAU;GAC7B,IAAI,IAAI,UAAU,MAAM,SAAS;GACjC,OAAO;EACT;EACA,MAAM;CACR;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sukujs/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "The Suku command line: create a project, generate features, routes and services, and run, build and start your app.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"suku",
|
|
7
|
+
"cli",
|
|
8
|
+
"scaffold",
|
|
9
|
+
"generator",
|
|
10
|
+
"backend",
|
|
11
|
+
"framework"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": "Suku Authors",
|
|
15
|
+
"homepage": "https://github.com/sukujs/sukujs#readme",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/sukujs/sukujs.git",
|
|
19
|
+
"directory": "packages/cli"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/sukujs/sukujs/issues"
|
|
23
|
+
},
|
|
24
|
+
"type": "module",
|
|
25
|
+
"bin": {
|
|
26
|
+
"suku": "./dist/bin.mjs"
|
|
27
|
+
},
|
|
28
|
+
"module": "./dist/index.mjs",
|
|
29
|
+
"types": "./dist/index.d.mts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.mts",
|
|
33
|
+
"default": "./dist/index.mjs"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist",
|
|
38
|
+
"README.md",
|
|
39
|
+
"LICENSE"
|
|
40
|
+
],
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsdown",
|
|
43
|
+
"typecheck": "tsc -p tsconfig.json"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=22"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"zod": "^4.6.7"
|
|
53
|
+
}
|
|
54
|
+
}
|