@igoruehara/canvas-flow 0.1.12 → 0.1.13
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/bin/canvas-flow.js +52 -0
- package/package.json +1 -1
package/bin/canvas-flow.js
CHANGED
|
@@ -20,6 +20,56 @@ const INFRA_PROJECT_NAME = 'canvas-flow';
|
|
|
20
20
|
const INFRA_BASE_SERVICES = ['mongo'];
|
|
21
21
|
const INFRA_FULL_SERVICES = ['mongo', 'etcd', 'minio', 'milvus'];
|
|
22
22
|
|
|
23
|
+
const STARTUP_BANNER = [
|
|
24
|
+
' ______ ________ ',
|
|
25
|
+
' / ____/___ _____ _ ______ ______/ ____/ /___ _ __ ',
|
|
26
|
+
" / / / __ '/ __ \\ | / / __ '/ ___/ /_ / / __ \\ | /| / / ",
|
|
27
|
+
'/ /___/ /_/ / / / / |/ / /_/ (__ ) __/ / / /_/ / |/ |/ / ',
|
|
28
|
+
'\\____/\\__,_/_/ /_/|___/\\__,_/____/_/ /_/\\____/|__/|__/ ',
|
|
29
|
+
].join('\n');
|
|
30
|
+
|
|
31
|
+
function envFlagEnabled(name) {
|
|
32
|
+
return ['1', 'true', 'yes', 'sim', 'on'].includes(String(process.env[name] || '').trim().toLowerCase());
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function shouldUseAnsiColor() {
|
|
36
|
+
if (process.env.NO_COLOR) return false;
|
|
37
|
+
return Boolean(process.stdout.isTTY || process.env.FORCE_COLOR);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function colorAnsi(text, code) {
|
|
41
|
+
return shouldUseAnsiColor() ? `\x1b[${code}m${text}\x1b[0m` : text;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function shouldPrintStartupBanner(flags = {}) {
|
|
45
|
+
if (flags.banner === false || envFlagEnabled('CANVAS_FLOW_NO_BANNER')) return false;
|
|
46
|
+
if (process.env.CI && !envFlagEnabled('CANVAS_FLOW_BANNER')) return false;
|
|
47
|
+
return Boolean(process.stdout.isTTY || envFlagEnabled('CANVAS_FLOW_BANNER'));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function boxLine(text, width = 74) {
|
|
51
|
+
const safeText = String(text || '').slice(0, width - 4);
|
|
52
|
+
return `| ${safeText.padEnd(width - 4, ' ')} |`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function printStartupBanner(flags = {}) {
|
|
56
|
+
if (!shouldPrintStartupBanner(flags)) return;
|
|
57
|
+
|
|
58
|
+
const border = '+'.padEnd(75, '-') + '+';
|
|
59
|
+
const box = [
|
|
60
|
+
border,
|
|
61
|
+
boxLine('Canvas Flow standalone runtime'),
|
|
62
|
+
boxLine('Tip: use --with-docker for local Mongo, or --full for Mongo + Milvus.'),
|
|
63
|
+
boxLine('Docs: https://igoruehara.github.io/canvas-flow/'),
|
|
64
|
+
border,
|
|
65
|
+
].join('\n');
|
|
66
|
+
|
|
67
|
+
console.log('');
|
|
68
|
+
console.log(colorAnsi(STARTUP_BANNER.trimEnd(), '95'));
|
|
69
|
+
console.log(colorAnsi(box, '36'));
|
|
70
|
+
console.log('');
|
|
71
|
+
}
|
|
72
|
+
|
|
23
73
|
function printHelp() {
|
|
24
74
|
console.log(`
|
|
25
75
|
Canvas Flow standalone
|
|
@@ -44,6 +94,7 @@ Options:
|
|
|
44
94
|
--public-url <url> Override server.publicUrl
|
|
45
95
|
--open Open the browser after starting
|
|
46
96
|
--no-open Do not open the browser
|
|
97
|
+
--no-banner Do not print the startup banner
|
|
47
98
|
--with-docker Start local Docker infrastructure before Canvas Flow
|
|
48
99
|
--full Include Milvus, MinIO and etcd with Docker infrastructure
|
|
49
100
|
--show Show config content with "init" or "config"
|
|
@@ -1266,6 +1317,7 @@ async function waitForMongo(config, flags, paths, progress) {
|
|
|
1266
1317
|
}
|
|
1267
1318
|
|
|
1268
1319
|
async function start(flags) {
|
|
1320
|
+
printStartupBanner(flags);
|
|
1269
1321
|
const progress = createStartupProgress();
|
|
1270
1322
|
let startupStatus;
|
|
1271
1323
|
try {
|
package/package.json
CHANGED