create-zenith 1.3.7 → 1.3.18

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 +22 -2
  2. package/dist/cli.js +218 -94
  3. package/dist/index.js +218 -94
  4. package/package.json +10 -5
package/README.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  The official CLI for scaffolding new Zenith applications. Fast, animated, and delightful.
4
4
 
5
+ ## Canonical Docs
6
+
7
+ - Create contract: `framework/docs`
8
+ - Install and compatibility: `framework/docs`
9
+
5
10
  ## Overview
6
11
 
7
12
  `create-zenith` is the entry point to the Zenith ecosystem. It provides a signature, high-quality terminal experience for initializing new projects, ensuring you go from command line to `localhost` in seconds with confidence.
@@ -35,11 +40,26 @@ pnpm create zenith
35
40
  | `-h, --help` | Show usage information |
36
41
  | `-v, --version` | Show version number |
37
42
 
43
+ ## Beta Version Pinning
44
+
45
+ Zenith beta currently pins `@zenithbuild/core` to `0.5.0-beta.2.20` and leaf packages (compiler, cli, runtime, router, bundler) to `0.5.0-beta.2.20`. This is intentional — core contains the CLI entry point and may bump independently for bin/CLI fixes without touching the engine.
46
+
47
+ If you see version mismatches after install, delete `node_modules` and `package-lock.json`, then reinstall.
48
+
49
+ ## Latest Release
50
+
51
+ - Generated apps now depend on `@zenithbuild/core@latest` so new installs track the current stable framework release.
52
+ - Template downloads now resolve from `zenithbuild/framework`, which is the active monorepo source of truth.
53
+ - Verified scaffold → install → build coverage lives in `tests/template-regression.spec.mjs`.
54
+
38
55
  ## Development
39
56
 
40
57
  ```bash
41
- # Clone the repository
42
- git clone https://github.com/zenithbuild/create-zenith.git
58
+ # Clone the monorepo
59
+ git clone https://github.com/zenithbuild/framework.git
60
+
61
+ # Enter the package
62
+ cd framework/packages/create-zenith
43
63
 
44
64
  # Install dependencies
45
65
  bun install
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,70 @@ 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
 
2741
2822
  // src/index.ts
2742
- var VERSION = "1.3.0";
2743
- var GITHUB_REPO = "zenithbuild/create-zenith";
2823
+ var GITHUB_REPO = "zenithbuild/framework";
2744
2824
  var DEFAULT_TEMPLATE = "examples/starter";
2745
2825
  var TAILWIND_TEMPLATE = "examples/starter-tailwindcss";
2826
+ var __filename2 = fileURLToPath(import.meta.url);
2827
+ var __dirname2 = path.dirname(__filename2);
2828
+ function getCliVersion() {
2829
+ try {
2830
+ const pkgPath = path.resolve(__dirname2, "..", "package.json");
2831
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
2832
+ return typeof pkg.version === "string" ? pkg.version : "0.0.0";
2833
+ } catch {
2834
+ return "0.0.0";
2835
+ }
2836
+ }
2837
+ var VERSION = getCliVersion();
2838
+ function flagEnabled2(value) {
2839
+ if (value == null)
2840
+ return false;
2841
+ const normalized = value.trim().toLowerCase();
2842
+ return normalized === "1" || normalized === "true" || normalized === "yes" || normalized === "on";
2843
+ }
2844
+ function resolveLocalTemplatePath(templatePath) {
2845
+ const candidate = path.resolve(__dirname2, "..", templatePath);
2846
+ return fs.existsSync(candidate) ? candidate : null;
2847
+ }
2746
2848
  function detectPackageManager() {
2747
2849
  const userAgent = process.env.npm_config_user_agent || "";
2748
2850
  if (userAgent.includes("bun"))
@@ -2774,17 +2876,28 @@ function hasGit() {
2774
2876
  }
2775
2877
  }
2776
2878
  async function downloadTemplate(targetDir, templatePath) {
2879
+ const localTemplatePath = resolveLocalTemplatePath(templatePath);
2880
+ const forceLocal = process.env.CREATE_ZENITH_TEMPLATE_MODE === "local" || flagEnabled2(process.env.CREATE_ZENITH_OFFLINE);
2881
+ const preferLocal = process.env.CREATE_ZENITH_PREFER_LOCAL !== "0";
2882
+ if (localTemplatePath && (forceLocal || preferLocal)) {
2883
+ fs.cpSync(localTemplatePath, targetDir, { recursive: true });
2884
+ return;
2885
+ }
2886
+ if (forceLocal && !localTemplatePath) {
2887
+ throw new Error(`Local template not found: ${templatePath}`);
2888
+ }
2777
2889
  const tempDir = path.join(os2.tmpdir(), `zenith-template-${Date.now()}`);
2778
2890
  try {
2779
2891
  if (hasGit()) {
2780
2892
  execSync(`git clone --depth 1 --filter=blob:none --sparse https://github.com/${GITHUB_REPO}.git "${tempDir}"`, {
2781
2893
  stdio: "pipe"
2782
2894
  });
2783
- execSync(`git sparse-checkout set ${templatePath}`, {
2895
+ const repoTemplatePath = `packages/create-zenith/${templatePath}`;
2896
+ execSync(`git sparse-checkout set ${repoTemplatePath}`, {
2784
2897
  cwd: tempDir,
2785
2898
  stdio: "pipe"
2786
2899
  });
2787
- const templateSource = path.join(tempDir, templatePath);
2900
+ const templateSource = path.join(tempDir, repoTemplatePath);
2788
2901
  fs.cpSync(templateSource, targetDir, { recursive: true });
2789
2902
  } else {
2790
2903
  const tarballUrl = `https://github.com/${GITHUB_REPO}/archive/refs/heads/main.tar.gz`;
@@ -2792,11 +2905,11 @@ async function downloadTemplate(targetDir, templatePath) {
2792
2905
  execSync(`curl -sL "${tarballUrl}" -o "${tarballPath}"`, { stdio: "pipe" });
2793
2906
  fs.mkdirSync(tempDir, { recursive: true });
2794
2907
  execSync(`tar -xzf "${tarballPath}" -C "${tempDir}"`, { stdio: "pipe" });
2795
- const extractedDir = fs.readdirSync(tempDir).find((f) => f.startsWith("create-zenith"));
2908
+ const extractedDir = fs.readdirSync(tempDir).find((f) => f.startsWith("framework"));
2796
2909
  if (!extractedDir) {
2797
2910
  throw new Error("Failed to extract template from GitHub");
2798
2911
  }
2799
- const templateSource = path.join(tempDir, extractedDir, templatePath);
2912
+ const templateSource = path.join(tempDir, extractedDir, "packages/create-zenith", templatePath);
2800
2913
  fs.cpSync(templateSource, targetDir, { recursive: true });
2801
2914
  fs.unlinkSync(tarballPath);
2802
2915
  }
@@ -2930,6 +3043,8 @@ async function createProject(options) {
2930
3043
  async function create(appName, withTailwind) {
2931
3044
  await intro();
2932
3045
  const options = await gatherOptions(appName, withTailwind);
3046
+ const templateLabel = options.tailwind ? "starter-tailwindcss" : "starter";
3047
+ showScaffoldSummary(options.name, templateLabel);
2933
3048
  console.log("");
2934
3049
  log.step(`Creating ${bold(options.name)}...`);
2935
3050
  const s = spinner();
@@ -2940,15 +3055,20 @@ async function create(appName, withTailwind) {
2940
3055
  s.start("Installing dependencies...");
2941
3056
  const targetDir = path.resolve(process.cwd(), options.name);
2942
3057
  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");
3058
+ if (flagEnabled2(process.env.CREATE_ZENITH_SKIP_INSTALL)) {
3059
+ s.stop("Dependency installation skipped");
2951
3060
  warn(`Run "${pm} install" manually in the project directory`);
3061
+ } else {
3062
+ try {
3063
+ execSync(`${pm} install`, {
3064
+ cwd: targetDir,
3065
+ stdio: "pipe"
3066
+ });
3067
+ s.stop("Dependencies installed");
3068
+ } catch {
3069
+ s.stop("Could not install dependencies automatically");
3070
+ warn(`Run "${pm} install" manually in the project directory`);
3071
+ }
2952
3072
  }
2953
3073
  await outro(options.name, pm);
2954
3074
  } catch (err) {
@@ -2984,6 +3104,10 @@ if (args.includes("--version") || args.includes("-v")) {
2984
3104
  var projectName = args.find((arg) => !arg.startsWith("-"));
2985
3105
  var withTailwind = args.includes("--with-tailwind") ? true : undefined;
2986
3106
  create(projectName, withTailwind).catch((err) => {
3107
+ const mode = getUiMode(process);
3108
+ if (mode.plain) {
3109
+ console.log("ERROR: SCAFFOLD_ERROR");
3110
+ }
2987
3111
  error(err instanceof Error ? err.message : String(err));
2988
3112
  process.exit(1);
2989
3113
  });
package/dist/index.js CHANGED
@@ -3,20 +3,34 @@ var __getProtoOf = Object.getPrototypeOf;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ function __accessProp(key) {
7
+ return this[key];
8
+ }
9
+ var __toESMCache_node;
10
+ var __toESMCache_esm;
6
11
  var __toESM = (mod, isNodeMode, target) => {
12
+ var canCache = mod != null && typeof mod === "object";
13
+ if (canCache) {
14
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
15
+ var cached = cache.get(mod);
16
+ if (cached)
17
+ return cached;
18
+ }
7
19
  target = mod != null ? __create(__getProtoOf(mod)) : {};
8
20
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
9
21
  for (let key of __getOwnPropNames(mod))
10
22
  if (!__hasOwnProp.call(to, key))
11
23
  __defProp(to, key, {
12
- get: () => mod[key],
24
+ get: __accessProp.bind(mod, key),
13
25
  enumerable: true
14
26
  });
27
+ if (canCache)
28
+ cache.set(mod, to);
15
29
  return to;
16
30
  };
17
31
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
18
32
 
19
- // ../node_modules/.bun/picocolors@1.1.1/node_modules/picocolors/picocolors.js
33
+ // ../../node_modules/.bun/picocolors@1.1.1/node_modules/picocolors/picocolors.js
20
34
  var require_picocolors = __commonJS((exports, module) => {
21
35
  var p = process || {};
22
36
  var argv = p.argv || [];
@@ -86,7 +100,7 @@ var require_picocolors = __commonJS((exports, module) => {
86
100
  module.exports.createColors = createColors;
87
101
  });
88
102
 
89
- // ../node_modules/.bun/tinycolor2@1.6.0/node_modules/tinycolor2/cjs/tinycolor.js
103
+ // ../../node_modules/.bun/tinycolor2@1.6.0/node_modules/tinycolor2/cjs/tinycolor.js
90
104
  var require_tinycolor = __commonJS((exports, module) => {
91
105
  (function(global, factory) {
92
106
  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());
@@ -1070,7 +1084,7 @@ var require_tinycolor = __commonJS((exports, module) => {
1070
1084
  });
1071
1085
  });
1072
1086
 
1073
- // ../node_modules/.bun/tinygradient@1.1.5/node_modules/tinygradient/index.js
1087
+ // ../../node_modules/.bun/tinygradient@1.1.5/node_modules/tinygradient/index.js
1074
1088
  var require_tinygradient = __commonJS((exports, module) => {
1075
1089
  var tinycolor = require_tinycolor();
1076
1090
  var RGBA_MAX = { r: 256, g: 256, b: 256, a: 1 };
@@ -1325,7 +1339,7 @@ var require_tinygradient = __commonJS((exports, module) => {
1325
1339
  };
1326
1340
  });
1327
1341
 
1328
- // ../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
1342
+ // ../../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
1329
1343
  var require_src = __commonJS((exports, module) => {
1330
1344
  var ESC = "\x1B";
1331
1345
  var CSI = `${ESC}[`;
@@ -1388,11 +1402,12 @@ import * as fs from "node:fs";
1388
1402
  import * as path from "node:path";
1389
1403
  import * as os2 from "node:os";
1390
1404
  import { execSync } from "node:child_process";
1405
+ import { fileURLToPath } from "node:url";
1391
1406
 
1392
1407
  // src/branding.ts
1393
1408
  var import_picocolors = __toESM(require_picocolors(), 1);
1394
1409
 
1395
- // ../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
1410
+ // ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
1396
1411
  var ANSI_BACKGROUND_OFFSET = 10;
1397
1412
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
1398
1413
  var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
@@ -1569,7 +1584,7 @@ function assembleStyles() {
1569
1584
  var ansiStyles = assembleStyles();
1570
1585
  var ansi_styles_default = ansiStyles;
1571
1586
 
1572
- // ../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
1587
+ // ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
1573
1588
  import process2 from "node:process";
1574
1589
  import os from "node:os";
1575
1590
  import tty from "node:tty";
@@ -1701,7 +1716,7 @@ var supportsColor = {
1701
1716
  };
1702
1717
  var supports_color_default = supportsColor;
1703
1718
 
1704
- // ../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/utilities.js
1719
+ // ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/utilities.js
1705
1720
  function stringReplaceAll(string, substring, replacer) {
1706
1721
  let index = string.indexOf(substring);
1707
1722
  if (index === -1) {
@@ -1734,7 +1749,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
1734
1749
  return returnValue;
1735
1750
  }
1736
1751
 
1737
- // ../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/index.js
1752
+ // ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/index.js
1738
1753
  var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
1739
1754
  var GENERATOR = Symbol("GENERATOR");
1740
1755
  var STYLER = Symbol("STYLER");
@@ -1881,7 +1896,7 @@ var chalk = createChalk();
1881
1896
  var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
1882
1897
  var source_default = chalk;
1883
1898
 
1884
- // ../node_modules/.bun/gradient-string@3.0.0/node_modules/gradient-string/dist/index.js
1899
+ // ../../node_modules/.bun/gradient-string@3.0.0/node_modules/gradient-string/dist/index.js
1885
1900
  var import_tinygradient = __toESM(require_tinygradient(), 1);
1886
1901
  var gradient = (...colors) => {
1887
1902
  let gradient2;
@@ -1999,20 +2014,40 @@ gradient.summer = summer;
1999
2014
  gradient.rainbow = rainbow;
2000
2015
  gradient.pastel = pastel;
2001
2016
 
2017
+ // src/ui/env.ts
2018
+ function flagEnabled(value) {
2019
+ if (value == null)
2020
+ return false;
2021
+ const normalized = value.trim().toLowerCase();
2022
+ return normalized === "1" || normalized === "true" || normalized === "yes" || normalized === "on";
2023
+ }
2024
+ function getUiMode(runtime = process) {
2025
+ const tty2 = Boolean(runtime.stdout?.isTTY);
2026
+ const ci = flagEnabled(runtime.env.CI);
2027
+ const noUi = flagEnabled(runtime.env.ZENITH_NO_UI);
2028
+ const noColor = runtime.env.NO_COLOR !== undefined;
2029
+ const forceColor = flagEnabled(runtime.env.FORCE_COLOR);
2030
+ const debug = flagEnabled(runtime.env.ZENITH_DEBUG);
2031
+ const plain = noUi || ci || !tty2;
2032
+ const color = !plain && !noColor && (forceColor || tty2);
2033
+ const animate = tty2 && !plain && !ci;
2034
+ return { tty: tty2, plain, color, animate, debug };
2035
+ }
2036
+
2002
2037
  // src/branding.ts
2003
- var colors = {
2004
- primary: import_picocolors.default.blue,
2005
- secondary: import_picocolors.default.cyan,
2006
- success: import_picocolors.default.green,
2007
- warning: import_picocolors.default.yellow,
2008
- error: import_picocolors.default.red,
2009
- muted: import_picocolors.default.gray,
2010
- bold: import_picocolors.default.bold,
2011
- dim: import_picocolors.default.dim
2012
- };
2013
- var zenithGradient = dist_default(["#3b82f6", "#06b6d4", "#22d3ee"]);
2038
+ function ui() {
2039
+ return getUiMode(process);
2040
+ }
2041
+ function pc() {
2042
+ return import_picocolors.createColors(ui().color);
2043
+ }
2044
+ function zenithGradientText(text) {
2045
+ if (!ui().color)
2046
+ return text;
2047
+ return dist_default(["#3b82f6", "#06b6d4", "#22d3ee"])(text);
2048
+ }
2014
2049
  function isTTY() {
2015
- return Boolean(process.stdout.isTTY && !process.env.CI && !process.env.GITHUB_ACTIONS && !process.env.CONTINUOUS_INTEGRATION);
2050
+ return ui().animate;
2016
2051
  }
2017
2052
  var LOGO_LINES = [
2018
2053
  " ███████╗███████╗███╗ ██╗██╗████████╗██╗ ██╗",
@@ -2023,107 +2058,124 @@ var LOGO_LINES = [
2023
2058
  " ╚══════╝╚══════╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝ ╚═╝"
2024
2059
  ];
2025
2060
  var TAGLINE = "The Modern Reactive Web Framework";
2061
+ function renderLogoLine(line) {
2062
+ return ui().color ? zenithGradientText(line) : line;
2063
+ }
2026
2064
  var LOGO = `
2027
- ${import_picocolors.default.cyan("╔" + "═".repeat(55) + "╗")}
2028
- ${import_picocolors.default.cyan("║")}${" ".repeat(55)}${import_picocolors.default.cyan("║")}
2029
- ${LOGO_LINES.map((line) => `${import_picocolors.default.cyan("║")} ${zenithGradient(line)} ${import_picocolors.default.cyan("║")}`).join(`
2065
+ ${pc().cyan("╔" + "═".repeat(55) + "╗")}
2066
+ ${pc().cyan("║")}${" ".repeat(55)}${pc().cyan("║")}
2067
+ ${LOGO_LINES.map((line) => `${pc().cyan("║")} ${renderLogoLine(line)} ${pc().cyan("║")}`).join(`
2030
2068
  `)}
2031
- ${import_picocolors.default.cyan("║")}${" ".repeat(55)}${import_picocolors.default.cyan("║")}
2032
- ${import_picocolors.default.cyan("║")}${" ".repeat(10)}${import_picocolors.default.dim(TAGLINE)}${" ".repeat(10)}${import_picocolors.default.cyan("║")}
2033
- ${import_picocolors.default.cyan("║")}${" ".repeat(55)}${import_picocolors.default.cyan("║")}
2034
- ${import_picocolors.default.cyan("╚" + "═".repeat(55) + "╝")}
2035
- `;
2036
- var LOGO_COMPACT = `
2037
- ${import_picocolors.default.bold(zenithGradient("⚡ ZENITH"))} ${import_picocolors.default.dim("- Modern Reactive Framework")}
2069
+ ${pc().cyan("║")}${" ".repeat(55)}${pc().cyan("║")}
2070
+ ${pc().cyan("║")}${" ".repeat(10)}${pc().dim(TAGLINE)}${" ".repeat(10)}${pc().cyan("║")}
2071
+ ${pc().cyan("║")}${" ".repeat(55)}${pc().cyan("║")}
2072
+ ${pc().cyan("╚" + "═".repeat(55) + "╝")}
2038
2073
  `;
2074
+ var LOGO_COMPACT = ` ${pc().bold(renderLogoLine("⚡ ZENITH"))} ${pc().dim("- Modern Reactive Framework")}`;
2039
2075
  function sleep(ms) {
2040
2076
  return new Promise((resolve) => setTimeout(resolve, ms));
2041
2077
  }
2042
2078
  async function animateLogo() {
2043
- if (!isTTY()) {
2044
- showLogo();
2079
+ if (!ui().animate) {
2080
+ showCompactLogo();
2045
2081
  return;
2046
2082
  }
2047
2083
  console.clear();
2048
- console.log(import_picocolors.default.cyan("╔" + "═".repeat(55) + "╗"));
2049
- console.log(import_picocolors.default.cyan("║") + " ".repeat(55) + import_picocolors.default.cyan("║"));
2050
- for (let i = 0;i < LOGO_LINES.length; i++) {
2051
- const line = LOGO_LINES[i];
2052
- process.stdout.write(import_picocolors.default.cyan("║") + " ");
2084
+ console.log(pc().cyan("╔" + "═".repeat(55) + "╗"));
2085
+ console.log(pc().cyan("║") + " ".repeat(55) + pc().cyan("║"));
2086
+ for (const line of LOGO_LINES) {
2087
+ process.stdout.write(pc().cyan("║") + " ");
2053
2088
  const chars = [...line];
2054
2089
  const chunkSize = Math.ceil(chars.length / 8);
2055
2090
  for (let j = 0;j < chars.length; j += chunkSize) {
2056
2091
  const chunk = chars.slice(j, j + chunkSize).join("");
2057
- process.stdout.write(zenithGradient(chunk));
2092
+ process.stdout.write(renderLogoLine(chunk));
2058
2093
  await sleep(30);
2059
2094
  }
2060
- console.log(" " + import_picocolors.default.cyan("║"));
2095
+ console.log(" " + pc().cyan("║"));
2061
2096
  }
2062
- console.log(import_picocolors.default.cyan("║") + " ".repeat(55) + import_picocolors.default.cyan("║"));
2063
- process.stdout.write(import_picocolors.default.cyan("║") + " ".repeat(10));
2097
+ console.log(pc().cyan("║") + " ".repeat(55) + pc().cyan("║"));
2098
+ process.stdout.write(pc().cyan("║") + " ".repeat(10));
2064
2099
  const taglineChars = [...TAGLINE];
2065
2100
  for (let i = 0;i < taglineChars.length; i += 4) {
2066
2101
  const chunk = taglineChars.slice(i, i + 4).join("");
2067
- process.stdout.write(import_picocolors.default.dim(chunk));
2102
+ process.stdout.write(pc().dim(chunk));
2068
2103
  await sleep(20);
2069
2104
  }
2070
- console.log(" ".repeat(10) + import_picocolors.default.cyan("║"));
2071
- console.log(import_picocolors.default.cyan("║") + " ".repeat(55) + import_picocolors.default.cyan("║"));
2072
- console.log(import_picocolors.default.cyan("╚" + "═".repeat(55) + "╝"));
2105
+ console.log(" ".repeat(10) + pc().cyan("║"));
2106
+ console.log(pc().cyan("║") + " ".repeat(55) + pc().cyan("║"));
2107
+ console.log(pc().cyan("╚" + "═".repeat(55) + "╝"));
2073
2108
  await sleep(150);
2074
2109
  }
2075
- function showLogo() {
2076
- console.log(LOGO);
2077
- }
2078
2110
  function showCompactLogo() {
2111
+ if (ui().plain) {
2112
+ console.log("ZENITH - Modern Reactive Framework");
2113
+ return;
2114
+ }
2079
2115
  console.log(LOGO_COMPACT);
2080
2116
  }
2081
2117
  async function showCompletionAnimation() {
2082
- if (!isTTY()) {
2083
- console.log(`${import_picocolors.default.green("✓")} ${import_picocolors.default.bold("Done!")}`);
2118
+ if (!ui().animate) {
2119
+ console.log("OK: Done!");
2084
2120
  return;
2085
2121
  }
2086
2122
  const frames = ["✓", "✨", "✓", "✨", "✓"];
2087
- const colors2 = [import_picocolors.default.green, import_picocolors.default.yellow, import_picocolors.default.green, import_picocolors.default.yellow, import_picocolors.default.green];
2123
+ const colors = [pc().green, pc().yellow, pc().green, pc().yellow, pc().green];
2088
2124
  for (let i = 0;i < frames.length; i++) {
2089
- process.stdout.write(`\r${colors2[i](frames[i])} ${import_picocolors.default.bold("Done!")}`);
2125
+ process.stdout.write(`\r${colors[i](frames[i])} ${pc().bold("Done!")}`);
2090
2126
  await sleep(100);
2091
2127
  }
2092
2128
  console.log();
2093
2129
  }
2094
2130
  function error(text) {
2095
- console.log(`${import_picocolors.default.red("✗")} ${text}`);
2131
+ console.log(ui().plain ? `ERROR: ${text}` : `${pc().red("✗")} ${text}`);
2096
2132
  }
2097
2133
  function warn(text) {
2098
- console.log(`${import_picocolors.default.yellow("⚠")} ${text}`);
2134
+ console.log(ui().plain ? `WARN: ${text}` : `${pc().yellow("⚠")} ${text}`);
2099
2135
  }
2100
2136
  function bold(text) {
2101
- return import_picocolors.default.bold(text);
2137
+ return ui().plain ? text : pc().bold(text);
2102
2138
  }
2103
2139
  function showNextSteps(projectName, packageManager = "bun") {
2104
2140
  const pm = packageManager;
2105
2141
  const runCmd = pm === "npm" ? "npm run dev" : `${pm} run dev`;
2142
+ if (ui().plain) {
2143
+ console.log("");
2144
+ console.log("NEXT STEPS:");
2145
+ console.log(` cd ${projectName}`);
2146
+ console.log(` ${runCmd}`);
2147
+ console.log(" open http://localhost:3000");
2148
+ console.log("");
2149
+ return;
2150
+ }
2106
2151
  const cdLine = `cd ${projectName}`;
2107
2152
  const maxLineLen = 45;
2108
2153
  const cdPadding = Math.max(1, maxLineLen - cdLine.length - 6);
2109
2154
  const runPadding = Math.max(1, maxLineLen - runCmd.length - 6);
2110
2155
  console.log(`
2111
- ${import_picocolors.default.cyan("┌" + "─".repeat(50) + "┐")}
2112
- ${import_picocolors.default.cyan("│")}${" ".repeat(50)}${import_picocolors.default.cyan("│")}
2113
- ${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("│")}
2114
- ${import_picocolors.default.cyan("│")}${" ".repeat(50)}${import_picocolors.default.cyan("│")}
2115
- ${import_picocolors.default.cyan("│")} ${import_picocolors.default.dim("Next steps:")}${" ".repeat(36)}${import_picocolors.default.cyan("│")}
2116
- ${import_picocolors.default.cyan("│")}${" ".repeat(50)}${import_picocolors.default.cyan("│")}
2117
- ${import_picocolors.default.cyan("│")} ${import_picocolors.default.cyan("$")} ${import_picocolors.default.bold(cdLine)}${" ".repeat(cdPadding)}${import_picocolors.default.cyan("│")}
2118
- ${import_picocolors.default.cyan("│")} ${import_picocolors.default.cyan("$")} ${import_picocolors.default.bold(runCmd)}${" ".repeat(runPadding)}${import_picocolors.default.cyan("│")}
2119
- ${import_picocolors.default.cyan("│")}${" ".repeat(50)}${import_picocolors.default.cyan("│")}
2120
- ${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("│")}
2121
- ${import_picocolors.default.cyan("│")}${" ".repeat(50)}${import_picocolors.default.cyan("│")}
2122
- ${import_picocolors.default.cyan("└" + "─".repeat(50) + "┘")}
2156
+ ${pc().cyan("┌" + "─".repeat(50) + "┐")}
2157
+ ${pc().cyan("│")}${" ".repeat(50)}${pc().cyan("│")}
2158
+ ${pc().cyan("│")} ${pc().green("✨")} ${pc().bold(renderLogoLine("Your Zenith app is ready!"))}${" ".repeat(17)}${pc().cyan("│")}
2159
+ ${pc().cyan("│")}${" ".repeat(50)}${pc().cyan("│")}
2160
+ ${pc().cyan("│")} ${pc().dim("Next steps:")}${" ".repeat(36)}${pc().cyan("│")}
2161
+ ${pc().cyan("│")}${" ".repeat(50)}${pc().cyan("│")}
2162
+ ${pc().cyan("│")} ${pc().cyan("$")} ${pc().bold(cdLine)}${" ".repeat(cdPadding)}${pc().cyan("│")}
2163
+ ${pc().cyan("│")} ${pc().cyan("$")} ${pc().bold(runCmd)}${" ".repeat(runPadding)}${pc().cyan("│")}
2164
+ ${pc().cyan("│")}${" ".repeat(50)}${pc().cyan("│")}
2165
+ ${pc().cyan("│")} ${pc().dim("Then open")} ${pc().underline(pc().blue("http://localhost:3000"))}${" ".repeat(9)}${pc().cyan("│")}
2166
+ ${pc().cyan("│")}${" ".repeat(50)}${pc().cyan("│")}
2167
+ ${pc().cyan("└" + "─".repeat(50) + "┘")}
2123
2168
  `);
2124
2169
  }
2170
+ function showScaffoldSummary(projectName, templateLabel) {
2171
+ const title = ui().plain ? "SCAFFOLD PLAN" : pc().bold(pc().cyan("Scaffold Plan"));
2172
+ console.log(`
2173
+ ${title}`);
2174
+ console.log(`Project : ${projectName}`);
2175
+ console.log(`Template: ${templateLabel}`);
2176
+ }
2125
2177
 
2126
- // ../node_modules/.bun/@clack+core@0.5.0/node_modules/@clack/core/dist/index.mjs
2178
+ // ../../node_modules/.bun/@clack+core@0.5.0/node_modules/@clack/core/dist/index.mjs
2127
2179
  var import_sisteransi = __toESM(require_src(), 1);
2128
2180
  var import_picocolors2 = __toESM(require_picocolors(), 1);
2129
2181
  import { stdin as j, stdout as M } from "node:process";
@@ -2519,7 +2571,7 @@ class RD extends x {
2519
2571
  }
2520
2572
  }
2521
2573
 
2522
- // ../node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/dist/index.mjs
2574
+ // ../../node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/dist/index.mjs
2523
2575
  var import_picocolors3 = __toESM(require_picocolors(), 1);
2524
2576
  var import_sisteransi2 = __toESM(require_src(), 1);
2525
2577
  import y2 from "node:process";
@@ -2689,10 +2741,20 @@ var Y2 = ({ indicator: t = "dots" } = {}) => {
2689
2741
 
2690
2742
  // src/prompts.ts
2691
2743
  var import_picocolors4 = __toESM(require_picocolors(), 1);
2744
+ function pc2() {
2745
+ const mode = getUiMode(process);
2746
+ return import_picocolors4.createColors(mode.color);
2747
+ }
2692
2748
  async function intro() {
2693
2749
  await animateLogo();
2694
2750
  console.log();
2695
- Ie(import_picocolors4.default.bgCyan(import_picocolors4.default.black(" create-zenith ")));
2751
+ const mode = getUiMode(process);
2752
+ if (mode.plain) {
2753
+ console.log("create-zenith");
2754
+ return;
2755
+ }
2756
+ const colors = pc2();
2757
+ Ie(colors.bgCyan(colors.black(" create-zenith ")));
2696
2758
  }
2697
2759
  async function text(opts) {
2698
2760
  if (!isTTY()) {
@@ -2718,30 +2780,70 @@ function isCancel(value) {
2718
2780
  return pD(value);
2719
2781
  }
2720
2782
  function handleCancel() {
2721
- xe("Operation cancelled.");
2783
+ if (getUiMode(process).plain) {
2784
+ console.log("WARN: Operation cancelled.");
2785
+ } else {
2786
+ xe("Operation cancelled.");
2787
+ }
2722
2788
  process.exit(0);
2723
2789
  }
2724
2790
  function spinner() {
2725
- return Y2();
2791
+ if (getUiMode(process).animate) {
2792
+ return Y2();
2793
+ }
2794
+ return {
2795
+ start(message) {
2796
+ console.log(`INFO: ${message}`);
2797
+ },
2798
+ stop(message) {
2799
+ if (message) {
2800
+ console.log(`OK: ${message}`);
2801
+ }
2802
+ },
2803
+ message(message) {
2804
+ console.log(`INFO: ${message}`);
2805
+ }
2806
+ };
2726
2807
  }
2727
2808
  async function outro(projectName, packageManager) {
2728
2809
  await showCompletionAnimation();
2729
2810
  showNextSteps(projectName, packageManager);
2730
2811
  }
2731
2812
  var log = {
2732
- info: (message) => M2.info(message),
2733
- success: (message) => M2.success(message),
2734
- warn: (message) => M2.warn(message),
2735
- error: (message) => M2.error(message),
2736
- step: (message) => M2.step(message),
2737
- message: (message) => M2.message(message)
2813
+ info: (message) => getUiMode(process).plain ? console.log(`INFO: ${message}`) : M2.info(message),
2814
+ success: (message) => getUiMode(process).plain ? console.log(`OK: ${message}`) : M2.success(message),
2815
+ warn: (message) => getUiMode(process).plain ? console.log(`WARN: ${message}`) : M2.warn(message),
2816
+ error: (message) => getUiMode(process).plain ? console.log(`ERROR: ${message}`) : M2.error(message),
2817
+ step: (message) => getUiMode(process).plain ? console.log(`STEP: ${message}`) : M2.step(message),
2818
+ message: (message) => getUiMode(process).plain ? console.log(message) : M2.message(message)
2738
2819
  };
2739
2820
 
2740
2821
  // src/index.ts
2741
- var VERSION = "1.3.0";
2742
- var GITHUB_REPO = "zenithbuild/create-zenith";
2822
+ var GITHUB_REPO = "zenithbuild/framework";
2743
2823
  var DEFAULT_TEMPLATE = "examples/starter";
2744
2824
  var TAILWIND_TEMPLATE = "examples/starter-tailwindcss";
2825
+ var __filename2 = fileURLToPath(import.meta.url);
2826
+ var __dirname2 = path.dirname(__filename2);
2827
+ function getCliVersion() {
2828
+ try {
2829
+ const pkgPath = path.resolve(__dirname2, "..", "package.json");
2830
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
2831
+ return typeof pkg.version === "string" ? pkg.version : "0.0.0";
2832
+ } catch {
2833
+ return "0.0.0";
2834
+ }
2835
+ }
2836
+ var VERSION = getCliVersion();
2837
+ function flagEnabled2(value) {
2838
+ if (value == null)
2839
+ return false;
2840
+ const normalized = value.trim().toLowerCase();
2841
+ return normalized === "1" || normalized === "true" || normalized === "yes" || normalized === "on";
2842
+ }
2843
+ function resolveLocalTemplatePath(templatePath) {
2844
+ const candidate = path.resolve(__dirname2, "..", templatePath);
2845
+ return fs.existsSync(candidate) ? candidate : null;
2846
+ }
2745
2847
  function detectPackageManager() {
2746
2848
  const userAgent = process.env.npm_config_user_agent || "";
2747
2849
  if (userAgent.includes("bun"))
@@ -2773,17 +2875,28 @@ function hasGit() {
2773
2875
  }
2774
2876
  }
2775
2877
  async function downloadTemplate(targetDir, templatePath) {
2878
+ const localTemplatePath = resolveLocalTemplatePath(templatePath);
2879
+ const forceLocal = process.env.CREATE_ZENITH_TEMPLATE_MODE === "local" || flagEnabled2(process.env.CREATE_ZENITH_OFFLINE);
2880
+ const preferLocal = process.env.CREATE_ZENITH_PREFER_LOCAL !== "0";
2881
+ if (localTemplatePath && (forceLocal || preferLocal)) {
2882
+ fs.cpSync(localTemplatePath, targetDir, { recursive: true });
2883
+ return;
2884
+ }
2885
+ if (forceLocal && !localTemplatePath) {
2886
+ throw new Error(`Local template not found: ${templatePath}`);
2887
+ }
2776
2888
  const tempDir = path.join(os2.tmpdir(), `zenith-template-${Date.now()}`);
2777
2889
  try {
2778
2890
  if (hasGit()) {
2779
2891
  execSync(`git clone --depth 1 --filter=blob:none --sparse https://github.com/${GITHUB_REPO}.git "${tempDir}"`, {
2780
2892
  stdio: "pipe"
2781
2893
  });
2782
- execSync(`git sparse-checkout set ${templatePath}`, {
2894
+ const repoTemplatePath = `packages/create-zenith/${templatePath}`;
2895
+ execSync(`git sparse-checkout set ${repoTemplatePath}`, {
2783
2896
  cwd: tempDir,
2784
2897
  stdio: "pipe"
2785
2898
  });
2786
- const templateSource = path.join(tempDir, templatePath);
2899
+ const templateSource = path.join(tempDir, repoTemplatePath);
2787
2900
  fs.cpSync(templateSource, targetDir, { recursive: true });
2788
2901
  } else {
2789
2902
  const tarballUrl = `https://github.com/${GITHUB_REPO}/archive/refs/heads/main.tar.gz`;
@@ -2791,11 +2904,11 @@ async function downloadTemplate(targetDir, templatePath) {
2791
2904
  execSync(`curl -sL "${tarballUrl}" -o "${tarballPath}"`, { stdio: "pipe" });
2792
2905
  fs.mkdirSync(tempDir, { recursive: true });
2793
2906
  execSync(`tar -xzf "${tarballPath}" -C "${tempDir}"`, { stdio: "pipe" });
2794
- const extractedDir = fs.readdirSync(tempDir).find((f) => f.startsWith("create-zenith"));
2907
+ const extractedDir = fs.readdirSync(tempDir).find((f) => f.startsWith("framework"));
2795
2908
  if (!extractedDir) {
2796
2909
  throw new Error("Failed to extract template from GitHub");
2797
2910
  }
2798
- const templateSource = path.join(tempDir, extractedDir, templatePath);
2911
+ const templateSource = path.join(tempDir, extractedDir, "packages/create-zenith", templatePath);
2799
2912
  fs.cpSync(templateSource, targetDir, { recursive: true });
2800
2913
  fs.unlinkSync(tarballPath);
2801
2914
  }
@@ -2929,6 +3042,8 @@ async function createProject(options) {
2929
3042
  async function create(appName, withTailwind) {
2930
3043
  await intro();
2931
3044
  const options = await gatherOptions(appName, withTailwind);
3045
+ const templateLabel = options.tailwind ? "starter-tailwindcss" : "starter";
3046
+ showScaffoldSummary(options.name, templateLabel);
2932
3047
  console.log("");
2933
3048
  log.step(`Creating ${bold(options.name)}...`);
2934
3049
  const s = spinner();
@@ -2939,15 +3054,20 @@ async function create(appName, withTailwind) {
2939
3054
  s.start("Installing dependencies...");
2940
3055
  const targetDir = path.resolve(process.cwd(), options.name);
2941
3056
  const pm = detectPackageManager();
2942
- try {
2943
- execSync(`${pm} install`, {
2944
- cwd: targetDir,
2945
- stdio: "pipe"
2946
- });
2947
- s.stop("Dependencies installed");
2948
- } catch {
2949
- s.stop("Could not install dependencies automatically");
3057
+ if (flagEnabled2(process.env.CREATE_ZENITH_SKIP_INSTALL)) {
3058
+ s.stop("Dependency installation skipped");
2950
3059
  warn(`Run "${pm} install" manually in the project directory`);
3060
+ } else {
3061
+ try {
3062
+ execSync(`${pm} install`, {
3063
+ cwd: targetDir,
3064
+ stdio: "pipe"
3065
+ });
3066
+ s.stop("Dependencies installed");
3067
+ } catch {
3068
+ s.stop("Could not install dependencies automatically");
3069
+ warn(`Run "${pm} install" manually in the project directory`);
3070
+ }
2951
3071
  }
2952
3072
  await outro(options.name, pm);
2953
3073
  } catch (err) {
@@ -2983,6 +3103,10 @@ if (args.includes("--version") || args.includes("-v")) {
2983
3103
  var projectName = args.find((arg) => !arg.startsWith("-"));
2984
3104
  var withTailwind = args.includes("--with-tailwind") ? true : undefined;
2985
3105
  create(projectName, withTailwind).catch((err) => {
3106
+ const mode = getUiMode(process);
3107
+ if (mode.plain) {
3108
+ console.log("ERROR: SCAFFOLD_ERROR");
3109
+ }
2986
3110
  error(err instanceof Error ? err.message : String(err));
2987
3111
  process.exit(1);
2988
3112
  });
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "create-zenith",
3
- "version": "1.3.7",
3
+ "version": "1.3.18",
4
4
  "description": "Create a new Zenith application - the modern reactive web framework",
5
5
  "type": "module",
6
6
  "bin": {
7
- "create-zenith": "./dist/cli.js"
7
+ "create-zenith": "dist/cli.js"
8
8
  },
9
9
  "files": [
10
- "dist"
10
+ "dist/**"
11
11
  ],
12
12
  "scripts": {
13
13
  "build": "bun build src/index.ts --outdir dist --target node --format esm && node -e \"const fs=require('fs');const c=fs.readFileSync('dist/index.js','utf8');fs.writeFileSync('dist/cli.js','#!/usr/bin/env node\\n'+c);fs.chmodSync('dist/cli.js','755')\"",
14
14
  "prepublishOnly": "npm run build",
15
15
  "create": "bun src/index.ts",
16
16
  "example": "rm -rf examples/test-template && bun src/index.ts test-template && mv test-template examples/",
17
- "test": "node dist/cli.js --help",
17
+ "test": "node --test tests/*.spec.mjs",
18
18
  "release": "bun run scripts/release.ts",
19
19
  "release:dry": "bun run scripts/release.ts --dry-run",
20
20
  "release:patch": "bun run scripts/release.ts --bump=patch",
@@ -33,8 +33,13 @@
33
33
  "license": "MIT",
34
34
  "repository": {
35
35
  "type": "git",
36
- "url": "git+ssh://git@github.com/zenithbuild/create-zenith.git"
36
+ "url": "https://github.com/zenithbuild/framework",
37
+ "directory": "packages/create-zenith"
37
38
  },
39
+ "bugs": {
40
+ "url": "https://github.com/zenithbuild/framework/issues"
41
+ },
42
+ "homepage": "https://github.com/zenithbuild/framework#readme",
38
43
  "engines": {
39
44
  "node": ">=18.0.0"
40
45
  },