create-flow-os 0.0.30 → 0.0.32
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 +3 -5
- package/src/init/index.ts +6 -6
- package/src/init/ui.ts +47 -17
- package/logo.png +0 -0
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-flow-os",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"license": "PolyForm-Shield-1.0.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@flow-os/client": "^0.0.
|
|
8
|
-
"terminal-image": "^4.2.0"
|
|
7
|
+
"@flow-os/client": "^0.0.32"
|
|
9
8
|
},
|
|
10
9
|
"bin": {
|
|
11
10
|
"create-flow-os": "./src/index.ts"
|
|
@@ -22,7 +21,6 @@
|
|
|
22
21
|
"vite": ">=7.3.0"
|
|
23
22
|
},
|
|
24
23
|
"files": [
|
|
25
|
-
"src"
|
|
26
|
-
"logo.png"
|
|
24
|
+
"src"
|
|
27
25
|
]
|
|
28
26
|
}
|
package/src/init/index.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
+
// Clear subito per nascondere resolving/installing di Bun
|
|
3
|
+
process.stdout.write("\x1b[2J\x1b[H");
|
|
2
4
|
|
|
3
5
|
import * as readline from "readline";
|
|
4
6
|
import { join, dirname } from "path";
|
|
5
7
|
import { fileURLToPath } from "url";
|
|
6
8
|
import { libsWithConfig, toShortName, toPkgName } from "./lib";
|
|
7
9
|
import { initLib, fetchFlowPackageVersions } from "./scaffold";
|
|
8
|
-
import { box, bannerBox, withLoading, colors,
|
|
10
|
+
import { box, bannerBox, withLoading, colors, headerLogo } from "./ui";
|
|
9
11
|
|
|
10
12
|
const { V, Y, E, R, B } = colors;
|
|
11
13
|
|
|
@@ -37,9 +39,8 @@ if (!toInit.length) {
|
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
// ───────────────────────────────────────────────────────────────────────────────
|
|
40
|
-
// Execute:
|
|
42
|
+
// Execute: init con loading UI
|
|
41
43
|
// ───────────────────────────────────────────────────────────────────────────────
|
|
42
|
-
process.stdout.write("\x1b[2J\x1b[H");
|
|
43
44
|
const pkgNames = toInit.map(toPkgName);
|
|
44
45
|
await withLoading(async (onStep) => {
|
|
45
46
|
const versions = await fetchFlowPackageVersions(pkgNames);
|
|
@@ -49,10 +50,9 @@ await withLoading(async (onStep) => {
|
|
|
49
50
|
const iconOk = V + "◆" + R;
|
|
50
51
|
const iconUnrec = Y + "?" + R;
|
|
51
52
|
const iconFail = E + "✕" + R;
|
|
52
|
-
const
|
|
53
|
-
const lines: string[] = [B + "Initialized:" + R, ...toInit.map((l) => iconOk + " " + V + l + R)];
|
|
53
|
+
const logoLines = headerLogo().split("\n");
|
|
54
|
+
const lines: string[] = [...logoLines, "", B + "Initialized:" + R, ...toInit.map((l) => iconOk + " " + V + l + R)];
|
|
54
55
|
const out: string[] = [];
|
|
55
|
-
if (logo) process.stdout.write("\n" + logo + "\n");
|
|
56
56
|
out.push(bannerBox("Flow OS", lines, V));
|
|
57
57
|
if (skipped.length) out.push(box([B + "Unrecognized:" + R, ...skipped.map((l) => iconUnrec + " " + Y + l + R)], Y));
|
|
58
58
|
console.log(out.join(""));
|
package/src/init/ui.ts
CHANGED
|
@@ -19,14 +19,14 @@ export function pad(s: string, w: number): string {
|
|
|
19
19
|
return s + " ".repeat(Math.max(0, w - stripAnsi(s).length));
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
/** Riquadro
|
|
23
|
-
export function bannerBox(title: string, lines: string[], color: string, w =
|
|
22
|
+
/** Riquadro chiuso con Flow OS centrato nel bordo superiore */
|
|
23
|
+
export function bannerBox(title: string, lines: string[], color: string, w = 92): string {
|
|
24
24
|
const c = color;
|
|
25
|
-
const inner =
|
|
26
|
-
const
|
|
27
|
-
const top = c + "
|
|
28
|
-
const bottom = c + "
|
|
29
|
-
const body = lines.map((l) => c + "
|
|
25
|
+
const inner = ` ${title} `;
|
|
26
|
+
const halfPad = Math.max(0, Math.floor((w - 2 - stripAnsi(inner).length) / 2));
|
|
27
|
+
const top = c + "╔" + "═".repeat(halfPad) + inner + "═".repeat(w - 2 - halfPad - stripAnsi(inner).length) + "╗" + R;
|
|
28
|
+
const bottom = c + "╚" + "═".repeat(w) + "╝" + R;
|
|
29
|
+
const body = lines.map((l) => c + "║" + R + " " + pad(l, w - 2) + c + "║" + R).join("\n");
|
|
30
30
|
return "\n" + top + "\n" + body + "\n" + bottom + "\n";
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -84,16 +84,46 @@ export async function withLoading<T>(
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
const W = "\x1b[97m"; // bianco
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
89
|
+
export const colors = { V, Y, E, R, B, DIM, W };
|
|
90
|
+
|
|
91
|
+
/** Icona layers: 3 quadrati arrotondati sovrapposti (bianco) + Flow OS grande a fianco */
|
|
92
|
+
const LAYERS_ICON = [
|
|
93
|
+
" ▄▄▄▄▄▄",
|
|
94
|
+
" ▄▄▄▄▄▄▄▄",
|
|
95
|
+
" ▄▄▄▄▄▄▄▄▄▄",
|
|
96
|
+
" ▀▀▀▀▀▀▀▀▀▀",
|
|
97
|
+
" ▄▄▄▄▄▄",
|
|
98
|
+
" ▄▄▄▄▄▄▄▄",
|
|
99
|
+
" ▄▄▄▄▄▄▄▄▄▄",
|
|
100
|
+
" ▀▀▀▀▀▀▀▀▀▀",
|
|
101
|
+
" ▄▄▄▄▄▄",
|
|
102
|
+
" ▄▄▄▄▄▄▄▄",
|
|
103
|
+
" ▄▄▄▄▄▄▄▄▄▄",
|
|
104
|
+
" ▀▀▀▀▀▀▀▀▀▀",
|
|
105
|
+
];
|
|
106
|
+
|
|
107
|
+
const FLOW_OS_TEXT = [
|
|
108
|
+
" ███████╗██╗ ██████╗ ██╗ ██╗ ██████╗ ███████╗",
|
|
109
|
+
" ██╔════╝██║ ██╔═══██╗██║ ██║ ██╔══██╗██╔════╝",
|
|
110
|
+
" █████╗ ██║ ██║ ██║██║ █╗ ██║ ██║ ██║███████╗",
|
|
111
|
+
" ██╔══╝ ██║ ██║ ██║██║███╗██║ ██║ ██║╚════██║",
|
|
112
|
+
" ██║ ███████╗╚██████╔╝╚███╔███╔╝ ██║ ██║███████║",
|
|
113
|
+
" ╚═╝ ╚══════╝ ╚═════╝ ╚══╝╚══╝ ╚█████╔╝ ╚══════╝",
|
|
114
|
+
];
|
|
115
|
+
|
|
116
|
+
export function headerLogo(): string {
|
|
117
|
+
const layersLines = LAYERS_ICON;
|
|
118
|
+
const textLines = FLOW_OS_TEXT;
|
|
119
|
+
const maxLines = Math.max(layersLines.length, textLines.length);
|
|
120
|
+
const layersW = 20;
|
|
121
|
+
const out: string[] = [];
|
|
122
|
+
for (let i = 0; i < maxLines; i++) {
|
|
123
|
+
const l = layersLines[i] ?? "";
|
|
124
|
+
const t = textLines[i] ?? "";
|
|
125
|
+
const pad = " ".repeat(Math.max(0, layersW - l.length));
|
|
126
|
+
out.push(W + l + pad + " " + t + R);
|
|
98
127
|
}
|
|
128
|
+
return out.join("\n");
|
|
99
129
|
}
|
package/logo.png
DELETED
|
Binary file
|