chore: migrate to pnpm with a monorepo
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env node
|
||||
import { cac } from "cac";
|
||||
import { pack } from "./index.js";
|
||||
|
||||
const cli = cac("shimejic-pack");
|
||||
|
||||
cli.command("<input>", "Path to character asset folder")
|
||||
.option("-o, --output <path>", "Output directory (default: ./dist)")
|
||||
.option("-c, --config <path>", "Overrides JSON (default: <input>/character.config.json)")
|
||||
.option("--dry-run", "Report without writing files")
|
||||
.option("--verbose", "Verbose output")
|
||||
.action(async (input: string, options: Record<string, unknown>) => {
|
||||
try {
|
||||
const result = await pack({
|
||||
input,
|
||||
output: (options.output as string | undefined) ?? "./dist",
|
||||
...(options.config !== undefined && { config: options.config as string }),
|
||||
...(options.dryRun !== undefined && { dryRun: Boolean(options.dryRun) }),
|
||||
});
|
||||
|
||||
if (!result.ok) {
|
||||
if (result.errors) {
|
||||
for (const err of result.errors) {
|
||||
console.error(`[error] ${err.path}: ${err.message}`);
|
||||
}
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (result.warnings && result.warnings.length > 0) {
|
||||
for (const w of result.warnings) console.warn(`[warn] ${w}`);
|
||||
}
|
||||
|
||||
console.log("shimejic-pack: not implemented yet");
|
||||
process.exit(0);
|
||||
} catch (err) {
|
||||
console.error(`[fatal] ${err instanceof Error ? err.message : String(err)}`);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
||||
cli.help();
|
||||
cli.version("0.0.1");
|
||||
cli.parse();
|
||||
Reference in New Issue
Block a user