create-zenith 1.3.17 → 1.3.19

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 (4) hide show
  1. package/README.md +39 -3
  2. package/dist/cli.js +328 -127
  3. package/dist/index.js +328 -127
  4. package/package.json +11 -6
package/dist/cli.js CHANGED
@@ -4,20 +4,34 @@ var __getProtoOf = Object.getPrototypeOf;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
7
12
  var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
8
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
9
21
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
22
  for (let key of __getOwnPropNames(mod))
11
23
  if (!__hasOwnProp.call(to, key))
12
24
  __defProp(to, key, {
13
- get: () => mod[key],
25
+ get: __accessProp.bind(mod, key),
14
26
  enumerable: true
15
27
  });
28
+ if (canCache)
29
+ cache.set(mod, to);
16
30
  return to;
17
31
  };
18
32
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
19
33
 
20
- // ../node_modules/.bun/picocolors@1.1.1/node_modules/picocolors/picocolors.js
34
+ // ../../node_modules/.bun/picocolors@1.1.1/node_modules/picocolors/picocolors.js
21
35
  var require_picocolors = __commonJS((exports, module) => {
22
36
  var p = process || {};
23
37
  var argv = p.argv || [];
@@ -87,7 +101,7 @@ var require_picocolors = __commonJS((exports, module) => {
87
101
  module.exports.createColors = createColors;
88
102
  });
89
103
 
90
- // ../node_modules/.bun/tinycolor2@1.6.0/node_modules/tinycolor2/cjs/tinycolor.js
104
+ // ../../node_modules/.bun/tinycolor2@1.6.0/node_modules/tinycolor2/cjs/tinycolor.js
91
105
  var require_tinycolor = __commonJS((exports, module) => {
92
106
  (function(global, factory) {
93
107
  typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.tinycolor = factory());
@@ -1071,7 +1085,7 @@ var require_tinycolor = __commonJS((exports, module) => {
1071
1085
  });
1072
1086
  });
1073
1087
 
1074
- // ../node_modules/.bun/tinygradient@1.1.5/node_modules/tinygradient/index.js
1088
+ // ../../node_modules/.bun/tinygradient@1.1.5/node_modules/tinygradient/index.js
1075
1089
  var require_tinygradient = __commonJS((exports, module) => {
1076
1090
  var tinycolor = require_tinycolor();
1077
1091
  var RGBA_MAX = { r: 256, g: 256, b: 256, a: 1 };
@@ -1326,7 +1340,7 @@ var require_tinygradient = __commonJS((exports, module) => {
1326
1340
  };
1327
1341
  });
1328
1342
 
1329
- // ../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
1343
+ // ../../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
1330
1344
  var require_src = __commonJS((exports, module) => {
1331
1345
  var ESC = "\x1B";
1332
1346
  var CSI = `${ESC}[`;
@@ -1389,11 +1403,12 @@ import * as fs from "node:fs";
1389
1403
  import * as path from "node:path";
1390
1404
  import * as os2 from "node:os";
1391
1405
  import { execSync } from "node:child_process";
1406
+ import { fileURLToPath } from "node:url";
1392
1407
 
1393
1408
  // src/branding.ts
1394
1409
  var import_picocolors = __toESM(require_picocolors(), 1);
1395
1410
 
1396
- // ../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
1411
+ // ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
1397
1412
  var ANSI_BACKGROUND_OFFSET = 10;
1398
1413
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
1399
1414
  var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
@@ -1570,7 +1585,7 @@ function assembleStyles() {
1570
1585
  var ansiStyles = assembleStyles();
1571
1586
  var ansi_styles_default = ansiStyles;
1572
1587
 
1573
- // ../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
1588
+ // ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
1574
1589
  import process2 from "node:process";
1575
1590
  import os from "node:os";
1576
1591
  import tty from "node:tty";
@@ -1702,7 +1717,7 @@ var supportsColor = {
1702
1717
  };
1703
1718
  var supports_color_default = supportsColor;
1704
1719
 
1705
- // ../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/utilities.js
1720
+ // ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/utilities.js
1706
1721
  function stringReplaceAll(string, substring, replacer) {
1707
1722
  let index = string.indexOf(substring);
1708
1723
  if (index === -1) {
@@ -1735,7 +1750,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
1735
1750
  return returnValue;
1736
1751
  }
1737
1752
 
1738
- // ../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/index.js
1753
+ // ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/index.js
1739
1754
  var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
1740
1755
  var GENERATOR = Symbol("GENERATOR");
1741
1756
  var STYLER = Symbol("STYLER");
@@ -1882,7 +1897,7 @@ var chalk = createChalk();
1882
1897
  var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
1883
1898
  var source_default = chalk;
1884
1899
 
1885
- // ../node_modules/.bun/gradient-string@3.0.0/node_modules/gradient-string/dist/index.js
1900
+ // ../../node_modules/.bun/gradient-string@3.0.0/node_modules/gradient-string/dist/index.js
1886
1901
  var import_tinygradient = __toESM(require_tinygradient(), 1);
1887
1902
  var gradient = (...colors) => {
1888
1903
  let gradient2;
@@ -2000,20 +2015,40 @@ gradient.summer = summer;
2000
2015
  gradient.rainbow = rainbow;
2001
2016
  gradient.pastel = pastel;
2002
2017
 
2018
+ // src/ui/env.ts
2019
+ function flagEnabled(value) {
2020
+ if (value == null)
2021
+ return false;
2022
+ const normalized = value.trim().toLowerCase();
2023
+ return normalized === "1" || normalized === "true" || normalized === "yes" || normalized === "on";
2024
+ }
2025
+ function getUiMode(runtime = process) {
2026
+ const tty2 = Boolean(runtime.stdout?.isTTY);
2027
+ const ci = flagEnabled(runtime.env.CI);
2028
+ const noUi = flagEnabled(runtime.env.ZENITH_NO_UI);
2029
+ const noColor = runtime.env.NO_COLOR !== undefined;
2030
+ const forceColor = flagEnabled(runtime.env.FORCE_COLOR);
2031
+ const debug = flagEnabled(runtime.env.ZENITH_DEBUG);
2032
+ const plain = noUi || ci || !tty2;
2033
+ const color = !plain && !noColor && (forceColor || tty2);
2034
+ const animate = tty2 && !plain && !ci;
2035
+ return { tty: tty2, plain, color, animate, debug };
2036
+ }
2037
+
2003
2038
  // src/branding.ts
2004
- var colors = {
2005
- primary: import_picocolors.default.blue,
2006
- secondary: import_picocolors.default.cyan,
2007
- success: import_picocolors.default.green,
2008
- warning: import_picocolors.default.yellow,
2009
- error: import_picocolors.default.red,
2010
- muted: import_picocolors.default.gray,
2011
- bold: import_picocolors.default.bold,
2012
- dim: import_picocolors.default.dim
2013
- };
2014
- var zenithGradient = dist_default(["#3b82f6", "#06b6d4", "#22d3ee"]);
2039
+ function ui() {
2040
+ return getUiMode(process);
2041
+ }
2042
+ function pc() {
2043
+ return import_picocolors.createColors(ui().color);
2044
+ }
2045
+ function zenithGradientText(text) {
2046
+ if (!ui().color)
2047
+ return text;
2048
+ return dist_default(["#3b82f6", "#06b6d4", "#22d3ee"])(text);
2049
+ }
2015
2050
  function isTTY() {
2016
- return Boolean(process.stdout.isTTY && !process.env.CI && !process.env.GITHUB_ACTIONS && !process.env.CONTINUOUS_INTEGRATION);
2051
+ return ui().animate;
2017
2052
  }
2018
2053
  var LOGO_LINES = [
2019
2054
  " ███████╗███████╗███╗ ██╗██╗████████╗██╗ ██╗",
@@ -2024,107 +2059,124 @@ var LOGO_LINES = [
2024
2059
  " ╚══════╝╚══════╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝ ╚═╝"
2025
2060
  ];
2026
2061
  var TAGLINE = "The Modern Reactive Web Framework";
2062
+ function renderLogoLine(line) {
2063
+ return ui().color ? zenithGradientText(line) : line;
2064
+ }
2027
2065
  var LOGO = `
2028
- ${import_picocolors.default.cyan("╔" + "═".repeat(55) + "╗")}
2029
- ${import_picocolors.default.cyan("║")}${" ".repeat(55)}${import_picocolors.default.cyan("║")}
2030
- ${LOGO_LINES.map((line) => `${import_picocolors.default.cyan("║")} ${zenithGradient(line)} ${import_picocolors.default.cyan("║")}`).join(`
2066
+ ${pc().cyan("╔" + "═".repeat(55) + "╗")}
2067
+ ${pc().cyan("║")}${" ".repeat(55)}${pc().cyan("║")}
2068
+ ${LOGO_LINES.map((line) => `${pc().cyan("║")} ${renderLogoLine(line)} ${pc().cyan("║")}`).join(`
2031
2069
  `)}
2032
- ${import_picocolors.default.cyan("║")}${" ".repeat(55)}${import_picocolors.default.cyan("║")}
2033
- ${import_picocolors.default.cyan("║")}${" ".repeat(10)}${import_picocolors.default.dim(TAGLINE)}${" ".repeat(10)}${import_picocolors.default.cyan("║")}
2034
- ${import_picocolors.default.cyan("║")}${" ".repeat(55)}${import_picocolors.default.cyan("║")}
2035
- ${import_picocolors.default.cyan("╚" + "═".repeat(55) + "╝")}
2036
- `;
2037
- var LOGO_COMPACT = `
2038
- ${import_picocolors.default.bold(zenithGradient("⚡ ZENITH"))} ${import_picocolors.default.dim("- Modern Reactive Framework")}
2070
+ ${pc().cyan("║")}${" ".repeat(55)}${pc().cyan("║")}
2071
+ ${pc().cyan("║")}${" ".repeat(10)}${pc().dim(TAGLINE)}${" ".repeat(10)}${pc().cyan("║")}
2072
+ ${pc().cyan("║")}${" ".repeat(55)}${pc().cyan("║")}
2073
+ ${pc().cyan("╚" + "═".repeat(55) + "╝")}
2039
2074
  `;
2075
+ var LOGO_COMPACT = ` ${pc().bold(renderLogoLine("⚡ ZENITH"))} ${pc().dim("- Modern Reactive Framework")}`;
2040
2076
  function sleep(ms) {
2041
2077
  return new Promise((resolve) => setTimeout(resolve, ms));
2042
2078
  }
2043
2079
  async function animateLogo() {
2044
- if (!isTTY()) {
2045
- showLogo();
2080
+ if (!ui().animate) {
2081
+ showCompactLogo();
2046
2082
  return;
2047
2083
  }
2048
2084
  console.clear();
2049
- console.log(import_picocolors.default.cyan("╔" + "═".repeat(55) + "╗"));
2050
- console.log(import_picocolors.default.cyan("║") + " ".repeat(55) + import_picocolors.default.cyan("║"));
2051
- for (let i = 0;i < LOGO_LINES.length; i++) {
2052
- const line = LOGO_LINES[i];
2053
- process.stdout.write(import_picocolors.default.cyan("║") + " ");
2085
+ console.log(pc().cyan("╔" + "═".repeat(55) + "╗"));
2086
+ console.log(pc().cyan("║") + " ".repeat(55) + pc().cyan("║"));
2087
+ for (const line of LOGO_LINES) {
2088
+ process.stdout.write(pc().cyan("║") + " ");
2054
2089
  const chars = [...line];
2055
2090
  const chunkSize = Math.ceil(chars.length / 8);
2056
2091
  for (let j = 0;j < chars.length; j += chunkSize) {
2057
2092
  const chunk = chars.slice(j, j + chunkSize).join("");
2058
- process.stdout.write(zenithGradient(chunk));
2093
+ process.stdout.write(renderLogoLine(chunk));
2059
2094
  await sleep(30);
2060
2095
  }
2061
- console.log(" " + import_picocolors.default.cyan("║"));
2096
+ console.log(" " + pc().cyan("║"));
2062
2097
  }
2063
- console.log(import_picocolors.default.cyan("║") + " ".repeat(55) + import_picocolors.default.cyan("║"));
2064
- process.stdout.write(import_picocolors.default.cyan("║") + " ".repeat(10));
2098
+ console.log(pc().cyan("║") + " ".repeat(55) + pc().cyan("║"));
2099
+ process.stdout.write(pc().cyan("║") + " ".repeat(10));
2065
2100
  const taglineChars = [...TAGLINE];
2066
2101
  for (let i = 0;i < taglineChars.length; i += 4) {
2067
2102
  const chunk = taglineChars.slice(i, i + 4).join("");
2068
- process.stdout.write(import_picocolors.default.dim(chunk));
2103
+ process.stdout.write(pc().dim(chunk));
2069
2104
  await sleep(20);
2070
2105
  }
2071
- console.log(" ".repeat(10) + import_picocolors.default.cyan("║"));
2072
- console.log(import_picocolors.default.cyan("║") + " ".repeat(55) + import_picocolors.default.cyan("║"));
2073
- console.log(import_picocolors.default.cyan("╚" + "═".repeat(55) + "╝"));
2106
+ console.log(" ".repeat(10) + pc().cyan("║"));
2107
+ console.log(pc().cyan("║") + " ".repeat(55) + pc().cyan("║"));
2108
+ console.log(pc().cyan("╚" + "═".repeat(55) + "╝"));
2074
2109
  await sleep(150);
2075
2110
  }
2076
- function showLogo() {
2077
- console.log(LOGO);
2078
- }
2079
2111
  function showCompactLogo() {
2112
+ if (ui().plain) {
2113
+ console.log("ZENITH - Modern Reactive Framework");
2114
+ return;
2115
+ }
2080
2116
  console.log(LOGO_COMPACT);
2081
2117
  }
2082
2118
  async function showCompletionAnimation() {
2083
- if (!isTTY()) {
2084
- console.log(`${import_picocolors.default.green("✓")} ${import_picocolors.default.bold("Done!")}`);
2119
+ if (!ui().animate) {
2120
+ console.log("OK: Done!");
2085
2121
  return;
2086
2122
  }
2087
2123
  const frames = ["✓", "✨", "✓", "✨", "✓"];
2088
- const colors2 = [import_picocolors.default.green, import_picocolors.default.yellow, import_picocolors.default.green, import_picocolors.default.yellow, import_picocolors.default.green];
2124
+ const colors = [pc().green, pc().yellow, pc().green, pc().yellow, pc().green];
2089
2125
  for (let i = 0;i < frames.length; i++) {
2090
- process.stdout.write(`\r${colors2[i](frames[i])} ${import_picocolors.default.bold("Done!")}`);
2126
+ process.stdout.write(`\r${colors[i](frames[i])} ${pc().bold("Done!")}`);
2091
2127
  await sleep(100);
2092
2128
  }
2093
2129
  console.log();
2094
2130
  }
2095
2131
  function error(text) {
2096
- console.log(`${import_picocolors.default.red("✗")} ${text}`);
2132
+ console.log(ui().plain ? `ERROR: ${text}` : `${pc().red("✗")} ${text}`);
2097
2133
  }
2098
2134
  function warn(text) {
2099
- console.log(`${import_picocolors.default.yellow("⚠")} ${text}`);
2135
+ console.log(ui().plain ? `WARN: ${text}` : `${pc().yellow("⚠")} ${text}`);
2100
2136
  }
2101
2137
  function bold(text) {
2102
- return import_picocolors.default.bold(text);
2138
+ return ui().plain ? text : pc().bold(text);
2103
2139
  }
2104
2140
  function showNextSteps(projectName, packageManager = "bun") {
2105
2141
  const pm = packageManager;
2106
2142
  const runCmd = pm === "npm" ? "npm run dev" : `${pm} run dev`;
2143
+ if (ui().plain) {
2144
+ console.log("");
2145
+ console.log("NEXT STEPS:");
2146
+ console.log(` cd ${projectName}`);
2147
+ console.log(` ${runCmd}`);
2148
+ console.log(" open http://localhost:3000");
2149
+ console.log("");
2150
+ return;
2151
+ }
2107
2152
  const cdLine = `cd ${projectName}`;
2108
2153
  const maxLineLen = 45;
2109
2154
  const cdPadding = Math.max(1, maxLineLen - cdLine.length - 6);
2110
2155
  const runPadding = Math.max(1, maxLineLen - runCmd.length - 6);
2111
2156
  console.log(`
2112
- ${import_picocolors.default.cyan("┌" + "─".repeat(50) + "┐")}
2113
- ${import_picocolors.default.cyan("│")}${" ".repeat(50)}${import_picocolors.default.cyan("│")}
2114
- ${import_picocolors.default.cyan("│")} ${import_picocolors.default.green("✨")} ${zenithGradient.multiline(import_picocolors.default.bold("Your Zenith app is ready!"))}${" ".repeat(17)}${import_picocolors.default.cyan("│")}
2115
- ${import_picocolors.default.cyan("│")}${" ".repeat(50)}${import_picocolors.default.cyan("│")}
2116
- ${import_picocolors.default.cyan("│")} ${import_picocolors.default.dim("Next steps:")}${" ".repeat(36)}${import_picocolors.default.cyan("│")}
2117
- ${import_picocolors.default.cyan("│")}${" ".repeat(50)}${import_picocolors.default.cyan("│")}
2118
- ${import_picocolors.default.cyan("│")} ${import_picocolors.default.cyan("$")} ${import_picocolors.default.bold(cdLine)}${" ".repeat(cdPadding)}${import_picocolors.default.cyan("│")}
2119
- ${import_picocolors.default.cyan("│")} ${import_picocolors.default.cyan("$")} ${import_picocolors.default.bold(runCmd)}${" ".repeat(runPadding)}${import_picocolors.default.cyan("│")}
2120
- ${import_picocolors.default.cyan("│")}${" ".repeat(50)}${import_picocolors.default.cyan("│")}
2121
- ${import_picocolors.default.cyan("│")} ${import_picocolors.default.dim("Then open")} ${import_picocolors.default.underline(import_picocolors.default.blue("http://localhost:3000"))}${" ".repeat(9)}${import_picocolors.default.cyan("│")}
2122
- ${import_picocolors.default.cyan("│")}${" ".repeat(50)}${import_picocolors.default.cyan("│")}
2123
- ${import_picocolors.default.cyan("└" + "─".repeat(50) + "┘")}
2157
+ ${pc().cyan("┌" + "─".repeat(50) + "┐")}
2158
+ ${pc().cyan("│")}${" ".repeat(50)}${pc().cyan("│")}
2159
+ ${pc().cyan("│")} ${pc().green("✨")} ${pc().bold(renderLogoLine("Your Zenith app is ready!"))}${" ".repeat(17)}${pc().cyan("│")}
2160
+ ${pc().cyan("│")}${" ".repeat(50)}${pc().cyan("│")}
2161
+ ${pc().cyan("│")} ${pc().dim("Next steps:")}${" ".repeat(36)}${pc().cyan("│")}
2162
+ ${pc().cyan("│")}${" ".repeat(50)}${pc().cyan("│")}
2163
+ ${pc().cyan("│")} ${pc().cyan("$")} ${pc().bold(cdLine)}${" ".repeat(cdPadding)}${pc().cyan("│")}
2164
+ ${pc().cyan("│")} ${pc().cyan("$")} ${pc().bold(runCmd)}${" ".repeat(runPadding)}${pc().cyan("│")}
2165
+ ${pc().cyan("│")}${" ".repeat(50)}${pc().cyan("│")}
2166
+ ${pc().cyan("│")} ${pc().dim("Then open")} ${pc().underline(pc().blue("http://localhost:3000"))}${" ".repeat(9)}${pc().cyan("│")}
2167
+ ${pc().cyan("│")}${" ".repeat(50)}${pc().cyan("│")}
2168
+ ${pc().cyan("└" + "─".repeat(50) + "┘")}
2124
2169
  `);
2125
2170
  }
2171
+ function showScaffoldSummary(projectName, templateLabel) {
2172
+ const title = ui().plain ? "SCAFFOLD PLAN" : pc().bold(pc().cyan("Scaffold Plan"));
2173
+ console.log(`
2174
+ ${title}`);
2175
+ console.log(`Project : ${projectName}`);
2176
+ console.log(`Template: ${templateLabel}`);
2177
+ }
2126
2178
 
2127
- // ../node_modules/.bun/@clack+core@0.5.0/node_modules/@clack/core/dist/index.mjs
2179
+ // ../../node_modules/.bun/@clack+core@0.5.0/node_modules/@clack/core/dist/index.mjs
2128
2180
  var import_sisteransi = __toESM(require_src(), 1);
2129
2181
  var import_picocolors2 = __toESM(require_picocolors(), 1);
2130
2182
  import { stdin as j, stdout as M } from "node:process";
@@ -2520,7 +2572,7 @@ class RD extends x {
2520
2572
  }
2521
2573
  }
2522
2574
 
2523
- // ../node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/dist/index.mjs
2575
+ // ../../node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/dist/index.mjs
2524
2576
  var import_picocolors3 = __toESM(require_picocolors(), 1);
2525
2577
  var import_sisteransi2 = __toESM(require_src(), 1);
2526
2578
  import y2 from "node:process";
@@ -2690,10 +2742,20 @@ var Y2 = ({ indicator: t = "dots" } = {}) => {
2690
2742
 
2691
2743
  // src/prompts.ts
2692
2744
  var import_picocolors4 = __toESM(require_picocolors(), 1);
2745
+ function pc2() {
2746
+ const mode = getUiMode(process);
2747
+ return import_picocolors4.createColors(mode.color);
2748
+ }
2693
2749
  async function intro() {
2694
2750
  await animateLogo();
2695
2751
  console.log();
2696
- Ie(import_picocolors4.default.bgCyan(import_picocolors4.default.black(" create-zenith ")));
2752
+ const mode = getUiMode(process);
2753
+ if (mode.plain) {
2754
+ console.log("create-zenith");
2755
+ return;
2756
+ }
2757
+ const colors = pc2();
2758
+ Ie(colors.bgCyan(colors.black(" create-zenith ")));
2697
2759
  }
2698
2760
  async function text(opts) {
2699
2761
  if (!isTTY()) {
@@ -2719,30 +2781,145 @@ function isCancel(value) {
2719
2781
  return pD(value);
2720
2782
  }
2721
2783
  function handleCancel() {
2722
- xe("Operation cancelled.");
2784
+ if (getUiMode(process).plain) {
2785
+ console.log("WARN: Operation cancelled.");
2786
+ } else {
2787
+ xe("Operation cancelled.");
2788
+ }
2723
2789
  process.exit(0);
2724
2790
  }
2725
2791
  function spinner() {
2726
- return Y2();
2792
+ if (getUiMode(process).animate) {
2793
+ return Y2();
2794
+ }
2795
+ return {
2796
+ start(message) {
2797
+ console.log(`INFO: ${message}`);
2798
+ },
2799
+ stop(message) {
2800
+ if (message) {
2801
+ console.log(`OK: ${message}`);
2802
+ }
2803
+ },
2804
+ message(message) {
2805
+ console.log(`INFO: ${message}`);
2806
+ }
2807
+ };
2727
2808
  }
2728
2809
  async function outro(projectName, packageManager) {
2729
2810
  await showCompletionAnimation();
2730
2811
  showNextSteps(projectName, packageManager);
2731
2812
  }
2732
2813
  var log = {
2733
- info: (message) => M2.info(message),
2734
- success: (message) => M2.success(message),
2735
- warn: (message) => M2.warn(message),
2736
- error: (message) => M2.error(message),
2737
- step: (message) => M2.step(message),
2738
- message: (message) => M2.message(message)
2814
+ info: (message) => getUiMode(process).plain ? console.log(`INFO: ${message}`) : M2.info(message),
2815
+ success: (message) => getUiMode(process).plain ? console.log(`OK: ${message}`) : M2.success(message),
2816
+ warn: (message) => getUiMode(process).plain ? console.log(`WARN: ${message}`) : M2.warn(message),
2817
+ error: (message) => getUiMode(process).plain ? console.log(`ERROR: ${message}`) : M2.error(message),
2818
+ step: (message) => getUiMode(process).plain ? console.log(`STEP: ${message}`) : M2.step(message),
2819
+ message: (message) => getUiMode(process).plain ? console.log(message) : M2.message(message)
2739
2820
  };
2740
2821
 
2822
+ // src/template-features.ts
2823
+ var FEATURE_DEFINITIONS = {
2824
+ eslint: {
2825
+ templatePath: "templates/features/eslint",
2826
+ packagePatch: {
2827
+ scripts: {
2828
+ lint: "eslint ."
2829
+ },
2830
+ devDependencies: {
2831
+ eslint: "^9.39.2",
2832
+ "@typescript-eslint/eslint-plugin": "^8.53.0",
2833
+ "@typescript-eslint/parser": "^8.53.0"
2834
+ }
2835
+ }
2836
+ },
2837
+ prettier: {
2838
+ templatePath: "templates/features/prettier",
2839
+ packagePatch: {
2840
+ scripts: {
2841
+ format: "prettier --write ."
2842
+ },
2843
+ devDependencies: {
2844
+ prettier: "^3.7.4"
2845
+ }
2846
+ }
2847
+ }
2848
+ };
2849
+ function mergeRecord(target, patch) {
2850
+ if (!patch) {
2851
+ return target;
2852
+ }
2853
+ return { ...target || {}, ...patch };
2854
+ }
2855
+ function selectedTemplateFeaturePaths(options) {
2856
+ const paths = [];
2857
+ if (options.eslint) {
2858
+ paths.push(FEATURE_DEFINITIONS.eslint.templatePath);
2859
+ }
2860
+ if (options.prettier) {
2861
+ paths.push(FEATURE_DEFINITIONS.prettier.templatePath);
2862
+ }
2863
+ return paths;
2864
+ }
2865
+ function applyPackageFeatures(manifest, options) {
2866
+ const nextManifest = {
2867
+ ...manifest,
2868
+ scripts: { ...manifest.scripts || {} },
2869
+ devDependencies: { ...manifest.devDependencies || {} }
2870
+ };
2871
+ for (const featureName of Object.keys(FEATURE_DEFINITIONS)) {
2872
+ if (!options[featureName]) {
2873
+ continue;
2874
+ }
2875
+ const patch = FEATURE_DEFINITIONS[featureName].packagePatch;
2876
+ nextManifest.scripts = mergeRecord(nextManifest.scripts, patch.scripts);
2877
+ nextManifest.devDependencies = mergeRecord(nextManifest.devDependencies, patch.devDependencies);
2878
+ }
2879
+ if (nextManifest.scripts && Object.keys(nextManifest.scripts).length === 0) {
2880
+ delete nextManifest.scripts;
2881
+ }
2882
+ if (nextManifest.devDependencies && Object.keys(nextManifest.devDependencies).length === 0) {
2883
+ delete nextManifest.devDependencies;
2884
+ }
2885
+ return nextManifest;
2886
+ }
2887
+
2741
2888
  // src/index.ts
2742
- var VERSION = "1.3.0";
2743
- var GITHUB_REPO = "zenithbuild/create-zenith";
2889
+ var GITHUB_REPO = "zenithbuild/framework";
2744
2890
  var DEFAULT_TEMPLATE = "examples/starter";
2745
2891
  var TAILWIND_TEMPLATE = "examples/starter-tailwindcss";
2892
+ var __filename2 = fileURLToPath(import.meta.url);
2893
+ var __dirname2 = path.dirname(__filename2);
2894
+ function getCliVersion() {
2895
+ try {
2896
+ const pkgPath = path.resolve(__dirname2, "..", "package.json");
2897
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
2898
+ return typeof pkg.version === "string" ? pkg.version : "0.0.0";
2899
+ } catch {
2900
+ return "0.0.0";
2901
+ }
2902
+ }
2903
+ var VERSION = getCliVersion();
2904
+ function flagEnabled2(value) {
2905
+ if (value == null)
2906
+ return false;
2907
+ const normalized = value.trim().toLowerCase();
2908
+ return normalized === "1" || normalized === "true" || normalized === "yes" || normalized === "on";
2909
+ }
2910
+ function resolveLocalTemplatePath(templatePath) {
2911
+ const candidate = path.resolve(__dirname2, "..", templatePath);
2912
+ return fs.existsSync(candidate) ? candidate : null;
2913
+ }
2914
+ function copyDirectoryContents(sourceDir, targetDir) {
2915
+ fs.mkdirSync(targetDir, { recursive: true });
2916
+ for (const entry of fs.readdirSync(sourceDir)) {
2917
+ fs.cpSync(path.join(sourceDir, entry), path.join(targetDir, entry), {
2918
+ recursive: true,
2919
+ force: true
2920
+ });
2921
+ }
2922
+ }
2746
2923
  function detectPackageManager() {
2747
2924
  const userAgent = process.env.npm_config_user_agent || "";
2748
2925
  if (userAgent.includes("bun"))
@@ -2773,31 +2950,52 @@ function hasGit() {
2773
2950
  return false;
2774
2951
  }
2775
2952
  }
2776
- async function downloadTemplate(targetDir, templatePath) {
2953
+ async function downloadTemplate(targetDir, templatePaths) {
2954
+ const localTemplatePaths = templatePaths.map((templatePath) => ({
2955
+ templatePath,
2956
+ localPath: resolveLocalTemplatePath(templatePath)
2957
+ }));
2958
+ const forceLocal = process.env.CREATE_ZENITH_TEMPLATE_MODE === "local" || flagEnabled2(process.env.CREATE_ZENITH_OFFLINE);
2959
+ const preferLocal = process.env.CREATE_ZENITH_PREFER_LOCAL !== "0";
2960
+ if (localTemplatePaths.every((entry) => entry.localPath) && (forceLocal || preferLocal)) {
2961
+ for (const entry of localTemplatePaths) {
2962
+ copyDirectoryContents(entry.localPath, targetDir);
2963
+ }
2964
+ return;
2965
+ }
2966
+ if (forceLocal) {
2967
+ const missingPath = localTemplatePaths.find((entry) => !entry.localPath)?.templatePath;
2968
+ throw new Error(`Local template not found: ${missingPath}`);
2969
+ }
2777
2970
  const tempDir = path.join(os2.tmpdir(), `zenith-template-${Date.now()}`);
2778
2971
  try {
2779
2972
  if (hasGit()) {
2780
2973
  execSync(`git clone --depth 1 --filter=blob:none --sparse https://github.com/${GITHUB_REPO}.git "${tempDir}"`, {
2781
2974
  stdio: "pipe"
2782
2975
  });
2783
- execSync(`git sparse-checkout set ${templatePath}`, {
2976
+ const repoTemplatePaths = templatePaths.map((templatePath) => `packages/create-zenith/${templatePath}`);
2977
+ execSync(`git sparse-checkout set ${repoTemplatePaths.join(" ")}`, {
2784
2978
  cwd: tempDir,
2785
2979
  stdio: "pipe"
2786
2980
  });
2787
- const templateSource = path.join(tempDir, templatePath);
2788
- fs.cpSync(templateSource, targetDir, { recursive: true });
2981
+ for (const repoTemplatePath of repoTemplatePaths) {
2982
+ const templateSource = path.join(tempDir, repoTemplatePath);
2983
+ copyDirectoryContents(templateSource, targetDir);
2984
+ }
2789
2985
  } else {
2790
2986
  const tarballUrl = `https://github.com/${GITHUB_REPO}/archive/refs/heads/main.tar.gz`;
2791
2987
  const tarballPath = path.join(os2.tmpdir(), `zenith-${Date.now()}.tar.gz`);
2792
2988
  execSync(`curl -sL "${tarballUrl}" -o "${tarballPath}"`, { stdio: "pipe" });
2793
2989
  fs.mkdirSync(tempDir, { recursive: true });
2794
2990
  execSync(`tar -xzf "${tarballPath}" -C "${tempDir}"`, { stdio: "pipe" });
2795
- const extractedDir = fs.readdirSync(tempDir).find((f) => f.startsWith("create-zenith"));
2991
+ const extractedDir = fs.readdirSync(tempDir).find((f) => f.startsWith("framework"));
2796
2992
  if (!extractedDir) {
2797
2993
  throw new Error("Failed to extract template from GitHub");
2798
2994
  }
2799
- const templateSource = path.join(tempDir, extractedDir, templatePath);
2800
- fs.cpSync(templateSource, targetDir, { recursive: true });
2995
+ for (const templatePath of templatePaths) {
2996
+ const templateSource = path.join(tempDir, extractedDir, "packages/create-zenith", templatePath);
2997
+ copyDirectoryContents(templateSource, targetDir);
2998
+ }
2801
2999
  fs.unlinkSync(tarballPath);
2802
3000
  }
2803
3001
  } finally {
@@ -2806,7 +3004,17 @@ async function downloadTemplate(targetDir, templatePath) {
2806
3004
  }
2807
3005
  }
2808
3006
  }
3007
+ function readOptionOverride(name) {
3008
+ const value = process.env[name];
3009
+ if (value == null || value.trim() === "") {
3010
+ return;
3011
+ }
3012
+ return flagEnabled2(value);
3013
+ }
2809
3014
  async function gatherOptions(providedName, withTailwind) {
3015
+ const eslintOverride = readOptionOverride("CREATE_ZENITH_ESLINT");
3016
+ const prettierOverride = readOptionOverride("CREATE_ZENITH_PRETTIER");
3017
+ const pathAliasOverride = readOptionOverride("CREATE_ZENITH_PATH_ALIAS");
2810
3018
  let name = providedName;
2811
3019
  if (!name) {
2812
3020
  const nameResult = await text({
@@ -2844,9 +3052,9 @@ async function gatherOptions(providedName, withTailwind) {
2844
3052
  log.info("Non-interactive mode detected, using defaults...");
2845
3053
  return {
2846
3054
  name,
2847
- eslint: true,
2848
- prettier: true,
2849
- pathAlias: true,
3055
+ eslint: eslintOverride ?? true,
3056
+ prettier: prettierOverride ?? true,
3057
+ pathAlias: pathAliasOverride ?? true,
2850
3058
  tailwind: withTailwind ?? false
2851
3059
  };
2852
3060
  }
@@ -2856,23 +3064,23 @@ async function gatherOptions(providedName, withTailwind) {
2856
3064
  });
2857
3065
  if (isCancel(tailwindResult))
2858
3066
  handleCancel();
2859
- const eslintResult = await confirm({
3067
+ const eslintResult = eslintOverride ?? await confirm({
2860
3068
  message: "Add ESLint for code linting?",
2861
3069
  initialValue: true
2862
3070
  });
2863
- if (isCancel(eslintResult))
3071
+ if (eslintOverride === undefined && isCancel(eslintResult))
2864
3072
  handleCancel();
2865
- const prettierResult = await confirm({
3073
+ const prettierResult = prettierOverride ?? await confirm({
2866
3074
  message: "Add Prettier for code formatting?",
2867
3075
  initialValue: true
2868
3076
  });
2869
- if (isCancel(prettierResult))
3077
+ if (prettierOverride === undefined && isCancel(prettierResult))
2870
3078
  handleCancel();
2871
- const pathAliasResult = await confirm({
3079
+ const pathAliasResult = pathAliasOverride ?? await confirm({
2872
3080
  message: "Add TypeScript path alias (@/*)?",
2873
3081
  initialValue: true
2874
3082
  });
2875
- if (isCancel(pathAliasResult))
3083
+ if (pathAliasOverride === undefined && isCancel(pathAliasResult))
2876
3084
  handleCancel();
2877
3085
  return {
2878
3086
  name,
@@ -2885,31 +3093,13 @@ async function gatherOptions(providedName, withTailwind) {
2885
3093
  async function createProject(options) {
2886
3094
  const targetDir = path.resolve(process.cwd(), options.name);
2887
3095
  const templatePath = options.tailwind ? TAILWIND_TEMPLATE : DEFAULT_TEMPLATE;
2888
- await downloadTemplate(targetDir, templatePath);
3096
+ const templateFeaturePaths = selectedTemplateFeaturePaths(options);
3097
+ await downloadTemplate(targetDir, [templatePath, ...templateFeaturePaths]);
2889
3098
  const pkgPath = path.join(targetDir, "package.json");
2890
3099
  if (fs.existsSync(pkgPath)) {
2891
- const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
3100
+ const pkg = applyPackageFeatures(JSON.parse(fs.readFileSync(pkgPath, "utf8")), options);
2892
3101
  pkg.name = options.name;
2893
3102
  pkg.version = "0.1.0";
2894
- if (!options.eslint) {
2895
- delete pkg.devDependencies?.["eslint"];
2896
- delete pkg.devDependencies?.["@typescript-eslint/eslint-plugin"];
2897
- delete pkg.devDependencies?.["@typescript-eslint/parser"];
2898
- delete pkg.scripts?.lint;
2899
- const eslintPath = path.join(targetDir, ".eslintrc.json");
2900
- if (fs.existsSync(eslintPath))
2901
- fs.unlinkSync(eslintPath);
2902
- }
2903
- if (!options.prettier) {
2904
- delete pkg.devDependencies?.["prettier"];
2905
- delete pkg.scripts?.format;
2906
- const prettierRc = path.join(targetDir, ".prettierrc");
2907
- const prettierIgnore = path.join(targetDir, ".prettierignore");
2908
- if (fs.existsSync(prettierRc))
2909
- fs.unlinkSync(prettierRc);
2910
- if (fs.existsSync(prettierIgnore))
2911
- fs.unlinkSync(prettierIgnore);
2912
- }
2913
3103
  fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 4));
2914
3104
  }
2915
3105
  const tsconfigPath = path.join(targetDir, "tsconfig.json");
@@ -2930,6 +3120,8 @@ async function createProject(options) {
2930
3120
  async function create(appName, withTailwind) {
2931
3121
  await intro();
2932
3122
  const options = await gatherOptions(appName, withTailwind);
3123
+ const templateLabel = options.tailwind ? "starter-tailwindcss" : "starter";
3124
+ showScaffoldSummary(options.name, templateLabel);
2933
3125
  console.log("");
2934
3126
  log.step(`Creating ${bold(options.name)}...`);
2935
3127
  const s = spinner();
@@ -2940,15 +3132,20 @@ async function create(appName, withTailwind) {
2940
3132
  s.start("Installing dependencies...");
2941
3133
  const targetDir = path.resolve(process.cwd(), options.name);
2942
3134
  const pm = detectPackageManager();
2943
- try {
2944
- execSync(`${pm} install`, {
2945
- cwd: targetDir,
2946
- stdio: "pipe"
2947
- });
2948
- s.stop("Dependencies installed");
2949
- } catch {
2950
- s.stop("Could not install dependencies automatically");
3135
+ if (flagEnabled2(process.env.CREATE_ZENITH_SKIP_INSTALL)) {
3136
+ s.stop("Dependency installation skipped");
2951
3137
  warn(`Run "${pm} install" manually in the project directory`);
3138
+ } else {
3139
+ try {
3140
+ execSync(`${pm} install`, {
3141
+ cwd: targetDir,
3142
+ stdio: "pipe"
3143
+ });
3144
+ s.stop("Dependencies installed");
3145
+ } catch {
3146
+ s.stop("Could not install dependencies automatically");
3147
+ warn(`Run "${pm} install" manually in the project directory`);
3148
+ }
2952
3149
  }
2953
3150
  await outro(options.name, pm);
2954
3151
  } catch (err) {
@@ -2984,6 +3181,10 @@ if (args.includes("--version") || args.includes("-v")) {
2984
3181
  var projectName = args.find((arg) => !arg.startsWith("-"));
2985
3182
  var withTailwind = args.includes("--with-tailwind") ? true : undefined;
2986
3183
  create(projectName, withTailwind).catch((err) => {
3184
+ const mode = getUiMode(process);
3185
+ if (mode.plain) {
3186
+ console.log("ERROR: SCAFFOLD_ERROR");
3187
+ }
2987
3188
  error(err instanceof Error ? err.message : String(err));
2988
3189
  process.exit(1);
2989
3190
  });