create-addfox-app 0.1.1-beta.16 → 0.1.1-beta.17

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.
Files changed (2) hide show
  1. package/dist/cli.js +132 -131
  2. package/package.json +7 -4
package/dist/cli.js CHANGED
@@ -1,23 +1,23 @@
1
1
  #!/usr/bin/env node
2
- import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
3
- import { dirname, join, relative, resolve as external_node_path_resolve } from "node:path";
4
- import { fileURLToPath } from "node:url";
5
- import { createRequire } from "node:module";
6
- import { execSync } from "node:child_process";
7
- import prompts from "prompts";
8
- import { blue, cyan, dim, gray, green, lightBlue, magenta, red, trueColor, yellow } from "kolorist";
9
- import minimist from "minimist";
10
- import { cp, mkdir } from "node:fs/promises";
11
- import { detectPackageManager, getExecCommand, getInstallCommand, getRunCommand } from "@addfox/pkg-manager";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
4
+ import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
5
+ import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
6
+ import * as __WEBPACK_EXTERNAL_MODULE_node_child_process_27f17141__ from "node:child_process";
7
+ import * as __WEBPACK_EXTERNAL_MODULE_prompts__ from "prompts";
8
+ import * as __WEBPACK_EXTERNAL_MODULE_kolorist__ from "kolorist";
9
+ import * as __WEBPACK_EXTERNAL_MODULE_minimist__ from "minimist";
10
+ import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
11
+ import * as __WEBPACK_EXTERNAL_MODULE__addfox_pkg_manager_41697cb6__ from "@addfox/pkg-manager";
12
12
  const TEMPLATE_BASE = "templates";
13
13
  function getPackageRoot() {
14
- return external_node_path_resolve(dirname(fileURLToPath(import.meta.url)), "..");
14
+ return (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.resolve)((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.dirname)((0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.fileURLToPath)(import.meta.url)), "..");
15
15
  }
16
16
  function getBundledTemplatesDir() {
17
- return join(getPackageRoot(), TEMPLATE_BASE);
17
+ return (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(getPackageRoot(), TEMPLATE_BASE);
18
18
  }
19
19
  function hasLocalTemplate(templateName) {
20
- return existsSync(join(getBundledTemplatesDir(), templateName));
20
+ return (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.existsSync)((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(getBundledTemplatesDir(), templateName));
21
21
  }
22
22
  const SKIP_RELATIVE_SEGMENTS = new Set([
23
23
  "node_modules",
@@ -25,35 +25,35 @@ const SKIP_RELATIVE_SEGMENTS = new Set([
25
25
  ".pnpm"
26
26
  ]);
27
27
  function shouldCopyLocalTemplatePath(src, templateRoot) {
28
- const root = external_node_path_resolve(templateRoot);
29
- const rel = relative(root, external_node_path_resolve(src));
28
+ const root = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.resolve)(templateRoot);
29
+ const rel = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.relative)(root, (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.resolve)(src));
30
30
  if (rel.startsWith("..")) return true;
31
31
  for (const part of rel.split(/[/\\]/))if (SKIP_RELATIVE_SEGMENTS.has(part)) return false;
32
32
  return true;
33
33
  }
34
34
  async function copyBundledTemplate(templateName, destDir) {
35
- const templatePath = join(getBundledTemplatesDir(), templateName);
36
- if (!existsSync(templatePath)) throw new Error(`Bundled template "${templateName}" not found under create-addfox-app. Reinstall the package.`);
37
- await mkdir(destDir, {
35
+ const templatePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(getBundledTemplatesDir(), templateName);
36
+ if (!(0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.existsSync)(templatePath)) throw new Error(`Bundled template "${templateName}" not found under create-addfox-app. Reinstall the package.`);
37
+ await (0, __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__.mkdir)(destDir, {
38
38
  recursive: true
39
39
  });
40
- const resolvedTemplate = external_node_path_resolve(templatePath);
41
- await cp(resolvedTemplate, destDir, {
40
+ const resolvedTemplate = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.resolve)(templatePath);
41
+ await (0, __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__.cp)(resolvedTemplate, destDir, {
42
42
  recursive: true,
43
43
  filter: (src)=>shouldCopyLocalTemplatePath(src, resolvedTemplate)
44
44
  });
45
45
  }
46
46
  const FRAMES = [
47
- "⠋",
48
- "⠙",
49
- "⠹",
50
- "⠸",
51
- "⠼",
52
- "⠴",
53
- "⠦",
54
- "⠧",
55
- "⠇",
56
- "⠏"
47
+ "\u280B",
48
+ "\u2819",
49
+ "\u2839",
50
+ "\u2838",
51
+ "\u283C",
52
+ "\u2834",
53
+ "\u2826",
54
+ "\u2827",
55
+ "\u2807",
56
+ "\u280F"
57
57
  ];
58
58
  const INTERVAL_MS = 80;
59
59
  function clearSpinnerLine() {
@@ -67,7 +67,7 @@ function sleep(ms) {
67
67
  async function runWithTemplateSpinner(label, fn, options) {
68
68
  const minVisibleMs = options?.minVisibleMs ?? 0;
69
69
  if (!process.stdout.isTTY) {
70
- console.log(yellow(`\n ${label}\n`));
70
+ console.log((0, __WEBPACK_EXTERNAL_MODULE_kolorist__.yellow)(`\n ${label}\n`));
71
71
  return fn();
72
72
  }
73
73
  let frameIndex = 0;
@@ -75,7 +75,7 @@ async function runWithTemplateSpinner(label, fn, options) {
75
75
  const timer = setInterval(()=>{
76
76
  const frame = FRAMES[frameIndex % FRAMES.length];
77
77
  frameIndex += 1;
78
- process.stdout.write(`\r ${yellow(frame)} ${label}`);
78
+ process.stdout.write(`\r ${(0, __WEBPACK_EXTERNAL_MODULE_kolorist__.yellow)(frame)} ${label}`);
79
79
  }, INTERVAL_MS);
80
80
  const startedAt = Date.now();
81
81
  try {
@@ -181,22 +181,22 @@ function filterAppEntries(destDir, selectedEntries) {
181
181
  const useAll = selectedEntries.includes("__all__");
182
182
  if (useAll) return;
183
183
  const keepSet = new Set(selectedEntries);
184
- const appPath = join(destDir, APP_DIR);
185
- if (!existsSync(appPath)) return;
186
- const dirs = readdirSync(appPath, {
184
+ const appPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(destDir, APP_DIR);
185
+ if (!(0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.existsSync)(appPath)) return;
186
+ const dirs = (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.readdirSync)(appPath, {
187
187
  withFileTypes: true
188
188
  }).filter((d)=>d.isDirectory()).map((d)=>d.name);
189
189
  for (const dir of dirs){
190
190
  const isEntryDir = ENTRY_APP_DIRS.includes(dir);
191
- if (isEntryDir && !keepSet.has(dir)) rmSync(join(appPath, dir), {
191
+ if (isEntryDir && !keepSet.has(dir)) (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.rmSync)((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(appPath, dir), {
192
192
  recursive: true
193
193
  });
194
194
  }
195
195
  }
196
196
  function getExistingAppEntryDirs(destDir) {
197
- const appPath = join(destDir, APP_DIR);
198
- if (!existsSync(appPath)) return [];
199
- return readdirSync(appPath, {
197
+ const appPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(destDir, APP_DIR);
198
+ if (!(0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.existsSync)(appPath)) return [];
199
+ return (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.readdirSync)(appPath, {
200
200
  withFileTypes: true
201
201
  }).filter((d)=>d.isDirectory()).map((d)=>d.name).filter((name)=>ENTRY_APP_DIRS.includes(name));
202
202
  }
@@ -338,11 +338,11 @@ function stripUtf8Bom(text) {
338
338
  return text.startsWith(UTF8_BOM) ? text.slice(UTF8_BOM.length) : text;
339
339
  }
340
340
  function readJsonFile(path) {
341
- const raw = readFileSync(path, "utf8");
341
+ const raw = (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.readFileSync)(path, "utf8");
342
342
  return JSON.parse(stripUtf8Bom(raw));
343
343
  }
344
344
  function writeJsonFile(path, data) {
345
- writeFileSync(path, JSON.stringify(data, null, 2), "utf8");
345
+ (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.writeFileSync)(path, JSON.stringify(data, null, 2), "utf8");
346
346
  }
347
347
  const RSTEST_CORE = "^0.9.4";
348
348
  const RSTEST_COVERAGE = "^0.3.0";
@@ -418,10 +418,10 @@ function generateRstestConfig(language, testKinds) {
418
418
  }
419
419
  function writeUnitSample(root, language) {
420
420
  const ext = getTestExt(language);
421
- mkdirSync(external_node_path_resolve(root, "__tests__"), {
421
+ (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.mkdirSync)((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.resolve)(root, "__tests__"), {
422
422
  recursive: true
423
423
  });
424
- const path = external_node_path_resolve(root, "__tests__", `example.test.${ext}`);
424
+ const path = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.resolve)(root, "__tests__", `example.test.${ext}`);
425
425
  const body = "ts" === language ? `import { describe, expect, it } from "@rstest/core";
426
426
 
427
427
  describe("example unit tests", () => {
@@ -437,15 +437,15 @@ describe("example unit tests", () => {
437
437
  });
438
438
  });
439
439
  `;
440
- writeFileSync(path, body, "utf-8");
440
+ (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.writeFileSync)(path, body, "utf-8");
441
441
  }
442
442
  function writeE2eSample(root, language) {
443
443
  const ext = getTestExt(language);
444
- const dir = external_node_path_resolve(root, "__tests__", "e2e");
445
- mkdirSync(dir, {
444
+ const dir = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.resolve)(root, "__tests__", "e2e");
445
+ (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.mkdirSync)(dir, {
446
446
  recursive: true
447
447
  });
448
- const path = external_node_path_resolve(dir, `example.browser.test.${ext}`);
448
+ const path = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.resolve)(dir, `example.browser.test.${ext}`);
449
449
  const body = `import { describe, expect, it } from "@rstest/core";
450
450
  import { page } from "@rstest/browser";
451
451
 
@@ -458,7 +458,7 @@ describe("E2E browser tests", () => {
458
458
  });
459
459
  });
460
460
  `;
461
- writeFileSync(path, body, "utf-8");
461
+ (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.writeFileSync)(path, body, "utf-8");
462
462
  }
463
463
  function mergeDevDeps(pkg, testKinds, installRsdoctor) {
464
464
  const dev = pkg.devDependencies ?? {};
@@ -482,7 +482,7 @@ function mergeScripts(pkg, testKinds) {
482
482
  function applyTestAndReportSetup(root, language, selection) {
483
483
  const { testKinds, installRsdoctor } = selection;
484
484
  if (0 === testKinds.length && !installRsdoctor) return;
485
- const pkgPath = external_node_path_resolve(root, "package.json");
485
+ const pkgPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.resolve)(root, "package.json");
486
486
  const pkg = readJsonFile(pkgPath);
487
487
  mergeDevDeps(pkg, testKinds, installRsdoctor);
488
488
  mergeScripts(pkg, testKinds);
@@ -490,19 +490,19 @@ function applyTestAndReportSetup(root, language, selection) {
490
490
  if (testKinds.length > 0) {
491
491
  const configName = "ts" === language ? "rstest.config.ts" : "rstest.config.js";
492
492
  const content = generateRstestConfig(language, testKinds);
493
- writeFileSync(external_node_path_resolve(root, configName), content, "utf-8");
493
+ (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.writeFileSync)((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.resolve)(root, configName), content, "utf-8");
494
494
  if (testKinds.includes("unit")) writeUnitSample(root, language);
495
495
  if (testKinds.includes("e2e")) writeE2eSample(root, language);
496
496
  }
497
497
  }
498
498
  const RESET = "\x1b[0m";
499
499
  const LOGO_LINES = [
500
- " █████╗ ██████╗ ██████╗ ███████╗ ██████╗ ██╗ ██╗",
501
- "██╔══██╗██╔══██╗██╔══██╗██╔════╝██╔═══██╗╚██╗██╔╝",
502
- "███████║██║ ██║██║ ██║█████╗ ██║ ██║ ╚███╔╝ ",
503
- "██╔══██║██║ ██║██║ ██║██╔══╝ ██║ ██║ ██╔██╗ ",
504
- "██║ ██║██████╔╝██████╔╝██║ ╚██████╔╝██╔╝ ██╗",
505
- "╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝"
500
+ " \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557",
501
+ "\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u255A\u2588\u2588\u2557\u2588\u2588\u2554\u255D",
502
+ "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2554\u255D ",
503
+ "\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u2588\u2588\u2557 ",
504
+ "\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2554\u255D \u2588\u2588\u2557",
505
+ "\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D"
506
506
  ];
507
507
  const GRADIENT_START_256 = 208;
508
508
  const GRADIENT_END_256 = 213;
@@ -571,8 +571,8 @@ function styleFileName(engine) {
571
571
  return "global.scss";
572
572
  }
573
573
  function listUiEntryScripts(root, language) {
574
- const appDir = join(root, "app");
575
- if (!existsSync(appDir)) return [];
574
+ const appDir = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(root, "app");
575
+ if (!(0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.existsSync)(appDir)) return [];
576
576
  const extOrder = "ts" === language ? [
577
577
  ".tsx",
578
578
  ".ts",
@@ -585,12 +585,12 @@ function listUiEntryScripts(root, language) {
585
585
  ".svelte"
586
586
  ];
587
587
  const out = [];
588
- for (const name of readdirSync(appDir)){
588
+ for (const name of (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.readdirSync)(appDir)){
589
589
  if (SKIP_STYLE_ENTRIES.has(name)) continue;
590
- const sub = join(appDir, name);
591
- if (statSync(sub).isDirectory()) for (const ext of extOrder){
592
- const p = join(sub, `index${ext}`);
593
- if (existsSync(p)) {
590
+ const sub = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(appDir, name);
591
+ if ((0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.statSync)(sub).isDirectory()) for (const ext of extOrder){
592
+ const p = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(sub, `index${ext}`);
593
+ if ((0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.existsSync)(p)) {
594
594
  out.push(p);
595
595
  break;
596
596
  }
@@ -599,23 +599,23 @@ function listUiEntryScripts(root, language) {
599
599
  return out;
600
600
  }
601
601
  function buildStyleImportLine(entryFile, engine) {
602
- const entryDir = join(entryFile, "..");
603
- const stylePath = join(entryDir, "..", "styles", styleFileName(engine));
604
- const rel = relative(entryDir, stylePath).replace(/\\/g, "/");
602
+ const entryDir = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(entryFile, "..");
603
+ const stylePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(entryDir, "..", "styles", styleFileName(engine));
604
+ const rel = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.relative)(entryDir, stylePath).replace(/\\/g, "/");
605
605
  return `import "${rel}";`;
606
606
  }
607
607
  function prependImportIfMissing(filePath, line) {
608
- const raw = readFileSync(filePath, "utf8");
608
+ const raw = (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.readFileSync)(filePath, "utf8");
609
609
  if (raw.includes("/styles/global.") || raw.includes("/styles/uno.css")) return;
610
- writeFileSync(filePath, `${line}\n${raw}`, "utf8");
610
+ (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.writeFileSync)(filePath, `${line}\n${raw}`, "utf8");
611
611
  }
612
612
  function writeTailwindFiles(root) {
613
- const dir = join(root, "app", "styles");
614
- mkdirSync(dir, {
613
+ const dir = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(root, "app", "styles");
614
+ (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.mkdirSync)(dir, {
615
615
  recursive: true
616
616
  });
617
- writeFileSync(join(dir, "global.css"), '@import "tailwindcss";\n', "utf8");
618
- writeFileSync(join(root, "postcss.config.mjs"), `export default {
617
+ (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.writeFileSync)((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(dir, "global.css"), '@import "tailwindcss";\n', "utf8");
618
+ (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.writeFileSync)((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(root, "postcss.config.mjs"), `export default {
619
619
  plugins: {
620
620
  "@tailwindcss/postcss": {},
621
621
  autoprefixer: {},
@@ -624,20 +624,20 @@ function writeTailwindFiles(root) {
624
624
  `, "utf8");
625
625
  }
626
626
  function writeUnoFiles(root) {
627
- const dir = join(root, "app", "styles");
628
- mkdirSync(dir, {
627
+ const dir = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(root, "app", "styles");
628
+ (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.mkdirSync)(dir, {
629
629
  recursive: true
630
630
  });
631
- writeFileSync(join(dir, "uno.css"), `@unocss preflights;
631
+ (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.writeFileSync)((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(dir, "uno.css"), `@unocss preflights;
632
632
  @unocss default;
633
633
  `, "utf8");
634
- writeFileSync(join(root, "postcss.config.mjs"), `import UnoCSS from "@unocss/postcss";
634
+ (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.writeFileSync)((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(root, "postcss.config.mjs"), `import UnoCSS from "@unocss/postcss";
635
635
 
636
636
  export default {
637
637
  plugins: [UnoCSS()],
638
638
  };
639
639
  `, "utf8");
640
- writeFileSync(join(root, "uno.config.ts"), `import { defineConfig, presetUno } from "unocss";
640
+ (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.writeFileSync)((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(root, "uno.config.ts"), `import { defineConfig, presetUno } from "unocss";
641
641
 
642
642
  export default defineConfig({
643
643
  content: {
@@ -648,11 +648,12 @@ export default defineConfig({
648
648
  `, "utf8");
649
649
  }
650
650
  function writeLessSassFiles(root, engine) {
651
- const dir = join(root, "app", "styles");
652
- mkdirSync(dir, {
651
+ const dir = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(root, "app", "styles");
652
+ (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.mkdirSync)(dir, {
653
653
  recursive: true
654
654
  });
655
- "less" === engine ? writeFileSync(join(dir, "global.less"), "body {\n margin: 0;\n}\n", "utf8") : writeFileSync(join(dir, "global.scss"), "body {\n margin: 0;\n}\n", "utf8");
655
+ if ("less" === engine) (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.writeFileSync)((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(dir, "global.less"), "body {\n margin: 0;\n}\n", "utf8");
656
+ else (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.writeFileSync)((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(dir, "global.scss"), "body {\n margin: 0;\n}\n", "utf8");
656
657
  }
657
658
  function mergeDevDependencies(pkg, engine) {
658
659
  const dev = pkg.devDependencies ?? {};
@@ -666,7 +667,7 @@ function writeEngineFiles(root, engine) {
666
667
  }
667
668
  function applyStyleEngine(root, _framework, language, engine) {
668
669
  if ("none" === engine) return;
669
- const pkgPath = join(root, "package.json");
670
+ const pkgPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(root, "package.json");
670
671
  const pkg = readJsonFile(pkgPath);
671
672
  mergeDevDependencies(pkg, engine);
672
673
  writeJsonFile(pkgPath, pkg);
@@ -674,7 +675,7 @@ function applyStyleEngine(root, _framework, language, engine) {
674
675
  const entries = listUiEntryScripts(root, language);
675
676
  for (const file of entries)prependImportIfMissing(file, buildStyleImportLine(file, engine));
676
677
  }
677
- const cli_require = createRequire(import.meta.url);
678
+ const cli_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url);
678
679
  try {
679
680
  const figures = cli_require("prompts/lib/util/figures");
680
681
  figures.radioOn = "\u25CF";
@@ -685,15 +686,15 @@ const PROMPT_SELECT_HINT = "- Use arrow-keys. Enter to confirm";
685
686
  function multiselectInstructions(showToggleAll) {
686
687
  return "\nInstructions:\n ↑/↓: Highlight option\n ←/→/[space]: Toggle selection\n" + (showToggleAll ? " a: Toggle all\n" : "") + " Enter to confirm";
687
688
  }
688
- const orange = trueColor(230, 138, 46);
689
+ const orange = (0, __WEBPACK_EXTERNAL_MODULE_kolorist__.trueColor)(230, 138, 46);
689
690
  function getFrameworkChoicesColored() {
690
691
  const colors = {
691
- vanilla: gray,
692
- vue: green,
693
- react: cyan,
694
- preact: yellow,
695
- svelte: red,
696
- solid: lightBlue
692
+ vanilla: __WEBPACK_EXTERNAL_MODULE_kolorist__.gray,
693
+ vue: __WEBPACK_EXTERNAL_MODULE_kolorist__.green,
694
+ react: __WEBPACK_EXTERNAL_MODULE_kolorist__.cyan,
695
+ preact: __WEBPACK_EXTERNAL_MODULE_kolorist__.yellow,
696
+ svelte: __WEBPACK_EXTERNAL_MODULE_kolorist__.red,
697
+ solid: __WEBPACK_EXTERNAL_MODULE_kolorist__.lightBlue
697
698
  };
698
699
  return FRAMEWORKS.map((f)=>({
699
700
  ...f,
@@ -703,11 +704,11 @@ function getFrameworkChoicesColored() {
703
704
  function getLanguageChoicesColored() {
704
705
  return [
705
706
  {
706
- title: cyan("TypeScript"),
707
+ title: (0, __WEBPACK_EXTERNAL_MODULE_kolorist__.cyan)("TypeScript"),
707
708
  value: "ts"
708
709
  },
709
710
  {
710
- title: yellow("JavaScript"),
711
+ title: (0, __WEBPACK_EXTERNAL_MODULE_kolorist__.yellow)("JavaScript"),
711
712
  value: "js"
712
713
  }
713
714
  ];
@@ -715,9 +716,9 @@ function getLanguageChoicesColored() {
715
716
  function getPackageManagerChoicesColored() {
716
717
  const colors = {
717
718
  pnpm: orange,
718
- npm: red,
719
- yarn: blue,
720
- bun: green
719
+ npm: __WEBPACK_EXTERNAL_MODULE_kolorist__.red,
720
+ yarn: __WEBPACK_EXTERNAL_MODULE_kolorist__.blue,
721
+ bun: __WEBPACK_EXTERNAL_MODULE_kolorist__.green
721
722
  };
722
723
  return PACKAGE_MANAGER_CHOICES.map((c)=>({
723
724
  ...c,
@@ -726,11 +727,11 @@ function getPackageManagerChoicesColored() {
726
727
  }
727
728
  function getStyleEngineChoicesColored() {
728
729
  const colors = {
729
- none: dim,
730
- tailwindcss: cyan,
731
- unocss: green,
732
- less: yellow,
733
- sass: magenta
730
+ none: __WEBPACK_EXTERNAL_MODULE_kolorist__.dim,
731
+ tailwindcss: __WEBPACK_EXTERNAL_MODULE_kolorist__.cyan,
732
+ unocss: __WEBPACK_EXTERNAL_MODULE_kolorist__.green,
733
+ less: __WEBPACK_EXTERNAL_MODULE_kolorist__.yellow,
734
+ sass: __WEBPACK_EXTERNAL_MODULE_kolorist__.magenta
734
735
  };
735
736
  return STYLE_ENGINES.map((c)=>({
736
737
  ...c,
@@ -739,8 +740,8 @@ function getStyleEngineChoicesColored() {
739
740
  }
740
741
  function getVersion() {
741
742
  try {
742
- const pkgPath = external_node_path_resolve(dirname(fileURLToPath(import.meta.url)), "..", "package.json");
743
- const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
743
+ const pkgPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.resolve)((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.dirname)((0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.fileURLToPath)(import.meta.url)), "..", "package.json");
744
+ const pkg = JSON.parse((0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.readFileSync)(pkgPath, "utf-8"));
744
745
  return pkg.version ?? "0.0.0";
745
746
  } catch {
746
747
  return "0.0.0";
@@ -786,7 +787,7 @@ function parseStyleEngineArg(raw) {
786
787
  return "tailwindcss";
787
788
  }
788
789
  async function confirmOverwrite(dir) {
789
- const { action } = await prompts({
790
+ const { action } = await (0, __WEBPACK_EXTERNAL_MODULE_prompts__["default"])({
790
791
  type: "select",
791
792
  name: "action",
792
793
  message: `Directory "${dir}" already exists. What would you like to do?`,
@@ -807,7 +808,7 @@ async function confirmOverwrite(dir) {
807
808
  return "overwrite" === action;
808
809
  }
809
810
  async function promptOptions() {
810
- const res = await prompts([
811
+ const res = await (0, __WEBPACK_EXTERNAL_MODULE_prompts__["default"])([
811
812
  {
812
813
  type: "select",
813
814
  name: "framework",
@@ -842,7 +843,7 @@ async function promptOptions() {
842
843
  message: "Select extension entries",
843
844
  choices: ENTRY_CHOICES,
844
845
  min: 1,
845
- hint: "Space to toggle (○ unselected, ● selected)",
846
+ hint: "Space to toggle (\u25CB unselected, \u25CF selected)",
846
847
  instructions: multiselectInstructions(true)
847
848
  }
848
849
  ]);
@@ -857,26 +858,26 @@ async function promptOptions() {
857
858
  }
858
859
  const TEST_KIND_CHOICES = [
859
860
  {
860
- title: "Unit — rstest (Node)",
861
+ title: "Unit \u2014 rstest (Node)",
861
862
  value: "unit"
862
863
  },
863
864
  {
864
- title: "E2E — rstest + Playwright (browser)",
865
+ title: "E2E \u2014 rstest + Playwright (browser)",
865
866
  value: "e2e"
866
867
  }
867
868
  ];
868
869
  async function promptTestAndReport() {
869
- const testRes = await prompts({
870
+ const testRes = await (0, __WEBPACK_EXTERNAL_MODULE_prompts__["default"])({
870
871
  type: "multiselect",
871
872
  name: "testKinds",
872
873
  message: "Initialize test config? (optional)",
873
874
  choices: TEST_KIND_CHOICES,
874
875
  min: 0,
875
- hint: "Space toggles — leave empty to skip",
876
+ hint: "Space toggles \u2014 leave empty to skip",
876
877
  instructions: multiselectInstructions(true)
877
878
  });
878
879
  if (void 0 === testRes.testKinds) return null;
879
- const docRes = await prompts({
880
+ const docRes = await (0, __WEBPACK_EXTERNAL_MODULE_prompts__["default"])({
880
881
  type: "select",
881
882
  name: "installRsdoctor",
882
883
  message: "Install Rsdoctor (@rsdoctor/rspack-plugin) for bundle analysis? After install, use addfox dev or addfox build with --report.",
@@ -909,26 +910,26 @@ function resolveTestSelectionFromArgv(argv) {
909
910
  };
910
911
  }
911
912
  function updatePackageName(destDir, projectName) {
912
- const pkgPath = external_node_path_resolve(destDir, "package.json");
913
- if (!existsSync(pkgPath)) return;
913
+ const pkgPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.resolve)(destDir, "package.json");
914
+ if (!(0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.existsSync)(pkgPath)) return;
914
915
  const pkg = readJsonFile(pkgPath);
915
916
  pkg.name = projectName.replace(/\s+/g, "-").toLowerCase();
916
917
  writeJsonFile(pkgPath, pkg);
917
918
  }
918
919
  async function main() {
919
- const argv = minimist(process.argv.slice(2));
920
+ const argv = (0, __WEBPACK_EXTERNAL_MODULE_minimist__["default"])(process.argv.slice(2));
920
921
  if (argv.help || argv.h) return void printHelp();
921
922
  if (argv.version || argv.v) return void console.log(getVersion());
922
923
  const targetDir = argv._[0] ?? "my-extension";
923
924
  const cliFramework = argv.framework;
924
925
  const cliLanguage = argv.language;
925
926
  printAddfoxLogo();
926
- console.log(blue("\n Create Addfox App\n"));
927
- const root = external_node_path_resolve(process.cwd(), targetDir);
928
- if (existsSync(root)) {
927
+ console.log((0, __WEBPACK_EXTERNAL_MODULE_kolorist__.blue)("\n Create Addfox App\n"));
928
+ const root = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.resolve)(process.cwd(), targetDir);
929
+ if ((0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.existsSync)(root)) {
929
930
  const confirmed = await confirmOverwrite(targetDir);
930
931
  if (!confirmed) process.exit(0);
931
- rmSync(root, {
932
+ (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.rmSync)(root, {
932
933
  recursive: true,
933
934
  force: true
934
935
  });
@@ -937,7 +938,7 @@ async function main() {
937
938
  framework: cliFramework,
938
939
  styleEngine: parseStyleEngineArg(argv.style),
939
940
  language: cliLanguage,
940
- packageManager: detectPackageManager(),
941
+ packageManager: (0, __WEBPACK_EXTERNAL_MODULE__addfox_pkg_manager_41697cb6__.detectPackageManager)(),
941
942
  entries: [
942
943
  "__all__"
943
944
  ]
@@ -960,7 +961,7 @@ async function main() {
960
961
  minVisibleMs: TEMPLATE_SPINNER_MIN_MS
961
962
  } : void 0);
962
963
  } catch (err) {
963
- console.error(red(`\n Failed to copy template: ${err.message}\n`));
964
+ console.error((0, __WEBPACK_EXTERNAL_MODULE_kolorist__.red)(`\n Failed to copy template: ${err.message}\n`));
964
965
  process.exit(1);
965
966
  }
966
967
  const useAllEntries = options.entries.includes("__all__");
@@ -970,19 +971,19 @@ async function main() {
970
971
  ] : options.entries.filter((e)=>"__all__" !== e && existingDirs.includes(e));
971
972
  if (!useAllEntries && effectiveEntries.length > 0) filterAppEntries(root, effectiveEntries);
972
973
  const configExt = "ts" === options.language ? "ts" : "js";
973
- const configPath = external_node_path_resolve(root, `addfox.config.${configExt}`);
974
+ const configPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.resolve)(root, `addfox.config.${configExt}`);
974
975
  let configContent;
975
- if (existsSync(configPath)) {
976
- const existing = readFileSync(configPath, "utf-8");
976
+ if ((0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.existsSync)(configPath)) {
977
+ const existing = (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.readFileSync)(configPath, "utf-8");
977
978
  configContent = existing.trim().length > 0 && existing.includes("defineConfig") ? mergeScaffoldIntoAddfoxConfig(existing, options.styleEngine) : generateAddfoxConfig(options.framework, options.language, options.styleEngine);
978
979
  } else configContent = generateAddfoxConfig(options.framework, options.language, options.styleEngine);
979
- writeFileSync(configPath, configContent, "utf-8");
980
+ (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.writeFileSync)(configPath, configContent, "utf-8");
980
981
  updatePackageName(root, targetDir);
981
982
  applyStyleEngine(root, options.framework, options.language, options.styleEngine);
982
983
  applyTestAndReportSetup(root, options.language, testSelection);
983
- const installCmd = getInstallCommand(pm);
984
- const devCmd = getRunCommand(pm, "dev");
985
- const { installSkills } = await prompts({
984
+ const installCmd = (0, __WEBPACK_EXTERNAL_MODULE__addfox_pkg_manager_41697cb6__.getInstallCommand)(pm);
985
+ const devCmd = (0, __WEBPACK_EXTERNAL_MODULE__addfox_pkg_manager_41697cb6__.getRunCommand)(pm, "dev");
986
+ const { installSkills } = await (0, __WEBPACK_EXTERNAL_MODULE_prompts__["default"])({
986
987
  type: "select",
987
988
  name: "installSkills",
988
989
  message: "Install addfox skills?",
@@ -1000,20 +1001,20 @@ async function main() {
1000
1001
  hint: PROMPT_SELECT_HINT
1001
1002
  });
1002
1003
  if (true === installSkills) {
1003
- const execCmd = getExecCommand(pm);
1004
+ const execCmd = (0, __WEBPACK_EXTERNAL_MODULE__addfox_pkg_manager_41697cb6__.getExecCommand)(pm);
1004
1005
  const fullCmd = `${execCmd} skills add ${SKILLS_REPO}`;
1005
- console.log(yellow("\n Running: " + fullCmd + "\n"));
1006
+ console.log((0, __WEBPACK_EXTERNAL_MODULE_kolorist__.yellow)("\n Running: " + fullCmd + "\n"));
1006
1007
  try {
1007
- execSync(fullCmd, {
1008
+ (0, __WEBPACK_EXTERNAL_MODULE_node_child_process_27f17141__.execSync)(fullCmd, {
1008
1009
  cwd: root,
1009
1010
  stdio: "inherit"
1010
1011
  });
1011
1012
  } catch {
1012
- console.log(dim(" (Skills install skipped or failed; you can run it later.)\n"));
1013
+ console.log((0, __WEBPACK_EXTERNAL_MODULE_kolorist__.dim)(" (Skills install skipped or failed; you can run it later.)\n"));
1013
1014
  }
1014
1015
  }
1015
- console.log(green("\n ✓ Project created successfully\n"));
1016
- console.log(dim(" Next steps:\n"));
1016
+ console.log((0, __WEBPACK_EXTERNAL_MODULE_kolorist__.green)("\n \u2713 Project created successfully\n"));
1017
+ console.log((0, __WEBPACK_EXTERNAL_MODULE_kolorist__.dim)(" Next steps:\n"));
1017
1018
  console.log(` cd ${targetDir}`);
1018
1019
  console.log(` ${installCmd}`);
1019
1020
  console.log(` ${devCmd}\n`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-addfox-app",
3
- "version": "0.1.1-beta.16",
3
+ "version": "0.1.1-beta.17",
4
4
  "description": "Interactive scaffolder for addfox extension projects",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -17,11 +17,14 @@
17
17
  "prompts": "^2.4.2",
18
18
  "kolorist": "^1.8.0",
19
19
  "minimist": "^1.2.8",
20
- "@addfox/pkg-manager": "0.1.1-beta.9"
20
+ "@addfox/pkg-manager": "0.1.1-beta.10"
21
+ },
22
+ "engines": {
23
+ "node": ">=18.0.0"
21
24
  },
22
25
  "devDependencies": {
23
- "@rslib/core": "^0.20.0",
24
- "@rstest/core": "^0.9.4",
26
+ "@rslib/core": "^0.6.0",
27
+ "@rstest/core": "^0.9.0",
25
28
  "@rstest/coverage-istanbul": "^0.3.0",
26
29
  "@types/node": "^20.0.0",
27
30
  "typescript": "^5.0.0"