Skip to content

Chrome DevTools for coding agents

build: fix bundled packages metadata (#2538)

Alex Rudenko084772f14cf0
diff --git a/rollup.config.js b/rollup.config.js
index 78a9cb0c..2a9e7e6d 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -20,6 +20,7 @@
* and modified to specific requirement.
*/
+import {execSync} from 'node:child_process';
import fs from 'node:fs';
import path from 'node:path';
@@ -59,6 +60,17 @@ function getResolvedVersion(packageName) {
return packageEntry?.version || null;
}
+function getDevToolsFrontendCommit() {
+ try {
+ return execSync('git rev-parse HEAD', {
+ cwd: path.join(process.cwd(), 'devtools-frontend'),
+ encoding: 'utf-8',
+ }).trim();
+ } catch {
+ return null;
+ }
+}
+
const aggregatedStats = {
bundlesProcessed: 0,
totalBundles: 0,
@@ -116,7 +128,6 @@ function listBundledDeps() {
for (const [name, versionRange] of Object.entries(devDependencies)) {
if (
aggregatedStats.bundledPackages.has(name) ||
- name === 'chrome-devtools-frontend' ||
name === 'lighthouse'
) {
const resolvedVersion = getResolvedVersion(name);
@@ -124,6 +135,13 @@ function listBundledDeps() {
}
}
+ const devtoolsFrontendCommit = getDevToolsFrontendCommit();
+ if (devtoolsFrontendCommit) {
+ bundledDevDeps[
+ 'https://github.com/ChromeDevTools/devtools-frontend'
+ ] = devtoolsFrontendCommit;
+ }
+
fs.writeFileSync(outputPath, JSON.stringify(bundledDevDeps, null, 2));
}
},
@@ -211,17 +229,23 @@ const bundleDependency = (
'devtools-frontend/LICENSE',
);
if (fs.existsSync(cdtfLicensePath)) {
- manualLicenses.push(
- [
- 'Name: chrome-devtools-frontend',
- 'License: Apache-2.0',
- '',
- fs.readFileSync(cdtfLicensePath, 'utf-8'),
- ].join('\n'),
+ const devtoolsFrontendCommit = getDevToolsFrontendCommit();
+ const licenseLines = [
+ 'Name: devtools-frontend',
+ 'URL: https://github.com/ChromeDevTools/devtools-frontend',
+ ];
+ if (devtoolsFrontendCommit) {
+ licenseLines.push(`Version: ${devtoolsFrontendCommit}`);
+ }
+ licenseLines.push(
+ 'License: Apache-2.0',
+ '',
+ fs.readFileSync(cdtfLicensePath, 'utf-8'),
);
+ manualLicenses.push(licenseLines.join('\n'));
}
- // Add chrome-devtools-frontend main license
+ // Add lighthouse main license
const lighthouseLicensePath = path.join(
process.cwd(),
'node_modules/lighthouse/LICENSE',
diff --git a/tests/third_party_notices.test.js.snapshot b/tests/third_party_notices.test.js.snapshot
index 0baa3d03..c3b881d9 100644
--- a/tests/third_party_notices.test.js.snapshot
+++ b/tests/third_party_notices.test.js.snapshot
@@ -853,7 +853,9 @@ License: MIT
-------------------- DEPENDENCY DIVIDER --------------------
-Name: chrome-devtools-frontend
+Name: devtools-frontend
+URL: https://github.com/ChromeDevTools/devtools-frontend
+Version: <VERSION>
License: Apache-2.0
// Copyright 2014 The Chromium Authors