create-flow-os 0.0.1-dev.1771666003 → 0.0.1-dev.1771667897

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/index.js CHANGED
@@ -147,7 +147,7 @@ var require_picocolors = __commonJS((exports, module) => {
147
147
  });
148
148
 
149
149
  // index.ts
150
- import { rm, stat } from "fs/promises";
150
+ import { rm, rename, stat } from "fs/promises";
151
151
  import { join as join2, relative, basename } from "path";
152
152
 
153
153
  // ../../node_modules/@clack/core/dist/index.mjs
@@ -716,19 +716,6 @@ ${import_picocolors2.default.cyan($2)}
716
716
  }
717
717
  } }).prompt();
718
718
  };
719
- var R2 = (s) => s.replace(ye(), "");
720
- var me = (s = "", n = "") => {
721
- const t = `
722
- ${s}
723
- `.split(`
724
- `), i = R2(n).length, r2 = Math.max(t.reduce((c2, l2) => (l2 = R2(l2), l2.length > c2 ? l2.length : c2), 0), i) + 2, o = t.map((c2) => `${import_picocolors2.default.gray(a2)} ${import_picocolors2.default.dim(c2)}${" ".repeat(r2 - R2(c2).length)}${import_picocolors2.default.gray(a2)}`).join(`
725
- `);
726
- process.stdout.write(`${import_picocolors2.default.gray(a2)}
727
- ${import_picocolors2.default.green(M2)} ${import_picocolors2.default.reset(n)} ${import_picocolors2.default.gray(G.repeat(Math.max(r2 - i - 1, 1)) + H)}
728
- ${o}
729
- ${import_picocolors2.default.gray(ee + G.repeat(r2 + 2) + te)}
730
- `);
731
- };
732
719
  var he = (s = "") => {
733
720
  process.stdout.write(`${import_picocolors2.default.gray($2)} ${import_picocolors2.default.red(s)}
734
721
 
@@ -795,10 +782,6 @@ var _2 = () => {
795
782
  o = g2 ?? o;
796
783
  } };
797
784
  };
798
- function ye() {
799
- const s = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
800
- return new RegExp(s, "g");
801
- }
802
785
 
803
786
  // index.ts
804
787
  var import_picocolors3 = __toESM(require_picocolors(), 1);
@@ -882,109 +865,116 @@ async function findPackageDir(repoRoot, packageName) {
882
865
  var argv = process.argv.slice(2);
883
866
  var noInstall = argv.includes("--no-install");
884
867
  var noGit = argv.includes("--no-git");
868
+ var noStart = argv.includes("--no-start");
885
869
  var force = argv.includes("--force");
886
870
  var yes = argv.includes("--yes") || argv.includes("-y");
887
871
  var useDevTag = argv.includes("--dev");
888
872
  var nameArg = argv.find((a3) => !a3.startsWith("--"));
889
873
  var DIR = basename(import.meta.dir) === "dist" || basename(import.meta.dir) === "bin" ? join2(import.meta.dir, "..") : import.meta.dir;
890
874
  var REPO_ROOT = (process.env.FLOW_FRAMEWORK_ROOT ?? join2(DIR, "..", "..")).replace(/\\/g, "/");
875
+ var aqua = import_picocolors3.default.cyan;
876
+ var teal = (s) => import_picocolors3.default.cyan(s);
877
+ var dim = import_picocolors3.default.dim;
878
+ var subtle = (s) => import_picocolors3.default.dim(import_picocolors3.default.cyan(s));
879
+ function optsForProfile(config, profileId) {
880
+ return Object.entries(config.packages).filter(([, e2]) => {
881
+ const inc = e2.includeIn ?? [];
882
+ if (inc.includes(profileId))
883
+ return true;
884
+ if (profileId === "full" && (inc.includes("client") || inc.includes("server")))
885
+ return true;
886
+ return false;
887
+ });
888
+ }
891
889
  async function main() {
892
- pe(import_picocolors3.default.cyan(` Flow \u2013 create project
893
- `));
890
+ const devBadge = useDevTag ? teal(" \xB7 dev") : "";
891
+ pe(teal("\u25B8 ") + import_picocolors3.default.bold("Flow") + devBadge + `
892
+ ` + dim(" Create a new application"));
894
893
  const config = await Bun.file(join2(DIR, "config.json")).json();
895
894
  const hasDeps = Object.values(config.packages).every((e2) => Array.isArray(e2.deps));
896
895
  if (!hasDeps) {
897
- he("Esegui prima " + import_picocolors3.default.cyan("bun run gen") + " dalla cartella create-flow.");
896
+ he(dim("Run ") + teal("bun run gen") + dim(" from create-flow first."));
898
897
  process.exit(1);
899
898
  }
900
899
  const projectName = nameArg?.trim() || (yes ? "my-flow-app" : null);
901
900
  let name = projectName;
902
901
  if (!name && !yes) {
903
- const r2 = await ae({ message: "Project name", initialValue: "my-flow-app", validate: (v3) => !v3?.trim() ? "Obbligatorio" : undefined });
902
+ const r2 = await ae({
903
+ message: subtle("Project name"),
904
+ initialValue: "my-flow-app",
905
+ validate: (v3) => !v3?.trim() ? "Required" : undefined
906
+ });
904
907
  if (lD(r2))
905
908
  process.exit(0);
906
909
  name = r2.trim() || "my-flow-app";
907
910
  }
908
911
  if (!name)
909
912
  name = "my-flow-app";
910
- function optsForProfile(profileId2) {
911
- return Object.entries(config.packages).filter(([, e2]) => {
912
- const inc = e2.includeIn ?? [];
913
- if (inc.includes(profileId2))
914
- return true;
915
- if (profileId2 === "full" && (inc.includes("client") || inc.includes("server")))
916
- return true;
917
- return false;
918
- });
919
- }
920
913
  let profileId;
921
914
  let selected = [];
922
- const optsForFull = optsForProfile("full");
915
+ const optsFull = optsForProfile(config, "full");
923
916
  if (yes) {
924
917
  profileId = "full";
925
- selected = optsForFull.map(([id]) => id);
918
+ selected = optsFull.map(([id]) => id);
926
919
  } else {
927
- const complete = await le({
928
- message: "Vuoi installare tutto completo? (tutti i package)",
920
+ const choice = await le({
921
+ message: subtle("Template"),
929
922
  options: [
930
- { value: "yes", label: "S\xEC, tutto completo" },
931
- { value: "no", label: "No, scelgo profile e package" }
923
+ { value: "full", label: "Full stack " + dim("(client + server)") },
924
+ { value: "client", label: "Client only" },
925
+ { value: "server", label: "Server only" }
932
926
  ]
933
927
  });
934
- if (lD(complete))
928
+ if (lD(choice))
935
929
  process.exit(0);
936
- if (complete === "yes") {
937
- profileId = "full";
938
- selected = optsForFull.map(([id]) => id);
939
- } else {
940
- const profile = await le({
941
- message: "Client, Server o Client+Server?",
942
- options: [
943
- { value: "client", label: "Client" },
944
- { value: "server", label: "Server" },
945
- { value: "full", label: "Client + Server" }
946
- ]
947
- });
948
- if (lD(profile))
949
- process.exit(0);
950
- profileId = profile;
951
- const opts = optsForProfile(profileId);
952
- if (opts.length > 0) {
930
+ profileId = choice;
931
+ const opts = optsForProfile(config, profileId);
932
+ const optIds = opts.map(([id]) => id);
933
+ const defaultIds = config.profiles[profileId]?.defaultPackages ?? [];
934
+ selected = optIds.filter((id) => defaultIds.includes(id));
935
+ if (profileId === "full") {
936
+ selected = optIds;
937
+ } else if (opts.length > 0) {
938
+ const optionalIds = optIds.filter((id) => !defaultIds.includes(id));
939
+ if (optionalIds.length > 0) {
953
940
  const r2 = await $e({
954
- message: "Scegli i package",
955
- options: opts.map(([id]) => ({ value: id, label: id })),
941
+ message: subtle("Add-ons"),
942
+ options: optionalIds.map((id) => ({ value: id, label: id })),
956
943
  required: false
957
944
  });
958
945
  if (!lD(r2))
959
- selected = r2 ?? [];
946
+ selected = [...selected, ...r2 ?? []];
960
947
  }
961
948
  }
962
949
  }
963
- const projectPath = join2(process.cwd(), name);
964
- const exists = await stat(projectPath).then(() => true).catch(() => false);
965
- if (exists && !force) {
966
- he("Esiste gi\xE0: " + name + ". Usa " + import_picocolors3.default.cyan("--force") + ".");
950
+ const cwd = process.cwd();
951
+ const projectPath = join2(cwd, name);
952
+ const projectPathNew = join2(cwd, name + ".new");
953
+ const profileDir = join2(DIR, "profiles", profileId);
954
+ const [profileExists, pathExists] = await Promise.all([
955
+ stat(profileDir).then(() => true).catch(() => false),
956
+ stat(projectPath).then(() => true).catch(() => false)
957
+ ]);
958
+ if (!profileExists) {
959
+ he(dim("Profile not found. Run ") + teal("bun run gen") + dim("."));
967
960
  process.exit(1);
968
961
  }
969
- if (exists)
970
- await rm(projectPath, { recursive: true, force: true });
971
- const profileDir = join2(DIR, "profiles", profileId);
972
- try {
973
- await stat(profileDir);
974
- } catch {
975
- he("Profile " + profileId + " non trovato. Esegui " + import_picocolors3.default.cyan("bun run gen") + ".");
962
+ if (pathExists && !force) {
963
+ he(dim("Folder ") + name + dim(" exists. Use ") + teal("--force") + dim("."));
976
964
  process.exit(1);
977
965
  }
978
- const scaffoldSpinner = _2();
979
- scaffoldSpinner.start("Scaffold");
980
- await copyWithExclude(profileDir, projectPath, ["node_modules", ".git"]);
966
+ const isDevFromRepoPromise = useDevTag ? findPackageDir(REPO_ROOT, "@flow.os/client").then((d2) => !!d2) : Promise.resolve(false);
967
+ await rm(projectPathNew, { recursive: true, force: true });
968
+ const createSpinner = _2();
969
+ createSpinner.start(teal("Creating project\u2026"));
970
+ await copyWithExclude(profileDir, projectPathNew, ["node_modules", ".git"]);
981
971
  for (const id of selected) {
982
972
  const pkgDir = join2(DIR, "packages", id);
983
973
  try {
984
- await copyWithExclude(pkgDir, projectPath, []);
974
+ await copyWithExclude(pkgDir, projectPathNew, []);
985
975
  } catch {}
986
976
  }
987
- scaffoldSpinner.stop("Scaffold");
977
+ createSpinner.stop(teal("Project created"));
988
978
  const extraDeps = {};
989
979
  for (const id of selected) {
990
980
  const deps = config.packages[id]?.deps;
@@ -992,65 +982,83 @@ async function main() {
992
982
  for (const d2 of deps)
993
983
  extraDeps[d2] = "^0.0.1";
994
984
  }
995
- const pkgPath = join2(projectPath, "package.json");
985
+ const pkgPath = join2(projectPathNew, "package.json");
996
986
  const pkg = await Bun.file(pkgPath).json();
997
987
  await Bun.write(pkgPath, JSON.stringify(transformPackageJson(pkg, name, extraDeps, false), null, 2));
998
988
  if (!noGit) {
999
989
  try {
1000
- await Bun.$`git init ${projectPath}`.quiet();
1001
- await Bun.$`git -C ${projectPath} add -A`.quiet();
1002
- await Bun.$`git -C ${projectPath} commit -m "Initial commit (Flow)"`.quiet();
990
+ await Bun.$`git init ${projectPathNew}`.quiet();
991
+ await Bun.$`git -C ${projectPathNew} add -A`.quiet();
992
+ await Bun.$`git -C ${projectPathNew} commit -m "Initial commit (Flow)"`.quiet();
1003
993
  } catch {}
1004
994
  }
1005
995
  const finalPkg = await Bun.file(pkgPath).json();
1006
996
  delete finalPkg.workspaces;
1007
997
  if (finalPkg.dependencies) {
1008
- const isDevFromRepo = useDevTag && await findPackageDir(REPO_ROOT, "@flow.os/client").then((d2) => !!d2);
1009
- if (useDevTag && !isDevFromRepo) {
1010
- me("Uso package da npm (tag dev). Per usare i sorgenti locali esegui dal repo o imposta FLOW_FRAMEWORK_ROOT.", "Dev da npm");
1011
- } else if (useDevTag && isDevFromRepo) {
1012
- me("Uso package locali da " + REPO_ROOT, "Dev da repo");
1013
- }
1014
- for (const k3 of Object.keys(finalPkg.dependencies)) {
1015
- if (finalPkg.dependencies[k3] === "workspace:*")
1016
- finalPkg.dependencies[k3] = "^0.0.1";
1017
- if (useDevTag && (k3 === "@flow.os" || k3.startsWith("@flow.os/"))) {
1018
- if (isDevFromRepo) {
1019
- const pkgDir = await findPackageDir(REPO_ROOT, k3);
1020
- if (pkgDir) {
1021
- const rel = relative(projectPath, pkgDir).replace(/\\/g, "/");
1022
- finalPkg.dependencies[k3] = "file:" + (rel.startsWith("..") ? rel : "./" + rel);
1023
- } else {
1024
- finalPkg.dependencies[k3] = "dev";
1025
- }
998
+ const isDevFromRepo = await isDevFromRepoPromise;
999
+ const flowKeys = Object.keys(finalPkg.dependencies).filter((k3) => k3 === "@flow.os" || k3.startsWith("@flow.os/"));
1000
+ if (useDevTag && isDevFromRepo && flowKeys.length > 0) {
1001
+ const dirs = await Promise.all(flowKeys.map((k3) => findPackageDir(REPO_ROOT, k3)));
1002
+ for (let i = 0;i < flowKeys.length; i++) {
1003
+ const k3 = flowKeys[i];
1004
+ const pkgDir = dirs[i];
1005
+ if (pkgDir) {
1006
+ const rel = relative(projectPathNew, pkgDir).replace(/\\/g, "/");
1007
+ finalPkg.dependencies[k3] = "file:" + (rel.startsWith("..") ? rel : "./" + rel);
1026
1008
  } else {
1027
1009
  finalPkg.dependencies[k3] = "dev";
1028
1010
  }
1029
1011
  }
1012
+ } else if (useDevTag) {
1013
+ for (const k3 of flowKeys)
1014
+ finalPkg.dependencies[k3] = "dev";
1015
+ }
1016
+ for (const k3 of Object.keys(finalPkg.dependencies)) {
1017
+ if (finalPkg.dependencies[k3] === "workspace:*")
1018
+ finalPkg.dependencies[k3] = "^0.0.1";
1030
1019
  }
1031
1020
  delete finalPkg.dependencies["@flow.os"];
1032
1021
  finalPkg.dependencies = Object.fromEntries(Object.entries(finalPkg.dependencies).filter(([key]) => key !== "@flow.os"));
1033
1022
  }
1034
1023
  await Bun.write(pkgPath, JSON.stringify(finalPkg, null, 2));
1035
1024
  if (useDevTag) {
1036
- const projectPackagesDir = join2(projectPath, "packages");
1037
1025
  try {
1038
- await rm(projectPackagesDir, { recursive: true, force: true });
1026
+ await rm(join2(projectPathNew, "packages"), { recursive: true, force: true });
1039
1027
  } catch {}
1040
1028
  }
1041
1029
  if (!noInstall) {
1042
1030
  const s = _2();
1043
- s.start("Install");
1044
- const proc = Bun.spawn(["bun", "install"], { cwd: projectPath, stdout: "pipe", stderr: "pipe" });
1031
+ s.start(teal("Installing dependencies\u2026"));
1032
+ const proc = Bun.spawn(["bun", "install"], { cwd: projectPathNew, stdout: "pipe", stderr: "pipe" });
1045
1033
  const code = await proc.exited;
1046
- s.stop(code === 0 ? "Install ok" : "Install failed");
1034
+ s.stop(code === 0 ? teal("Dependencies installed") : "Failed");
1047
1035
  if (code !== 0) {
1048
1036
  const err = await new Response(proc.stderr).text();
1049
1037
  v2.error(err || "bun install exit " + code);
1038
+ await rm(projectPathNew, { recursive: true, force: true });
1039
+ process.exit(1);
1050
1040
  }
1051
1041
  }
1052
- ge([import_picocolors3.default.green("Ok."), "", " " + import_picocolors3.default.cyan("cd " + name), " " + import_picocolors3.default.cyan("bun run dev")].join(`
1042
+ if (pathExists)
1043
+ await rm(projectPath, { recursive: true, force: true });
1044
+ await rename(projectPathNew, projectPath);
1045
+ const startDev = !noStart && !noInstall;
1046
+ if (startDev) {
1047
+ ge(teal(`\u25B8 Ready
1048
+ `) + dim(" ") + teal(name) + dim(` is ready. Starting dev server\u2026
1053
1049
  `));
1050
+ const devProc = Bun.spawn(["bun", "run", "dev"], {
1051
+ cwd: projectPath,
1052
+ stdio: "inherit"
1053
+ });
1054
+ await devProc.exited;
1055
+ } else {
1056
+ ge(teal(`\u25B8 Done
1057
+ `) + dim(` Next steps:
1058
+ `) + " " + teal("cd " + name) + `
1059
+ ` + " " + teal("bun run dev") + `
1060
+ `);
1061
+ }
1054
1062
  }
1055
1063
  main().catch((e2) => {
1056
1064
  v2.error(String(e2));
package/config.json CHANGED
@@ -8,6 +8,12 @@
8
8
  ".cursor",
9
9
  "agent-transcripts",
10
10
  "server"
11
+ ],
12
+ "defaultPackages": [
13
+ "client",
14
+ "core",
15
+ "router",
16
+ "style"
11
17
  ]
12
18
  },
13
19
  "server": {
@@ -18,7 +24,8 @@
18
24
  ".cursor",
19
25
  "agent-transcripts",
20
26
  "client"
21
- ]
27
+ ],
28
+ "defaultPackages": []
22
29
  },
23
30
  "full": {
24
31
  "exclude": [
@@ -27,6 +34,12 @@
27
34
  ".git",
28
35
  ".cursor",
29
36
  "agent-transcripts"
37
+ ],
38
+ "defaultPackages": [
39
+ "client",
40
+ "core",
41
+ "router",
42
+ "style"
30
43
  ]
31
44
  }
32
45
  },
@@ -46,7 +59,25 @@
46
59
  "client"
47
60
  ],
48
61
  "deps": [
49
- "@flow.os/core",
62
+ "@flow.os/router"
63
+ ]
64
+ },
65
+ "server": {
66
+ "package": "@flow.os/server",
67
+ "includeIn": [
68
+ "server"
69
+ ],
70
+ "deps": [
71
+ "@flow.os/server"
72
+ ]
73
+ },
74
+ "client": {
75
+ "package": "@flow.os/client",
76
+ "includeIn": [
77
+ "client"
78
+ ],
79
+ "deps": [
80
+ "@flow.os/client",
50
81
  "@flow.os/router"
51
82
  ]
52
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-flow-os",
3
- "version": "0.0.1-dev.1771666003",
3
+ "version": "0.0.1-dev.1771667897",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "create-flow-os": "bin/index.js"
@@ -1,6 +1,5 @@
1
1
  import './root.css';
2
2
  import { App } from '@flow.os/router';
3
- import { state } from '@flow.os/core';
4
3
 
5
4
  export const fallback = undefined;
6
5
 
@@ -0,0 +1,3 @@
1
+ import { defineHandler } from '@flow.os/server';
2
+
3
+ export default defineHandler(() => ({ hello: 'api' }));
@@ -5,8 +5,8 @@
5
5
  "": {
6
6
  "name": "flow-framework",
7
7
  "dependencies": {
8
- "@flow.os": "workspace:*",
9
8
  "@flow.os/client": "workspace:*",
9
+ "@flow.os/core": "workspace:*",
10
10
  "@flow.os/router": "workspace:*",
11
11
  "@flow.os/server": "workspace:*",
12
12
  "@flow.os/style": "workspace:*",
@@ -24,7 +24,7 @@
24
24
  "name": "@flow.os/client",
25
25
  "version": "0.0.1",
26
26
  "dependencies": {
27
- "@flow.os": "workspace:*",
27
+ "@flow.os/core": "workspace:*",
28
28
  "@flow.os/router": "workspace:*",
29
29
  "@flow.os/style": "workspace:*",
30
30
  },
@@ -33,10 +33,10 @@
33
33
  },
34
34
  },
35
35
  "packages/create-flow": {
36
- "name": "create-flow",
36
+ "name": "create-flow.os",
37
37
  "version": "0.0.1",
38
38
  "bin": {
39
- "create-flow": "./index.ts",
39
+ "create-flow.os": "./dist/index.js",
40
40
  },
41
41
  "dependencies": {
42
42
  "@clack/prompts": "^0.8.2",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  },
49
49
  "packages/flow.os": {
50
- "name": "@flow.os",
50
+ "name": "@flow.os/core",
51
51
  "version": "0.0.1",
52
52
  },
53
53
  "packages/router": {
@@ -57,6 +57,7 @@
57
57
  "packages/server": {
58
58
  "name": "@flow.os/server",
59
59
  "version": "0.0.1",
60
+ "bin": "./start.ts",
60
61
  "peerDependencies": {
61
62
  "vite": ">=5.0.0",
62
63
  },
@@ -123,10 +124,10 @@
123
124
 
124
125
  "@esbuild/win32-x64": ["@esbuild/win32-x64@0.27.3", "", { "os": "win32", "cpu": "x64" }, "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA=="],
125
126
 
126
- "@flow.os": ["@flow.os@workspace:packages/flow.os"],
127
-
128
127
  "@flow.os/client": ["@flow.os/client@workspace:packages/client"],
129
128
 
129
+ "@flow.os/core": ["@flow.os/core@workspace:packages/flow.os"],
130
+
130
131
  "@flow.os/router": ["@flow.os/router@workspace:packages/router"],
131
132
 
132
133
  "@flow.os/server": ["@flow.os/server@workspace:packages/server"],
@@ -247,7 +248,7 @@
247
248
 
248
249
  "bun-types": ["bun-types@1.2.23", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-R9f0hKAZXgFU3mlrA0YpE/fiDvwV0FT9rORApt2aQVWSuJDzZOyB5QLc0N/4HF57CS8IXJ6+L5E4W1bW6NS2Aw=="],
249
250
 
250
- "create-flow": ["create-flow@workspace:packages/create-flow"],
251
+ "create-flow.os": ["create-flow.os@workspace:packages/create-flow"],
251
252
 
252
253
  "cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="],
253
254
 
@@ -1,7 +1,6 @@
1
- // @flow-package: router
1
+ // @flow: client
2
2
  import './root.css';
3
3
  import { App } from '@flow.os/router';
4
- import { state } from '@flow.os/core';
5
4
 
6
5
  export const fallback = undefined;
7
6
 
@@ -1,4 +1,4 @@
1
- // @flow-package: core
1
+ // @flow: core
2
2
  import { state } from '@flow.os/core';
3
3
 
4
4
  export default function Home() {
@@ -11,8 +11,7 @@
11
11
  "lint": "oxlint .",
12
12
  "fmt": "oxfmt",
13
13
  "fmt:check": "oxfmt --check",
14
- "gen": "bun run --cwd packages/create-flow gen",
15
- "publish:dev": "bun run --cwd packages/create-flow publish:dev"
14
+ "release": "bun run --cwd packages/create-flow release"
16
15
  },
17
16
  "dependencies": {
18
17
  "@flow.os/client": "file:./packages/client",
@@ -15,8 +15,14 @@ function resolveAlias(): Record<string, string> {
15
15
  }
16
16
  for (const name of fs.readdirSync(packagesDir)) {
17
17
  const dir = path.join(packagesDir, name);
18
- if (!fs.statSync(dir).isDirectory() || !fs.existsSync(path.join(dir, 'package.json'))) continue;
18
+ if (!fs.statSync(dir).isDirectory()) continue;
19
+ const pkgPath = path.join(dir, 'package.json');
20
+ if (!fs.existsSync(pkgPath)) continue;
19
21
  const abs = path.resolve(dir);
22
+ try {
23
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8')) as { name?: string };
24
+ if (pkg.name?.startsWith('@flow.os/') || pkg.name === '@flow.os') alias[pkg.name] = abs;
25
+ } catch {}
20
26
  if (name !== 'flow.os') alias[`@flow.os/${name}`] = abs;
21
27
  }
22
28
  return alias;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flow.os/client",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "main": "./index.ts",
6
6
  "types": "./index.ts",
@@ -19,18 +19,20 @@ const HTML = `<!DOCTYPE html>
19
19
  </html>`;
20
20
 
21
21
  export function flow(): Plugin {
22
+ const cwd = process.cwd();
22
23
  return {
23
24
  name: 'flow',
24
25
  config() {
25
26
  return {
26
- root: '.',
27
+ root: resolve(cwd),
28
+ base: '/',
27
29
  esbuild: { jsx: 'automatic', jsxImportSource: '@flow.os/client' },
28
- resolve: { alias: { '~': resolve(process.cwd(), 'client') } },
30
+ resolve: { alias: { '~': resolve(cwd, 'client') } },
29
31
  build: { target: 'esnext', minify: 'esbuild', sourcemap: true },
30
32
  };
31
33
  },
32
34
  configResolved(_config) {
33
- writeFileSync(resolve(process.cwd(), 'index.html'), HTML);
35
+ writeFileSync(resolve(cwd, 'index.html'), HTML);
34
36
  },
35
37
  resolveId(id) {
36
38
  return id === '/entry.tsx' ? FLOW_ENTRY_ID : null;
@@ -38,5 +40,12 @@ export function flow(): Plugin {
38
40
  load(id) {
39
41
  return id === FLOW_ENTRY_ID ? ENTRY_CODE : null;
40
42
  },
43
+ buildEnd(err) {
44
+ if (err) {
45
+ const msg = err.message ?? String(err);
46
+ const stack = err.stack ?? (err as Error).cause?.toString?.();
47
+ console.error('[flow] build error:', msg, stack ?? '');
48
+ }
49
+ },
41
50
  };
42
51
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flow.os/core",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "main": "./index.ts",
6
6
  "types": "./index.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flow.os/router",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "main": "./index.ts",
6
6
  "types": "./index.ts",
@@ -5,8 +5,8 @@
5
5
  "": {
6
6
  "name": "flow-framework",
7
7
  "dependencies": {
8
- "@flow.os": "workspace:*",
9
8
  "@flow.os/client": "workspace:*",
9
+ "@flow.os/core": "workspace:*",
10
10
  "@flow.os/router": "workspace:*",
11
11
  "@flow.os/server": "workspace:*",
12
12
  "@flow.os/style": "workspace:*",
@@ -24,7 +24,7 @@
24
24
  "name": "@flow.os/client",
25
25
  "version": "0.0.1",
26
26
  "dependencies": {
27
- "@flow.os": "workspace:*",
27
+ "@flow.os/core": "workspace:*",
28
28
  "@flow.os/router": "workspace:*",
29
29
  "@flow.os/style": "workspace:*",
30
30
  },
@@ -33,10 +33,10 @@
33
33
  },
34
34
  },
35
35
  "packages/create-flow": {
36
- "name": "create-flow",
36
+ "name": "create-flow.os",
37
37
  "version": "0.0.1",
38
38
  "bin": {
39
- "create-flow": "./index.ts",
39
+ "create-flow.os": "./dist/index.js",
40
40
  },
41
41
  "dependencies": {
42
42
  "@clack/prompts": "^0.8.2",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  },
49
49
  "packages/flow.os": {
50
- "name": "@flow.os",
50
+ "name": "@flow.os/core",
51
51
  "version": "0.0.1",
52
52
  },
53
53
  "packages/router": {
@@ -57,6 +57,7 @@
57
57
  "packages/server": {
58
58
  "name": "@flow.os/server",
59
59
  "version": "0.0.1",
60
+ "bin": "./start.ts",
60
61
  "peerDependencies": {
61
62
  "vite": ">=5.0.0",
62
63
  },
@@ -123,10 +124,10 @@
123
124
 
124
125
  "@esbuild/win32-x64": ["@esbuild/win32-x64@0.27.3", "", { "os": "win32", "cpu": "x64" }, "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA=="],
125
126
 
126
- "@flow.os": ["@flow.os@workspace:packages/flow.os"],
127
-
128
127
  "@flow.os/client": ["@flow.os/client@workspace:packages/client"],
129
128
 
129
+ "@flow.os/core": ["@flow.os/core@workspace:packages/flow.os"],
130
+
130
131
  "@flow.os/router": ["@flow.os/router@workspace:packages/router"],
131
132
 
132
133
  "@flow.os/server": ["@flow.os/server@workspace:packages/server"],
@@ -247,7 +248,7 @@
247
248
 
248
249
  "bun-types": ["bun-types@1.2.23", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-R9f0hKAZXgFU3mlrA0YpE/fiDvwV0FT9rORApt2aQVWSuJDzZOyB5QLc0N/4HF57CS8IXJ6+L5E4W1bW6NS2Aw=="],
249
250
 
250
- "create-flow": ["create-flow@workspace:packages/create-flow"],
251
+ "create-flow.os": ["create-flow.os@workspace:packages/create-flow"],
251
252
 
252
253
  "cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="],
253
254
 
@@ -1,7 +1,6 @@
1
- // @flow-package: router
1
+ // @flow: client
2
2
  import './root.css';
3
3
  import { App } from '@flow.os/router';
4
- import { state } from '@flow.os/core';
5
4
 
6
5
  export const fallback = undefined;
7
6
 
@@ -1,4 +1,4 @@
1
- // @flow-package: core
1
+ // @flow: core
2
2
  import { state } from '@flow.os/core';
3
3
 
4
4
  export default function Home() {
@@ -11,8 +11,7 @@
11
11
  "lint": "oxlint .",
12
12
  "fmt": "oxfmt",
13
13
  "fmt:check": "oxfmt --check",
14
- "gen": "bun run --cwd packages/create-flow gen",
15
- "publish:dev": "bun run --cwd packages/create-flow publish:dev"
14
+ "release": "bun run --cwd packages/create-flow release"
16
15
  },
17
16
  "dependencies": {
18
17
  "@flow.os/client": "file:./packages/client",
@@ -15,8 +15,14 @@ function resolveAlias(): Record<string, string> {
15
15
  }
16
16
  for (const name of fs.readdirSync(packagesDir)) {
17
17
  const dir = path.join(packagesDir, name);
18
- if (!fs.statSync(dir).isDirectory() || !fs.existsSync(path.join(dir, 'package.json'))) continue;
18
+ if (!fs.statSync(dir).isDirectory()) continue;
19
+ const pkgPath = path.join(dir, 'package.json');
20
+ if (!fs.existsSync(pkgPath)) continue;
19
21
  const abs = path.resolve(dir);
22
+ try {
23
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8')) as { name?: string };
24
+ if (pkg.name?.startsWith('@flow.os/') || pkg.name === '@flow.os') alias[pkg.name] = abs;
25
+ } catch {}
20
26
  if (name !== 'flow.os') alias[`@flow.os/${name}`] = abs;
21
27
  }
22
28
  return alias;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flow.os/client",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "main": "./index.ts",
6
6
  "types": "./index.ts",
@@ -19,18 +19,20 @@ const HTML = `<!DOCTYPE html>
19
19
  </html>`;
20
20
 
21
21
  export function flow(): Plugin {
22
+ const cwd = process.cwd();
22
23
  return {
23
24
  name: 'flow',
24
25
  config() {
25
26
  return {
26
- root: '.',
27
+ root: resolve(cwd),
28
+ base: '/',
27
29
  esbuild: { jsx: 'automatic', jsxImportSource: '@flow.os/client' },
28
- resolve: { alias: { '~': resolve(process.cwd(), 'client') } },
30
+ resolve: { alias: { '~': resolve(cwd, 'client') } },
29
31
  build: { target: 'esnext', minify: 'esbuild', sourcemap: true },
30
32
  };
31
33
  },
32
34
  configResolved(_config) {
33
- writeFileSync(resolve(process.cwd(), 'index.html'), HTML);
35
+ writeFileSync(resolve(cwd, 'index.html'), HTML);
34
36
  },
35
37
  resolveId(id) {
36
38
  return id === '/entry.tsx' ? FLOW_ENTRY_ID : null;
@@ -38,5 +40,12 @@ export function flow(): Plugin {
38
40
  load(id) {
39
41
  return id === FLOW_ENTRY_ID ? ENTRY_CODE : null;
40
42
  },
43
+ buildEnd(err) {
44
+ if (err) {
45
+ const msg = err.message ?? String(err);
46
+ const stack = err.stack ?? (err as Error).cause?.toString?.();
47
+ console.error('[flow] build error:', msg, stack ?? '');
48
+ }
49
+ },
41
50
  };
42
51
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flow.os/core",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "main": "./index.ts",
6
6
  "types": "./index.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flow.os/router",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "main": "./index.ts",
6
6
  "types": "./index.ts",
@@ -1,3 +1,4 @@
1
+ // @flow: server
1
2
  import { defineHandler } from '@flow.os/server';
2
3
 
3
4
  export default defineHandler(() => ({ hello: 'api' }));
@@ -5,8 +5,8 @@
5
5
  "": {
6
6
  "name": "flow-framework",
7
7
  "dependencies": {
8
- "@flow.os": "workspace:*",
9
8
  "@flow.os/client": "workspace:*",
9
+ "@flow.os/core": "workspace:*",
10
10
  "@flow.os/router": "workspace:*",
11
11
  "@flow.os/server": "workspace:*",
12
12
  "@flow.os/style": "workspace:*",
@@ -24,7 +24,7 @@
24
24
  "name": "@flow.os/client",
25
25
  "version": "0.0.1",
26
26
  "dependencies": {
27
- "@flow.os": "workspace:*",
27
+ "@flow.os/core": "workspace:*",
28
28
  "@flow.os/router": "workspace:*",
29
29
  "@flow.os/style": "workspace:*",
30
30
  },
@@ -33,10 +33,10 @@
33
33
  },
34
34
  },
35
35
  "packages/create-flow": {
36
- "name": "create-flow",
36
+ "name": "create-flow.os",
37
37
  "version": "0.0.1",
38
38
  "bin": {
39
- "create-flow": "./index.ts",
39
+ "create-flow.os": "./dist/index.js",
40
40
  },
41
41
  "dependencies": {
42
42
  "@clack/prompts": "^0.8.2",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  },
49
49
  "packages/flow.os": {
50
- "name": "@flow.os",
50
+ "name": "@flow.os/core",
51
51
  "version": "0.0.1",
52
52
  },
53
53
  "packages/router": {
@@ -57,6 +57,7 @@
57
57
  "packages/server": {
58
58
  "name": "@flow.os/server",
59
59
  "version": "0.0.1",
60
+ "bin": "./start.ts",
60
61
  "peerDependencies": {
61
62
  "vite": ">=5.0.0",
62
63
  },
@@ -123,10 +124,10 @@
123
124
 
124
125
  "@esbuild/win32-x64": ["@esbuild/win32-x64@0.27.3", "", { "os": "win32", "cpu": "x64" }, "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA=="],
125
126
 
126
- "@flow.os": ["@flow.os@workspace:packages/flow.os"],
127
-
128
127
  "@flow.os/client": ["@flow.os/client@workspace:packages/client"],
129
128
 
129
+ "@flow.os/core": ["@flow.os/core@workspace:packages/flow.os"],
130
+
130
131
  "@flow.os/router": ["@flow.os/router@workspace:packages/router"],
131
132
 
132
133
  "@flow.os/server": ["@flow.os/server@workspace:packages/server"],
@@ -247,7 +248,7 @@
247
248
 
248
249
  "bun-types": ["bun-types@1.2.23", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-R9f0hKAZXgFU3mlrA0YpE/fiDvwV0FT9rORApt2aQVWSuJDzZOyB5QLc0N/4HF57CS8IXJ6+L5E4W1bW6NS2Aw=="],
249
250
 
250
- "create-flow": ["create-flow@workspace:packages/create-flow"],
251
+ "create-flow.os": ["create-flow.os@workspace:packages/create-flow"],
251
252
 
252
253
  "cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="],
253
254
 
@@ -11,8 +11,7 @@
11
11
  "lint": "oxlint .",
12
12
  "fmt": "oxfmt",
13
13
  "fmt:check": "oxfmt --check",
14
- "gen": "bun run --cwd packages/create-flow gen",
15
- "publish:dev": "bun run --cwd packages/create-flow publish:dev"
14
+ "release": "bun run --cwd packages/create-flow release"
16
15
  },
17
16
  "dependencies": {
18
17
  "@flow.os/client": "^0.0.1",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flow.os/core",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "main": "./index.ts",
6
6
  "types": "./index.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flow.os/router",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "main": "./index.ts",
6
6
  "types": "./index.ts",
@@ -1,3 +1,4 @@
1
+ // @flow: server
1
2
  import { defineHandler } from '@flow.os/server';
2
3
 
3
4
  export default defineHandler(() => ({ hello: 'api' }));