flowbook 0.1.0 → 0.1.1
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/README.de.md +1 -1
- package/README.es.md +1 -1
- package/README.fr.md +1 -1
- package/README.ja.md +1 -1
- package/README.ko.md +1 -1
- package/README.md +1 -1
- package/README.pt-BR.md +1 -1
- package/README.ru.md +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/cli.js +31 -2
- package/package.json +1 -1
- package/src/node/init.ts +33 -4
package/README.de.md
CHANGED
|
@@ -16,7 +16,7 @@ Storybook für Flussdiagramme. Erkennt automatisch Mermaid-Diagrammdateien in Ih
|
|
|
16
16
|
npm install -D flowbook
|
|
17
17
|
|
|
18
18
|
# Initialisieren — fügt Skripte + Beispieldatei hinzu
|
|
19
|
-
npx flowbook init
|
|
19
|
+
npx flowbook@latest init
|
|
20
20
|
|
|
21
21
|
# Entwicklungsserver starten
|
|
22
22
|
npm run flowbook
|
package/README.es.md
CHANGED
|
@@ -16,7 +16,7 @@ Storybook para diagramas de flujo. Descubre automáticamente archivos de diagram
|
|
|
16
16
|
npm install -D flowbook
|
|
17
17
|
|
|
18
18
|
# Inicializar — agrega scripts + archivo de ejemplo
|
|
19
|
-
npx flowbook init
|
|
19
|
+
npx flowbook@latest init
|
|
20
20
|
|
|
21
21
|
# Iniciar servidor de desarrollo
|
|
22
22
|
npm run flowbook
|
package/README.fr.md
CHANGED
|
@@ -16,7 +16,7 @@ Storybook pour les diagrammes de flux. Découvre automatiquement les fichiers de
|
|
|
16
16
|
npm install -D flowbook
|
|
17
17
|
|
|
18
18
|
# Initialiser — ajoute les scripts + fichier d'exemple
|
|
19
|
-
npx flowbook init
|
|
19
|
+
npx flowbook@latest init
|
|
20
20
|
|
|
21
21
|
# Démarrer le serveur de développement
|
|
22
22
|
npm run flowbook
|
package/README.ja.md
CHANGED
package/README.ko.md
CHANGED
package/README.md
CHANGED
package/README.pt-BR.md
CHANGED
|
@@ -16,7 +16,7 @@ Storybook para fluxogramas. Descobre automaticamente arquivos de diagramas Merma
|
|
|
16
16
|
npm install -D flowbook
|
|
17
17
|
|
|
18
18
|
# Inicializar — adiciona scripts + arquivo de exemplo
|
|
19
|
-
npx flowbook init
|
|
19
|
+
npx flowbook@latest init
|
|
20
20
|
|
|
21
21
|
# Iniciar servidor de desenvolvimento
|
|
22
22
|
npm run flowbook
|
package/README.ru.md
CHANGED
package/README.zh-CN.md
CHANGED
package/dist/cli.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// src/node/init.ts
|
|
4
4
|
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
|
|
5
5
|
import { resolve } from "path";
|
|
6
|
+
import { execSync } from "child_process";
|
|
6
7
|
var EXAMPLE_FLOW = `---
|
|
7
8
|
title: Example Flow
|
|
8
9
|
category: Getting Started
|
|
@@ -27,6 +28,15 @@ async function initFlowbook() {
|
|
|
27
28
|
console.error(" No package.json found. Run 'npm init' first.");
|
|
28
29
|
process.exit(1);
|
|
29
30
|
}
|
|
31
|
+
const pm = detectPackageManager(cwd);
|
|
32
|
+
const installCmd = getInstallCommand(pm);
|
|
33
|
+
console.log(` Installing flowbook via ${pm}...`);
|
|
34
|
+
try {
|
|
35
|
+
execSync(installCmd, { cwd, stdio: "ignore" });
|
|
36
|
+
console.log(" \u2713 Installed flowbook as a dev dependency");
|
|
37
|
+
} catch {
|
|
38
|
+
console.error(` \u2717 Failed to run '${installCmd}'. Please install manually.`);
|
|
39
|
+
}
|
|
30
40
|
const raw = readFileSync(pkgPath, "utf-8");
|
|
31
41
|
const pkg = JSON.parse(raw);
|
|
32
42
|
pkg.scripts = pkg.scripts ?? {};
|
|
@@ -54,12 +64,31 @@ async function initFlowbook() {
|
|
|
54
64
|
} else {
|
|
55
65
|
console.log(" \u2713 Example flow already exists");
|
|
56
66
|
}
|
|
67
|
+
const run = pm === "yarn" ? "yarn" : `${pm} run`;
|
|
57
68
|
console.log("");
|
|
58
69
|
console.log(" Next steps:");
|
|
59
|
-
console.log(
|
|
60
|
-
console.log(
|
|
70
|
+
console.log(` ${run} flowbook Start the dev server`);
|
|
71
|
+
console.log(` ${run} build-flowbook Build static site`);
|
|
61
72
|
console.log("");
|
|
62
73
|
}
|
|
74
|
+
function detectPackageManager(cwd) {
|
|
75
|
+
if (existsSync(resolve(cwd, "bun.lockb")) || existsSync(resolve(cwd, "bun.lock"))) return "bun";
|
|
76
|
+
if (existsSync(resolve(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
77
|
+
if (existsSync(resolve(cwd, "yarn.lock"))) return "yarn";
|
|
78
|
+
return "npm";
|
|
79
|
+
}
|
|
80
|
+
function getInstallCommand(pm) {
|
|
81
|
+
switch (pm) {
|
|
82
|
+
case "bun":
|
|
83
|
+
return "bun add -D flowbook";
|
|
84
|
+
case "pnpm":
|
|
85
|
+
return "pnpm add -D flowbook";
|
|
86
|
+
case "yarn":
|
|
87
|
+
return "yarn add -D flowbook";
|
|
88
|
+
default:
|
|
89
|
+
return "npm install -D flowbook";
|
|
90
|
+
}
|
|
91
|
+
}
|
|
63
92
|
|
|
64
93
|
// src/node/server.ts
|
|
65
94
|
import { createServer, build } from "vite";
|
package/package.json
CHANGED
package/src/node/init.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "node:fs";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
|
+
import { execSync } from "node:child_process";
|
|
3
4
|
|
|
4
5
|
const EXAMPLE_FLOW = `---
|
|
5
6
|
title: Example Flow
|
|
@@ -28,7 +29,18 @@ export async function initFlowbook() {
|
|
|
28
29
|
process.exit(1);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
// 1.
|
|
32
|
+
// 1. Install flowbook as devDependency
|
|
33
|
+
const pm = detectPackageManager(cwd);
|
|
34
|
+
const installCmd = getInstallCommand(pm);
|
|
35
|
+
console.log(` Installing flowbook via ${pm}...`);
|
|
36
|
+
try {
|
|
37
|
+
execSync(installCmd, { cwd, stdio: "ignore" });
|
|
38
|
+
console.log(" ✓ Installed flowbook as a dev dependency");
|
|
39
|
+
} catch {
|
|
40
|
+
console.error(` ✗ Failed to run '${installCmd}'. Please install manually.`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// 2. Add scripts to package.json
|
|
32
44
|
const raw = readFileSync(pkgPath, "utf-8");
|
|
33
45
|
const pkg = JSON.parse(raw);
|
|
34
46
|
pkg.scripts = pkg.scripts ?? {};
|
|
@@ -51,7 +63,7 @@ export async function initFlowbook() {
|
|
|
51
63
|
console.log(" ✓ Scripts already exist in package.json");
|
|
52
64
|
}
|
|
53
65
|
|
|
54
|
-
//
|
|
66
|
+
// 3. Create example flow file
|
|
55
67
|
const flowsDir = resolve(cwd, "flows");
|
|
56
68
|
const examplePath = resolve(flowsDir, "example.flow.md");
|
|
57
69
|
|
|
@@ -63,9 +75,26 @@ export async function initFlowbook() {
|
|
|
63
75
|
console.log(" ✓ Example flow already exists");
|
|
64
76
|
}
|
|
65
77
|
|
|
78
|
+
const run = pm === "yarn" ? "yarn" : `${pm} run`;
|
|
66
79
|
console.log("");
|
|
67
80
|
console.log(" Next steps:");
|
|
68
|
-
console.log(
|
|
69
|
-
console.log(
|
|
81
|
+
console.log(` ${run} flowbook Start the dev server`);
|
|
82
|
+
console.log(` ${run} build-flowbook Build static site`);
|
|
70
83
|
console.log("");
|
|
71
84
|
}
|
|
85
|
+
|
|
86
|
+
function detectPackageManager(cwd: string): "npm" | "yarn" | "pnpm" | "bun" {
|
|
87
|
+
if (existsSync(resolve(cwd, "bun.lockb")) || existsSync(resolve(cwd, "bun.lock"))) return "bun";
|
|
88
|
+
if (existsSync(resolve(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
89
|
+
if (existsSync(resolve(cwd, "yarn.lock"))) return "yarn";
|
|
90
|
+
return "npm";
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function getInstallCommand(pm: string): string {
|
|
94
|
+
switch (pm) {
|
|
95
|
+
case "bun": return "bun add -D flowbook";
|
|
96
|
+
case "pnpm": return "pnpm add -D flowbook";
|
|
97
|
+
case "yarn": return "yarn add -D flowbook";
|
|
98
|
+
default: return "npm install -D flowbook";
|
|
99
|
+
}
|
|
100
|
+
}
|