chore: migrate to pnpm with a monorepo

This commit is contained in:
2026-10-22 08:38:05 +02:00
commit e7c7a7f5e9
26 changed files with 1891 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
{
"name": "shimejic-packer",
"version": "0.0.1",
"type": "module",
"bin": {
"shimejic-pack": "./dist/cli.js"
},
"exports": {
".": "./src/index.ts"
},
"files": [
"src",
"dist"
],
"scripts": {
"build": "tsc",
"dev": "tsc --watch",
"check": "tsc --noEmit"
},
"dependencies": {
"shimejic": "workspace:*",
"sharp": "^0.33.0",
"cac": "^6.7.14"
},
"devDependencies": {
"typescript": "catalog:",
"@types/node": "^22.0.0"
}
}
+44
View File
@@ -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();
+26
View File
@@ -0,0 +1,26 @@
export interface PackOptions {
/** Path to the folder containing character assets. */
input: string;
/** Path where atlases and character.json should be written. */
output: string;
/** Path to overrides JSON. Defaults to `<input>/character.config.json` if present. */
config?: string;
/** Max atlas dimension in pixels. Default 2048. */
maxAtlasSize?: number;
/** Report what would be done without writing files. */
dryRun?: boolean;
}
export interface PackResult {
ok: boolean;
/** Populated on success. */
characterConfig?: unknown;
/** Populated on failure. */
errors?: Array<{ path: string; message: string }>;
/** Non-fatal issues. */
warnings?: string[];
}
export async function pack(_options: PackOptions): Promise<PackResult> {
throw new Error("shimejic-packer: not implemented yet");
}
+14
View File
@@ -0,0 +1,14 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "nodenext",
"moduleResolution": "nodenext",
"target": "es2022",
"types": ["node"],
"outDir": "./dist",
"rootDir": "./src",
"noEmit": false,
"allowImportingTsExtensions": false
},
"include": ["src"]
}