create-flow-os 0.0.46 → 0.0.47-dev.1772043547

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "create-flow-os",
3
- "version": "0.0.46",
3
+ "version": "0.0.47-dev.1772043547",
4
4
  "license": "PolyForm-Shield-1.0.0",
5
5
  "type": "module",
6
6
  "dependencies": {
7
- "@flow-os/client": "^0.0.46"
7
+ "@flow-os/client": ">=0.0.1-dev.0"
8
8
  },
9
9
  "bin": {
10
10
  "create-flow-os": "./src/index.ts"
package/src/init/index.ts CHANGED
@@ -7,7 +7,7 @@ import { join, dirname } from "path";
7
7
  import { fileURLToPath } from "url";
8
8
  import { libsWithConfig, toShortName, toPkgName } from "./lib";
9
9
  import { initLib, fetchFlowPackageVersions } from "./scaffold";
10
- import { box, bannerBox, withLoading, colors } from "./ui";
10
+ import { bannerBox, withLoading, colors } from "./ui";
11
11
 
12
12
  const { V, V_LIGHT, Y, E, R, B } = colors;
13
13
 
@@ -21,7 +21,7 @@ const available = libsWithConfig(cliRoot).map(toShortName);
21
21
  let libs = [...new Set(process.argv.slice(3))];
22
22
 
23
23
  if (!libs.length && available.length) {
24
- console.log(box([B + "Packages disponibili:" + R, ...available.map((l) => V + "◆" + R + " " + l)], V));
24
+ console.log(bannerBox("Flow OS", [B + "Packages disponibili:" + R, ...available.map((l) => V + "◆" + R + " " + l)], V));
25
25
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
26
26
  const answer = await new Promise<string>((resolve) =>
27
27
  rl.question(V + "Seleziona (spazio o virgola): " + R, resolve)
@@ -34,7 +34,7 @@ const toInit = libs.filter((l) => available.includes(l));
34
34
  const skipped = libs.filter((l) => !available.includes(l));
35
35
 
36
36
  if (!toInit.length) {
37
- console.error(box([E + "usa " + (available.join(" | ") || "(nessuna lib con config)") + R], E));
37
+ console.error(bannerBox("Flow OS", [E + "usa " + (available.join(" | ") || "(nessuna lib con config)") + R], E));
38
38
  process.exit(1);
39
39
  }
40
40
 
@@ -52,7 +52,7 @@ const iconUnrec = Y + "?" + R;
52
52
  const iconFail = E + "✕" + R;
53
53
  const out: string[] = [];
54
54
  out.push(bannerBox("Flow OS", [B + "Initialized:" + R, ...toInit.map((l) => iconOk + " " + V_LIGHT + l + R)], V_LIGHT));
55
- if (skipped.length) out.push(box([B + "Unrecognized:" + R, ...skipped.map((l) => iconUnrec + " " + Y + l + R)], Y));
55
+ if (skipped.length) out.push(bannerBox("Flow OS", [B + "Unrecognized:" + R, ...skipped.map((l) => iconUnrec + " " + Y + l + R)], Y));
56
56
  console.log(out.join(""));
57
57
 
58
58
  export {};
@@ -309,9 +309,9 @@ async function collectAllTemplates(
309
309
  }
310
310
  }
311
311
 
312
- export type InitProgressStep = "fetch" | "templates" | "write";
312
+ export type InitProgressStep = "fetch" | "templates" | "write" | "install";
313
313
 
314
- /** Init: 1) fetch versioni npm, 2) merge template, 3) mergePkg, 4) merge con file utente */
314
+ /** Init: 1) fetch versioni npm, 2) merge template, 3) mergePkg, 4) merge con file utente, 5) bun install */
315
315
  export async function initLib(
316
316
  libs: string[],
317
317
  cwd: string,
@@ -339,6 +339,13 @@ export async function initLib(
339
339
  onProgress?.("write");
340
340
  await writeMergedWithUser(combined, cwd, (path, conflicts) => resolveConflicts(conflicts, path));
341
341
 
342
+ onProgress?.("install");
343
+ const proc = Bun.spawn(["bun", "install"], { cwd, stdout: "inherit", stderr: "inherit" });
344
+ const exitCode = await proc.exited;
345
+ if (exitCode !== 0) {
346
+ throw new Error(`bun install exited with code ${exitCode}`);
347
+ }
348
+
342
349
  const { rmSync } = await import("fs");
343
350
  for (const d of tmpDirs) {
344
351
  try {
package/src/init/ui.ts CHANGED
@@ -2,8 +2,8 @@
2
2
  * UI per init: loading spinner e box coerenti con flow-os
3
3
  */
4
4
 
5
- const V = "\x1b[95m"; // magenta
6
- const V_LIGHT = "\x1b[38;2;255;0;135m"; // #ff0087 rgb(255,0,135)
5
+ const V = "\x1b[38;2;255;0;135m"; // #ff0087 rgb(255,0,135)
6
+ const V_LIGHT = "\x1b[38;2;255;0;135m"; // stesso colore
7
7
  const Y = "\x1b[38;5;226m";
8
8
  const E = "\x1b[91m";
9
9
  const R = "\x1b[0m";
@@ -20,17 +20,16 @@ export function pad(s: string, w: number): string {
20
20
  return s + " ".repeat(Math.max(0, w - stripAnsi(s).length));
21
21
  }
22
22
 
23
- /** Riquadro chiuso con Flow OS in grassetto nel bordo superiore */
23
+ /** Riquadro con Flow OS centrato in grassetto nel bordo superiore, linea singola ─ */
24
24
  export function bannerBox(title: string, lines: string[], color: string, w = 50): string {
25
25
  const c = color;
26
- const inner = " " + c + B + title + R + " "; // titolo subito dopo ╔, stesso colore
26
+ const inner = " " + c + B + title + R + " ";
27
27
  const innerLen = stripAnsi(inner).length;
28
- const top = c + "╔" + inner + c + "═".repeat(Math.max(0, w - 2 - innerLen)) + "╗" + R;
29
- const bottom = c + "" + "".repeat(w - 2) + "" + R;
30
- const spacer = c + "" + R + " " + " ".repeat(w - 4) + c + "" + R; // riga vuota
31
- const bodyLines = lines.map((l) => c + "" + R + " " + pad(l, w - 4) + c + "" + R);
32
- const body = "\n" + spacer + "\n" + bodyLines.join("\n");
33
- return "\n" + top + body + "\n" + bottom + "\n";
28
+ const half = Math.max(0, Math.floor((w - 2 - innerLen) / 2));
29
+ const top = c + "" + "".repeat(half) + inner + "─".repeat(w - 2 - half - innerLen) + "" + R;
30
+ const bottom = c + "" + "".repeat(w - 2) + "" + R;
31
+ const bodyLines = lines.map((l) => c + "" + R + " " + pad(l, w - 2) + c + "" + R);
32
+ return "\n" + top + "\n" + bodyLines.join("\n") + "\n" + bottom + "\n";
34
33
  }
35
34
 
36
35
  export function box(lines: string[], color: string, w = 52): string {
@@ -47,6 +46,7 @@ const STEP_LABELS: Record<InitProgressStep, string> = {
47
46
  fetch: "Fetching packages",
48
47
  templates: "Preparing templates",
49
48
  write: "Writing files",
49
+ install: "Installing dependencies",
50
50
  };
51
51
 
52
52
  /** Esegue fn mostrando uno spinner elegante; onStep viene chiamato per aggiornare lo step */