TypeScript
fix(server): sync device tool license versions with installer pins (#18121)
Yash Singhbb9b9aae57ce
diff --git a/apps/server/src/device/DeviceToolchain.ts b/apps/server/src/device/DeviceToolchain.tsindex e302a452433..132fbcebdb1 100644--- a/apps/server/src/device/DeviceToolchain.ts+++ b/apps/server/src/device/DeviceToolchain.ts@@ -1,4 +1,5 @@import type { DeviceToolVersions } from "@t3tools/contracts";+import { DEVICE_TOOL_VERSIONS } from "@t3tools/shared/deviceToolVersions";/*** Pinned installs of the two external tools device support is built on.*@@ -26,9 +27,9 @@ import * as Semaphore from "effect/Semaphore";import * as ProcessRunner from "../processRunner.ts";const DEVICE_HUB_PACKAGE = "expo-device-hub";-export const DEVICE_HUB_VERSION = "0.15.3";+export const DEVICE_HUB_VERSION = DEVICE_TOOL_VERSIONS[DEVICE_HUB_PACKAGE];const AGENT_DEVICE_PACKAGE = "agent-device";-export const AGENT_DEVICE_VERSION = "0.21.24";+export const AGENT_DEVICE_VERSION = DEVICE_TOOL_VERSIONS[AGENT_DEVICE_PACKAGE];const INSTALL_TIMEOUT = Duration.minutes(10);const installLock = Semaphore.makeUnsafe(1);diff --git a/docs/internals/open-source-licenses.md b/docs/internals/open-source-licenses.mdindex 8bac6010bfa..904c9be4471 100644--- a/docs/internals/open-source-licenses.md+++ b/docs/internals/open-source-licenses.md@@ -60,6 +60,10 @@ relative to the config file. `bundles` controls which generated manifests includsupplies the label shown to users. Use `includeInBundles` when those differ, such as an optionalserver tool that should appear in both client manifests but is not bundled into either client.+The `agent-device` and `expo-device-hub` custom notices take their versions from the+[shared installer pins](../../packages/shared/src/deviceToolVersions.ts). Keep their package names+in the config; their versions do not need manual updates.+Use `packageOverrides` only when an installed npm archive omits its notice or has incorrectmetadata:diff --git a/packages/shared/package.json b/packages/shared/package.jsonindex 4ccc2b69102..7b750e7a3c5 100644--- a/packages/shared/package.json+++ b/packages/shared/package.json@@ -359,6 +359,10 @@"types": "./src/thirdPartyLicenses.ts","import": "./src/thirdPartyLicenses.ts"},+ "./deviceToolVersions": {+ "types": "./src/deviceToolVersions.ts",+ "import": "./src/deviceToolVersions.ts"+ },"./claudeCompaction": {"types": "./src/claudeCompaction.ts","import": "./src/claudeCompaction.ts"diff --git a/packages/shared/src/deviceToolVersions.ts b/packages/shared/src/deviceToolVersions.tsnew file mode 100644index 00000000000..12a7071831d--- /dev/null+++ b/packages/shared/src/deviceToolVersions.ts@@ -0,0 +1,5 @@+// The installer and third-party notices share these pins for tools installed outside the workspace.+export const DEVICE_TOOL_VERSIONS = {+ "agent-device": "0.21.24",+ "expo-device-hub": "0.15.3",+} as const;diff --git a/scripts/lib/third-party-licenses.test.ts b/scripts/lib/third-party-licenses.test.tsindex e1607ebc6eb..638dd60e15d 100644--- a/scripts/lib/third-party-licenses.test.ts+++ b/scripts/lib/third-party-licenses.test.ts@@ -5,6 +5,7 @@ import * as NodeOS from "node:os";import * as NodePath from "node:path";import * as NodeURL from "node:url";+import { DEVICE_TOOL_VERSIONS } from "@t3tools/shared/deviceToolVersions";import { afterEach, describe, expect, it } from "vite-plus/test";import {@@ -77,6 +78,56 @@ afterEach(async () => {});describe("third-party license generation", () => {+ it.each(["web", "mobile"])(+ "uses installer pins for device tool notices in the %s manifest",+ async (bundle) => {+ const fixture = await createFixture();+ await writeJson(fixture.configFile, {+ customNotices: [+ {+ name: "agent-device",+ license: "MIT",+ noticeFile: "asset-notice.txt",+ bundles: ["device-tools"],+ includeInBundles: ["web", "mobile"],+ },+ {+ name: "expo-device-hub",+ license: "MIT",+ noticeFile: "asset-notice.txt",+ version: "0.0.0",+ bundles: ["device-tools"],+ includeInBundles: ["web", "mobile"],+ },+ {+ name: "vendored-asset",+ license: "MIT",+ noticeFile: "asset-notice.txt",+ version: "1.2.3",+ bundles: ["web", "mobile"],+ },+ ],+ });++ const manifest = await generateThirdPartyLicenseManifest({+ configFile: fixture.configFile,+ packageManifests: [{ bundle, path: fixture.appManifest }],+ });++ expect(manifest.entries.find((entry) => entry.name === "agent-device")).toMatchObject({+ version: DEVICE_TOOL_VERSIONS["agent-device"],+ bundles: ["device-tools"],+ });+ expect(manifest.entries.find((entry) => entry.name === "expo-device-hub")).toMatchObject({+ version: DEVICE_TOOL_VERSIONS["expo-device-hub"],+ bundles: ["device-tools"],+ });+ expect(manifest.entries.find((entry) => entry.name === "vendored-asset")?.version).toBe(+ "1.2.3",+ );+ },+ );+it("keeps the GhosttyKit notice pinned to the vendored framework revision", async () => {const [config, revision] = await Promise.all([NodeFSP.readFile(NodePath.join(REPOSITORY_ROOT, "third-party-licenses.config.json"), "utf8"),diff --git a/scripts/lib/third-party-licenses.ts b/scripts/lib/third-party-licenses.tsindex c1a5199f41b..124f16a3ce4 100644--- a/scripts/lib/third-party-licenses.ts+++ b/scripts/lib/third-party-licenses.ts@@ -5,12 +5,14 @@ import * as NodePath from "node:path";import * as NodeURL from "node:url";import * as NodeModule from "node:module";+import { DEVICE_TOOL_VERSIONS } from "@t3tools/shared/deviceToolVersions";import type { Plugin } from "vite-plus";export const THIRD_PARTY_LICENSES_FILE_NAME = "third-party-licenses.json";const SPDX_LICENSE_LIST_VERSION = "v3.28.0";const SPDX_LICENSE_LIST_REVISION = "c4a7237ec8f4654e867546f9f409749300f1bf4c";const GENERATED_NOTICE_CACHE_DIRECTORY = ".generated/third-party-licenses/spdx";+const DEVICE_TOOL_NOTICE_VERSIONS = new Map(Object.entries(DEVICE_TOOL_VERSIONS));export interface ThirdPartyLicenseEntry {readonly bundles: ReadonlyArray<string>;@@ -868,7 +870,7 @@ async function customEntries(name: notice.name,noticeText,sourceUrl: notice.sourceUrl ?? null,- version: notice.version ?? null,+ version: DEVICE_TOOL_NOTICE_VERSIONS.get(notice.name) ?? notice.version ?? null,};}),);diff --git a/third-party-licenses.config.json b/third-party-licenses.config.jsonindex 9102be3af27..a2eb54574ff 100644--- a/third-party-licenses.config.json+++ b/third-party-licenses.config.json@@ -62,7 +62,6 @@"license": "MIT","name": "agent-device","sourceUrl": "https://github.com/callstack/agent-device",- "version": "0.21.7","generatedNotices": [{"licenseId": "MIT",@@ -76,7 +75,6 @@"license": "MIT AND Apache-2.0 AND BSD-3-Clause","name": "expo-device-hub","sourceUrl": "https://github.com/expo/expo-device-hub",- "version": "0.10.1","generatedNotices": [{"licenseId": "MIT",@@ -174,14 +172,6 @@"copyrights": ["Copyright 2021-2024 The Connect Authors"]}},- {- "name": "@connectrpc/connect-node",- "version": "1.7.0",- "generatedNotice": {- "licenseId": "Apache-2.0",- "copyrights": ["Copyright 2021-2024 The Connect Authors"]- }- },{"name": "@connectrpc/connect-web","version": "1.7.0",