everything-dev 1.12.1 → 1.12.3
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/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/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/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/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/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/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
|
-
}
|