create-fornix 0.0.11 → 0.0.12
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/index.js +80 -56
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2284,32 +2284,56 @@ async function runManualFlow(input) {
|
|
|
2284
2284
|
let selectedHeader;
|
|
2285
2285
|
let selectedFooter;
|
|
2286
2286
|
let selectedContentBlocks = [];
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2287
|
+
while (true) {
|
|
2288
|
+
selectedHeader = void 0;
|
|
2289
|
+
selectedFooter = void 0;
|
|
2290
|
+
selectedContentBlocks = [];
|
|
2291
|
+
if (headerOptions.length > 0) {
|
|
2292
|
+
const noneOption = { value: "__none__", label: "None", hint: "No header" };
|
|
2293
|
+
const headerChoice = await p.select({
|
|
2294
|
+
message: "Choose a header (appears on every page)",
|
|
2295
|
+
options: [noneOption, ...headerOptions]
|
|
2296
|
+
});
|
|
2297
|
+
if (p.isCancel(headerChoice)) return handleCancel();
|
|
2298
|
+
if (headerChoice !== "__none__") selectedHeader = headerChoice;
|
|
2299
|
+
}
|
|
2300
|
+
if (contentOptions.length > 0) {
|
|
2301
|
+
const blocks = await p.multiselect({
|
|
2302
|
+
message: "Select content blocks (space to toggle, enter to confirm)",
|
|
2303
|
+
options: contentOptions,
|
|
2304
|
+
required: false
|
|
2305
|
+
});
|
|
2306
|
+
if (p.isCancel(blocks)) return handleCancel();
|
|
2307
|
+
selectedContentBlocks = blocks;
|
|
2308
|
+
}
|
|
2309
|
+
if (footerOptions.length > 0) {
|
|
2310
|
+
const noneOption = { value: "__none__", label: "None", hint: "No footer" };
|
|
2311
|
+
const footerChoice = await p.select({
|
|
2312
|
+
message: "Choose a footer (appears on every page)",
|
|
2313
|
+
options: [noneOption, ...footerOptions]
|
|
2314
|
+
});
|
|
2315
|
+
if (p.isCancel(footerChoice)) return handleCancel();
|
|
2316
|
+
if (footerChoice !== "__none__") selectedFooter = footerChoice;
|
|
2317
|
+
}
|
|
2318
|
+
const tempSelected = [];
|
|
2319
|
+
if (selectedHeader) tempSelected.push(selectedHeader);
|
|
2320
|
+
tempSelected.push(...selectedContentBlocks);
|
|
2321
|
+
if (selectedFooter) tempSelected.push(selectedFooter);
|
|
2322
|
+
if (tempSelected.length > 0) {
|
|
2323
|
+
const checkResult = resolveDependencies(tempSelected, input.manifests);
|
|
2324
|
+
if (!isOk(checkResult)) {
|
|
2325
|
+
if (checkResult.error.kind === "DependencyConflictError") {
|
|
2326
|
+
p.log.warn(`Conflict detected: ${checkResult.error.blockA} conflicts with ${checkResult.error.blockB}`);
|
|
2327
|
+
const retry = await p.confirm({
|
|
2328
|
+
message: "Block conflict detected. Would you like to select your blocks again?",
|
|
2329
|
+
initialValue: true
|
|
2330
|
+
});
|
|
2331
|
+
if (p.isCancel(retry) || !retry) return handleCancel();
|
|
2332
|
+
continue;
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
break;
|
|
2313
2337
|
}
|
|
2314
2338
|
const localesInput = await p.text({
|
|
2315
2339
|
message: "Locales (comma-separated, e.g. en,es,ar)",
|
|
@@ -2477,58 +2501,58 @@ import { writeFileSync as writeFileSync3 } from "fs";
|
|
|
2477
2501
|
import { join as join4, basename } from "path";
|
|
2478
2502
|
import pc2 from "picocolors";
|
|
2479
2503
|
function runPostScaffold(input, callbacks) {
|
|
2480
|
-
const
|
|
2504
|
+
const log2 = callbacks?.onLog ?? ((msg) => console.log(msg));
|
|
2481
2505
|
const warn = callbacks?.onWarn ?? ((msg) => console.warn(msg));
|
|
2482
2506
|
const { config, resolvedBlockNames, filesWritten, verbose } = input;
|
|
2483
2507
|
const projectDir = config.projectDir;
|
|
2484
2508
|
const projectName = basename(projectDir);
|
|
2485
2509
|
generateClaudeMd(projectDir, config, resolvedBlockNames);
|
|
2486
|
-
if (verbose)
|
|
2510
|
+
if (verbose) log2(pc2.dim(" created CLAUDE.md"));
|
|
2487
2511
|
let installSuccess = false;
|
|
2488
2512
|
if (!input.skipInstall) {
|
|
2489
|
-
installSuccess = installDependencies(projectDir, config.packageManager, verbose,
|
|
2513
|
+
installSuccess = installDependencies(projectDir, config.packageManager, verbose, log2, warn);
|
|
2490
2514
|
}
|
|
2491
2515
|
let gitSuccess = false;
|
|
2492
2516
|
if (!input.skipGit) {
|
|
2493
|
-
gitSuccess = initGit(projectDir, verbose,
|
|
2494
|
-
}
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2517
|
+
gitSuccess = initGit(projectDir, verbose, log2, warn);
|
|
2518
|
+
}
|
|
2519
|
+
log2("");
|
|
2520
|
+
log2(pc2.green(pc2.bold("\u2714 Project created successfully!")));
|
|
2521
|
+
log2("");
|
|
2522
|
+
log2(` ${pc2.bold("Project:")} ${config.projectName}`);
|
|
2523
|
+
log2(` ${pc2.bold("Dir:")} ${projectDir}`);
|
|
2524
|
+
log2(` ${pc2.bold("Render:")} ${config.renderMode}`);
|
|
2525
|
+
log2(` ${pc2.bold("Deploy:")} ${config.deployTarget}`);
|
|
2526
|
+
log2(` ${pc2.bold("CSS:")} ${config.cssEngine}`);
|
|
2503
2527
|
if (resolvedBlockNames.length > 0) {
|
|
2504
|
-
|
|
2528
|
+
log2(` ${pc2.bold("Blocks:")} ${resolvedBlockNames.join(", ")}`);
|
|
2505
2529
|
}
|
|
2506
2530
|
if (config.locales.length > 1) {
|
|
2507
|
-
|
|
2531
|
+
log2(` ${pc2.bold("Locales:")} ${config.locales.join(", ")} (default: ${config.defaultLocale})`);
|
|
2508
2532
|
}
|
|
2509
2533
|
if (config.palette.preset) {
|
|
2510
|
-
|
|
2534
|
+
log2(` ${pc2.bold("Palette:")} ${config.palette.preset}`);
|
|
2511
2535
|
}
|
|
2512
|
-
|
|
2536
|
+
log2(` ${pc2.bold("Files:")} ${filesWritten} files written`);
|
|
2513
2537
|
if (installSuccess) {
|
|
2514
|
-
|
|
2538
|
+
log2(` ${pc2.bold("Deps:")} ${pc2.green("installed")}`);
|
|
2515
2539
|
}
|
|
2516
2540
|
if (gitSuccess) {
|
|
2517
|
-
|
|
2541
|
+
log2(` ${pc2.bold("Git:")} ${pc2.green("initialized")}`);
|
|
2518
2542
|
}
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2543
|
+
log2("");
|
|
2544
|
+
log2(pc2.dim(" Next steps:"));
|
|
2545
|
+
log2(pc2.dim(` cd ${projectName}`));
|
|
2522
2546
|
if (!installSuccess) {
|
|
2523
|
-
|
|
2547
|
+
log2(pc2.dim(` ${config.packageManager} install`));
|
|
2524
2548
|
}
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2549
|
+
log2(pc2.dim(` ${config.packageManager} dev`));
|
|
2550
|
+
log2(pc2.dim(` npx create-fornix add <block>`));
|
|
2551
|
+
log2("");
|
|
2528
2552
|
}
|
|
2529
|
-
function installDependencies(projectDir, packageManager, verbose,
|
|
2553
|
+
function installDependencies(projectDir, packageManager, verbose, log2, warn) {
|
|
2530
2554
|
try {
|
|
2531
|
-
|
|
2555
|
+
log2(pc2.dim(" Installing dependencies..."));
|
|
2532
2556
|
const cmd = `${packageManager} install`;
|
|
2533
2557
|
execSync(cmd, {
|
|
2534
2558
|
cwd: projectDir,
|
|
@@ -2542,9 +2566,9 @@ function installDependencies(projectDir, packageManager, verbose, log, warn) {
|
|
|
2542
2566
|
return false;
|
|
2543
2567
|
}
|
|
2544
2568
|
}
|
|
2545
|
-
function initGit(projectDir, verbose,
|
|
2569
|
+
function initGit(projectDir, verbose, log2, warn) {
|
|
2546
2570
|
try {
|
|
2547
|
-
if (verbose)
|
|
2571
|
+
if (verbose) log2(pc2.dim(" Initializing git repository..."));
|
|
2548
2572
|
execSync("git init", {
|
|
2549
2573
|
cwd: projectDir,
|
|
2550
2574
|
stdio: "pipe",
|