@mbsi/mkcmd 0.2.1 → 0.2.2
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/CHANGELOG.md +11 -1
- package/dist/index.js +333 -11
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
|
|
11
|
+
## [0.2.2] - 2025-12-30
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- `src/core/helpers/stringifier.ts` to codegen before building
|
|
15
|
+
- `prebuild` script to dynamically update the code located in data/core at build time.
|
|
16
|
+
- `src/data/core.ts` is generated / regenerated at before building for use in dist
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
- `src/functions/scaffold-core.ts` doesn't try to pull data that doesn't exist anymore :^)
|
|
20
|
+
|
|
10
21
|
## [0.2.1] - 2025-12-30
|
|
11
22
|
### Added
|
|
12
23
|
- `CHANGELOG.md` for tracking changes
|
|
@@ -29,7 +40,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
29
40
|
- Build scripts: `build`, `build:exe`, `prepack`
|
|
30
41
|
- npm package preparation (removed `private: true`)
|
|
31
42
|
|
|
32
|
-
|
|
33
43
|
### Changed
|
|
34
44
|
- Moved `typescript` from peerDependencies to devDependencies
|
|
35
45
|
- Updated package.json entry points to `./dist/index.js`
|
package/dist/index.js
CHANGED
|
@@ -2250,18 +2250,340 @@ async function scaffoldProject(prompts) {
|
|
|
2250
2250
|
}
|
|
2251
2251
|
|
|
2252
2252
|
// src/functions/scaffold-core.ts
|
|
2253
|
-
import { join as join4 } from "path";
|
|
2254
|
-
import {
|
|
2255
|
-
import {
|
|
2256
|
-
|
|
2257
|
-
|
|
2253
|
+
import { join as join4, dirname as dirname2 } from "path";
|
|
2254
|
+
import { existsSync } from "fs";
|
|
2255
|
+
import { mkdir as mkdir2, writeFile } from "fs/promises";
|
|
2256
|
+
import { cwd } from "process";
|
|
2257
|
+
|
|
2258
|
+
// src/data/core.ts
|
|
2259
|
+
var src_core_cli_init = () => {
|
|
2260
|
+
const fb = new FileBuilder;
|
|
2261
|
+
fb.addLine('import log from "./log";');
|
|
2262
|
+
fb.addLine('import { join } from "node:path";');
|
|
2263
|
+
fb.addLine('import { config } from "../config";');
|
|
2264
|
+
fb.addLine("");
|
|
2265
|
+
fb.addLine("export type Command = {");
|
|
2266
|
+
fb.addLine(" name: string;");
|
|
2267
|
+
fb.addLine(" description: string;");
|
|
2268
|
+
fb.addLine(" instructions: string;");
|
|
2269
|
+
fb.addLine(" run: (args: string[]) => Promise<void> | void;");
|
|
2270
|
+
fb.addLine("};");
|
|
2271
|
+
fb.addLine("");
|
|
2272
|
+
fb.addLine("const commands = new Map<string, Command>();");
|
|
2273
|
+
fb.addLine("");
|
|
2274
|
+
fb.addLine("export function registerCommand(cmd: Command) {");
|
|
2275
|
+
fb.addLine(" commands.set(cmd.name, cmd);");
|
|
2276
|
+
fb.addLine("}");
|
|
2277
|
+
fb.addLine("");
|
|
2278
|
+
fb.addLine("export async function runCLI(argv = Bun.argv.slice(2)) {");
|
|
2279
|
+
fb.addLine(" const [name, ...args] = argv;");
|
|
2280
|
+
fb.addLine(" // -- TS Defense --");
|
|
2281
|
+
fb.addLine(" if (!name) {");
|
|
2282
|
+
fb.addLine(' log.single.err("ARGS", "No Argument Supplied");');
|
|
2283
|
+
fb.addLine(" return;");
|
|
2284
|
+
fb.addLine(" }");
|
|
2285
|
+
fb.addLine(' if (["-h", "--help"].includes(name)) {');
|
|
2286
|
+
fb.addLine(" const multiLog: any[] = [];");
|
|
2287
|
+
fb.addLine(" multiLog.push({");
|
|
2288
|
+
fb.addLine(' t: "About",');
|
|
2289
|
+
fb.addLine(" m: config.about_text,");
|
|
2290
|
+
fb.addLine(" });");
|
|
2291
|
+
fb.addLine(" multiLog.push({");
|
|
2292
|
+
fb.addLine(' t: "Commands",');
|
|
2293
|
+
fb.addLine(' m: "Available Commands",');
|
|
2294
|
+
fb.addLine(" });");
|
|
2295
|
+
fb.addLine(" for (const cmd of commands.values()) {");
|
|
2296
|
+
fb.addLine(" multiLog.push({");
|
|
2297
|
+
fb.addLine(" t: cmd.name,");
|
|
2298
|
+
fb.addLine(" m: `${cmd.description}\\n |-> [Instructions]: ${cmd.instructions}\\n`,");
|
|
2299
|
+
fb.addLine(" });");
|
|
2300
|
+
fb.addLine(" }");
|
|
2301
|
+
fb.addLine(" multiLog.push({");
|
|
2302
|
+
fb.addLine(' t: "More Info",');
|
|
2303
|
+
fb.addLine(" m: config.more_info_text,");
|
|
2304
|
+
fb.addLine(" });");
|
|
2305
|
+
fb.addLine(" log.multi.info(multiLog);");
|
|
2306
|
+
fb.addLine(" return;");
|
|
2307
|
+
fb.addLine(" }");
|
|
2308
|
+
fb.addLine("");
|
|
2309
|
+
fb.addLine(' if (["-v", "--version"].includes(name)) {');
|
|
2310
|
+
fb.addLine(' const pkgText = await Bun.file(join(process.cwd(), "package.json")).text();');
|
|
2311
|
+
fb.addLine(" const pkg = JSON.parse(pkgText);");
|
|
2312
|
+
fb.addLine(" log.multi.info([");
|
|
2313
|
+
fb.addLine(" {");
|
|
2314
|
+
fb.addLine(' t: "Package Name",');
|
|
2315
|
+
fb.addLine(" m: pkg.name,");
|
|
2316
|
+
fb.addLine(" },");
|
|
2317
|
+
fb.addLine(" {");
|
|
2318
|
+
fb.addLine(' t: "Package Version",');
|
|
2319
|
+
fb.addLine(" m: pkg.version,");
|
|
2320
|
+
fb.addLine(" },");
|
|
2321
|
+
fb.addLine(" ]);");
|
|
2322
|
+
fb.addLine(" return;");
|
|
2323
|
+
fb.addLine(" }");
|
|
2324
|
+
fb.addLine("");
|
|
2325
|
+
fb.addLine(" const command = commands.get(name);");
|
|
2326
|
+
fb.addLine(" if (!command) {");
|
|
2327
|
+
fb.addLine(' log.single.err("Command", "No Command Supplied");');
|
|
2328
|
+
fb.addLine(" process.exit(1);");
|
|
2329
|
+
fb.addLine(" }");
|
|
2330
|
+
fb.addLine("");
|
|
2331
|
+
fb.addLine(" try {");
|
|
2332
|
+
fb.addLine(" await command.run(args);");
|
|
2333
|
+
fb.addLine(" } catch (err) {");
|
|
2334
|
+
fb.addLine(" const multilog: any[] = [];");
|
|
2335
|
+
fb.addLine(" multilog.push({");
|
|
2336
|
+
fb.addLine(' t: "Panic",');
|
|
2337
|
+
fb.addLine(" m: `Failed to run ${name}`,");
|
|
2338
|
+
fb.addLine(" });");
|
|
2339
|
+
fb.addLine(" if (err instanceof Error) {");
|
|
2340
|
+
fb.addLine(" multilog.push({");
|
|
2341
|
+
fb.addLine(' t: "Error",');
|
|
2342
|
+
fb.addLine(" m: err.message,");
|
|
2343
|
+
fb.addLine(" });");
|
|
2344
|
+
fb.addLine(" } else {");
|
|
2345
|
+
fb.addLine(" multilog.push({");
|
|
2346
|
+
fb.addLine(' t: "Unknown Error",');
|
|
2347
|
+
fb.addLine(" m: JSON.stringify(err),");
|
|
2348
|
+
fb.addLine(" });");
|
|
2349
|
+
fb.addLine(" }");
|
|
2350
|
+
fb.addLine(" log.multi.err(multilog);");
|
|
2351
|
+
fb.addLine(" process.exit(1);");
|
|
2352
|
+
fb.addLine(" }");
|
|
2353
|
+
fb.addLine("}");
|
|
2354
|
+
fb.addLine("");
|
|
2355
|
+
return fb.build();
|
|
2356
|
+
};
|
|
2357
|
+
var src_core_cli = {
|
|
2358
|
+
location: "src/core/cli.ts",
|
|
2359
|
+
content: src_core_cli_init
|
|
2360
|
+
};
|
|
2361
|
+
var src_core_log_init = () => {
|
|
2362
|
+
const fb = new FileBuilder;
|
|
2363
|
+
fb.addLine('import figlet from "figlet";');
|
|
2364
|
+
fb.addLine("");
|
|
2365
|
+
fb.addLine("const infoLogSingle = (title: string, message: string) => {");
|
|
2366
|
+
fb.addLine(' console.log("");');
|
|
2367
|
+
fb.addLine(' console.info(" [INFO]");');
|
|
2368
|
+
fb.addLine(" console.info(` [${title}]: ${message}`);");
|
|
2369
|
+
fb.addLine(' console.log("");');
|
|
2370
|
+
fb.addLine("};");
|
|
2371
|
+
fb.addLine("");
|
|
2372
|
+
fb.addLine("type MultiLogArgs = {");
|
|
2373
|
+
fb.addLine(" t: string;");
|
|
2374
|
+
fb.addLine(" m: string;");
|
|
2375
|
+
fb.addLine("}[];");
|
|
2376
|
+
fb.addLine("");
|
|
2377
|
+
fb.addLine("const infoLogMulti = (args: MultiLogArgs) => {");
|
|
2378
|
+
fb.addLine(' console.log("");');
|
|
2379
|
+
fb.addLine(' console.info(" [INFO]");');
|
|
2380
|
+
fb.addLine(" for (const arg of args) {");
|
|
2381
|
+
fb.addLine(" console.info(` [${arg.t}]: ${arg.m}`);");
|
|
2382
|
+
fb.addLine(" }");
|
|
2383
|
+
fb.addLine(' console.log("");');
|
|
2384
|
+
fb.addLine("};");
|
|
2385
|
+
fb.addLine("");
|
|
2386
|
+
fb.addLine("const warnLogSingle = (title: string, message: string) => {");
|
|
2387
|
+
fb.addLine(' console.log("");');
|
|
2388
|
+
fb.addLine(' console.warn(" [WARNING]");');
|
|
2389
|
+
fb.addLine(" console.warn(` [${title}]: ${message}`);");
|
|
2390
|
+
fb.addLine(' console.log("");');
|
|
2391
|
+
fb.addLine("};");
|
|
2392
|
+
fb.addLine("");
|
|
2393
|
+
fb.addLine("const warnLogMulti = (args: MultiLogArgs) => {");
|
|
2394
|
+
fb.addLine(' console.log("");');
|
|
2395
|
+
fb.addLine(' console.warn(" [WARNING]");');
|
|
2396
|
+
fb.addLine(" for (const arg of args) {");
|
|
2397
|
+
fb.addLine(" console.warn(` [${arg.t}]: ${arg.m}`);");
|
|
2398
|
+
fb.addLine(" }");
|
|
2399
|
+
fb.addLine(' console.log("");');
|
|
2400
|
+
fb.addLine("};");
|
|
2401
|
+
fb.addLine("");
|
|
2402
|
+
fb.addLine("const errLogSingle = (title: string, message: string) => {");
|
|
2403
|
+
fb.addLine(' console.log("");');
|
|
2404
|
+
fb.addLine(' console.error(" [ERROR]");');
|
|
2405
|
+
fb.addLine(" console.error(` [${title}]: ${message}`);");
|
|
2406
|
+
fb.addLine(' console.log("");');
|
|
2407
|
+
fb.addLine("};");
|
|
2408
|
+
fb.addLine("");
|
|
2409
|
+
fb.addLine("const errLogMulti = (args: MultiLogArgs) => {");
|
|
2410
|
+
fb.addLine(' console.log("");');
|
|
2411
|
+
fb.addLine(' console.error(" [ERROR]");');
|
|
2412
|
+
fb.addLine(" for (const arg of args) {");
|
|
2413
|
+
fb.addLine(" console.error(` [${arg.t}]: ${arg.m}`);");
|
|
2414
|
+
fb.addLine(" }");
|
|
2415
|
+
fb.addLine(' console.log("");');
|
|
2416
|
+
fb.addLine("};");
|
|
2417
|
+
fb.addLine("");
|
|
2418
|
+
fb.addLine("const title = (title: string, subtitle?: string) => {");
|
|
2419
|
+
fb.addLine(" console.clear();");
|
|
2420
|
+
fb.addLine(" console.log();");
|
|
2421
|
+
fb.addLine(" console.log(");
|
|
2422
|
+
fb.addLine(" figlet.textSync(title, {");
|
|
2423
|
+
fb.addLine(' font: "ANSI Regular",');
|
|
2424
|
+
fb.addLine(" }),");
|
|
2425
|
+
fb.addLine(" );");
|
|
2426
|
+
fb.addLine(" console.log(` [${subtitle}]`);");
|
|
2427
|
+
fb.addLine(" console.log();");
|
|
2428
|
+
fb.addLine("};");
|
|
2429
|
+
fb.addLine("");
|
|
2430
|
+
fb.addLine("const log = {");
|
|
2431
|
+
fb.addLine(" single: {");
|
|
2432
|
+
fb.addLine(" info: infoLogSingle,");
|
|
2433
|
+
fb.addLine(" warn: warnLogSingle,");
|
|
2434
|
+
fb.addLine(" err: errLogSingle,");
|
|
2435
|
+
fb.addLine(" },");
|
|
2436
|
+
fb.addLine(" multi: {");
|
|
2437
|
+
fb.addLine(" info: infoLogMulti,");
|
|
2438
|
+
fb.addLine(" warn: warnLogMulti,");
|
|
2439
|
+
fb.addLine(" err: errLogMulti,");
|
|
2440
|
+
fb.addLine(" },");
|
|
2441
|
+
fb.addLine(" title,");
|
|
2442
|
+
fb.addLine("};");
|
|
2443
|
+
fb.addLine("");
|
|
2444
|
+
fb.addLine("export default log;");
|
|
2445
|
+
fb.addLine("");
|
|
2446
|
+
return fb.build();
|
|
2447
|
+
};
|
|
2448
|
+
var src_core_log = {
|
|
2449
|
+
location: "src/core/log.ts",
|
|
2450
|
+
content: src_core_log_init
|
|
2451
|
+
};
|
|
2452
|
+
var src_core_helpers_file_builder_init = () => {
|
|
2453
|
+
const fb = new FileBuilder;
|
|
2454
|
+
fb.addLine("export function line(content: string, depth: number): string {");
|
|
2455
|
+
fb.addLine(' return `\\n${"\\t".repeat(depth)}${content}`;');
|
|
2456
|
+
fb.addLine("}");
|
|
2457
|
+
fb.addLine("");
|
|
2458
|
+
fb.addLine("export class FileBuilder {");
|
|
2459
|
+
fb.addLine(" private lines: string[] = [];");
|
|
2460
|
+
fb.addLine("");
|
|
2461
|
+
fb.addLine(" addLine(content: string, depth: number = 0): void {");
|
|
2462
|
+
fb.addLine(' this.lines.push(`${"\\t".repeat(depth)}${content}`);');
|
|
2463
|
+
fb.addLine(" }");
|
|
2464
|
+
fb.addLine("");
|
|
2465
|
+
fb.addLine(" addEmptyLine(): void {");
|
|
2466
|
+
fb.addLine(' this.lines.push("");');
|
|
2467
|
+
fb.addLine(" }");
|
|
2468
|
+
fb.addLine("");
|
|
2469
|
+
fb.addLine(" build(): string {");
|
|
2470
|
+
fb.addLine(' return this.lines.join("\\n");');
|
|
2471
|
+
fb.addLine(" }");
|
|
2472
|
+
fb.addLine("}");
|
|
2473
|
+
fb.addLine("");
|
|
2474
|
+
return fb.build();
|
|
2475
|
+
};
|
|
2476
|
+
var src_core_helpers_file_builder = {
|
|
2477
|
+
location: "src/core/helpers/file-builder.ts",
|
|
2478
|
+
content: src_core_helpers_file_builder_init
|
|
2479
|
+
};
|
|
2480
|
+
var src_core_helpers_stringifier_init = () => {
|
|
2481
|
+
const fb = new FileBuilder;
|
|
2482
|
+
fb.addLine('import { join } from "node:path";');
|
|
2483
|
+
fb.addLine('import { readdir, writeFile } from "node:fs/promises";');
|
|
2484
|
+
fb.addLine('import { FileBuilder } from "./file-builder";');
|
|
2485
|
+
fb.addLine('import { statSync } from "node:fs";');
|
|
2486
|
+
fb.addLine("");
|
|
2487
|
+
fb.addLine("const outExport: string[] = [];");
|
|
2488
|
+
fb.addLine("");
|
|
2489
|
+
fb.addLine("async function generateTemplate(path: string) {");
|
|
2490
|
+
fb.addLine(' if (path.endsWith(".ts")) {');
|
|
2491
|
+
fb.addLine(" const content = await Bun.file(path).text();");
|
|
2492
|
+
fb.addLine(" const fb = new FileBuilder();");
|
|
2493
|
+
fb.addLine(" const snaked_title = path");
|
|
2494
|
+
fb.addLine(' .split("/")');
|
|
2495
|
+
fb.addLine(' .join("_")');
|
|
2496
|
+
fb.addLine(' .split("-")');
|
|
2497
|
+
fb.addLine(' .join("_")');
|
|
2498
|
+
fb.addLine(' .split(".")[0];');
|
|
2499
|
+
fb.addLine(' fb.addLine(`const ${snaked_title + "_init"} = () => {`);');
|
|
2500
|
+
fb.addLine(" fb.addLine(`const fb = new FileBuilder();`, 1);");
|
|
2501
|
+
fb.addLine(' const lines = content.split("\\n");');
|
|
2502
|
+
fb.addLine(" for (const line of lines) {");
|
|
2503
|
+
fb.addLine(` const cleanLine = line.replaceAll("\\\\", "\\\\\\\\").replaceAll('"', '\\\\"');`);
|
|
2504
|
+
fb.addLine(' fb.addLine(`fb.addLine("${cleanLine}")`, 1);');
|
|
2505
|
+
fb.addLine(" }");
|
|
2506
|
+
fb.addLine(' fb.addLine("return fb.build();", 1);');
|
|
2507
|
+
fb.addLine(' fb.addLine("};");');
|
|
2508
|
+
fb.addLine(" fb.addEmptyLine();");
|
|
2509
|
+
fb.addLine(" fb.addLine(`export const ${snaked_title} = {`);");
|
|
2510
|
+
fb.addLine(' fb.addLine(`location: "${path}",`, 1);');
|
|
2511
|
+
fb.addLine(' fb.addLine(`content: ${snaked_title + "_init"}`, 1);');
|
|
2512
|
+
fb.addLine(" fb.addLine(`};`);");
|
|
2513
|
+
fb.addLine(" const out = fb.build();");
|
|
2514
|
+
fb.addLine(" outExport.push(`${snaked_title}`);");
|
|
2515
|
+
fb.addLine(" return out;");
|
|
2516
|
+
fb.addLine(" }");
|
|
2517
|
+
fb.addLine(' return "";');
|
|
2518
|
+
fb.addLine("}");
|
|
2519
|
+
fb.addLine("");
|
|
2520
|
+
fb.addLine("async function parseFolder(path: string, fb: FileBuilder) {");
|
|
2521
|
+
fb.addLine(" const items = await readdir(path);");
|
|
2522
|
+
fb.addLine(" for (const item of items) {");
|
|
2523
|
+
fb.addLine(" const relPath = join(path, item);");
|
|
2524
|
+
fb.addLine(" const itemStat = statSync(relPath);");
|
|
2525
|
+
fb.addLine(" if (itemStat.isDirectory()) {");
|
|
2526
|
+
fb.addLine(" await parseFolder(relPath, fb);");
|
|
2527
|
+
fb.addLine(" }");
|
|
2528
|
+
fb.addLine(' if (item.endsWith(".ts")) {');
|
|
2529
|
+
fb.addLine(" fb.addLine(await generateTemplate(relPath));");
|
|
2530
|
+
fb.addLine(" fb.addEmptyLine();");
|
|
2531
|
+
fb.addLine(" }");
|
|
2532
|
+
fb.addLine(" }");
|
|
2533
|
+
fb.addLine("}");
|
|
2534
|
+
fb.addLine("");
|
|
2535
|
+
fb.addLine("async function generateTemplates() {");
|
|
2536
|
+
fb.addLine(' const sourceCoreDir = join(".", "src", "core");');
|
|
2537
|
+
fb.addLine(" const fb = new FileBuilder();");
|
|
2538
|
+
fb.addLine(' fb.addLine(`import { FileBuilder } from "../core/helpers/file-builder";`);');
|
|
2539
|
+
fb.addLine(" fb.addEmptyLine();");
|
|
2540
|
+
fb.addLine(" await parseFolder(sourceCoreDir, fb);");
|
|
2541
|
+
fb.addLine(' fb.addLine(`const core = [${outExport.join(", ")}]`);');
|
|
2542
|
+
fb.addLine(" fb.addLine(`export { core }`);");
|
|
2543
|
+
fb.addLine(" const out = fb.build();");
|
|
2544
|
+
fb.addLine(' await writeFile(join(".", "src", "data", "core.ts"), out, "utf8");');
|
|
2545
|
+
fb.addLine("}");
|
|
2546
|
+
fb.addLine("");
|
|
2547
|
+
fb.addLine("generateTemplates();");
|
|
2548
|
+
fb.addLine("");
|
|
2549
|
+
return fb.build();
|
|
2550
|
+
};
|
|
2551
|
+
var src_core_helpers_stringifier = {
|
|
2552
|
+
location: "src/core/helpers/stringifier.ts",
|
|
2553
|
+
content: src_core_helpers_stringifier_init
|
|
2554
|
+
};
|
|
2555
|
+
var src_core_helpers_file_utils_init = () => {
|
|
2556
|
+
const fb = new FileBuilder;
|
|
2557
|
+
fb.addLine('import { mkdir } from "node:fs/promises";');
|
|
2558
|
+
fb.addLine('import { resolve, join } from "node:path";');
|
|
2559
|
+
fb.addLine("");
|
|
2560
|
+
fb.addLine("export async function writeFileTuple([targetDir, relativePath, content]: [string, string, string]): Promise<void> {");
|
|
2561
|
+
fb.addLine(" const fullPath = resolve(targetDir, relativePath);");
|
|
2562
|
+
fb.addLine(' await mkdir(join(fullPath, ".."), { recursive: true });');
|
|
2563
|
+
fb.addLine(" await Bun.write(fullPath, content);");
|
|
2564
|
+
fb.addLine("}");
|
|
2565
|
+
fb.addLine("");
|
|
2566
|
+
return fb.build();
|
|
2567
|
+
};
|
|
2568
|
+
var src_core_helpers_file_utils = {
|
|
2569
|
+
location: "src/core/helpers/file-utils.ts",
|
|
2570
|
+
content: src_core_helpers_file_utils_init
|
|
2571
|
+
};
|
|
2572
|
+
var core = [src_core_cli, src_core_log, src_core_helpers_file_builder, src_core_helpers_stringifier, src_core_helpers_file_utils];
|
|
2573
|
+
|
|
2574
|
+
// src/functions/scaffold-core.ts
|
|
2575
|
+
var currentDir = join4(cwd());
|
|
2258
2576
|
async function scaffoldCore(targetDir) {
|
|
2259
|
-
const
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
}
|
|
2577
|
+
const combinedPath = join4(currentDir, targetDir);
|
|
2578
|
+
console.dir(combinedPath);
|
|
2579
|
+
for (const file of core) {
|
|
2580
|
+
const relativePath = file.location.replace(/^\.\//, "");
|
|
2581
|
+
const parentDir = join4(combinedPath, dirname2(relativePath));
|
|
2582
|
+
console.dir({ parentDir });
|
|
2583
|
+
if (!existsSync(parentDir)) {
|
|
2584
|
+
mkdir2(parentDir, { recursive: true });
|
|
2585
|
+
}
|
|
2586
|
+
writeFile(join4(combinedPath, relativePath), file.content(), "utf8");
|
|
2265
2587
|
}
|
|
2266
2588
|
}
|
|
2267
2589
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mbsi/mkcmd",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"mkcmd": "./dist/index.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
+
"prebuild": "bun run src/core/helpers/stringifier.ts",
|
|
11
12
|
"build": "bun build --target=bun --outfile=dist/index.js src/index.ts",
|
|
12
13
|
"build:exe": "bun build --compile --outfile=dist/mkcmd src/index.ts",
|
|
13
14
|
"prepack": "bun run build"
|