create-flow-os 0.0.1-dev.1771781977 → 0.0.1-dev.1771782787
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 +86 -36
- package/package.json +1 -1
- package/profiles/client/client/root.css +0 -1
- package/profiles/client/client/root.tsx +0 -1
- package/profiles/client/client/routes/404.tsx +0 -1
- package/profiles/client/client/routes/index.tsx +0 -1
- package/profiles/client/package.json +0 -1
- package/profiles/full/client/root.css +0 -1
- package/profiles/full/client/root.tsx +0 -1
- package/profiles/full/client/routes/404.tsx +0 -1
- package/profiles/full/client/routes/index.tsx +0 -1
- package/profiles/full/server/routes/hello.get.ts +0 -1
- package/profiles/server/server/routes/hello.get.ts +0 -1
package/bin/index.js
CHANGED
|
@@ -463,6 +463,24 @@ class x {
|
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
|
+
|
|
467
|
+
class BD extends x {
|
|
468
|
+
get cursor() {
|
|
469
|
+
return this.value ? 0 : 1;
|
|
470
|
+
}
|
|
471
|
+
get _value() {
|
|
472
|
+
return this.cursor === 0;
|
|
473
|
+
}
|
|
474
|
+
constructor(u) {
|
|
475
|
+
super(u, false), this.value = !!u.initialValue, this.on("value", () => {
|
|
476
|
+
this.value = this._value;
|
|
477
|
+
}), this.on("confirm", (F) => {
|
|
478
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = F, this.state = "submit", this.close();
|
|
479
|
+
}), this.on("cursor", () => {
|
|
480
|
+
this.value = !this.value;
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
}
|
|
466
484
|
var fD = Object.defineProperty;
|
|
467
485
|
var gD = (e, u, F) => (u in e) ? fD(e, u, { enumerable: true, configurable: true, writable: true, value: F }) : e[u] = F;
|
|
468
486
|
var K = (e, u, F) => (gD(e, typeof u != "symbol" ? u + "" : u, F), F);
|
|
@@ -642,6 +660,25 @@ ${import_picocolors2.default.cyan($2)}
|
|
|
642
660
|
`;
|
|
643
661
|
}
|
|
644
662
|
} }).prompt();
|
|
663
|
+
var ce = (s) => {
|
|
664
|
+
const n = s.active ?? "Yes", t = s.inactive ?? "No";
|
|
665
|
+
return new BD({ active: n, inactive: t, initialValue: s.initialValue ?? true, render() {
|
|
666
|
+
const i = `${import_picocolors2.default.gray(a2)}
|
|
667
|
+
${y2(this.state)} ${s.message}
|
|
668
|
+
`, r2 = this.value ? n : t;
|
|
669
|
+
switch (this.state) {
|
|
670
|
+
case "submit":
|
|
671
|
+
return `${i}${import_picocolors2.default.gray(a2)} ${import_picocolors2.default.dim(r2)}`;
|
|
672
|
+
case "cancel":
|
|
673
|
+
return `${i}${import_picocolors2.default.gray(a2)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(r2))}
|
|
674
|
+
${import_picocolors2.default.gray(a2)}`;
|
|
675
|
+
default:
|
|
676
|
+
return `${i}${import_picocolors2.default.cyan(a2)} ${this.value ? `${import_picocolors2.default.green(I2)} ${n}` : `${import_picocolors2.default.dim(T2)} ${import_picocolors2.default.dim(n)}`} ${import_picocolors2.default.dim("/")} ${this.value ? `${import_picocolors2.default.dim(T2)} ${import_picocolors2.default.dim(t)}` : `${import_picocolors2.default.green(I2)} ${t}`}
|
|
677
|
+
${import_picocolors2.default.cyan($2)}
|
|
678
|
+
`;
|
|
679
|
+
}
|
|
680
|
+
} }).prompt();
|
|
681
|
+
};
|
|
645
682
|
var le = (s) => {
|
|
646
683
|
const n = (t, i) => {
|
|
647
684
|
const r2 = t.label ?? String(t.value);
|
|
@@ -925,7 +962,11 @@ async function runDev(cwd) {
|
|
|
925
962
|
});
|
|
926
963
|
await devProc.exited;
|
|
927
964
|
}
|
|
928
|
-
var
|
|
965
|
+
var PROFILE_LABELS = {
|
|
966
|
+
full: "Full stack (client + server)",
|
|
967
|
+
client: "Client only",
|
|
968
|
+
server: "Server only"
|
|
969
|
+
};
|
|
929
970
|
function optsForProfile(config, profileId) {
|
|
930
971
|
return Object.entries(config.packages).filter(([, e2]) => {
|
|
931
972
|
const inc = e2.includeIn ?? [];
|
|
@@ -942,12 +983,13 @@ function optionalPackageIdsForProfile(config, profileId) {
|
|
|
942
983
|
const defaultIds = config.profiles[profileId]?.defaultPackages ?? [];
|
|
943
984
|
return optIds.filter((id) => !defaultIds.includes(id));
|
|
944
985
|
}
|
|
945
|
-
function profileFromArgv(argv2) {
|
|
986
|
+
function profileFromArgv(argv2, profileIds) {
|
|
987
|
+
const set = new Set(profileIds);
|
|
946
988
|
for (const arg of argv2) {
|
|
947
989
|
if (!arg.startsWith("--"))
|
|
948
990
|
continue;
|
|
949
991
|
const key = arg.slice(2);
|
|
950
|
-
if (
|
|
992
|
+
if (set.has(key))
|
|
951
993
|
return key;
|
|
952
994
|
}
|
|
953
995
|
return null;
|
|
@@ -982,9 +1024,10 @@ async function main() {
|
|
|
982
1024
|
} catch {}
|
|
983
1025
|
}
|
|
984
1026
|
const config = await Bun.file(join2(DIR, "config.json")).json();
|
|
1027
|
+
const profileIds = Object.keys(config.profiles);
|
|
985
1028
|
const hasDeps = Object.values(config.packages).every((e2) => Array.isArray(e2.deps));
|
|
986
1029
|
if (!hasDeps) {
|
|
987
|
-
he(c2.dim("Run ") + c2.brand("bun run gen") + c2.dim("
|
|
1030
|
+
he(c2.dim("Run ") + c2.brand("bun run gen") + c2.dim(" in create-flow first."));
|
|
988
1031
|
process.exit(1);
|
|
989
1032
|
}
|
|
990
1033
|
const projectName = nameArg?.trim() || (yes ? "my-flow-app" : null);
|
|
@@ -1001,8 +1044,9 @@ async function main() {
|
|
|
1001
1044
|
}
|
|
1002
1045
|
if (!name)
|
|
1003
1046
|
name = "my-flow-app";
|
|
1004
|
-
const profileFlag = profileFromArgv(argv);
|
|
1047
|
+
const profileFlag = profileFromArgv(argv, profileIds);
|
|
1005
1048
|
const optsFull = optsForProfile(config, "full");
|
|
1049
|
+
const allPackageIds = optsFull.map(([id]) => id);
|
|
1006
1050
|
let profileId;
|
|
1007
1051
|
let selected = [];
|
|
1008
1052
|
if (profileFlag) {
|
|
@@ -1013,35 +1057,42 @@ async function main() {
|
|
|
1013
1057
|
selected = [...defaultIds, ...addOns];
|
|
1014
1058
|
} else if (yes) {
|
|
1015
1059
|
profileId = "full";
|
|
1016
|
-
selected =
|
|
1060
|
+
selected = allPackageIds;
|
|
1017
1061
|
} else {
|
|
1018
|
-
const
|
|
1019
|
-
message: c2.muted("
|
|
1020
|
-
|
|
1021
|
-
{ value: "full", label: `${ICON.full} Full stack ${c2.dim("(client + server)")}` },
|
|
1022
|
-
{ value: "client", label: `${ICON.client} Client only` },
|
|
1023
|
-
{ value: "server", label: `${ICON.server} Server only` }
|
|
1024
|
-
]
|
|
1062
|
+
const withAll = await ce({
|
|
1063
|
+
message: c2.muted("Include all packages?"),
|
|
1064
|
+
initialValue: true
|
|
1025
1065
|
});
|
|
1026
|
-
if (lD(
|
|
1066
|
+
if (lD(withAll))
|
|
1027
1067
|
process.exit(0);
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1068
|
+
if (withAll) {
|
|
1069
|
+
profileId = "full";
|
|
1070
|
+
selected = allPackageIds;
|
|
1071
|
+
} else {
|
|
1072
|
+
const options = profileIds.map((id) => ({
|
|
1073
|
+
value: id,
|
|
1074
|
+
label: `${ICON[id] ?? ""} ${PROFILE_LABELS[id] ?? id}`.trim() || id
|
|
1075
|
+
}));
|
|
1076
|
+
const choice = await le({
|
|
1077
|
+
message: c2.muted("Template"),
|
|
1078
|
+
options
|
|
1079
|
+
});
|
|
1080
|
+
if (lD(choice))
|
|
1081
|
+
process.exit(0);
|
|
1082
|
+
profileId = choice;
|
|
1083
|
+
const opts = optsForProfile(config, profileId);
|
|
1084
|
+
const optIds = opts.map(([id]) => id);
|
|
1085
|
+
const defaultIds = config.profiles[profileId]?.defaultPackages ?? [];
|
|
1086
|
+
selected = optIds.filter((id) => defaultIds.includes(id));
|
|
1036
1087
|
const optionalIds = optIds.filter((id) => !defaultIds.includes(id));
|
|
1037
1088
|
if (optionalIds.length > 0) {
|
|
1038
|
-
const
|
|
1089
|
+
const addOns = await $e({
|
|
1039
1090
|
message: c2.muted("Add-ons"),
|
|
1040
1091
|
options: optionalIds.map((id) => ({ value: id, label: id })),
|
|
1041
1092
|
required: false
|
|
1042
1093
|
});
|
|
1043
|
-
if (!lD(
|
|
1044
|
-
selected = [...selected, ...
|
|
1094
|
+
if (!lD(addOns))
|
|
1095
|
+
selected = [...selected, ...addOns ?? []];
|
|
1045
1096
|
}
|
|
1046
1097
|
}
|
|
1047
1098
|
}
|
|
@@ -1054,11 +1105,11 @@ async function main() {
|
|
|
1054
1105
|
stat(projectPath).then(() => true).catch(() => false)
|
|
1055
1106
|
]);
|
|
1056
1107
|
if (!profileExists) {
|
|
1057
|
-
he(c2.dim("Profile
|
|
1108
|
+
he(c2.dim("Profile missing. Run ") + c2.brand("bun run gen") + c2.dim(" in create-flow."));
|
|
1058
1109
|
process.exit(1);
|
|
1059
1110
|
}
|
|
1060
1111
|
if (pathExists && !force) {
|
|
1061
|
-
he(c2.dim("
|
|
1112
|
+
he(c2.dim("Directory ") + name + c2.dim(" exists. Use ") + c2.brand("--force") + c2.dim(" to overwrite."));
|
|
1062
1113
|
process.exit(1);
|
|
1063
1114
|
}
|
|
1064
1115
|
const isDevFromRepoPromise = useDevTag ? findPackageDir(REPO_ROOT, "@flow.os/client").then((d2) => !!d2) : Promise.resolve(false);
|
|
@@ -1066,7 +1117,7 @@ async function main() {
|
|
|
1066
1117
|
const createSpinner = _2();
|
|
1067
1118
|
createSpinner.start(c2.cyan(ICON.rocket + " Creating project\u2026"));
|
|
1068
1119
|
await copyWithExclude(profileDir, projectPathNew, ["node_modules", ".git", "packages", "scripts", "LICENSE", "README.md"]);
|
|
1069
|
-
createSpinner.stop(c2.cyan(ICON.rocket + "
|
|
1120
|
+
createSpinner.stop(c2.cyan(ICON.rocket + " Done"));
|
|
1070
1121
|
const extraDeps = {};
|
|
1071
1122
|
for (const id of selected) {
|
|
1072
1123
|
const deps = config.packages[id]?.deps;
|
|
@@ -1081,7 +1132,7 @@ async function main() {
|
|
|
1081
1132
|
try {
|
|
1082
1133
|
await Bun.$`git init ${projectPathNew}`.quiet();
|
|
1083
1134
|
await Bun.$`git -C ${projectPathNew} add -A`.quiet();
|
|
1084
|
-
await Bun.$`git -C ${projectPathNew} commit -m "Initial commit
|
|
1135
|
+
await Bun.$`git -C ${projectPathNew} commit -m "Initial commit"`.quiet();
|
|
1085
1136
|
} catch {}
|
|
1086
1137
|
}
|
|
1087
1138
|
const finalPkg = await Bun.file(pkgPath).json();
|
|
@@ -1118,10 +1169,10 @@ async function main() {
|
|
|
1118
1169
|
await Bun.write(pkgPath, JSON.stringify(finalPkg, null, 2));
|
|
1119
1170
|
if (!noInstall) {
|
|
1120
1171
|
const s = _2();
|
|
1121
|
-
s.start(c2.cyan(ICON.deps + " Installing
|
|
1172
|
+
s.start(c2.cyan(ICON.deps + " Installing\u2026"));
|
|
1122
1173
|
const proc = Bun.spawn(["bun", "install"], { cwd: projectPathNew, stdout: "pipe", stderr: "pipe" });
|
|
1123
1174
|
const code = await proc.exited;
|
|
1124
|
-
s.stop(code === 0 ? c2.cyan(ICON.deps + "
|
|
1175
|
+
s.stop(code === 0 ? c2.cyan(ICON.deps + " Installed") : "Failed");
|
|
1125
1176
|
if (code !== 0) {
|
|
1126
1177
|
const err = await new Response(proc.stderr).text();
|
|
1127
1178
|
v2.error(err || "bun install exit " + code);
|
|
@@ -1137,14 +1188,13 @@ async function main() {
|
|
|
1137
1188
|
ge(c2.cyan(ICON.rocket + " Starting dev server\u2026"));
|
|
1138
1189
|
await runDev(projectPath);
|
|
1139
1190
|
} else {
|
|
1140
|
-
|
|
1141
|
-
c2.bold("
|
|
1191
|
+
ge(box([
|
|
1192
|
+
c2.bold("All set"),
|
|
1142
1193
|
"",
|
|
1143
|
-
c2.dim("
|
|
1194
|
+
c2.dim("Run:"),
|
|
1144
1195
|
" " + c2.brand("cd " + name),
|
|
1145
1196
|
" " + c2.brand("bun run dev")
|
|
1146
|
-
];
|
|
1147
|
-
ge(box(outroLines));
|
|
1197
|
+
]));
|
|
1148
1198
|
}
|
|
1149
1199
|
}
|
|
1150
1200
|
main().catch((e2) => {
|
package/package.json
CHANGED