create-flow-os 0.0.1-dev.1771670377 → 0.0.1-dev.1771691512
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 +29 -2
- package/package.json +1 -1
- package/profiles/client/package.json +3 -3
- package/profiles/full/package.json +3 -3
- package/profiles/server/package.json +3 -3
- package/profiles/client/dev.ts +0 -18
- package/profiles/full/dev.ts +0 -18
- package/profiles/server/dev.ts +0 -18
package/bin/index.js
CHANGED
|
@@ -910,6 +910,7 @@ async function runDev(cwd) {
|
|
|
910
910
|
});
|
|
911
911
|
await devProc.exited;
|
|
912
912
|
}
|
|
913
|
+
var PROFILE_FLAGS = ["client", "full", "server"];
|
|
913
914
|
function optsForProfile(config, profileId) {
|
|
914
915
|
return Object.entries(config.packages).filter(([, e2]) => {
|
|
915
916
|
const inc = e2.includeIn ?? [];
|
|
@@ -920,6 +921,25 @@ function optsForProfile(config, profileId) {
|
|
|
920
921
|
return false;
|
|
921
922
|
});
|
|
922
923
|
}
|
|
924
|
+
function optionalPackageIdsForProfile(config, profileId) {
|
|
925
|
+
const opts = optsForProfile(config, profileId);
|
|
926
|
+
const optIds = opts.map(([id]) => id);
|
|
927
|
+
const defaultIds = config.profiles[profileId]?.defaultPackages ?? [];
|
|
928
|
+
return optIds.filter((id) => !defaultIds.includes(id));
|
|
929
|
+
}
|
|
930
|
+
function profileFromArgv(argv2) {
|
|
931
|
+
for (const arg of argv2) {
|
|
932
|
+
if (!arg.startsWith("--"))
|
|
933
|
+
continue;
|
|
934
|
+
const key = arg.slice(2);
|
|
935
|
+
if (PROFILE_FLAGS.includes(key))
|
|
936
|
+
return key;
|
|
937
|
+
}
|
|
938
|
+
return null;
|
|
939
|
+
}
|
|
940
|
+
function addOnsFromArgv(argv2, optionalIds) {
|
|
941
|
+
return optionalIds.filter((id) => argv2.includes("--" + id));
|
|
942
|
+
}
|
|
923
943
|
async function main() {
|
|
924
944
|
const devBadge = useDevTag ? c2.dim(" \xB7 dev") : "";
|
|
925
945
|
const CONTENT_W = 46;
|
|
@@ -959,10 +979,17 @@ async function main() {
|
|
|
959
979
|
}
|
|
960
980
|
if (!name)
|
|
961
981
|
name = "my-flow-app";
|
|
982
|
+
const profileFlag = profileFromArgv(argv);
|
|
983
|
+
const optsFull = optsForProfile(config, "full");
|
|
962
984
|
let profileId;
|
|
963
985
|
let selected = [];
|
|
964
|
-
|
|
965
|
-
|
|
986
|
+
if (profileFlag) {
|
|
987
|
+
profileId = profileFlag;
|
|
988
|
+
const defaultIds = config.profiles[profileId]?.defaultPackages ?? [];
|
|
989
|
+
const optionalIds = optionalPackageIdsForProfile(config, profileId);
|
|
990
|
+
const addOns = addOnsFromArgv(argv, optionalIds);
|
|
991
|
+
selected = [...defaultIds, ...addOns];
|
|
992
|
+
} else if (yes) {
|
|
966
993
|
profileId = "full";
|
|
967
994
|
selected = optsFull.map(([id]) => id);
|
|
968
995
|
} else {
|
package/package.json
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"dev": "bun dev.ts",
|
|
8
|
-
"build": "tsc -b && bun
|
|
9
|
-
"preview": "bun
|
|
7
|
+
"dev": "bun packages/client/start-dev.ts",
|
|
8
|
+
"build": "tsc -b && bun packages/client/build.ts",
|
|
9
|
+
"preview": "bun packages/client/preview.ts",
|
|
10
10
|
"start": "bun node_modules/@flow.os/server/start.ts",
|
|
11
11
|
"lint": "oxlint .",
|
|
12
12
|
"fmt": "oxfmt",
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"dev": "bun dev.ts",
|
|
8
|
-
"build": "tsc -b && bun
|
|
9
|
-
"preview": "bun
|
|
7
|
+
"dev": "bun packages/client/start-dev.ts",
|
|
8
|
+
"build": "tsc -b && bun packages/client/build.ts",
|
|
9
|
+
"preview": "bun packages/client/preview.ts",
|
|
10
10
|
"start": "bun node_modules/@flow.os/server/start.ts",
|
|
11
11
|
"lint": "oxlint .",
|
|
12
12
|
"fmt": "oxfmt",
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"dev": "bun dev.ts",
|
|
8
|
-
"build": "tsc -b && bun
|
|
9
|
-
"preview": "bun
|
|
7
|
+
"dev": "bun packages/client/start-dev.ts",
|
|
8
|
+
"build": "tsc -b && bun packages/client/build.ts",
|
|
9
|
+
"preview": "bun packages/client/preview.ts",
|
|
10
10
|
"start": "bun node_modules/@flow.os/server/start.ts",
|
|
11
11
|
"lint": "oxlint .",
|
|
12
12
|
"fmt": "oxfmt",
|
package/profiles/client/dev.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
/**
|
|
3
|
-
* Dev server: carica flow.config.ts e avvia il server (non dipende da file nel package @flow.os/client).
|
|
4
|
-
*/
|
|
5
|
-
import { pathToFileURL } from "node:url";
|
|
6
|
-
import { join } from "node:path";
|
|
7
|
-
import { createServer } from "vite";
|
|
8
|
-
|
|
9
|
-
const cwd = import.meta.dir;
|
|
10
|
-
const configUrl = pathToFileURL(join(cwd, "flow.config.ts")).href;
|
|
11
|
-
const mod = await import(configUrl).catch((e: Error) => {
|
|
12
|
-
console.error("Flow: could not load flow.config.ts:", e.message);
|
|
13
|
-
process.exit(1);
|
|
14
|
-
});
|
|
15
|
-
const getConfig = mod.default;
|
|
16
|
-
const config = typeof getConfig === "function" ? await getConfig() : getConfig;
|
|
17
|
-
const server = await createServer(config);
|
|
18
|
-
await server.listen();
|
package/profiles/full/dev.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
/**
|
|
3
|
-
* Dev server: carica flow.config.ts e avvia il server (non dipende da file nel package @flow.os/client).
|
|
4
|
-
*/
|
|
5
|
-
import { pathToFileURL } from "node:url";
|
|
6
|
-
import { join } from "node:path";
|
|
7
|
-
import { createServer } from "vite";
|
|
8
|
-
|
|
9
|
-
const cwd = import.meta.dir;
|
|
10
|
-
const configUrl = pathToFileURL(join(cwd, "flow.config.ts")).href;
|
|
11
|
-
const mod = await import(configUrl).catch((e: Error) => {
|
|
12
|
-
console.error("Flow: could not load flow.config.ts:", e.message);
|
|
13
|
-
process.exit(1);
|
|
14
|
-
});
|
|
15
|
-
const getConfig = mod.default;
|
|
16
|
-
const config = typeof getConfig === "function" ? await getConfig() : getConfig;
|
|
17
|
-
const server = await createServer(config);
|
|
18
|
-
await server.listen();
|
package/profiles/server/dev.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
/**
|
|
3
|
-
* Dev server: carica flow.config.ts e avvia il server (non dipende da file nel package @flow.os/client).
|
|
4
|
-
*/
|
|
5
|
-
import { pathToFileURL } from "node:url";
|
|
6
|
-
import { join } from "node:path";
|
|
7
|
-
import { createServer } from "vite";
|
|
8
|
-
|
|
9
|
-
const cwd = import.meta.dir;
|
|
10
|
-
const configUrl = pathToFileURL(join(cwd, "flow.config.ts")).href;
|
|
11
|
-
const mod = await import(configUrl).catch((e: Error) => {
|
|
12
|
-
console.error("Flow: could not load flow.config.ts:", e.message);
|
|
13
|
-
process.exit(1);
|
|
14
|
-
});
|
|
15
|
-
const getConfig = mod.default;
|
|
16
|
-
const config = typeof getConfig === "function" ? await getConfig() : getConfig;
|
|
17
|
-
const server = await createServer(config);
|
|
18
|
-
await server.listen();
|