create-flow-os 0.0.1-dev.1771782345 → 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 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);
@@ -926,7 +963,7 @@ async function runDev(cwd) {
926
963
  await devProc.exited;
927
964
  }
928
965
  var PROFILE_LABELS = {
929
- full: "Full stack (client + server)",
966
+ full: "Full stack (client + server)",
930
967
  client: "Client only",
931
968
  server: "Server only"
932
969
  };
@@ -990,7 +1027,7 @@ async function main() {
990
1027
  const profileIds = Object.keys(config.profiles);
991
1028
  const hasDeps = Object.values(config.packages).every((e2) => Array.isArray(e2.deps));
992
1029
  if (!hasDeps) {
993
- he(c2.dim("Run ") + c2.brand("bun run gen") + c2.dim(" from create-flow first."));
1030
+ he(c2.dim("Run ") + c2.brand("bun run gen") + c2.dim(" in create-flow first."));
994
1031
  process.exit(1);
995
1032
  }
996
1033
  const projectName = nameArg?.trim() || (yes ? "my-flow-app" : null);
@@ -1009,6 +1046,7 @@ async function main() {
1009
1046
  name = "my-flow-app";
1010
1047
  const profileFlag = profileFromArgv(argv, profileIds);
1011
1048
  const optsFull = optsForProfile(config, "full");
1049
+ const allPackageIds = optsFull.map(([id]) => id);
1012
1050
  let profileId;
1013
1051
  let selected = [];
1014
1052
  if (profileFlag) {
@@ -1019,35 +1057,42 @@ async function main() {
1019
1057
  selected = [...defaultIds, ...addOns];
1020
1058
  } else if (yes) {
1021
1059
  profileId = "full";
1022
- selected = optsFull.map(([id]) => id);
1060
+ selected = allPackageIds;
1023
1061
  } else {
1024
- const options = profileIds.map((id) => ({
1025
- value: id,
1026
- label: `${ICON[id] ?? ""} ${PROFILE_LABELS[id] ?? id}`.trim() || id
1027
- }));
1028
- const choice = await le({
1029
- message: c2.muted("Template"),
1030
- options
1062
+ const withAll = await ce({
1063
+ message: c2.muted("Include all packages?"),
1064
+ initialValue: true
1031
1065
  });
1032
- if (lD(choice))
1066
+ if (lD(withAll))
1033
1067
  process.exit(0);
1034
- profileId = choice;
1035
- const opts = optsForProfile(config, profileId);
1036
- const optIds = opts.map(([id]) => id);
1037
- const defaultIds = config.profiles[profileId]?.defaultPackages ?? [];
1038
- selected = optIds.filter((id) => defaultIds.includes(id));
1039
- if (profileId === "full") {
1040
- selected = optIds;
1041
- } else if (opts.length > 0) {
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));
1042
1087
  const optionalIds = optIds.filter((id) => !defaultIds.includes(id));
1043
1088
  if (optionalIds.length > 0) {
1044
- const r2 = await $e({
1089
+ const addOns = await $e({
1045
1090
  message: c2.muted("Add-ons"),
1046
1091
  options: optionalIds.map((id) => ({ value: id, label: id })),
1047
1092
  required: false
1048
1093
  });
1049
- if (!lD(r2))
1050
- selected = [...selected, ...r2 ?? []];
1094
+ if (!lD(addOns))
1095
+ selected = [...selected, ...addOns ?? []];
1051
1096
  }
1052
1097
  }
1053
1098
  }
@@ -1060,11 +1105,11 @@ async function main() {
1060
1105
  stat(projectPath).then(() => true).catch(() => false)
1061
1106
  ]);
1062
1107
  if (!profileExists) {
1063
- he(c2.dim("Profile not found. Run ") + c2.brand("bun run gen") + c2.dim("."));
1108
+ he(c2.dim("Profile missing. Run ") + c2.brand("bun run gen") + c2.dim(" in create-flow."));
1064
1109
  process.exit(1);
1065
1110
  }
1066
1111
  if (pathExists && !force) {
1067
- he(c2.dim("Folder ") + name + c2.dim(" exists. Use ") + c2.brand("--force") + c2.dim("."));
1112
+ he(c2.dim("Directory ") + name + c2.dim(" exists. Use ") + c2.brand("--force") + c2.dim(" to overwrite."));
1068
1113
  process.exit(1);
1069
1114
  }
1070
1115
  const isDevFromRepoPromise = useDevTag ? findPackageDir(REPO_ROOT, "@flow.os/client").then((d2) => !!d2) : Promise.resolve(false);
@@ -1072,7 +1117,7 @@ async function main() {
1072
1117
  const createSpinner = _2();
1073
1118
  createSpinner.start(c2.cyan(ICON.rocket + " Creating project\u2026"));
1074
1119
  await copyWithExclude(profileDir, projectPathNew, ["node_modules", ".git", "packages", "scripts", "LICENSE", "README.md"]);
1075
- createSpinner.stop(c2.cyan(ICON.rocket + " Project created"));
1120
+ createSpinner.stop(c2.cyan(ICON.rocket + " Done"));
1076
1121
  const extraDeps = {};
1077
1122
  for (const id of selected) {
1078
1123
  const deps = config.packages[id]?.deps;
@@ -1087,7 +1132,7 @@ async function main() {
1087
1132
  try {
1088
1133
  await Bun.$`git init ${projectPathNew}`.quiet();
1089
1134
  await Bun.$`git -C ${projectPathNew} add -A`.quiet();
1090
- await Bun.$`git -C ${projectPathNew} commit -m "Initial commit (Flow)"`.quiet();
1135
+ await Bun.$`git -C ${projectPathNew} commit -m "Initial commit"`.quiet();
1091
1136
  } catch {}
1092
1137
  }
1093
1138
  const finalPkg = await Bun.file(pkgPath).json();
@@ -1124,10 +1169,10 @@ async function main() {
1124
1169
  await Bun.write(pkgPath, JSON.stringify(finalPkg, null, 2));
1125
1170
  if (!noInstall) {
1126
1171
  const s = _2();
1127
- s.start(c2.cyan(ICON.deps + " Installing dependencies\u2026"));
1172
+ s.start(c2.cyan(ICON.deps + " Installing\u2026"));
1128
1173
  const proc = Bun.spawn(["bun", "install"], { cwd: projectPathNew, stdout: "pipe", stderr: "pipe" });
1129
1174
  const code = await proc.exited;
1130
- s.stop(code === 0 ? c2.cyan(ICON.deps + " Dependencies installed") : "Failed");
1175
+ s.stop(code === 0 ? c2.cyan(ICON.deps + " Installed") : "Failed");
1131
1176
  if (code !== 0) {
1132
1177
  const err = await new Response(proc.stderr).text();
1133
1178
  v2.error(err || "bun install exit " + code);
@@ -1143,14 +1188,13 @@ async function main() {
1143
1188
  ge(c2.cyan(ICON.rocket + " Starting dev server\u2026"));
1144
1189
  await runDev(projectPath);
1145
1190
  } else {
1146
- const outroLines = [
1147
- c2.bold("Done"),
1191
+ ge(box([
1192
+ c2.bold("All set"),
1148
1193
  "",
1149
- c2.dim("Next steps:"),
1194
+ c2.dim("Run:"),
1150
1195
  " " + c2.brand("cd " + name),
1151
1196
  " " + c2.brand("bun run dev")
1152
- ];
1153
- ge(box(outroLines));
1197
+ ]));
1154
1198
  }
1155
1199
  }
1156
1200
  main().catch((e2) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-flow-os",
3
- "version": "0.0.1-dev.1771782345",
3
+ "version": "0.0.1-dev.1771782787",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "create-flow-os": "bin/index.js"
@@ -1,4 +1,3 @@
1
- /* @flow: client */
2
1
  :root {
3
2
  --background: #rgb(34, 34, 34)
4
3
 
@@ -1,4 +1,3 @@
1
- // @flow: client
2
1
  import './root.css';
3
2
  import { App } from '@flow.os/router';
4
3
  import NotFound from './routes/404';
@@ -1,4 +1,3 @@
1
- // @flow: client
2
1
  /** Pagina 404 full-page (senza layout comune). Mostrata dal router per route inesistenti; raggiungibile anche da /404. */
3
2
  export default function NotFound(path: string) {
4
3
  return (
@@ -1,4 +1,3 @@
1
- // @flow: client
2
1
  import { state } from '@flow.os/core';
3
2
 
4
3
  export default function Home() {
@@ -1,4 +1,3 @@
1
- /* @flow: client */
2
1
  :root {
3
2
  --background: #rgb(34, 34, 34)
4
3
 
@@ -1,4 +1,3 @@
1
- // @flow: client
2
1
  import './root.css';
3
2
  import { App } from '@flow.os/router';
4
3
  import NotFound from './routes/404';
@@ -1,4 +1,3 @@
1
- // @flow: client
2
1
  /** Pagina 404 full-page (senza layout comune). Mostrata dal router per route inesistenti; raggiungibile anche da /404. */
3
2
  export default function NotFound(path: string) {
4
3
  return (
@@ -1,4 +1,3 @@
1
- // @flow: client
2
1
  import { state } from '@flow.os/core';
3
2
 
4
3
  export default function Home() {
@@ -1,4 +1,3 @@
1
- // @flow: server
2
1
  import { defineHandler } from '@flow.os/server';
3
2
 
4
3
  export default defineHandler(() => ({ hello: 'api' }));
@@ -1,4 +1,3 @@
1
- // @flow: server
2
1
  import { defineHandler } from '@flow.os/server';
3
2
 
4
3
  export default defineHandler(() => ({ hello: 'api' }));