everything-dev 1.12.2 → 1.12.4

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.
Files changed (77) hide show
  1. package/dist/app.cjs +7 -96
  2. package/dist/app.cjs.map +1 -1
  3. package/dist/app.mjs +8 -97
  4. package/dist/app.mjs.map +1 -1
  5. package/dist/cli/framework-version.cjs +35 -0
  6. package/dist/cli/framework-version.cjs.map +1 -0
  7. package/dist/cli/framework-version.mjs +34 -0
  8. package/dist/cli/framework-version.mjs.map +1 -0
  9. package/dist/cli/init.cjs +14 -3
  10. package/dist/cli/init.cjs.map +1 -1
  11. package/dist/cli/init.d.cts.map +1 -1
  12. package/dist/cli/init.d.mts.map +1 -1
  13. package/dist/cli/init.mjs +14 -3
  14. package/dist/cli/init.mjs.map +1 -1
  15. package/dist/cli/status.cjs +2 -9
  16. package/dist/cli/status.cjs.map +1 -1
  17. package/dist/cli/status.mjs +2 -9
  18. package/dist/cli/status.mjs.map +1 -1
  19. package/dist/cli/sync.cjs +88 -16
  20. package/dist/cli/sync.cjs.map +1 -1
  21. package/dist/cli/sync.mjs +88 -16
  22. package/dist/cli/sync.mjs.map +1 -1
  23. package/dist/cli/upgrade.cjs +85 -48
  24. package/dist/cli/upgrade.cjs.map +1 -1
  25. package/dist/cli/upgrade.mjs +85 -48
  26. package/dist/cli/upgrade.mjs.map +1 -1
  27. package/dist/config.cjs +18 -13
  28. package/dist/config.cjs.map +1 -1
  29. package/dist/config.d.cts +10 -1
  30. package/dist/config.d.cts.map +1 -1
  31. package/dist/config.d.mts +10 -1
  32. package/dist/config.d.mts.map +1 -1
  33. package/dist/config.mjs +18 -14
  34. package/dist/config.mjs.map +1 -1
  35. package/dist/contract.d.cts +2 -2
  36. package/dist/contract.d.mts +2 -2
  37. package/dist/host.cjs +1 -0
  38. package/dist/host.cjs.map +1 -1
  39. package/dist/host.d.cts.map +1 -1
  40. package/dist/host.d.mts.map +1 -1
  41. package/dist/host.mjs +1 -0
  42. package/dist/host.mjs.map +1 -1
  43. package/dist/index.cjs +1 -0
  44. package/dist/index.d.cts +2 -2
  45. package/dist/index.d.mts +2 -2
  46. package/dist/index.mjs +2 -2
  47. package/dist/internal/manifest-normalizer.cjs +7 -0
  48. package/dist/internal/manifest-normalizer.cjs.map +1 -1
  49. package/dist/internal/manifest-normalizer.mjs +7 -0
  50. package/dist/internal/manifest-normalizer.mjs.map +1 -1
  51. package/dist/orchestrator.d.cts +1 -1
  52. package/dist/orchestrator.d.mts +1 -1
  53. package/dist/plugin.d.cts +1 -1
  54. package/dist/plugin.d.mts +1 -1
  55. package/dist/ui/index.cjs +0 -9
  56. package/dist/ui/index.d.cts +2 -2
  57. package/dist/ui/index.d.mts +2 -2
  58. package/dist/ui/index.mjs +2 -2
  59. package/dist/ui/runtime.cjs +1 -43
  60. package/dist/ui/runtime.cjs.map +1 -1
  61. package/dist/ui/runtime.d.cts +1 -16
  62. package/dist/ui/runtime.d.cts.map +1 -1
  63. package/dist/ui/runtime.d.mts +1 -16
  64. package/dist/ui/runtime.d.mts.map +1 -1
  65. package/dist/ui/runtime.mjs +2 -36
  66. package/dist/ui/runtime.mjs.map +1 -1
  67. package/package.json +1 -1
  68. package/src/app.ts +8 -113
  69. package/src/cli/framework-version.ts +61 -0
  70. package/src/cli/init.ts +16 -4
  71. package/src/cli/status.ts +2 -15
  72. package/src/cli/sync.ts +145 -24
  73. package/src/cli/upgrade.ts +94 -72
  74. package/src/config.ts +51 -14
  75. package/src/host.ts +1 -0
  76. package/src/internal/manifest-normalizer.ts +13 -0
  77. package/src/ui/runtime.ts +1 -48
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.mts","names":[],"sources":["../../src/ui/runtime.ts"],"mappings":";;;QAKQ,MAAA;EAAA,UACI,MAAA;IACR,kBAAA,GAAqB,mBAAA;EAAA;AAAA;AAAA,iBAIT,gBAAA,CAAA,GAAoB,mBAAA;AAAA,iBAYpB,gBAAA,CAAiB,aAAA,GAAgB,OAAA,CAAQ,mBAAA;;;;;;;iBAIzC,kBAAA,CAAmB,aAAA,GAAgB,OAAA,CAAQ,mBAAA;AAAA,iBAI3C,gBAAA,CAAiB,QAAA,UAAkB,aAAA,GAAgB,OAAA,CAAQ,mBAAA;AAAA,iBAa3D,yBAAA,CAA0B,SAAA;AAAA,iBAI1B,yBAAA,CAA0B,SAAA,UAAmB,SAAA;AAAA,iBAI7C,YAAA,CAAa,MAAA,GAAS,OAAA,CAAQ,mBAAA;AAAA,iBAK9B,UAAA,CAAW,MAAA,GAAS,OAAA,CAAQ,mBAAA;AAAA,iBAM5B,aAAA,CAAc,MAAA,GAAS,OAAA,CAAQ,mBAAA;AAAA,iBAO/B,UAAA,CAAW,MAAA,GAAS,OAAA,CAAQ,mBAAA;AAAA,iBAK5B,YAAA,CAAa,MAAA,GAAS,OAAA,CAAQ,mBAAA;AAAA,iBAK9B,aAAA,CAAc,MAAA,GAAS,OAAA,CAAQ,mBAAA;AAAA,iBAK/B,WAAA,CAAY,MAAA,GAAS,OAAA,CAAQ,mBAAA"}
1
+ {"version":3,"file":"runtime.d.mts","names":[],"sources":["../../src/ui/runtime.ts"],"mappings":";;;QAIQ,MAAA;EAAA,UACI,MAAA;IACR,kBAAA,GAAqB,mBAAA;EAAA;AAAA;AAAA,iBAIT,gBAAA,CAAA,GAAoB,mBAAA;AAAA,iBAYpB,gBAAA,CAAiB,QAAA,UAAkB,aAAA,GAAgB,OAAA,CAAQ,mBAAA;AAAA,iBAa3D,yBAAA,CAA0B,SAAA;AAAA,iBAI1B,yBAAA,CAA0B,SAAA,UAAmB,SAAA"}
@@ -1,19 +1,11 @@
1
- import { getNetworkIdForAccount } from "../network.mjs";
2
-
3
1
  //#region src/ui/runtime.ts
4
2
  function getRuntimeConfig() {
5
3
  if (typeof window === "undefined") throw new Error("Runtime config is only available in the browser");
6
4
  if (!window.__RUNTIME_CONFIG__) throw new Error("Missing runtime config");
7
5
  return window.__RUNTIME_CONFIG__;
8
6
  }
9
- function getActiveRuntime(runtimeConfig) {
10
- return runtimeConfig?.runtime;
11
- }
12
- function getRuntimeBasePath(runtimeConfig) {
13
- return getActiveRuntime(runtimeConfig)?.runtimeBasePath || "/";
14
- }
15
7
  function buildRuntimeHref(pathname, runtimeConfig) {
16
- const basePath = getRuntimeBasePath(runtimeConfig);
8
+ const basePath = runtimeConfig?.runtime?.runtimeBasePath ?? "/";
17
9
  if (basePath === "/") return pathname;
18
10
  if (!pathname.startsWith("/")) return `${basePath}/${pathname}`;
19
11
  return pathname === "/" ? basePath : `${basePath}${pathname}`;
@@ -24,33 +16,7 @@ function buildPublishedAccountHref(accountId) {
24
16
  function buildPublishedGatewayHref(accountId, gatewayId) {
25
17
  return `${buildPublishedAccountHref(accountId)}/${encodeURIComponent(gatewayId)}`;
26
18
  }
27
- function getAssetsUrl(config) {
28
- return (config ?? getRuntimeConfig())?.assetsUrl ?? "";
29
- }
30
- function getHostUrl(config) {
31
- const cfg = config ?? getRuntimeConfig();
32
- if (typeof window === "undefined") return "";
33
- return cfg?.hostUrl ?? window.location.origin;
34
- }
35
- function getApiBaseUrl(config) {
36
- const base = (config ?? getRuntimeConfig())?.rpcBase;
37
- if (typeof window === "undefined") return "/api/rpc";
38
- return base ? `${window.location.origin}${base}` : `${window.location.origin}/api/rpc`;
39
- }
40
- function getAccount(config) {
41
- return (config ?? getRuntimeConfig())?.account ?? "every.near";
42
- }
43
- function getNetworkId(config) {
44
- const cfg = config ?? getRuntimeConfig();
45
- return cfg?.networkId ?? getNetworkIdForAccount(cfg?.account ?? "every.near");
46
- }
47
- function getRepository(config) {
48
- return (config ?? getRuntimeConfig())?.repository;
49
- }
50
- function getCspNonce(config) {
51
- return (config ?? getRuntimeConfig())?.cspNonce;
52
- }
53
19
 
54
20
  //#endregion
55
- export { buildPublishedAccountHref, buildPublishedGatewayHref, buildRuntimeHref, getAccount, getActiveRuntime, getApiBaseUrl, getAssetsUrl, getCspNonce, getHostUrl, getNetworkId, getRepository, getRuntimeBasePath, getRuntimeConfig };
21
+ export { buildPublishedAccountHref, buildPublishedGatewayHref, buildRuntimeHref, getRuntimeConfig };
56
22
  //# sourceMappingURL=runtime.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.mjs","names":[],"sources":["../../src/ui/runtime.ts"],"sourcesContent":["import { getNetworkIdForAccount } from \"../network\";\nimport type { ClientRuntimeConfig } from \"../types\";\n\nexport type { ClientRuntimeInfo } from \"../types\";\n\ndeclare global {\n interface Window {\n __RUNTIME_CONFIG__?: ClientRuntimeConfig;\n }\n}\n\nexport function getRuntimeConfig(): ClientRuntimeConfig {\n if (typeof window === \"undefined\") {\n throw new Error(\"Runtime config is only available in the browser\");\n }\n\n if (!window.__RUNTIME_CONFIG__) {\n throw new Error(\"Missing runtime config\");\n }\n\n return window.__RUNTIME_CONFIG__;\n}\n\nexport function getActiveRuntime(runtimeConfig?: Partial<ClientRuntimeConfig>) {\n return runtimeConfig?.runtime;\n}\n\nexport function getRuntimeBasePath(runtimeConfig?: Partial<ClientRuntimeConfig>) {\n return getActiveRuntime(runtimeConfig)?.runtimeBasePath || \"/\";\n}\n\nexport function buildRuntimeHref(pathname: string, runtimeConfig?: Partial<ClientRuntimeConfig>) {\n const basePath = getRuntimeBasePath(runtimeConfig);\n if (basePath === \"/\") {\n return pathname;\n }\n\n if (!pathname.startsWith(\"/\")) {\n return `${basePath}/${pathname}`;\n }\n\n return pathname === \"/\" ? basePath : `${basePath}${pathname}`;\n}\n\nexport function buildPublishedAccountHref(accountId: string) {\n return `/apps/${encodeURIComponent(accountId)}`;\n}\n\nexport function buildPublishedGatewayHref(accountId: string, gatewayId: string) {\n return `${buildPublishedAccountHref(accountId)}/${encodeURIComponent(gatewayId)}`;\n}\n\nexport function getAssetsUrl(config?: Partial<ClientRuntimeConfig>): string {\n const cfg = config ?? getRuntimeConfig();\n return cfg?.assetsUrl ?? \"\";\n}\n\nexport function getHostUrl(config?: Partial<ClientRuntimeConfig>): string {\n const cfg = config ?? getRuntimeConfig();\n if (typeof window === \"undefined\") return \"\";\n return cfg?.hostUrl ?? window.location.origin;\n}\n\nexport function getApiBaseUrl(config?: Partial<ClientRuntimeConfig>): string {\n const cfg = config ?? getRuntimeConfig();\n const base = cfg?.rpcBase;\n if (typeof window === \"undefined\") return \"/api/rpc\";\n return base ? `${window.location.origin}${base}` : `${window.location.origin}/api/rpc`;\n}\n\nexport function getAccount(config?: Partial<ClientRuntimeConfig>): string {\n const cfg = config ?? getRuntimeConfig();\n return cfg?.account ?? \"every.near\";\n}\n\nexport function getNetworkId(config?: Partial<ClientRuntimeConfig>): \"mainnet\" | \"testnet\" {\n const cfg = config ?? getRuntimeConfig();\n return cfg?.networkId ?? getNetworkIdForAccount(cfg?.account ?? \"every.near\");\n}\n\nexport function getRepository(config?: Partial<ClientRuntimeConfig>): string | undefined {\n const cfg = config ?? getRuntimeConfig();\n return cfg?.repository;\n}\n\nexport function getCspNonce(config?: Partial<ClientRuntimeConfig>): string | undefined {\n const cfg = config ?? getRuntimeConfig();\n return cfg?.cspNonce;\n}\n"],"mappings":";;;AAWA,SAAgB,mBAAwC;AACtD,KAAI,OAAO,WAAW,YACpB,OAAM,IAAI,MAAM,kDAAkD;AAGpE,KAAI,CAAC,OAAO,mBACV,OAAM,IAAI,MAAM,yBAAyB;AAG3C,QAAO,OAAO;;AAGhB,SAAgB,iBAAiB,eAA8C;AAC7E,QAAO,eAAe;;AAGxB,SAAgB,mBAAmB,eAA8C;AAC/E,QAAO,iBAAiB,cAAc,EAAE,mBAAmB;;AAG7D,SAAgB,iBAAiB,UAAkB,eAA8C;CAC/F,MAAM,WAAW,mBAAmB,cAAc;AAClD,KAAI,aAAa,IACf,QAAO;AAGT,KAAI,CAAC,SAAS,WAAW,IAAI,CAC3B,QAAO,GAAG,SAAS,GAAG;AAGxB,QAAO,aAAa,MAAM,WAAW,GAAG,WAAW;;AAGrD,SAAgB,0BAA0B,WAAmB;AAC3D,QAAO,SAAS,mBAAmB,UAAU;;AAG/C,SAAgB,0BAA0B,WAAmB,WAAmB;AAC9E,QAAO,GAAG,0BAA0B,UAAU,CAAC,GAAG,mBAAmB,UAAU;;AAGjF,SAAgB,aAAa,QAA+C;AAE1E,SADY,UAAU,kBAAkB,GAC5B,aAAa;;AAG3B,SAAgB,WAAW,QAA+C;CACxE,MAAM,MAAM,UAAU,kBAAkB;AACxC,KAAI,OAAO,WAAW,YAAa,QAAO;AAC1C,QAAO,KAAK,WAAW,OAAO,SAAS;;AAGzC,SAAgB,cAAc,QAA+C;CAE3E,MAAM,QADM,UAAU,kBAAkB,GACtB;AAClB,KAAI,OAAO,WAAW,YAAa,QAAO;AAC1C,QAAO,OAAO,GAAG,OAAO,SAAS,SAAS,SAAS,GAAG,OAAO,SAAS,OAAO;;AAG/E,SAAgB,WAAW,QAA+C;AAExE,SADY,UAAU,kBAAkB,GAC5B,WAAW;;AAGzB,SAAgB,aAAa,QAA8D;CACzF,MAAM,MAAM,UAAU,kBAAkB;AACxC,QAAO,KAAK,aAAa,uBAAuB,KAAK,WAAW,aAAa;;AAG/E,SAAgB,cAAc,QAA2D;AAEvF,SADY,UAAU,kBAAkB,GAC5B;;AAGd,SAAgB,YAAY,QAA2D;AAErF,SADY,UAAU,kBAAkB,GAC5B"}
1
+ {"version":3,"file":"runtime.mjs","names":[],"sources":["../../src/ui/runtime.ts"],"sourcesContent":["import type { ClientRuntimeConfig } from \"../types\";\n\nexport type { ClientRuntimeInfo } from \"../types\";\n\ndeclare global {\n interface Window {\n __RUNTIME_CONFIG__?: ClientRuntimeConfig;\n }\n}\n\nexport function getRuntimeConfig(): ClientRuntimeConfig {\n if (typeof window === \"undefined\") {\n throw new Error(\"Runtime config is only available in the browser\");\n }\n\n if (!window.__RUNTIME_CONFIG__) {\n throw new Error(\"Missing runtime config\");\n }\n\n return window.__RUNTIME_CONFIG__;\n}\n\nexport function buildRuntimeHref(pathname: string, runtimeConfig?: Partial<ClientRuntimeConfig>) {\n const basePath = runtimeConfig?.runtime?.runtimeBasePath ?? \"/\";\n if (basePath === \"/\") {\n return pathname;\n }\n\n if (!pathname.startsWith(\"/\")) {\n return `${basePath}/${pathname}`;\n }\n\n return pathname === \"/\" ? basePath : `${basePath}${pathname}`;\n}\n\nexport function buildPublishedAccountHref(accountId: string) {\n return `/apps/${encodeURIComponent(accountId)}`;\n}\n\nexport function buildPublishedGatewayHref(accountId: string, gatewayId: string) {\n return `${buildPublishedAccountHref(accountId)}/${encodeURIComponent(gatewayId)}`;\n}\n"],"mappings":";AAUA,SAAgB,mBAAwC;AACtD,KAAI,OAAO,WAAW,YACpB,OAAM,IAAI,MAAM,kDAAkD;AAGpE,KAAI,CAAC,OAAO,mBACV,OAAM,IAAI,MAAM,yBAAyB;AAG3C,QAAO,OAAO;;AAGhB,SAAgB,iBAAiB,UAAkB,eAA8C;CAC/F,MAAM,WAAW,eAAe,SAAS,mBAAmB;AAC5D,KAAI,aAAa,IACf,QAAO;AAGT,KAAI,CAAC,SAAS,WAAW,IAAI,CAC3B,QAAO,GAAG,SAAS,GAAG;AAGxB,QAAO,aAAa,MAAM,WAAW,GAAG,WAAW;;AAGrD,SAAgB,0BAA0B,WAAmB;AAC3D,QAAO,SAAS,mBAAmB,UAAU;;AAG/C,SAAgB,0BAA0B,WAAmB,WAAmB;AAC9E,QAAO,GAAG,0BAA0B,UAAU,CAAC,GAAG,mBAAmB,UAAU"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "everything-dev",
3
- "version": "1.12.2",
3
+ "version": "1.12.4",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
package/src/app.ts CHANGED
@@ -2,13 +2,10 @@ import { existsSync } from "node:fs";
2
2
  import { createConnection } from "node:net";
3
3
  import { join } from "node:path";
4
4
  import {
5
+ buildRuntimeConfig as configBuildRuntimeConfig,
5
6
  getProjectRoot,
6
- isLocalDevelopmentTarget,
7
- parsePort,
8
7
  resolveLocalDevelopmentPath,
9
- resolvePluginRuntimeName,
10
8
  } from "./config";
11
- import { getNetworkIdForAccount } from "./network";
12
9
  import type { AppOrchestrator } from "./service-descriptor";
13
10
  import type { BosConfig, RuntimeConfig, RuntimePluginConfig } from "./types";
14
11
 
@@ -78,116 +75,14 @@ export function buildRuntimeConfig(
78
75
  plugins?: Record<string, RuntimePluginConfig>;
79
76
  },
80
77
  ): RuntimeConfig {
81
- const configDir = getProjectRoot();
82
- const hostConfig = bosConfig.app.host;
83
- const uiConfig = bosConfig.app.ui;
84
- const apiConfig = bosConfig.app.api;
85
- const authConfig = bosConfig.app.auth;
86
-
87
- function resolveDevelopmentEntry(
88
- entry: { development?: string; production?: string },
89
- preferredSource: "local" | "remote",
90
- ): { source: "local" | "remote"; url: string; localPath?: string; port?: number } {
91
- if (preferredSource === "remote") {
92
- return { source: "remote", url: entry.production ?? "" };
93
- }
94
-
95
- const localPath = resolveLocalDevelopmentPath(entry.development, configDir);
96
- if (localPath && existsSync(localPath)) {
97
- return { source: "local", url: "", localPath };
98
- }
99
-
100
- const devUrl =
101
- entry.development && !isLocalDevelopmentTarget(entry.development)
102
- ? entry.development.replace(/\/$/, "")
103
- : null;
104
- if (devUrl) {
105
- return { source: "local", url: devUrl, port: parsePort(devUrl) };
106
- }
107
-
108
- return { source: "remote", url: entry.production ?? "" };
109
- }
110
-
111
- const hostEntry = resolveDevelopmentEntry(hostConfig, options.hostSource ?? "local");
112
- const uiEntry = resolveDevelopmentEntry(uiConfig, options.uiSource ?? "local");
113
- const apiEntry = resolveDevelopmentEntry(apiConfig, options.apiSource ?? "local");
114
- const authEntry = authConfig
115
- ? resolveDevelopmentEntry(authConfig, options.authSource ?? "local")
116
- : undefined;
117
-
118
- const hostUrl = `http://localhost:${DEFAULT_HOST_PORT}`;
119
-
120
- return {
121
- env: options.env ?? "development",
122
- account: bosConfig.account,
123
- domain: bosConfig.domain,
124
- networkId: getNetworkIdForAccount(bosConfig.account),
125
- host: {
126
- name: "host",
127
- url: hostUrl,
128
- entry: `${hostUrl}/mf-manifest.json`,
129
- localPath: hostEntry.localPath,
130
- port: hostEntry.port ?? DEFAULT_HOST_PORT,
131
- secrets: hostConfig.secrets,
132
- integrity: hostEntry.source === "remote" ? hostConfig.integrity : undefined,
133
- source: hostEntry.source,
134
- remoteUrl: hostEntry.source === "remote" ? hostEntry.url : undefined,
135
- },
136
- shared: bosConfig.shared,
137
- ui: uiConfig
138
- ? {
139
- name: uiConfig.name,
140
- url: uiEntry.url,
141
- entry: uiEntry.url ? `${uiEntry.url}/mf-manifest.json` : "/mf-manifest.json",
142
- localPath: uiEntry.localPath,
143
- port: uiEntry.port,
144
- ssrUrl: uiEntry.source === "remote" ? uiConfig.ssr : undefined,
145
- ssrIntegrity: uiEntry.source === "remote" ? uiConfig.ssrIntegrity : undefined,
146
- integrity: uiEntry.source === "remote" ? uiConfig.integrity : undefined,
147
- source: uiEntry.source,
148
- }
149
- : {
150
- name: "ui",
151
- url: "",
152
- entry: "/mf-manifest.json",
153
- source: uiEntry.source,
154
- },
155
- api: apiConfig
156
- ? {
157
- name: apiConfig.name,
158
- url: apiEntry.url,
159
- entry: apiEntry.url ? `${apiEntry.url}/mf-manifest.json` : "/mf-manifest.json",
160
- localPath: apiEntry.localPath,
161
- port: apiEntry.port,
162
- source: apiEntry.source,
163
- proxy: options.proxy ?? apiConfig.proxy,
164
- variables: apiConfig.variables,
165
- secrets: apiConfig.secrets,
166
- integrity: apiEntry.source === "remote" ? apiConfig.integrity : undefined,
167
- }
168
- : {
169
- name: "api",
170
- url: "",
171
- entry: "/mf-manifest.json",
172
- source: apiEntry.source,
173
- },
174
- auth:
175
- authEntry && authConfig
176
- ? {
177
- name: resolvePluginRuntimeName(undefined, authEntry.localPath, authConfig.name),
178
- url: authEntry.url,
179
- entry: authEntry.url ? `${authEntry.url}/mf-manifest.json` : "/mf-manifest.json",
180
- localPath: authEntry.localPath,
181
- port: authEntry.port,
182
- source: authEntry.source,
183
- proxy: authConfig.proxy,
184
- variables: authConfig.variables,
185
- secrets: authConfig.secrets,
186
- integrity: authEntry.source === "remote" ? authConfig.integrity : undefined,
187
- }
188
- : undefined,
78
+ return configBuildRuntimeConfig(bosConfig, getProjectRoot(), options.env ?? "development", {
79
+ hostSource: options.hostSource,
80
+ uiSource: options.uiSource,
81
+ apiSource: options.apiSource,
82
+ authSource: options.authSource,
83
+ proxy: options.proxy,
189
84
  plugins: options.plugins,
190
- };
85
+ });
191
86
  }
192
87
 
193
88
  function probeTcpOpen(port: number, timeoutMs = 250): Promise<boolean> {
@@ -0,0 +1,61 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+
4
+ function stripVersionPrefix(version: string): string {
5
+ return version.replace(/^[\^~>=]+/, "");
6
+ }
7
+
8
+ export function readRootCatalogVersion(
9
+ projectDir: string,
10
+ packageName: string,
11
+ ): string | undefined {
12
+ const pkgPath = join(projectDir, "package.json");
13
+ if (!existsSync(pkgPath)) return undefined;
14
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf-8")) as {
15
+ workspaces?: { catalog?: Record<string, string> };
16
+ };
17
+ const version = pkg.workspaces?.catalog?.[packageName];
18
+ return version ? stripVersionPrefix(version) : undefined;
19
+ }
20
+
21
+ export function readNodeModulesVersion(
22
+ projectDir: string,
23
+ packageName: string,
24
+ ): string | undefined {
25
+ const pkgPath = join(projectDir, "node_modules", packageName, "package.json");
26
+ if (!existsSync(pkgPath)) return undefined;
27
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf-8")) as { version?: string };
28
+ return pkg.version;
29
+ }
30
+
31
+ export function readInstalledFrameworkVersion(
32
+ projectDir: string,
33
+ packageName: string,
34
+ ): string | undefined {
35
+ const pkgPath = join(projectDir, "package.json");
36
+ if (!existsSync(pkgPath)) return undefined;
37
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf-8")) as Record<string, unknown>;
38
+ const deps = (pkg.dependencies ?? {}) as Record<string, string>;
39
+ const devDeps = (pkg.devDependencies ?? {}) as Record<string, string>;
40
+ const version = deps[packageName] || devDeps[packageName];
41
+
42
+ if (!version) {
43
+ return (
44
+ readRootCatalogVersion(projectDir, packageName) ??
45
+ readNodeModulesVersion(projectDir, packageName)
46
+ );
47
+ }
48
+
49
+ if (version.startsWith("catalog:")) {
50
+ return (
51
+ readRootCatalogVersion(projectDir, packageName) ??
52
+ readNodeModulesVersion(projectDir, packageName)
53
+ );
54
+ }
55
+
56
+ if (version.startsWith("workspace:") || version.startsWith("file:")) {
57
+ return readNodeModulesVersion(projectDir, packageName);
58
+ }
59
+
60
+ return stripVersionPrefix(version);
61
+ }
package/src/cli/init.ts CHANGED
@@ -404,14 +404,25 @@ export async function personalizeConfig(
404
404
  delete deps["everything-dev"];
405
405
  }
406
406
 
407
+ if (!pkg.workspaces || typeof pkg.workspaces !== "object") {
408
+ pkg.workspaces = { packages: [], catalog: {} };
409
+ }
410
+ const workspaces = pkg.workspaces as { packages?: string[]; catalog?: Record<string, string> };
411
+ if (!workspaces.catalog || typeof workspaces.catalog !== "object") {
412
+ workspaces.catalog = {};
413
+ }
414
+
407
415
  if (!pkg.dependencies) pkg.dependencies = {};
408
416
  const deps = pkg.dependencies as Record<string, string>;
409
417
  const spec = opts.workspaceOpts?.sourceDir
410
418
  ? loadManifestNormalizationSpec(opts.workspaceOpts.sourceDir)
411
419
  : null;
412
- if (!deps["everything-dev"] && spec)
413
- deps["everything-dev"] = spec.rootCatalog["everything-dev"];
414
- if (!deps["every-plugin"] && spec) deps["every-plugin"] = spec.rootCatalog["every-plugin"];
420
+ if (spec) {
421
+ workspaces.catalog["everything-dev"] = spec.rootCatalog["everything-dev"];
422
+ workspaces.catalog["every-plugin"] = spec.rootCatalog["every-plugin"];
423
+ }
424
+ if (!deps["everything-dev"] && spec) deps["everything-dev"] = "catalog:";
425
+ if (!deps["every-plugin"] && spec) deps["every-plugin"] = "catalog:";
415
426
 
416
427
  writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`);
417
428
  }
@@ -500,7 +511,8 @@ async function resolveWorkspaceRefs(
500
511
  await normalizePackageManifestsInTree({
501
512
  sourceRootDir: options?.sourceDir ?? destination,
502
513
  targetDir: destination,
503
- resolveCatalogRefs: true,
514
+ resolveCatalogRefs: false,
515
+ preserveCatalogRefs: true,
504
516
  removeWorkspaceDeps: ["host"],
505
517
  });
506
518
 
package/src/cli/status.ts CHANGED
@@ -2,6 +2,7 @@ import { existsSync, readFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import type { StatusResult } from "../contract";
4
4
  import { fetchBosConfigFromFastKv } from "../fastkv";
5
+ import { readInstalledFrameworkVersion } from "./framework-version";
5
6
  import { readSnapshot } from "./snapshot";
6
7
 
7
8
  const FRAMEWORK_PACKAGES = ["everything-dev", "every-plugin"];
@@ -21,21 +22,7 @@ async function fetchLatestNpmVersion(packageName: string): Promise<string | null
21
22
  }
22
23
 
23
24
  function readInstalledVersion(projectDir: string, packageName: string): string | undefined {
24
- const pkgPath = join(projectDir, "package.json");
25
- if (!existsSync(pkgPath)) return undefined;
26
- const pkg = JSON.parse(readFileSync(pkgPath, "utf-8")) as Record<string, unknown>;
27
- const deps = (pkg.dependencies ?? {}) as Record<string, string>;
28
- const devDeps = (pkg.devDependencies ?? {}) as Record<string, string>;
29
- const version = deps[packageName] || devDeps[packageName];
30
- if (!version) return undefined;
31
- if (
32
- version.startsWith("workspace:") ||
33
- version.startsWith("catalog:") ||
34
- version.startsWith("file:")
35
- ) {
36
- return undefined;
37
- }
38
- return version.replace(/^[\^~>=]+/, "");
25
+ return readInstalledFrameworkVersion(projectDir, packageName);
39
26
  }
40
27
 
41
28
  function checkEnvFile(projectDir: string): "found" | "missing" | "example-only" {
package/src/cli/sync.ts CHANGED
@@ -19,6 +19,37 @@ import {
19
19
  } from "./init";
20
20
  import { readSnapshot, writeSnapshot } from "./snapshot";
21
21
 
22
+ const FRAMEWORK_OWNED_SYNC_FILES = new Set([
23
+ ".gitignore",
24
+ "biome.json",
25
+ "bos.config.json",
26
+ "package.json",
27
+ ".github/workflows/release-sync.yml",
28
+ "ui/package.json",
29
+ "ui/postcss.config.mjs",
30
+ "ui/rsbuild.config.ts",
31
+ "ui/tsconfig.json",
32
+ "ui/src/app.ts",
33
+ "ui/src/hydrate.tsx",
34
+ "ui/src/lib/api.ts",
35
+ "ui/src/lib/auth.ts",
36
+ "ui/src/router.server.tsx",
37
+ "ui/src/router.tsx",
38
+ "ui/src/routes/__root.tsx",
39
+ "api/package.json",
40
+ "api/plugin.dev.ts",
41
+ "api/rspack.config.js",
42
+ "api/tsconfig.contract.json",
43
+ "api/tsconfig.json",
44
+ "api/src/lib/auth.ts",
45
+ ]);
46
+
47
+ type PackageJson = Record<string, unknown>;
48
+
49
+ export function isFrameworkOwnedSyncFile(filePath: string): boolean {
50
+ return FRAMEWORK_OWNED_SYNC_FILES.has(filePath);
51
+ }
52
+
22
53
  function readExcludeFile(filePath: string): string[] {
23
54
  if (!existsSync(filePath)) return [];
24
55
  const content = readFileSync(filePath, "utf-8");
@@ -152,11 +183,52 @@ function mergeBosConfig(
152
183
  return merged;
153
184
  }
154
185
 
155
- function mergePackageJson(
156
- local: Record<string, unknown>,
157
- template: Record<string, unknown>,
158
- ): Record<string, unknown> {
159
- const merged = { ...template };
186
+ function mergeStringMaps(
187
+ local: Record<string, string> | undefined,
188
+ template: Record<string, string> | undefined,
189
+ ): Record<string, string> | undefined {
190
+ if (!local && !template) return undefined;
191
+
192
+ const merged: Record<string, string> = { ...(local ?? {}) };
193
+ for (const [name, value] of Object.entries(template ?? {})) {
194
+ merged[name] = value;
195
+ }
196
+
197
+ return Object.keys(merged).length > 0 ? merged : undefined;
198
+ }
199
+
200
+ function mergeWorkspacePackages(local: unknown, template: unknown): string[] | undefined {
201
+ const localPackages = Array.isArray(local) ? local : [];
202
+ const templatePackages = Array.isArray(template) ? template : [];
203
+ if (localPackages.length === 0 && templatePackages.length === 0) return undefined;
204
+
205
+ const ordered = new Set<string>();
206
+ for (const entry of templatePackages) {
207
+ if (typeof entry === "string" && entry.length > 0) ordered.add(entry);
208
+ }
209
+ for (const entry of localPackages) {
210
+ if (typeof entry === "string" && entry.length > 0) ordered.add(entry);
211
+ }
212
+
213
+ return ordered.size > 0 ? [...ordered] : undefined;
214
+ }
215
+
216
+ export function mergePackageJson(
217
+ filePath: string,
218
+ local: PackageJson,
219
+ template: PackageJson,
220
+ ): PackageJson {
221
+ const merged: PackageJson = { ...local, ...template };
222
+
223
+ if (filePath === "package.json") {
224
+ for (const key of ["name", "private", "version"] as const) {
225
+ if (key in local) {
226
+ merged[key] = local[key];
227
+ }
228
+ }
229
+ } else if ("version" in local) {
230
+ merged.version = local.version;
231
+ }
160
232
 
161
233
  for (const depField of [
162
234
  "dependencies",
@@ -167,28 +239,69 @@ function mergePackageJson(
167
239
  const localDeps = local[depField] as Record<string, string> | undefined;
168
240
  const templateDeps = template[depField] as Record<string, string> | undefined;
169
241
 
170
- if (!localDeps && !templateDeps) continue;
171
-
172
- const mergedDeps: Record<string, string> = { ...(templateDeps ?? {}) };
173
-
174
- if (localDeps) {
175
- for (const [name, version] of Object.entries(localDeps)) {
176
- if (!(name in mergedDeps)) {
177
- mergedDeps[name] = version;
178
- }
179
- }
242
+ const mergedDeps = mergeStringMaps(localDeps, templateDeps);
243
+ if (mergedDeps) {
244
+ merged[depField] = mergedDeps;
245
+ } else {
246
+ delete merged[depField];
180
247
  }
248
+ }
181
249
 
182
- if (Object.keys(mergedDeps).length > 0) {
183
- merged[depField] = mergedDeps;
250
+ if (
251
+ (local.scripts && typeof local.scripts === "object") ||
252
+ (template.scripts && typeof template.scripts === "object")
253
+ ) {
254
+ const mergedScripts = mergeStringMaps(
255
+ local.scripts as Record<string, string> | undefined,
256
+ template.scripts as Record<string, string> | undefined,
257
+ );
258
+ if (mergedScripts) {
259
+ merged.scripts = mergedScripts;
260
+ } else {
261
+ delete merged.scripts;
184
262
  }
185
263
  }
186
264
 
187
- if (local.scripts && typeof local.scripts === "object") {
188
- merged.scripts = {
189
- ...((template.scripts as Record<string, string>) ?? {}),
190
- ...(local.scripts as Record<string, string>),
265
+ if (
266
+ (local.workspaces && typeof local.workspaces === "object") ||
267
+ (template.workspaces && typeof template.workspaces === "object")
268
+ ) {
269
+ const localWorkspaces = (local.workspaces ?? {}) as {
270
+ packages?: string[];
271
+ catalog?: Record<string, string>;
272
+ };
273
+ const templateWorkspaces = (template.workspaces ?? {}) as {
274
+ packages?: string[];
275
+ catalog?: Record<string, string>;
191
276
  };
277
+
278
+ const mergedWorkspaces: { packages?: string[]; catalog?: Record<string, string> } = {
279
+ ...localWorkspaces,
280
+ ...templateWorkspaces,
281
+ };
282
+
283
+ const mergedPackages = mergeWorkspacePackages(
284
+ localWorkspaces.packages,
285
+ templateWorkspaces.packages,
286
+ );
287
+ if (mergedPackages) {
288
+ mergedWorkspaces.packages = mergedPackages;
289
+ } else {
290
+ delete mergedWorkspaces.packages;
291
+ }
292
+
293
+ const mergedCatalog = mergeStringMaps(localWorkspaces.catalog, templateWorkspaces.catalog);
294
+ if (mergedCatalog) {
295
+ mergedWorkspaces.catalog = mergedCatalog;
296
+ } else {
297
+ delete mergedWorkspaces.catalog;
298
+ }
299
+
300
+ if (Object.keys(mergedWorkspaces).length > 0) {
301
+ merged.workspaces = mergedWorkspaces;
302
+ } else {
303
+ delete merged.workspaces;
304
+ }
192
305
  }
193
306
 
194
307
  return merged;
@@ -228,7 +341,7 @@ function writeSyncedFile(sourceDir: string, projectDir: string, filePath: string
228
341
  if (localContent) {
229
342
  const local = JSON.parse(localContent) as Record<string, unknown>;
230
343
  const template = JSON.parse(templateContent) as Record<string, unknown>;
231
- const merged = mergePackageJson(local, template);
344
+ const merged = mergePackageJson(destPath, local, template);
232
345
  writeFileSync(dest, `${JSON.stringify(merged, null, 2)}\n`);
233
346
  return;
234
347
  }
@@ -355,7 +468,8 @@ export async function syncTemplate(projectDir: string, options: SyncOptions): Pr
355
468
 
356
469
  for (const filePath of filteredFiles) {
357
470
  const destPath = toDestPath(filePath);
358
- if (isExcluded(destPath, excludePatterns)) continue;
471
+ const frameworkOwned = isFrameworkOwnedSyncFile(destPath);
472
+ if (isExcluded(destPath, excludePatterns) && !frameworkOwned) continue;
359
473
 
360
474
  const localHash = computeLocalHash(projectDir, destPath);
361
475
  const sourceContent = readFileSync(join(sourceDir, filePath));
@@ -368,6 +482,11 @@ export async function syncTemplate(projectDir: string, options: SyncOptions): Pr
368
482
 
369
483
  if (localHash === sourceHash) continue;
370
484
 
485
+ if (frameworkOwned) {
486
+ updated.push(destPath);
487
+ continue;
488
+ }
489
+
371
490
  const snapshotHash = snapshot?.files[destPath];
372
491
 
373
492
  if (snapshotHash === undefined) {
@@ -395,7 +514,9 @@ export async function syncTemplate(projectDir: string, options: SyncOptions): Pr
395
514
  };
396
515
  }
397
516
 
398
- const filesToWrite = [...updated, ...added].filter((f) => !isExcluded(f, excludePatterns));
517
+ const filesToWrite = [...updated, ...added].filter(
518
+ (f) => isFrameworkOwnedSyncFile(f) || !isExcluded(f, excludePatterns),
519
+ );
399
520
 
400
521
  const destToSource = new Map<string, string>();
401
522
  for (const filePath of filteredFiles) {