fix(server): sync device tool license versions with installer pins (#18121)
This commit is contained in:
1 parent
cf82199186
commit
bb9b9aae57
7 files changed
+70
-13
No files matched your search
@@ -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);
|
||||
|
||||
@@ -60,6 +60,10 @@ relative to the config file. `bundles` controls which generated manifests includ
|
||||
supplies the label shown to users. Use `includeInBundles` when those differ, such as an optional
|
||||
server 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 incorrect
|
||||
metadata:
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
@@ -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"),
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in new issue
Block a user