Skip to content

Commit c9d53f1

Browse files
committed
fix(server): sync device tool license versions with installer pins
1 parent 8dfee38 commit c9d53f1

7 files changed

Lines changed: 70 additions & 13 deletions

File tree

‎apps/server/src/device/DeviceToolchain.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { DeviceToolVersions } from "@t3tools/contracts";
2+
import { DEVICE_TOOL_VERSIONS } from "@t3tools/shared/deviceToolVersions";
23
/**
34
* Pinned installs of the two external tools device support is built on.
45
*
@@ -26,9 +27,9 @@ import * as Semaphore from "effect/Semaphore";
2627
import * as ProcessRunner from "../processRunner.ts";
2728

2829
const DEVICE_HUB_PACKAGE = "expo-device-hub";
29-
export const DEVICE_HUB_VERSION = "0.15.3";
30+
export const DEVICE_HUB_VERSION = DEVICE_TOOL_VERSIONS[DEVICE_HUB_PACKAGE];
3031
const AGENT_DEVICE_PACKAGE = "agent-device";
31-
export const AGENT_DEVICE_VERSION = "0.21.24";
32+
export const AGENT_DEVICE_VERSION = DEVICE_TOOL_VERSIONS[AGENT_DEVICE_PACKAGE];
3233

3334
const INSTALL_TIMEOUT = Duration.minutes(10);
3435
const installLock = Semaphore.makeUnsafe(1);

‎docs/internals/open-source-licenses.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ relative to the config file. `bundles` controls which generated manifests includ
6060
supplies the label shown to users. Use `includeInBundles` when those differ, such as an optional
6161
server tool that should appear in both client manifests but is not bundled into either client.
6262

63+
The `agent-device` and `expo-device-hub` custom notices take their versions from the
64+
[shared installer pins](../../packages/shared/src/deviceToolVersions.ts). Keep their package names
65+
in the config; their versions do not need manual updates.
66+
6367
Use `packageOverrides` only when an installed npm archive omits its notice or has incorrect
6468
metadata:
6569

‎packages/shared/package.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,10 @@
359359
"types": "./src/thirdPartyLicenses.ts",
360360
"import": "./src/thirdPartyLicenses.ts"
361361
},
362+
"./deviceToolVersions": {
363+
"types": "./src/deviceToolVersions.ts",
364+
"import": "./src/deviceToolVersions.ts"
365+
},
362366
"./claudeCompaction": {
363367
"types": "./src/claudeCompaction.ts",
364368
"import": "./src/claudeCompaction.ts"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// The installer and third-party notices share these pins for tools installed outside the workspace.
2+
export const DEVICE_TOOL_VERSIONS = {
3+
"agent-device": "0.21.24",
4+
"expo-device-hub": "0.15.3",
5+
} as const;

‎scripts/lib/third-party-licenses.test.ts‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as NodeOS from "node:os";
55
import * as NodePath from "node:path";
66
import * as NodeURL from "node:url";
77

8+
import { DEVICE_TOOL_VERSIONS } from "@t3tools/shared/deviceToolVersions";
89
import { afterEach, describe, expect, it } from "vite-plus/test";
910

1011
import {
@@ -77,6 +78,56 @@ afterEach(async () => {
7778
});
7879

7980
describe("third-party license generation", () => {
81+
it.each(["web", "mobile"])(
82+
"uses installer pins for device tool notices in the %s manifest",
83+
async (bundle) => {
84+
const fixture = await createFixture();
85+
await writeJson(fixture.configFile, {
86+
customNotices: [
87+
{
88+
name: "agent-device",
89+
license: "MIT",
90+
noticeFile: "asset-notice.txt",
91+
bundles: ["device-tools"],
92+
includeInBundles: ["web", "mobile"],
93+
},
94+
{
95+
name: "expo-device-hub",
96+
license: "MIT",
97+
noticeFile: "asset-notice.txt",
98+
version: "0.0.0",
99+
bundles: ["device-tools"],
100+
includeInBundles: ["web", "mobile"],
101+
},
102+
{
103+
name: "vendored-asset",
104+
license: "MIT",
105+
noticeFile: "asset-notice.txt",
106+
version: "1.2.3",
107+
bundles: ["web", "mobile"],
108+
},
109+
],
110+
});
111+
112+
const manifest = await generateThirdPartyLicenseManifest({
113+
configFile: fixture.configFile,
114+
packageManifests: [{ bundle, path: fixture.appManifest }],
115+
});
116+
117+
expect(manifest.entries.find((entry) => entry.name === "agent-device")).toMatchObject({
118+
version: DEVICE_TOOL_VERSIONS["agent-device"],
119+
bundles: ["device-tools"],
120+
});
121+
expect(manifest.entries.find((entry) => entry.name === "expo-device-hub")).toMatchObject({
122+
version: DEVICE_TOOL_VERSIONS["expo-device-hub"],
123+
bundles: ["device-tools"],
124+
});
125+
expect(manifest.entries.find((entry) => entry.name === "vendored-asset")?.version).toBe(
126+
"1.2.3",
127+
);
128+
},
129+
);
130+
80131
it("keeps the GhosttyKit notice pinned to the vendored framework revision", async () => {
81132
const [config, revision] = await Promise.all([
82133
NodeFSP.readFile(NodePath.join(REPOSITORY_ROOT, "third-party-licenses.config.json"), "utf8"),

‎scripts/lib/third-party-licenses.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ import * as NodePath from "node:path";
55
import * as NodeURL from "node:url";
66
import * as NodeModule from "node:module";
77

8+
import { DEVICE_TOOL_VERSIONS } from "@t3tools/shared/deviceToolVersions";
89
import type { Plugin } from "vite-plus";
910

1011
export const THIRD_PARTY_LICENSES_FILE_NAME = "third-party-licenses.json";
1112
const SPDX_LICENSE_LIST_VERSION = "v3.28.0";
1213
const SPDX_LICENSE_LIST_REVISION = "c4a7237ec8f4654e867546f9f409749300f1bf4c";
1314
const GENERATED_NOTICE_CACHE_DIRECTORY = ".generated/third-party-licenses/spdx";
15+
const DEVICE_TOOL_NOTICE_VERSIONS = new Map(Object.entries(DEVICE_TOOL_VERSIONS));
1416

1517
export interface ThirdPartyLicenseEntry {
1618
readonly bundles: ReadonlyArray<string>;
@@ -868,7 +870,7 @@ async function customEntries(
868870
name: notice.name,
869871
noticeText,
870872
sourceUrl: notice.sourceUrl ?? null,
871-
version: notice.version ?? null,
873+
version: DEVICE_TOOL_NOTICE_VERSIONS.get(notice.name) ?? notice.version ?? null,
872874
};
873875
}),
874876
);

‎third-party-licenses.config.json‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
"license": "MIT",
6363
"name": "agent-device",
6464
"sourceUrl": "https://github.com/callstack/agent-device",
65-
"version": "0.21.7",
6665
"generatedNotices": [
6766
{
6867
"licenseId": "MIT",
@@ -76,7 +75,6 @@
7675
"license": "MIT AND Apache-2.0 AND BSD-3-Clause",
7776
"name": "expo-device-hub",
7877
"sourceUrl": "https://github.com/expo/expo-device-hub",
79-
"version": "0.10.1",
8078
"generatedNotices": [
8179
{
8280
"licenseId": "MIT",
@@ -174,14 +172,6 @@
174172
"copyrights": ["Copyright 2021-2024 The Connect Authors"]
175173
}
176174
},
177-
{
178-
"name": "@connectrpc/connect-node",
179-
"version": "1.7.0",
180-
"generatedNotice": {
181-
"licenseId": "Apache-2.0",
182-
"copyrights": ["Copyright 2021-2024 The Connect Authors"]
183-
}
184-
},
185175
{
186176
"name": "@connectrpc/connect-web",
187177
"version": "1.7.0",

0 commit comments

Comments
 (0)