Skip to content

Commit f32934a

Browse files
chore(cli): scope tagged-version diagnostics and drop node:url
Use import.meta.dirname instead of node:url, keep the server config's line-scoped nodeBuiltinImport suppression instead of a file-wide one, and drop a test assertion that cannot fail. AI-assisted; verified with the tests and tools listed above. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 8e84a06 commit f32934a

4 files changed

Lines changed: 8 additions & 12 deletions

File tree

‎apps/server/vite.config.ts‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
// @effect-diagnostics nodeBuiltinImport:off - Build configuration normalizes manifest paths before an Effect runtime exists.
21
import "vite-plus/test/config";
2+
// @effect-diagnostics-next-line nodeBuiltinImport:off -- tsdown needs the asset path when it reads this config.
33
import * as NodePath from "node:path";
44
import { defineConfig, mergeConfig } from "vite-plus";
5-
import * as NodeURL from "node:url";
65

76
import baseConfig from "../../vite.config.ts";
87
import { loadRepoEnv } from "../../scripts/lib/public-config.ts";
@@ -20,9 +19,9 @@ import {
2019
export { shouldBundleCliDependency };
2120

2221
const repoEnv = loadRepoEnv();
23-
const serverManifestPath = NodeURL.fileURLToPath(new URL("./package.json", import.meta.url));
22+
const serverManifestPath = NodePath.join(import.meta.dirname, "package.json");
2423
const buildVersion = resolveTaggedSourceVersion(
25-
NodeURL.fileURLToPath(new URL("../../", import.meta.url)),
24+
NodePath.join(import.meta.dirname, "../.."),
2625
packageJson.version,
2726
);
2827
const cliBuildChannel = /^[^-+]+-(?:nightly|preview)\./.test(buildVersion) ? "nightly" : "latest";

‎apps/web/vite.config.ts‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// @effect-diagnostics-next-line nodeBuiltinImport:off -- Vite config runs before any Effect runtime.
22
import * as NodeFSP from "node:fs/promises";
3-
import * as NodeURL from "node:url";
43
import * as NodeZlib from "node:zlib";
54

65
import react from "@vitejs/plugin-react";
@@ -49,11 +48,10 @@ const configuredReleaseChannel =
4948
process.env.T3CODE_BUILT_DEV === "1" ? "dev" : process.env.VITE_RELEASE_CHANNEL?.trim() || "";
5049
const configuredAppVersion =
5150
process.env.APP_VERSION?.trim() ||
52-
resolveTaggedSourceVersion(
53-
NodeURL.fileURLToPath(new URL("../../", import.meta.url)),
54-
pkg.version,
55-
["apps/server/package.json", "apps/web/package.json"],
56-
);
51+
resolveTaggedSourceVersion(`${import.meta.dirname}/../..`, pkg.version, [
52+
"apps/server/package.json",
53+
"apps/web/package.json",
54+
]);
5755
const configuredDesktopUpdateRepository =
5856
process.env.T3CODE_DESKTOP_UPDATE_REPOSITORY?.trim() ||
5957
process.env.GITHUB_REPOSITORY?.trim() ||

‎scripts/lib/tagged-source-version.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ it("uses the exact stable tag, preserving release overrides and untagged builds"
3333
git("tag", "-a", "v0.1.6", "-m", "release");
3434

3535
expect(resolveTaggedSourceVersion(root, "0.1.5")).toBe("0.1.6");
36-
expect(JSON.parse(NodeFS.readFileSync(manifest, "utf8")).version).toBe("0.1.5");
3736
expect(resolveTaggedSourceVersion(root, "0.1.5", webManifestPaths)).toBe("0.1.6");
3837

3938
NodeFS.writeFileSync(webManifest, JSON.stringify({ version: "0.1.7-preview.1" }));

‎scripts/lib/tagged-source-version.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @effect-diagnostics nodeBuiltinImport:off - Build configuration resolves tags before an Effect runtime exists.
1+
// @effect-diagnostics-next-line nodeBuiltinImport:off -- Build configs resolve tags before an Effect runtime exists.
22
import * as NodeChildProcess from "node:child_process";
33

44
export function resolveTaggedSourceVersion(

0 commit comments

Comments
 (0)