create-flow-os 0.0.1-dev.1771665964 → 0.0.1-dev.1771667671

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);
@@ -888,103 +871,108 @@ var useDevTag = argv.includes("--dev");
888
871
  var nameArg = argv.find((a3) => !a3.startsWith("--"));
889
872
  var DIR = basename(import.meta.dir) === "dist" || basename(import.meta.dir) === "bin" ? join2(import.meta.dir, "..") : import.meta.dir;
890
873
  var REPO_ROOT = (process.env.FLOW_FRAMEWORK_ROOT ?? join2(DIR, "..", "..")).replace(/\\/g, "/");
874
+ var aqua = import_picocolors3.default.cyan;
875
+ var dim = import_picocolors3.default.dim;
876
+ function optsForProfile(config, profileId) {
877
+ return Object.entries(config.packages).filter(([, e2]) => {
878
+ const inc = e2.includeIn ?? [];
879
+ if (inc.includes(profileId))
880
+ return true;
881
+ if (profileId === "full" && (inc.includes("client") || inc.includes("server")))
882
+ return true;
883
+ return false;
884
+ });
885
+ }
891
886
  async function main() {
892
- pe(import_picocolors3.default.cyan(` Flow \u2013 create project
887
+ const devBadge = useDevTag ? aqua(" \xB7 dev") : "";
888
+ pe(import_picocolors3.default.bold(" Flow") + devBadge + dim(`
889
+ Create a new Flow app
893
890
  `));
894
891
  const config = await Bun.file(join2(DIR, "config.json")).json();
895
892
  const hasDeps = Object.values(config.packages).every((e2) => Array.isArray(e2.deps));
896
893
  if (!hasDeps) {
897
- he("Esegui prima " + import_picocolors3.default.cyan("bun run gen") + " dalla cartella create-flow.");
894
+ he(dim("Run ") + aqua("bun run gen") + dim(" from create-flow first."));
898
895
  process.exit(1);
899
896
  }
900
897
  const projectName = nameArg?.trim() || (yes ? "my-flow-app" : null);
901
898
  let name = projectName;
902
899
  if (!name && !yes) {
903
- const r2 = await ae({ message: "Project name", initialValue: "my-flow-app", validate: (v3) => !v3?.trim() ? "Obbligatorio" : undefined });
900
+ const r2 = await ae({
901
+ message: "Project name",
902
+ initialValue: "my-flow-app",
903
+ validate: (v3) => !v3?.trim() ? "Required" : undefined
904
+ });
904
905
  if (lD(r2))
905
906
  process.exit(0);
906
907
  name = r2.trim() || "my-flow-app";
907
908
  }
908
909
  if (!name)
909
910
  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
911
  let profileId;
921
912
  let selected = [];
922
- const optsForFull = optsForProfile("full");
913
+ const optsFull = optsForProfile(config, "full");
923
914
  if (yes) {
924
915
  profileId = "full";
925
- selected = optsForFull.map(([id]) => id);
916
+ selected = optsFull.map(([id]) => id);
926
917
  } else {
927
- const complete = await le({
928
- message: "Vuoi installare tutto completo? (tutti i package)",
918
+ const choice = await le({
919
+ message: "Template",
929
920
  options: [
930
- { value: "yes", label: "S\xEC, tutto completo" },
931
- { value: "no", label: "No, scelgo profile e package" }
921
+ { value: "full", label: "Full stack (client + server)" },
922
+ { value: "client", label: "Client only" },
923
+ { value: "server", label: "Server only" }
932
924
  ]
933
925
  });
934
- if (lD(complete))
926
+ if (lD(choice))
935
927
  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) {
928
+ profileId = choice;
929
+ const opts = optsForProfile(config, profileId);
930
+ const optIds = opts.map(([id]) => id);
931
+ const defaultIds = config.profiles[profileId]?.defaultPackages ?? [];
932
+ selected = optIds.filter((id) => defaultIds.includes(id));
933
+ if (profileId === "full") {
934
+ selected = optIds;
935
+ } else if (opts.length > 0) {
936
+ const optionalIds = optIds.filter((id) => !defaultIds.includes(id));
937
+ if (optionalIds.length > 0) {
953
938
  const r2 = await $e({
954
- message: "Scegli i package",
955
- options: opts.map(([id]) => ({ value: id, label: id })),
939
+ message: "Add-ons",
940
+ options: optionalIds.map((id) => ({ value: id, label: id })),
956
941
  required: false
957
942
  });
958
943
  if (!lD(r2))
959
- selected = r2 ?? [];
944
+ selected = [...selected, ...r2 ?? []];
960
945
  }
961
946
  }
962
947
  }
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") + ".");
948
+ const cwd = process.cwd();
949
+ const projectPath = join2(cwd, name);
950
+ const projectPathNew = join2(cwd, name + ".new");
951
+ const profileDir = join2(DIR, "profiles", profileId);
952
+ const [profileExists, pathExists] = await Promise.all([
953
+ stat(profileDir).then(() => true).catch(() => false),
954
+ stat(projectPath).then(() => true).catch(() => false)
955
+ ]);
956
+ if (!profileExists) {
957
+ he(dim("Profile not found. Run ") + aqua("bun run gen") + dim("."));
967
958
  process.exit(1);
968
959
  }
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") + ".");
960
+ if (pathExists && !force) {
961
+ he(dim("Folder ") + name + dim(" exists. Use ") + aqua("--force") + dim("."));
976
962
  process.exit(1);
977
963
  }
964
+ const isDevFromRepoPromise = useDevTag ? findPackageDir(REPO_ROOT, "@flow.os/client").then((d2) => !!d2) : Promise.resolve(false);
965
+ await rm(projectPathNew, { recursive: true, force: true });
978
966
  const scaffoldSpinner = _2();
979
- scaffoldSpinner.start("Scaffold");
980
- await copyWithExclude(profileDir, projectPath, ["node_modules", ".git"]);
967
+ scaffoldSpinner.start("Scaffolding");
968
+ await copyWithExclude(profileDir, projectPathNew, ["node_modules", ".git"]);
981
969
  for (const id of selected) {
982
970
  const pkgDir = join2(DIR, "packages", id);
983
971
  try {
984
- await copyWithExclude(pkgDir, projectPath, []);
972
+ await copyWithExclude(pkgDir, projectPathNew, []);
985
973
  } catch {}
986
974
  }
987
- scaffoldSpinner.stop("Scaffold");
975
+ scaffoldSpinner.stop("Scaffolding");
988
976
  const extraDeps = {};
989
977
  for (const id of selected) {
990
978
  const deps = config.packages[id]?.deps;
@@ -992,65 +980,70 @@ async function main() {
992
980
  for (const d2 of deps)
993
981
  extraDeps[d2] = "^0.0.1";
994
982
  }
995
- const pkgPath = join2(projectPath, "package.json");
983
+ const pkgPath = join2(projectPathNew, "package.json");
996
984
  const pkg = await Bun.file(pkgPath).json();
997
985
  await Bun.write(pkgPath, JSON.stringify(transformPackageJson(pkg, name, extraDeps, false), null, 2));
998
986
  if (!noGit) {
999
987
  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();
988
+ await Bun.$`git init ${projectPathNew}`.quiet();
989
+ await Bun.$`git -C ${projectPathNew} add -A`.quiet();
990
+ await Bun.$`git -C ${projectPathNew} commit -m "Initial commit (Flow)"`.quiet();
1003
991
  } catch {}
1004
992
  }
1005
993
  const finalPkg = await Bun.file(pkgPath).json();
1006
994
  delete finalPkg.workspaces;
1007
995
  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
- }
996
+ const isDevFromRepo = await isDevFromRepoPromise;
997
+ const flowKeys = Object.keys(finalPkg.dependencies).filter((k3) => k3 === "@flow.os" || k3.startsWith("@flow.os/"));
998
+ if (useDevTag && isDevFromRepo && flowKeys.length > 0) {
999
+ const dirs = await Promise.all(flowKeys.map((k3) => findPackageDir(REPO_ROOT, k3)));
1000
+ for (let i = 0;i < flowKeys.length; i++) {
1001
+ const k3 = flowKeys[i];
1002
+ const pkgDir = dirs[i];
1003
+ if (pkgDir) {
1004
+ const rel = relative(projectPathNew, pkgDir).replace(/\\/g, "/");
1005
+ finalPkg.dependencies[k3] = "file:" + (rel.startsWith("..") ? rel : "./" + rel);
1026
1006
  } else {
1027
1007
  finalPkg.dependencies[k3] = "dev";
1028
1008
  }
1029
1009
  }
1010
+ } else if (useDevTag) {
1011
+ for (const k3 of flowKeys)
1012
+ finalPkg.dependencies[k3] = "dev";
1013
+ }
1014
+ for (const k3 of Object.keys(finalPkg.dependencies)) {
1015
+ if (finalPkg.dependencies[k3] === "workspace:*")
1016
+ finalPkg.dependencies[k3] = "^0.0.1";
1030
1017
  }
1031
1018
  delete finalPkg.dependencies["@flow.os"];
1032
1019
  finalPkg.dependencies = Object.fromEntries(Object.entries(finalPkg.dependencies).filter(([key]) => key !== "@flow.os"));
1033
1020
  }
1034
1021
  await Bun.write(pkgPath, JSON.stringify(finalPkg, null, 2));
1035
1022
  if (useDevTag) {
1036
- const projectPackagesDir = join2(projectPath, "packages");
1037
1023
  try {
1038
- await rm(projectPackagesDir, { recursive: true, force: true });
1024
+ await rm(join2(projectPathNew, "packages"), { recursive: true, force: true });
1039
1025
  } catch {}
1040
1026
  }
1041
1027
  if (!noInstall) {
1042
1028
  const s = _2();
1043
- s.start("Install");
1044
- const proc = Bun.spawn(["bun", "install"], { cwd: projectPath, stdout: "pipe", stderr: "pipe" });
1029
+ s.start("Installing");
1030
+ const proc = Bun.spawn(["bun", "install"], { cwd: projectPathNew, stdout: "pipe", stderr: "pipe" });
1045
1031
  const code = await proc.exited;
1046
- s.stop(code === 0 ? "Install ok" : "Install failed");
1032
+ s.stop(code === 0 ? "Installed" : "Failed");
1047
1033
  if (code !== 0) {
1048
1034
  const err = await new Response(proc.stderr).text();
1049
1035
  v2.error(err || "bun install exit " + code);
1036
+ await rm(projectPathNew, { recursive: true, force: true });
1037
+ process.exit(1);
1050
1038
  }
1051
1039
  }
1052
- ge([import_picocolors3.default.green("Ok."), "", " " + import_picocolors3.default.cyan("cd " + name), " " + import_picocolors3.default.cyan("bun run dev")].join(`
1053
- `));
1040
+ if (pathExists)
1041
+ await rm(projectPath, { recursive: true, force: true });
1042
+ await rename(projectPathNew, projectPath);
1043
+ ge(import_picocolors3.default.green("Done.") + `
1044
+
1045
+ ` + aqua("cd " + name) + `
1046
+ ` + aqua("bun run dev"));
1054
1047
  }
1055
1048
  main().catch((e2) => {
1056
1049
  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.1771665964",
3
+ "version": "0.0.1-dev.1771667671",
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' }));