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.
- package/dist/app.cjs +7 -96
- package/dist/app.cjs.map +1 -1
- package/dist/app.mjs +8 -97
- package/dist/app.mjs.map +1 -1
- package/dist/cli/framework-version.cjs +35 -0
- package/dist/cli/framework-version.cjs.map +1 -0
- package/dist/cli/framework-version.mjs +34 -0
- package/dist/cli/framework-version.mjs.map +1 -0
- package/dist/cli/init.cjs +14 -3
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.d.cts.map +1 -1
- package/dist/cli/init.d.mts.map +1 -1
- package/dist/cli/init.mjs +14 -3
- package/dist/cli/init.mjs.map +1 -1
- package/dist/cli/status.cjs +2 -9
- package/dist/cli/status.cjs.map +1 -1
- package/dist/cli/status.mjs +2 -9
- package/dist/cli/status.mjs.map +1 -1
- package/dist/cli/sync.cjs +88 -16
- package/dist/cli/sync.cjs.map +1 -1
- package/dist/cli/sync.mjs +88 -16
- package/dist/cli/sync.mjs.map +1 -1
- package/dist/cli/upgrade.cjs +85 -48
- package/dist/cli/upgrade.cjs.map +1 -1
- package/dist/cli/upgrade.mjs +85 -48
- package/dist/cli/upgrade.mjs.map +1 -1
- package/dist/config.cjs +18 -13
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +10 -1
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts +10 -1
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +18 -14
- package/dist/config.mjs.map +1 -1
- package/dist/contract.d.cts +2 -2
- package/dist/contract.d.mts +2 -2
- package/dist/host.cjs +1 -0
- package/dist/host.cjs.map +1 -1
- package/dist/host.d.cts.map +1 -1
- package/dist/host.d.mts.map +1 -1
- package/dist/host.mjs +1 -0
- package/dist/host.mjs.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/internal/manifest-normalizer.cjs +7 -0
- package/dist/internal/manifest-normalizer.cjs.map +1 -1
- package/dist/internal/manifest-normalizer.mjs +7 -0
- package/dist/internal/manifest-normalizer.mjs.map +1 -1
- package/dist/orchestrator.d.cts +1 -1
- package/dist/orchestrator.d.mts +1 -1
- package/dist/plugin.d.cts +1 -1
- package/dist/plugin.d.mts +1 -1
- package/dist/ui/index.cjs +0 -9
- package/dist/ui/index.d.cts +2 -2
- package/dist/ui/index.d.mts +2 -2
- package/dist/ui/index.mjs +2 -2
- package/dist/ui/runtime.cjs +1 -43
- package/dist/ui/runtime.cjs.map +1 -1
- package/dist/ui/runtime.d.cts +1 -16
- package/dist/ui/runtime.d.cts.map +1 -1
- package/dist/ui/runtime.d.mts +1 -16
- package/dist/ui/runtime.d.mts.map +1 -1
- package/dist/ui/runtime.mjs +2 -36
- package/dist/ui/runtime.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app.ts +8 -113
- package/src/cli/framework-version.ts +61 -0
- package/src/cli/init.ts +16 -4
- package/src/cli/status.ts +2 -15
- package/src/cli/sync.ts +145 -24
- package/src/cli/upgrade.ts +94 -72
- package/src/config.ts +51 -14
- package/src/host.ts +1 -0
- package/src/internal/manifest-normalizer.ts +13 -0
- package/src/ui/runtime.ts +1 -48
package/src/cli/upgrade.ts
CHANGED
|
@@ -2,10 +2,30 @@ import { existsSync, readFileSync, rmSync, statSync, writeFileSync } from "node:
|
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { glob } from "glob";
|
|
4
4
|
import type { UpgradeOptions, UpgradeResult } from "../contract";
|
|
5
|
+
import { readInstalledFrameworkVersion } from "./framework-version";
|
|
5
6
|
import { runBunInstall, runTypesGen } from "./init";
|
|
6
7
|
import { syncTemplate } from "./sync";
|
|
7
8
|
|
|
8
9
|
const FRAMEWORK_PACKAGES = ["everything-dev", "every-plugin"];
|
|
10
|
+
const LEGACY_UI_IMPORT_REWRITES = [
|
|
11
|
+
['from "@/auth"', 'from "@/app"'],
|
|
12
|
+
["from '@/auth'", "from '@/app'"],
|
|
13
|
+
['from "@/lib/use-api-client"', 'from "@/app"'],
|
|
14
|
+
["from '@/lib/use-api-client'", "from '@/app'"],
|
|
15
|
+
['from "@/lib/api-client"', 'from "@/app"'],
|
|
16
|
+
["from '@/lib/api-client'", "from '@/app'"],
|
|
17
|
+
] as const;
|
|
18
|
+
const OBSOLETE_FILES = [
|
|
19
|
+
"ui/src/auth.ts",
|
|
20
|
+
"ui/src/auth-types.gen.ts",
|
|
21
|
+
"ui/src/lib/api-client.ts",
|
|
22
|
+
"ui/src/lib/use-api-client.ts",
|
|
23
|
+
"ui/src/api-contract.ts",
|
|
24
|
+
"ui/src/api-contract.gen.ts",
|
|
25
|
+
"ui/src/lib/auth-client.ts",
|
|
26
|
+
"ui/src/lib/session.ts",
|
|
27
|
+
"ui/scripts/generate-metadata.ts",
|
|
28
|
+
];
|
|
9
29
|
|
|
10
30
|
interface NpmPackageInfo {
|
|
11
31
|
version: string;
|
|
@@ -26,95 +46,71 @@ async function fetchLatestNpmVersion(packageName: string): Promise<string | null
|
|
|
26
46
|
}
|
|
27
47
|
|
|
28
48
|
function readInstalledVersion(projectDir: string, packageName: string): string | undefined {
|
|
29
|
-
|
|
30
|
-
if (!existsSync(pkgPath)) return undefined;
|
|
31
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8")) as Record<string, unknown>;
|
|
32
|
-
const deps = (pkg.dependencies ?? {}) as Record<string, string>;
|
|
33
|
-
const devDeps = (pkg.devDependencies ?? {}) as Record<string, string>;
|
|
34
|
-
const version = deps[packageName] || devDeps[packageName];
|
|
35
|
-
if (!version) return undefined;
|
|
36
|
-
return version.replace(/^[\^~>=]+/, "");
|
|
49
|
+
return readInstalledFrameworkVersion(projectDir, packageName);
|
|
37
50
|
}
|
|
38
51
|
|
|
39
|
-
function
|
|
40
|
-
if (!
|
|
41
|
-
if (
|
|
42
|
-
|
|
52
|
+
function setCatalogRef(field: Record<string, string> | undefined, packageName: string): boolean {
|
|
53
|
+
if (!field || !(packageName in field)) return false;
|
|
54
|
+
if (field[packageName] === "catalog:" || field[packageName].startsWith("file:")) return false;
|
|
55
|
+
field[packageName] = "catalog:";
|
|
43
56
|
return true;
|
|
44
57
|
}
|
|
45
58
|
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
newVersion: string,
|
|
50
|
-
): boolean {
|
|
51
|
-
if (!field) return false;
|
|
52
|
-
if (!(packageName in field)) return false;
|
|
53
|
-
const current = field[packageName];
|
|
54
|
-
if (!isBumpedableVersion(current)) return false;
|
|
55
|
-
field[packageName] = `^${newVersion}`;
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
59
|
+
function updateWorkspacePackageRefInFile(filePath: string, packageName: string): boolean {
|
|
60
|
+
const pkg = JSON.parse(readFileSync(filePath, "utf-8")) as Record<string, unknown>;
|
|
61
|
+
let modified = false;
|
|
58
62
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (!(packageName in catalog)) return false;
|
|
66
|
-
const current = catalog[packageName];
|
|
67
|
-
if (!isBumpedableVersion(current)) return false;
|
|
68
|
-
catalog[packageName] = `^${newVersion}`;
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
63
|
+
for (const fieldName of ["dependencies", "devDependencies", "peerDependencies"] as const) {
|
|
64
|
+
const field = pkg[fieldName] as Record<string, string> | undefined;
|
|
65
|
+
if (setCatalogRef(field, packageName)) {
|
|
66
|
+
modified = true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
71
69
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
if (modified) {
|
|
71
|
+
writeFileSync(filePath, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
72
|
+
}
|
|
73
|
+
return modified;
|
|
75
74
|
}
|
|
76
75
|
|
|
77
|
-
function
|
|
78
|
-
|
|
76
|
+
function updateRootPackageVersion(
|
|
77
|
+
projectDir: string,
|
|
79
78
|
packageName: string,
|
|
80
79
|
newVersion: string,
|
|
81
|
-
):
|
|
82
|
-
const
|
|
80
|
+
): boolean {
|
|
81
|
+
const pkgPath = join(projectDir, "package.json");
|
|
82
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8")) as Record<string, unknown>;
|
|
83
|
+
let modified = false;
|
|
83
84
|
|
|
84
85
|
for (const fieldName of ["dependencies", "devDependencies", "peerDependencies"] as const) {
|
|
85
86
|
const field = pkg[fieldName] as Record<string, string> | undefined;
|
|
86
|
-
if (
|
|
87
|
-
|
|
87
|
+
if (setCatalogRef(field, packageName)) {
|
|
88
|
+
modified = true;
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
if (!pkg.workspaces || typeof pkg.workspaces !== "object") {
|
|
93
|
+
pkg.workspaces = { packages: [], catalog: {} };
|
|
94
|
+
modified = true;
|
|
94
95
|
}
|
|
95
96
|
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
const workspaces = pkg.workspaces as { packages?: string[]; catalog?: Record<string, string> };
|
|
98
|
+
if (!workspaces.catalog || typeof workspaces.catalog !== "object") {
|
|
99
|
+
workspaces.catalog = {};
|
|
100
|
+
modified = true;
|
|
101
|
+
}
|
|
98
102
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
): boolean {
|
|
104
|
-
const pkg = JSON.parse(readFileSync(filePath, "utf-8")) as Record<string, unknown>;
|
|
105
|
-
const result = bumpPackageJson(pkg, packageName, newVersion);
|
|
106
|
-
if (result.modified) {
|
|
107
|
-
writeFileSync(filePath, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
103
|
+
const nextVersion = `^${newVersion}`;
|
|
104
|
+
if (workspaces.catalog[packageName] !== nextVersion) {
|
|
105
|
+
workspaces.catalog[packageName] = nextVersion;
|
|
106
|
+
modified = true;
|
|
108
107
|
}
|
|
109
|
-
return result.modified;
|
|
110
|
-
}
|
|
111
108
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return updatePackageVersionInFile(join(projectDir, "package.json"), packageName, newVersion);
|
|
109
|
+
if (modified) {
|
|
110
|
+
writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return modified;
|
|
118
114
|
}
|
|
119
115
|
|
|
120
116
|
async function findWorkspacePackageJsons(projectDir: string): Promise<string[]> {
|
|
@@ -163,6 +159,33 @@ function buildChangelogUrl(
|
|
|
163
159
|
return `https://github.com/${owner}/${repo}/compare/v${oldVersion}...v${newVersion}`;
|
|
164
160
|
}
|
|
165
161
|
|
|
162
|
+
async function rewriteLegacyUiImports(projectDir: string): Promise<string[]> {
|
|
163
|
+
const files = await glob("ui/src/**/*.{ts,tsx}", {
|
|
164
|
+
cwd: projectDir,
|
|
165
|
+
nodir: true,
|
|
166
|
+
dot: false,
|
|
167
|
+
absolute: false,
|
|
168
|
+
});
|
|
169
|
+
const migrated: string[] = [];
|
|
170
|
+
|
|
171
|
+
for (const file of files) {
|
|
172
|
+
const filePath = join(projectDir, file);
|
|
173
|
+
const original = readFileSync(filePath, "utf-8");
|
|
174
|
+
let next = original;
|
|
175
|
+
|
|
176
|
+
for (const [from, to] of LEGACY_UI_IMPORT_REWRITES) {
|
|
177
|
+
next = next.replaceAll(from, to);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (next !== original) {
|
|
181
|
+
writeFileSync(filePath, next);
|
|
182
|
+
migrated.push(file);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return migrated;
|
|
187
|
+
}
|
|
188
|
+
|
|
166
189
|
export async function upgradeTemplate(
|
|
167
190
|
projectDir: string,
|
|
168
191
|
options: UpgradeOptions,
|
|
@@ -217,7 +240,7 @@ export async function upgradeTemplate(
|
|
|
217
240
|
|
|
218
241
|
for (const pkg of packages) {
|
|
219
242
|
if (pkg.from !== undefined && pkg.from !== pkg.to) {
|
|
220
|
-
|
|
243
|
+
updateRootPackageVersion(projectDir, pkg.name, pkg.to);
|
|
221
244
|
}
|
|
222
245
|
}
|
|
223
246
|
|
|
@@ -225,7 +248,7 @@ export async function upgradeTemplate(
|
|
|
225
248
|
for (const pkgPath of workspacePkgPaths) {
|
|
226
249
|
for (const pkg of packages) {
|
|
227
250
|
if (pkg.from !== undefined && pkg.from !== pkg.to) {
|
|
228
|
-
|
|
251
|
+
updateWorkspacePackageRefInFile(pkgPath, pkg.name);
|
|
229
252
|
}
|
|
230
253
|
}
|
|
231
254
|
}
|
|
@@ -244,9 +267,8 @@ export async function upgradeTemplate(
|
|
|
244
267
|
});
|
|
245
268
|
}
|
|
246
269
|
|
|
247
|
-
const migratedFiles
|
|
248
|
-
const
|
|
249
|
-
for (const file of obsoleteFiles) {
|
|
270
|
+
const migratedFiles = await rewriteLegacyUiImports(projectDir);
|
|
271
|
+
for (const file of OBSOLETE_FILES) {
|
|
250
272
|
const filePath = join(projectDir, file);
|
|
251
273
|
if (existsSync(filePath)) {
|
|
252
274
|
rmSync(filePath);
|
package/src/config.ts
CHANGED
|
@@ -126,7 +126,11 @@ function resolveDevelopmentTarget(
|
|
|
126
126
|
development: string | undefined,
|
|
127
127
|
production: string | undefined,
|
|
128
128
|
baseDir: string,
|
|
129
|
+
forceSource?: "local" | "remote",
|
|
129
130
|
): RuntimeTarget {
|
|
131
|
+
if (forceSource === "remote") {
|
|
132
|
+
return resolveRuntimeTarget(production, baseDir, "remote");
|
|
133
|
+
}
|
|
130
134
|
const devTarget = resolveRuntimeTarget(development, baseDir);
|
|
131
135
|
if (devTarget.source === "local" && (!devTarget.localPath || !existsSync(devTarget.localPath))) {
|
|
132
136
|
return resolveRuntimeTarget(production, baseDir, "remote");
|
|
@@ -134,37 +138,70 @@ function resolveDevelopmentTarget(
|
|
|
134
138
|
return devTarget;
|
|
135
139
|
}
|
|
136
140
|
|
|
137
|
-
|
|
141
|
+
export interface BuildRuntimeConfigOptions {
|
|
142
|
+
plugins?: Record<string, RuntimePluginConfig>;
|
|
143
|
+
hostSource?: "local" | "remote";
|
|
144
|
+
uiSource?: "local" | "remote";
|
|
145
|
+
apiSource?: "local" | "remote";
|
|
146
|
+
authSource?: "local" | "remote";
|
|
147
|
+
proxy?: string;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export function buildRuntimeConfig(
|
|
138
151
|
config: BosConfig,
|
|
139
152
|
baseDir: string,
|
|
140
153
|
env: "development" | "production",
|
|
141
|
-
options?:
|
|
154
|
+
options?: BuildRuntimeConfigOptions,
|
|
142
155
|
): RuntimeConfig {
|
|
143
156
|
const uiConfig = config.app.ui;
|
|
144
157
|
const apiConfig = config.app.api;
|
|
145
158
|
const authConfig = config.app.auth;
|
|
146
159
|
const uiRuntime =
|
|
147
160
|
env === "development"
|
|
148
|
-
? resolveDevelopmentTarget(
|
|
161
|
+
? resolveDevelopmentTarget(
|
|
162
|
+
uiConfig.development,
|
|
163
|
+
uiConfig.production,
|
|
164
|
+
baseDir,
|
|
165
|
+
options?.uiSource,
|
|
166
|
+
)
|
|
149
167
|
: resolveRuntimeTarget(uiConfig.production, baseDir, "remote");
|
|
150
168
|
const apiRuntime =
|
|
151
169
|
env === "development"
|
|
152
|
-
? resolveDevelopmentTarget(
|
|
170
|
+
? resolveDevelopmentTarget(
|
|
171
|
+
apiConfig.development,
|
|
172
|
+
apiConfig.production,
|
|
173
|
+
baseDir,
|
|
174
|
+
options?.apiSource,
|
|
175
|
+
)
|
|
153
176
|
: resolveRuntimeTarget(apiConfig.production, baseDir, "remote");
|
|
154
177
|
const authRuntime = authConfig
|
|
155
178
|
? env === "development"
|
|
156
|
-
? resolveDevelopmentTarget(
|
|
179
|
+
? resolveDevelopmentTarget(
|
|
180
|
+
authConfig.development,
|
|
181
|
+
authConfig.production,
|
|
182
|
+
baseDir,
|
|
183
|
+
options?.authSource,
|
|
184
|
+
)
|
|
157
185
|
: resolveRuntimeTarget(authConfig.production, baseDir, "remote")
|
|
158
186
|
: undefined;
|
|
159
187
|
|
|
160
188
|
const hostConfig = config.app.host;
|
|
161
189
|
const hostRuntime =
|
|
162
190
|
env === "development"
|
|
163
|
-
? resolveDevelopmentTarget(
|
|
191
|
+
? resolveDevelopmentTarget(
|
|
192
|
+
hostConfig.development,
|
|
193
|
+
hostConfig.production,
|
|
194
|
+
baseDir,
|
|
195
|
+
options?.hostSource,
|
|
196
|
+
)
|
|
164
197
|
: resolveRuntimeTarget(hostConfig.production, baseDir, "remote");
|
|
165
198
|
|
|
166
199
|
const hostListeningUrl = resolveDevelopmentHostUrl(hostConfig.development);
|
|
167
200
|
|
|
201
|
+
const hostIsRemote = hostRuntime.source === "remote";
|
|
202
|
+
const uiIsRemote = uiRuntime.source === "remote";
|
|
203
|
+
const apiIsRemote = apiRuntime.source === "remote";
|
|
204
|
+
|
|
168
205
|
return {
|
|
169
206
|
env,
|
|
170
207
|
account: config.account,
|
|
@@ -178,9 +215,9 @@ function buildRuntimeConfig(
|
|
|
178
215
|
localPath: hostRuntime.localPath,
|
|
179
216
|
port: hostRuntime.port ?? DEFAULT_HOST_PORT,
|
|
180
217
|
secrets: hostConfig.secrets,
|
|
181
|
-
integrity:
|
|
218
|
+
integrity: hostIsRemote ? hostConfig.integrity : undefined,
|
|
182
219
|
source: hostRuntime.source,
|
|
183
|
-
remoteUrl:
|
|
220
|
+
remoteUrl: hostIsRemote ? hostRuntime.url : undefined,
|
|
184
221
|
},
|
|
185
222
|
shared: config.shared,
|
|
186
223
|
ui: {
|
|
@@ -189,9 +226,9 @@ function buildRuntimeConfig(
|
|
|
189
226
|
entry: uiRuntime.url ? `${uiRuntime.url}/mf-manifest.json` : "/mf-manifest.json",
|
|
190
227
|
localPath: uiRuntime.localPath,
|
|
191
228
|
port: uiRuntime.port,
|
|
192
|
-
ssrUrl: uiConfig.ssr,
|
|
193
|
-
ssrIntegrity:
|
|
194
|
-
integrity:
|
|
229
|
+
ssrUrl: uiIsRemote ? uiConfig.ssr : undefined,
|
|
230
|
+
ssrIntegrity: uiIsRemote ? uiConfig.ssrIntegrity : undefined,
|
|
231
|
+
integrity: uiIsRemote ? uiConfig.integrity : undefined,
|
|
195
232
|
source: uiRuntime.source,
|
|
196
233
|
},
|
|
197
234
|
api: {
|
|
@@ -201,10 +238,10 @@ function buildRuntimeConfig(
|
|
|
201
238
|
localPath: apiRuntime.localPath,
|
|
202
239
|
port: apiRuntime.port,
|
|
203
240
|
source: apiRuntime.source,
|
|
204
|
-
proxy: apiConfig.proxy,
|
|
241
|
+
proxy: options?.proxy ?? apiConfig.proxy,
|
|
205
242
|
variables: apiConfig.variables,
|
|
206
243
|
secrets: apiConfig.secrets,
|
|
207
|
-
integrity:
|
|
244
|
+
integrity: apiIsRemote ? apiConfig.integrity : undefined,
|
|
208
245
|
},
|
|
209
246
|
auth: authConfig
|
|
210
247
|
? {
|
|
@@ -217,7 +254,7 @@ function buildRuntimeConfig(
|
|
|
217
254
|
proxy: authConfig.proxy,
|
|
218
255
|
variables: authConfig.variables,
|
|
219
256
|
secrets: authConfig.secrets,
|
|
220
|
-
integrity:
|
|
257
|
+
integrity: authRuntime!.source === "remote" ? authConfig.integrity : undefined,
|
|
221
258
|
}
|
|
222
259
|
: undefined,
|
|
223
260
|
plugins:
|
package/src/host.ts
CHANGED
|
@@ -37,6 +37,7 @@ function buildClientRuntimeConfig(runtimeConfig: RuntimeConfig): ClientRuntimeCo
|
|
|
37
37
|
apiBase: "/api",
|
|
38
38
|
rpcBase: "/api/rpc",
|
|
39
39
|
authAvailable: !!runtimeConfig.auth,
|
|
40
|
+
repository: runtimeConfig.repository,
|
|
40
41
|
ui: runtimeConfig.ui
|
|
41
42
|
? {
|
|
42
43
|
name: runtimeConfig.ui.name,
|
|
@@ -13,6 +13,7 @@ type NormalizationSpec = {
|
|
|
13
13
|
|
|
14
14
|
type NormalizeManifestOptions = {
|
|
15
15
|
resolveCatalogRefs: boolean;
|
|
16
|
+
preserveCatalogRefs?: boolean;
|
|
16
17
|
excludeFrameworkWorkspaces?: boolean;
|
|
17
18
|
removeWorkspaceDeps?: string[];
|
|
18
19
|
removeWorkspaces?: boolean;
|
|
@@ -74,6 +75,17 @@ function normalizeDependencyMap(
|
|
|
74
75
|
let modified = false;
|
|
75
76
|
|
|
76
77
|
for (const [name, version] of Object.entries(map)) {
|
|
78
|
+
if (
|
|
79
|
+
options.preserveCatalogRefs &&
|
|
80
|
+
FRAMEWORK_PACKAGES.includes(name as (typeof FRAMEWORK_PACKAGES)[number])
|
|
81
|
+
) {
|
|
82
|
+
if (version !== "catalog:") {
|
|
83
|
+
map[name] = "catalog:";
|
|
84
|
+
modified = true;
|
|
85
|
+
}
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
|
|
77
89
|
if (version === "workspace:*") {
|
|
78
90
|
const frameworkVersion = spec.frameworkVersions[name];
|
|
79
91
|
if (frameworkVersion) {
|
|
@@ -237,6 +249,7 @@ export function stageReleasePackage(opts: {
|
|
|
237
249
|
|
|
238
250
|
normalizePackageManifest(pkg, spec, {
|
|
239
251
|
resolveCatalogRefs: true,
|
|
252
|
+
preserveCatalogRefs: false,
|
|
240
253
|
removeWorkspaces: true,
|
|
241
254
|
removePublishScripts: true,
|
|
242
255
|
});
|
package/src/ui/runtime.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getNetworkIdForAccount } from "../network";
|
|
2
1
|
import type { ClientRuntimeConfig } from "../types";
|
|
3
2
|
|
|
4
3
|
export type { ClientRuntimeInfo } from "../types";
|
|
@@ -21,16 +20,8 @@ export function getRuntimeConfig(): ClientRuntimeConfig {
|
|
|
21
20
|
return window.__RUNTIME_CONFIG__;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
|
-
export function getActiveRuntime(runtimeConfig?: Partial<ClientRuntimeConfig>) {
|
|
25
|
-
return runtimeConfig?.runtime;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function getRuntimeBasePath(runtimeConfig?: Partial<ClientRuntimeConfig>) {
|
|
29
|
-
return getActiveRuntime(runtimeConfig)?.runtimeBasePath || "/";
|
|
30
|
-
}
|
|
31
|
-
|
|
32
23
|
export function buildRuntimeHref(pathname: string, runtimeConfig?: Partial<ClientRuntimeConfig>) {
|
|
33
|
-
const basePath =
|
|
24
|
+
const basePath = runtimeConfig?.runtime?.runtimeBasePath ?? "/";
|
|
34
25
|
if (basePath === "/") {
|
|
35
26
|
return pathname;
|
|
36
27
|
}
|
|
@@ -49,41 +40,3 @@ export function buildPublishedAccountHref(accountId: string) {
|
|
|
49
40
|
export function buildPublishedGatewayHref(accountId: string, gatewayId: string) {
|
|
50
41
|
return `${buildPublishedAccountHref(accountId)}/${encodeURIComponent(gatewayId)}`;
|
|
51
42
|
}
|
|
52
|
-
|
|
53
|
-
export function getAssetsUrl(config?: Partial<ClientRuntimeConfig>): string {
|
|
54
|
-
const cfg = config ?? getRuntimeConfig();
|
|
55
|
-
return cfg?.assetsUrl ?? "";
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export function getHostUrl(config?: Partial<ClientRuntimeConfig>): string {
|
|
59
|
-
const cfg = config ?? getRuntimeConfig();
|
|
60
|
-
if (typeof window === "undefined") return "";
|
|
61
|
-
return cfg?.hostUrl ?? window.location.origin;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export function getApiBaseUrl(config?: Partial<ClientRuntimeConfig>): string {
|
|
65
|
-
const cfg = config ?? getRuntimeConfig();
|
|
66
|
-
const base = cfg?.rpcBase;
|
|
67
|
-
if (typeof window === "undefined") return "/api/rpc";
|
|
68
|
-
return base ? `${window.location.origin}${base}` : `${window.location.origin}/api/rpc`;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export function getAccount(config?: Partial<ClientRuntimeConfig>): string {
|
|
72
|
-
const cfg = config ?? getRuntimeConfig();
|
|
73
|
-
return cfg?.account ?? "every.near";
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export function getNetworkId(config?: Partial<ClientRuntimeConfig>): "mainnet" | "testnet" {
|
|
77
|
-
const cfg = config ?? getRuntimeConfig();
|
|
78
|
-
return cfg?.networkId ?? getNetworkIdForAccount(cfg?.account ?? "every.near");
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export function getRepository(config?: Partial<ClientRuntimeConfig>): string | undefined {
|
|
82
|
-
const cfg = config ?? getRuntimeConfig();
|
|
83
|
-
return cfg?.repository;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export function getCspNonce(config?: Partial<ClientRuntimeConfig>): string | undefined {
|
|
87
|
-
const cfg = config ?? getRuntimeConfig();
|
|
88
|
-
return cfg?.cspNonce;
|
|
89
|
-
}
|