@batijs/cli 0.0.38 → 0.0.40
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/dist/boilerplates/@batijs/edgedb/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/edgedb/{package-XY7TSZN3.js → package-4HYDCFQC.js} +1 -1
- package/dist/boilerplates/@batijs/express/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/express/{package-NSBYO6ZY.js → package-PHZH357G.js} +3 -3
- package/dist/boilerplates/@batijs/hattip/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/hattip/{package-PUWO2VVR.js → package-P737QT4N.js} +3 -3
- package/dist/boilerplates/@batijs/prisma/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/prisma/{package-OVSUG4KZ.js → package-FSGBZ2VB.js} +1 -1
- package/dist/boilerplates/@batijs/react/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/react/{package-ICVJ5UL5.js → package-LR5YVULO.js} +3 -3
- package/dist/boilerplates/@batijs/shared/files/package.json +1 -1
- package/dist/boilerplates/@batijs/solid/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/solid/{package-UCURTN7N.js → package-NBEQ3O3J.js} +3 -3
- package/dist/boilerplates/@batijs/tailwindcss/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/tailwindcss/{package-2HMN7U7S.js → package-EX67AI74.js} +3 -3
- package/dist/boilerplates/@batijs/telefunc/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/telefunc/{package-H7G2XYNG.js → package-VVPQITQ5.js} +3 -3
- package/dist/chunk-chunk-HOVHXSZ5.js +1064 -0
- package/dist/chunk-prompt-LPA56PA5.js +781 -0
- package/dist/index.js +143 -256
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
colors,
|
|
4
|
+
consola
|
|
5
|
+
} from "./chunk-chunk-HOVHXSZ5.js";
|
|
2
6
|
|
|
3
|
-
// ../../node_modules/.pnpm/citty@0.1.
|
|
4
|
-
import * as tty from "tty";
|
|
7
|
+
// ../../node_modules/.pnpm/citty@0.1.2/node_modules/citty/dist/index.mjs
|
|
5
8
|
function toArray(val) {
|
|
6
9
|
if (Array.isArray(val)) {
|
|
7
10
|
return val;
|
|
8
11
|
}
|
|
9
|
-
return val
|
|
12
|
+
return val === void 0 ? [] : [val];
|
|
10
13
|
}
|
|
11
14
|
function formatLineColumns(lines, linePrefix = "") {
|
|
12
15
|
const maxLengh = [];
|
|
@@ -244,13 +247,13 @@ function parseArgs(rawArgs, argsDef) {
|
|
|
244
247
|
const nextPositionalArgument = positionalArguments.shift();
|
|
245
248
|
if (nextPositionalArgument !== void 0) {
|
|
246
249
|
parsedArgsProxy[arg.name] = nextPositionalArgument;
|
|
247
|
-
} else if (arg.default
|
|
248
|
-
parsedArgsProxy[arg.name] = arg.default;
|
|
249
|
-
} else {
|
|
250
|
+
} else if (arg.default === void 0 && arg.required !== false) {
|
|
250
251
|
throw new CLIError(
|
|
251
252
|
`Missing required positional argument: ${arg.name.toUpperCase()}`,
|
|
252
253
|
"EARG"
|
|
253
254
|
);
|
|
255
|
+
} else {
|
|
256
|
+
parsedArgsProxy[arg.name] = arg.default;
|
|
254
257
|
}
|
|
255
258
|
} else if (arg.required && parsedArgsProxy[arg.name] === void 0) {
|
|
256
259
|
throw new CLIError(`Missing required argument: --${arg.name}`, "EARG");
|
|
@@ -278,6 +281,7 @@ async function runCommand(cmd, opts) {
|
|
|
278
281
|
const context = {
|
|
279
282
|
rawArgs: opts.rawArgs,
|
|
280
283
|
args: parsedArgs,
|
|
284
|
+
data: opts.data,
|
|
281
285
|
cmd
|
|
282
286
|
};
|
|
283
287
|
if (typeof cmd.setup === "function") {
|
|
@@ -290,15 +294,12 @@ async function runCommand(cmd, opts) {
|
|
|
290
294
|
);
|
|
291
295
|
const subCommandName = opts.rawArgs[subCommandArgIndex];
|
|
292
296
|
if (!subCommandName && !cmd.run) {
|
|
293
|
-
throw new CLIError(
|
|
294
|
-
`Missing sub command. Use --help to see available sub commands.`,
|
|
295
|
-
"ESUBCOMMAND"
|
|
296
|
-
);
|
|
297
|
+
throw new CLIError(`No command specified.`, "E_NO_COMMAND");
|
|
297
298
|
}
|
|
298
299
|
if (!subCommands[subCommandName]) {
|
|
299
300
|
throw new CLIError(
|
|
300
|
-
`Unknown
|
|
301
|
-
"
|
|
301
|
+
`Unknown command \`${subCommandName}\``,
|
|
302
|
+
"E_UNKNOWN_COMMAND"
|
|
302
303
|
);
|
|
303
304
|
}
|
|
304
305
|
const subCommand = await resolveValue(subCommands[subCommandName]);
|
|
@@ -330,9 +331,9 @@ async function resolveSubCommand(cmd, rawArgs, parent) {
|
|
|
330
331
|
}
|
|
331
332
|
async function showUsage(cmd, parent) {
|
|
332
333
|
try {
|
|
333
|
-
|
|
334
|
+
consola.log(await renderUsage(cmd, parent) + "\n");
|
|
334
335
|
} catch (error) {
|
|
335
|
-
|
|
336
|
+
consola.error(error);
|
|
336
337
|
}
|
|
337
338
|
}
|
|
338
339
|
async function renderUsage(cmd, parent) {
|
|
@@ -349,7 +350,7 @@ async function renderUsage(cmd, parent) {
|
|
|
349
350
|
const name = arg.name.toUpperCase();
|
|
350
351
|
const isRequired = arg.required !== false && arg.default === void 0;
|
|
351
352
|
const usageHint = arg.default ? `="${arg.default}"` : "";
|
|
352
|
-
posLines.push([name + usageHint, arg.description || ""]);
|
|
353
|
+
posLines.push(["`" + name + usageHint + "`", arg.description || ""]);
|
|
353
354
|
usageLine.push(isRequired ? `<${name}>` : `[${name}]`);
|
|
354
355
|
} else {
|
|
355
356
|
const isRequired = arg.required === true && arg.default === void 0;
|
|
@@ -360,7 +361,7 @@ async function renderUsage(cmd, parent) {
|
|
|
360
361
|
", "
|
|
361
362
|
)) + (arg.type === "string" && (arg.valueHint || arg.default) ? `=${arg.valueHint ? `<${arg.valueHint}>` : `"${arg.default || ""}"`}` : "");
|
|
362
363
|
argLines.push([
|
|
363
|
-
argStr + (isRequired ? " (required)" : ""),
|
|
364
|
+
"`" + argStr + (isRequired ? " (required)" : "") + "`",
|
|
364
365
|
arg.description || ""
|
|
365
366
|
]);
|
|
366
367
|
if (isRequired) {
|
|
@@ -370,8 +371,11 @@ async function renderUsage(cmd, parent) {
|
|
|
370
371
|
}
|
|
371
372
|
if (cmd.subCommands) {
|
|
372
373
|
const commandNames = [];
|
|
373
|
-
|
|
374
|
-
|
|
374
|
+
const subCommands = await resolveValue(cmd.subCommands);
|
|
375
|
+
for (const [name, sub] of Object.entries(subCommands)) {
|
|
376
|
+
const subCmd = await resolveValue(sub);
|
|
377
|
+
const meta = await resolveValue(subCmd?.meta);
|
|
378
|
+
commandsLines.push([`\`${name}\``, meta?.description || ""]);
|
|
375
379
|
commandNames.push(name);
|
|
376
380
|
}
|
|
377
381
|
usageLine.push(commandNames.join("|"));
|
|
@@ -379,29 +383,28 @@ async function renderUsage(cmd, parent) {
|
|
|
379
383
|
const usageLines = [];
|
|
380
384
|
const version = cmdMeta.version || parentMeta.version;
|
|
381
385
|
usageLines.push(
|
|
382
|
-
|
|
383
|
-
|
|
386
|
+
colors.gray(
|
|
387
|
+
`${cmdMeta.description} (${commandName + (version ? ` v${version}` : "")})`
|
|
388
|
+
),
|
|
384
389
|
""
|
|
385
390
|
);
|
|
386
391
|
const hasOptions = argLines.length > 0 || posLines.length > 0;
|
|
387
392
|
usageLines.push(
|
|
388
|
-
|
|
389
|
-
" "
|
|
390
|
-
)}`,
|
|
393
|
+
`${colors.underline(colors.bold("USAGE"))} \`${commandName}${hasOptions ? " [OPTIONS]" : ""} ${usageLine.join(" ")}\``,
|
|
391
394
|
""
|
|
392
395
|
);
|
|
393
396
|
if (posLines.length > 0) {
|
|
394
|
-
usageLines.push("ARGUMENTS
|
|
397
|
+
usageLines.push(colors.underline(colors.bold("ARGUMENTS")), "");
|
|
395
398
|
usageLines.push(formatLineColumns(posLines, " "));
|
|
396
399
|
usageLines.push("");
|
|
397
400
|
}
|
|
398
401
|
if (argLines.length > 0) {
|
|
399
|
-
usageLines.push("OPTIONS
|
|
402
|
+
usageLines.push(colors.underline(colors.bold("OPTIONS")), "");
|
|
400
403
|
usageLines.push(formatLineColumns(argLines, " "));
|
|
401
404
|
usageLines.push("");
|
|
402
405
|
}
|
|
403
406
|
if (commandsLines.length > 0) {
|
|
404
|
-
usageLines.push("COMMANDS
|
|
407
|
+
usageLines.push(colors.underline(colors.bold("COMMANDS")), "");
|
|
405
408
|
usageLines.push(formatLineColumns(commandsLines, " "));
|
|
406
409
|
usageLines.push(
|
|
407
410
|
"",
|
|
@@ -410,118 +413,6 @@ async function renderUsage(cmd, parent) {
|
|
|
410
413
|
}
|
|
411
414
|
return usageLines.filter((l) => typeof l === "string").join("\n");
|
|
412
415
|
}
|
|
413
|
-
var {
|
|
414
|
-
env = {},
|
|
415
|
-
argv = [],
|
|
416
|
-
platform = ""
|
|
417
|
-
} = typeof process === "undefined" ? {} : process;
|
|
418
|
-
var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
419
|
-
var isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
420
|
-
var isWindows = platform === "win32";
|
|
421
|
-
var isDumbTerminal = env.TERM === "dumb";
|
|
422
|
-
var isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
|
|
423
|
-
var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
424
|
-
var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
425
|
-
var replaceClose = (index, string, close, replace, head = string.substring(0, index) + replace, tail = string.substring(index + close.length), next = tail.indexOf(close)) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
426
|
-
var clearBleed = (index, string, open, close, replace) => index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
427
|
-
var filterEmpty = (open, close, replace = open, at = open.length + 1) => (string) => string || !(string === "" || string === void 0) ? clearBleed(
|
|
428
|
-
("" + string).indexOf(close, at),
|
|
429
|
-
string,
|
|
430
|
-
open,
|
|
431
|
-
close,
|
|
432
|
-
replace
|
|
433
|
-
) : "";
|
|
434
|
-
var init = (open, close, replace) => filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
|
|
435
|
-
var colors = {
|
|
436
|
-
reset: init(0, 0),
|
|
437
|
-
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
438
|
-
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
439
|
-
italic: init(3, 23),
|
|
440
|
-
underline: init(4, 24),
|
|
441
|
-
inverse: init(7, 27),
|
|
442
|
-
hidden: init(8, 28),
|
|
443
|
-
strikethrough: init(9, 29),
|
|
444
|
-
black: init(30, 39),
|
|
445
|
-
red: init(31, 39),
|
|
446
|
-
green: init(32, 39),
|
|
447
|
-
yellow: init(33, 39),
|
|
448
|
-
blue: init(34, 39),
|
|
449
|
-
magenta: init(35, 39),
|
|
450
|
-
cyan: init(36, 39),
|
|
451
|
-
white: init(37, 39),
|
|
452
|
-
gray: init(90, 39),
|
|
453
|
-
bgBlack: init(40, 49),
|
|
454
|
-
bgRed: init(41, 49),
|
|
455
|
-
bgGreen: init(42, 49),
|
|
456
|
-
bgYellow: init(43, 49),
|
|
457
|
-
bgBlue: init(44, 49),
|
|
458
|
-
bgMagenta: init(45, 49),
|
|
459
|
-
bgCyan: init(46, 49),
|
|
460
|
-
bgWhite: init(47, 49),
|
|
461
|
-
blackBright: init(90, 39),
|
|
462
|
-
redBright: init(91, 39),
|
|
463
|
-
greenBright: init(92, 39),
|
|
464
|
-
yellowBright: init(93, 39),
|
|
465
|
-
blueBright: init(94, 39),
|
|
466
|
-
magentaBright: init(95, 39),
|
|
467
|
-
cyanBright: init(96, 39),
|
|
468
|
-
whiteBright: init(97, 39),
|
|
469
|
-
bgBlackBright: init(100, 49),
|
|
470
|
-
bgRedBright: init(101, 49),
|
|
471
|
-
bgGreenBright: init(102, 49),
|
|
472
|
-
bgYellowBright: init(103, 49),
|
|
473
|
-
bgBlueBright: init(104, 49),
|
|
474
|
-
bgMagentaBright: init(105, 49),
|
|
475
|
-
bgCyanBright: init(106, 49),
|
|
476
|
-
bgWhiteBright: init(107, 49)
|
|
477
|
-
};
|
|
478
|
-
var createColors = ({ useColor = isColorSupported } = {}) => useColor ? colors : Object.keys(colors).reduce(
|
|
479
|
-
(colors3, key) => ({ ...colors3, [key]: String }),
|
|
480
|
-
{}
|
|
481
|
-
);
|
|
482
|
-
var {
|
|
483
|
-
reset,
|
|
484
|
-
bold,
|
|
485
|
-
dim,
|
|
486
|
-
italic,
|
|
487
|
-
underline,
|
|
488
|
-
inverse,
|
|
489
|
-
hidden,
|
|
490
|
-
strikethrough,
|
|
491
|
-
black,
|
|
492
|
-
red,
|
|
493
|
-
green,
|
|
494
|
-
yellow,
|
|
495
|
-
blue,
|
|
496
|
-
magenta,
|
|
497
|
-
cyan,
|
|
498
|
-
white,
|
|
499
|
-
gray,
|
|
500
|
-
bgBlack,
|
|
501
|
-
bgRed,
|
|
502
|
-
bgGreen,
|
|
503
|
-
bgYellow,
|
|
504
|
-
bgBlue,
|
|
505
|
-
bgMagenta,
|
|
506
|
-
bgCyan,
|
|
507
|
-
bgWhite,
|
|
508
|
-
blackBright,
|
|
509
|
-
redBright,
|
|
510
|
-
greenBright,
|
|
511
|
-
yellowBright,
|
|
512
|
-
blueBright,
|
|
513
|
-
magentaBright,
|
|
514
|
-
cyanBright,
|
|
515
|
-
whiteBright,
|
|
516
|
-
bgBlackBright,
|
|
517
|
-
bgRedBright,
|
|
518
|
-
bgGreenBright,
|
|
519
|
-
bgYellowBright,
|
|
520
|
-
bgBlueBright,
|
|
521
|
-
bgMagentaBright,
|
|
522
|
-
bgCyanBright,
|
|
523
|
-
bgWhiteBright
|
|
524
|
-
} = createColors();
|
|
525
416
|
async function runMain(cmd, opts = {}) {
|
|
526
417
|
const rawArgs = opts.rawArgs || process.argv.slice(2);
|
|
527
418
|
try {
|
|
@@ -534,16 +425,12 @@ async function runMain(cmd, opts = {}) {
|
|
|
534
425
|
} catch (error) {
|
|
535
426
|
const isCLIError = error instanceof CLIError;
|
|
536
427
|
if (!isCLIError) {
|
|
537
|
-
|
|
428
|
+
consola.error(error, "\n");
|
|
538
429
|
}
|
|
539
|
-
console.error(
|
|
540
|
-
`
|
|
541
|
-
${bgRed(` ${error.code || error.name} `)} ${error.message}
|
|
542
|
-
`
|
|
543
|
-
);
|
|
544
430
|
if (isCLIError) {
|
|
545
431
|
await showUsage(...await resolveSubCommand(cmd, rawArgs));
|
|
546
432
|
}
|
|
433
|
+
consola.error(error.message);
|
|
547
434
|
process.exit(1);
|
|
548
435
|
}
|
|
549
436
|
}
|
|
@@ -653,7 +540,7 @@ Please report this issue to https://github.com/magne4000/bati`
|
|
|
653
540
|
// package.json
|
|
654
541
|
var package_default = {
|
|
655
542
|
name: "@batijs/cli",
|
|
656
|
-
version: "0.0.
|
|
543
|
+
version: "0.0.40",
|
|
657
544
|
type: "module",
|
|
658
545
|
scripts: {
|
|
659
546
|
prerelease: "rimraf ./dist",
|
|
@@ -671,7 +558,7 @@ var package_default = {
|
|
|
671
558
|
"@batijs/tsup": "workspace:*",
|
|
672
559
|
"@types/node": "^16.18.37",
|
|
673
560
|
"@types/which": "^3.0.0",
|
|
674
|
-
citty: "^0.1.
|
|
561
|
+
citty: "^0.1.2",
|
|
675
562
|
colorette: "^2.0.20",
|
|
676
563
|
esbuild: "^0.18.11",
|
|
677
564
|
espree: "^9.6.0",
|
|
@@ -682,7 +569,7 @@ var package_default = {
|
|
|
682
569
|
"tree-kill": "^1.2.2",
|
|
683
570
|
tsup: "^7.1.0",
|
|
684
571
|
typescript: "^5.1.6",
|
|
685
|
-
vite: "^4.
|
|
572
|
+
vite: "^4.4.0",
|
|
686
573
|
vitest: "^0.32.4",
|
|
687
574
|
which: "^3.0.1"
|
|
688
575
|
},
|
|
@@ -713,119 +600,119 @@ import { dirname, join, parse } from "path";
|
|
|
713
600
|
import { access, constants, lstat, readdir, readFile as readFile2 } from "fs/promises";
|
|
714
601
|
|
|
715
602
|
// ../../node_modules/.pnpm/colorette@2.0.20/node_modules/colorette/index.js
|
|
716
|
-
import * as
|
|
603
|
+
import * as tty from "tty";
|
|
717
604
|
var {
|
|
718
|
-
env
|
|
719
|
-
argv
|
|
720
|
-
platform
|
|
605
|
+
env = {},
|
|
606
|
+
argv = [],
|
|
607
|
+
platform = ""
|
|
721
608
|
} = typeof process === "undefined" ? {} : process;
|
|
722
|
-
var
|
|
723
|
-
var
|
|
724
|
-
var
|
|
725
|
-
var
|
|
726
|
-
var
|
|
727
|
-
var
|
|
728
|
-
var
|
|
729
|
-
var
|
|
730
|
-
var
|
|
731
|
-
var
|
|
609
|
+
var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
610
|
+
var isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
611
|
+
var isWindows = platform === "win32";
|
|
612
|
+
var isDumbTerminal = env.TERM === "dumb";
|
|
613
|
+
var isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
|
|
614
|
+
var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
615
|
+
var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
616
|
+
var replaceClose = (index, string, close, replace, head = string.substring(0, index) + replace, tail = string.substring(index + close.length), next = tail.indexOf(close)) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
617
|
+
var clearBleed = (index, string, open, close, replace) => index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
618
|
+
var filterEmpty = (open, close, replace = open, at = open.length + 1) => (string) => string || !(string === "" || string === void 0) ? clearBleed(
|
|
732
619
|
("" + string).indexOf(close, at),
|
|
733
620
|
string,
|
|
734
621
|
open,
|
|
735
622
|
close,
|
|
736
623
|
replace
|
|
737
624
|
) : "";
|
|
738
|
-
var
|
|
625
|
+
var init = (open, close, replace) => filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
|
|
739
626
|
var colors2 = {
|
|
740
|
-
reset:
|
|
741
|
-
bold:
|
|
742
|
-
dim:
|
|
743
|
-
italic:
|
|
744
|
-
underline:
|
|
745
|
-
inverse:
|
|
746
|
-
hidden:
|
|
747
|
-
strikethrough:
|
|
748
|
-
black:
|
|
749
|
-
red:
|
|
750
|
-
green:
|
|
751
|
-
yellow:
|
|
752
|
-
blue:
|
|
753
|
-
magenta:
|
|
754
|
-
cyan:
|
|
755
|
-
white:
|
|
756
|
-
gray:
|
|
757
|
-
bgBlack:
|
|
758
|
-
bgRed:
|
|
759
|
-
bgGreen:
|
|
760
|
-
bgYellow:
|
|
761
|
-
bgBlue:
|
|
762
|
-
bgMagenta:
|
|
763
|
-
bgCyan:
|
|
764
|
-
bgWhite:
|
|
765
|
-
blackBright:
|
|
766
|
-
redBright:
|
|
767
|
-
greenBright:
|
|
768
|
-
yellowBright:
|
|
769
|
-
blueBright:
|
|
770
|
-
magentaBright:
|
|
771
|
-
cyanBright:
|
|
772
|
-
whiteBright:
|
|
773
|
-
bgBlackBright:
|
|
774
|
-
bgRedBright:
|
|
775
|
-
bgGreenBright:
|
|
776
|
-
bgYellowBright:
|
|
777
|
-
bgBlueBright:
|
|
778
|
-
bgMagentaBright:
|
|
779
|
-
bgCyanBright:
|
|
780
|
-
bgWhiteBright:
|
|
627
|
+
reset: init(0, 0),
|
|
628
|
+
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
629
|
+
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
630
|
+
italic: init(3, 23),
|
|
631
|
+
underline: init(4, 24),
|
|
632
|
+
inverse: init(7, 27),
|
|
633
|
+
hidden: init(8, 28),
|
|
634
|
+
strikethrough: init(9, 29),
|
|
635
|
+
black: init(30, 39),
|
|
636
|
+
red: init(31, 39),
|
|
637
|
+
green: init(32, 39),
|
|
638
|
+
yellow: init(33, 39),
|
|
639
|
+
blue: init(34, 39),
|
|
640
|
+
magenta: init(35, 39),
|
|
641
|
+
cyan: init(36, 39),
|
|
642
|
+
white: init(37, 39),
|
|
643
|
+
gray: init(90, 39),
|
|
644
|
+
bgBlack: init(40, 49),
|
|
645
|
+
bgRed: init(41, 49),
|
|
646
|
+
bgGreen: init(42, 49),
|
|
647
|
+
bgYellow: init(43, 49),
|
|
648
|
+
bgBlue: init(44, 49),
|
|
649
|
+
bgMagenta: init(45, 49),
|
|
650
|
+
bgCyan: init(46, 49),
|
|
651
|
+
bgWhite: init(47, 49),
|
|
652
|
+
blackBright: init(90, 39),
|
|
653
|
+
redBright: init(91, 39),
|
|
654
|
+
greenBright: init(92, 39),
|
|
655
|
+
yellowBright: init(93, 39),
|
|
656
|
+
blueBright: init(94, 39),
|
|
657
|
+
magentaBright: init(95, 39),
|
|
658
|
+
cyanBright: init(96, 39),
|
|
659
|
+
whiteBright: init(97, 39),
|
|
660
|
+
bgBlackBright: init(100, 49),
|
|
661
|
+
bgRedBright: init(101, 49),
|
|
662
|
+
bgGreenBright: init(102, 49),
|
|
663
|
+
bgYellowBright: init(103, 49),
|
|
664
|
+
bgBlueBright: init(104, 49),
|
|
665
|
+
bgMagentaBright: init(105, 49),
|
|
666
|
+
bgCyanBright: init(106, 49),
|
|
667
|
+
bgWhiteBright: init(107, 49)
|
|
781
668
|
};
|
|
782
|
-
var
|
|
669
|
+
var createColors = ({ useColor = isColorSupported } = {}) => useColor ? colors2 : Object.keys(colors2).reduce(
|
|
783
670
|
(colors3, key) => ({ ...colors3, [key]: String }),
|
|
784
671
|
{}
|
|
785
672
|
);
|
|
786
673
|
var {
|
|
787
|
-
reset
|
|
788
|
-
bold
|
|
789
|
-
dim
|
|
790
|
-
italic
|
|
791
|
-
underline
|
|
792
|
-
inverse
|
|
793
|
-
hidden
|
|
794
|
-
strikethrough
|
|
795
|
-
black
|
|
796
|
-
red
|
|
797
|
-
green
|
|
798
|
-
yellow
|
|
799
|
-
blue
|
|
800
|
-
magenta
|
|
801
|
-
cyan
|
|
802
|
-
white
|
|
803
|
-
gray
|
|
804
|
-
bgBlack
|
|
805
|
-
bgRed
|
|
806
|
-
bgGreen
|
|
807
|
-
bgYellow
|
|
808
|
-
bgBlue
|
|
809
|
-
bgMagenta
|
|
810
|
-
bgCyan
|
|
811
|
-
bgWhite
|
|
812
|
-
blackBright
|
|
813
|
-
redBright
|
|
814
|
-
greenBright
|
|
815
|
-
yellowBright
|
|
816
|
-
blueBright
|
|
817
|
-
magentaBright
|
|
818
|
-
cyanBright
|
|
819
|
-
whiteBright
|
|
820
|
-
bgBlackBright
|
|
821
|
-
bgRedBright
|
|
822
|
-
bgGreenBright
|
|
823
|
-
bgYellowBright
|
|
824
|
-
bgBlueBright
|
|
825
|
-
bgMagentaBright
|
|
826
|
-
bgCyanBright
|
|
827
|
-
bgWhiteBright
|
|
828
|
-
} =
|
|
674
|
+
reset,
|
|
675
|
+
bold,
|
|
676
|
+
dim,
|
|
677
|
+
italic,
|
|
678
|
+
underline,
|
|
679
|
+
inverse,
|
|
680
|
+
hidden,
|
|
681
|
+
strikethrough,
|
|
682
|
+
black,
|
|
683
|
+
red,
|
|
684
|
+
green,
|
|
685
|
+
yellow,
|
|
686
|
+
blue,
|
|
687
|
+
magenta,
|
|
688
|
+
cyan,
|
|
689
|
+
white,
|
|
690
|
+
gray,
|
|
691
|
+
bgBlack,
|
|
692
|
+
bgRed,
|
|
693
|
+
bgGreen,
|
|
694
|
+
bgYellow,
|
|
695
|
+
bgBlue,
|
|
696
|
+
bgMagenta,
|
|
697
|
+
bgCyan,
|
|
698
|
+
bgWhite,
|
|
699
|
+
blackBright,
|
|
700
|
+
redBright,
|
|
701
|
+
greenBright,
|
|
702
|
+
yellowBright,
|
|
703
|
+
blueBright,
|
|
704
|
+
magentaBright,
|
|
705
|
+
cyanBright,
|
|
706
|
+
whiteBright,
|
|
707
|
+
bgBlackBright,
|
|
708
|
+
bgRedBright,
|
|
709
|
+
bgGreenBright,
|
|
710
|
+
bgYellowBright,
|
|
711
|
+
bgBlueBright,
|
|
712
|
+
bgMagentaBright,
|
|
713
|
+
bgCyanBright,
|
|
714
|
+
bgWhiteBright
|
|
715
|
+
} = createColors();
|
|
829
716
|
|
|
830
717
|
// index.ts
|
|
831
718
|
var __filename = fileURLToPath(import.meta.url);
|
|
@@ -866,18 +753,18 @@ function findDescription(key, boilerplates) {
|
|
|
866
753
|
}
|
|
867
754
|
}
|
|
868
755
|
function printOK(dist, flags, boilerplates) {
|
|
869
|
-
const arrow0 = withIcon("\u2192",
|
|
756
|
+
const arrow0 = withIcon("\u2192", blueBright);
|
|
870
757
|
const list3 = withIcon("-", void 0, 3);
|
|
871
|
-
const cmd3 = withIcon("$",
|
|
872
|
-
console.log(
|
|
873
|
-
console.log(list3(
|
|
758
|
+
const cmd3 = withIcon("$", gray, 3);
|
|
759
|
+
console.log(bold(`${green("\u2713")} Project created at ${cyan(dist)} with:`));
|
|
760
|
+
console.log(list3(green("Typescript")));
|
|
874
761
|
for (const key of flags) {
|
|
875
762
|
const bl = boilerplates.find((b) => b.config.flag === key);
|
|
876
763
|
if (!bl || !bl.config.name)
|
|
877
764
|
continue;
|
|
878
|
-
console.log(list3(
|
|
765
|
+
console.log(list3(green(bl.config.name)));
|
|
879
766
|
}
|
|
880
|
-
console.log("\n" +
|
|
767
|
+
console.log("\n" + bold(arrow0("Next steps:")));
|
|
881
768
|
console.log(cmd3(`cd ${dist}`));
|
|
882
769
|
console.log(cmd3("pnpm install"));
|
|
883
770
|
console.log(cmd3("pnpm run dev"));
|
|
@@ -907,7 +794,7 @@ async function checkArguments(args) {
|
|
|
907
794
|
const stat = await lstat(args.project);
|
|
908
795
|
if (!stat.isDirectory()) {
|
|
909
796
|
console.error(
|
|
910
|
-
`${
|
|
797
|
+
`${yellow("\u26A0")} Target ${cyan(args.project)} already exists but is not a directory. ${yellow("Aborting")}.`
|
|
911
798
|
);
|
|
912
799
|
process.exit(2);
|
|
913
800
|
}
|
|
@@ -915,16 +802,16 @@ async function checkArguments(args) {
|
|
|
915
802
|
await access(args.project, constants.W_OK);
|
|
916
803
|
} catch (_) {
|
|
917
804
|
console.error(
|
|
918
|
-
`${
|
|
805
|
+
`${yellow("\u26A0")} Target folder ${cyan(args.project)} already exists but is not writable. ${yellow("Aborting")}.`
|
|
919
806
|
);
|
|
920
807
|
process.exit(3);
|
|
921
808
|
}
|
|
922
809
|
if ((await readdir(args.project)).length > 0) {
|
|
923
810
|
console.error(
|
|
924
|
-
`${
|
|
811
|
+
`${yellow("\u26A0")} Target folder ${cyan(
|
|
925
812
|
args.project
|
|
926
813
|
)} already exists and is not empty.
|
|
927
|
-
Continuing might erase existing files. ${
|
|
814
|
+
Continuing might erase existing files. ${yellow("Aborting")}.`
|
|
928
815
|
);
|
|
929
816
|
process.exit(4);
|
|
930
817
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@batijs/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"description": "Next-gen scaffolder. Get started with fully-functional apps, and choose any tool you want",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@types/node": "^16.18.37",
|
|
12
12
|
"@types/which": "^3.0.0",
|
|
13
|
-
"citty": "^0.1.
|
|
13
|
+
"citty": "^0.1.2",
|
|
14
14
|
"colorette": "^2.0.20",
|
|
15
15
|
"esbuild": "^0.18.11",
|
|
16
16
|
"espree": "^9.6.0",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"tree-kill": "^1.2.2",
|
|
22
22
|
"tsup": "^7.1.0",
|
|
23
23
|
"typescript": "^5.1.6",
|
|
24
|
-
"vite": "^4.
|
|
24
|
+
"vite": "^4.4.0",
|
|
25
25
|
"vitest": "^0.32.4",
|
|
26
26
|
"which": "^3.0.1",
|
|
27
|
-
"@batijs/build": "0.0.
|
|
28
|
-
"@batijs/tsup": "0.0.
|
|
27
|
+
"@batijs/build": "0.0.40",
|
|
28
|
+
"@batijs/tsup": "0.0.40"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@batijs/core": "0.0.
|
|
31
|
+
"@batijs/core": "0.0.40"
|
|
32
32
|
},
|
|
33
33
|
"bin": "./dist/index.js",
|
|
34
34
|
"exports": {
|