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 +95 -102
- package/config.json +33 -2
- package/package.json +1 -1
- package/packages/{router → client}/client/root.tsx +0 -1
- package/packages/server/server/routes/hello.get.ts +3 -0
- package/profiles/client/bun.lock +9 -8
- package/profiles/client/client/root.tsx +1 -2
- package/profiles/client/client/routes/index.tsx +1 -1
- package/profiles/client/package.json +1 -2
- package/profiles/client/packages/client/config.ts +7 -1
- package/profiles/client/packages/client/package.json +1 -1
- package/profiles/client/packages/client/vite.ts +12 -3
- package/profiles/client/packages/flow.os/package.json +1 -1
- package/profiles/client/packages/router/package.json +1 -1
- package/profiles/full/bun.lock +9 -8
- package/profiles/full/client/root.tsx +1 -2
- package/profiles/full/client/routes/index.tsx +1 -1
- package/profiles/full/package.json +1 -2
- package/profiles/full/packages/client/config.ts +7 -1
- package/profiles/full/packages/client/package.json +1 -1
- package/profiles/full/packages/client/vite.ts +12 -3
- package/profiles/full/packages/flow.os/package.json +1 -1
- package/profiles/full/packages/router/package.json +1 -1
- package/profiles/full/server/routes/hello.get.ts +1 -0
- package/profiles/server/bun.lock +9 -8
- package/profiles/server/package.json +1 -2
- package/profiles/server/packages/flow.os/package.json +1 -1
- package/profiles/server/packages/router/package.json +1 -1
- package/profiles/server/server/routes/hello.get.ts +1 -0
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
|
-
|
|
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("
|
|
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({
|
|
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
|
|
913
|
+
const optsFull = optsForProfile(config, "full");
|
|
923
914
|
if (yes) {
|
|
924
915
|
profileId = "full";
|
|
925
|
-
selected =
|
|
916
|
+
selected = optsFull.map(([id]) => id);
|
|
926
917
|
} else {
|
|
927
|
-
const
|
|
928
|
-
message: "
|
|
918
|
+
const choice = await le({
|
|
919
|
+
message: "Template",
|
|
929
920
|
options: [
|
|
930
|
-
{ value: "
|
|
931
|
-
{ value: "
|
|
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(
|
|
926
|
+
if (lD(choice))
|
|
935
927
|
process.exit(0);
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
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: "
|
|
955
|
-
options:
|
|
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
|
|
964
|
-
const
|
|
965
|
-
|
|
966
|
-
|
|
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 (
|
|
970
|
-
|
|
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("
|
|
980
|
-
await copyWithExclude(profileDir,
|
|
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,
|
|
972
|
+
await copyWithExclude(pkgDir, projectPathNew, []);
|
|
985
973
|
} catch {}
|
|
986
974
|
}
|
|
987
|
-
scaffoldSpinner.stop("
|
|
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(
|
|
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 ${
|
|
1001
|
-
await Bun.$`git -C ${
|
|
1002
|
-
await Bun.$`git -C ${
|
|
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 =
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
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(
|
|
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("
|
|
1044
|
-
const proc = Bun.spawn(["bun", "install"], { cwd:
|
|
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 ? "
|
|
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
|
-
|
|
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/
|
|
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
package/profiles/client/bun.lock
CHANGED
|
@@ -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.
|
|
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
|
-
"
|
|
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()
|
|
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;
|
|
@@ -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(
|
|
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(
|
|
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
|
}
|
package/profiles/full/bun.lock
CHANGED
|
@@ -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.
|
|
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
|
-
"
|
|
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()
|
|
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;
|
|
@@ -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(
|
|
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(
|
|
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
|
}
|
package/profiles/server/bun.lock
CHANGED
|
@@ -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.
|
|
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
|
-
"
|
|
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",
|