Skip to content

Chrome DevTools for coding agents

build: set is_debug=false for release builds and memory profiling (#3466)

Nikolay Vitkov8f25911879e0
diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml
index 91c8a838..0c5265db 100644
--- a/.github/workflows/pre-release.yml
+++ b/.github/workflows/pre-release.yml
@@ -46,7 +46,7 @@ jobs:
- name: Build
shell: bash
- run: npm run build
+ run: npm run build:release
- name: Verify server.json
if: runner.os == 'Linux'
diff --git a/.github/workflows/publish-to-mcp-registry-on-tag.yml b/.github/workflows/publish-to-mcp-registry-on-tag.yml
index 5b39022a..39c8e6c8 100644
--- a/.github/workflows/publish-to-mcp-registry-on-tag.yml
+++ b/.github/workflows/publish-to-mcp-registry-on-tag.yml
@@ -37,7 +37,7 @@ jobs:
run: npm run sync
- name: Build
- run: npm run build
+ run: npm run build:release
- name: Install Cosign
uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2
diff --git a/.github/workflows/publish-to-npm-on-tag.yml b/.github/workflows/publish-to-npm-on-tag.yml
index 9f3ac717..60aa3ecf 100644
--- a/.github/workflows/publish-to-npm-on-tag.yml
+++ b/.github/workflows/publish-to-npm-on-tag.yml
@@ -33,7 +33,7 @@ jobs:
run: npm run sync
- name: Build
- run: npm run build
+ run: npm run build:release
- name: Publish chrome-devtools-mcp
run: |
diff --git a/.github/workflows/test-memory-leaks.yml b/.github/workflows/test-memory-leaks.yml
index ae764e3f..6773dc6b 100644
--- a/.github/workflows/test-memory-leaks.yml
+++ b/.github/workflows/test-memory-leaks.yml
@@ -38,7 +38,7 @@ jobs:
run: npx puppeteer browsers install chrome
- name: Build
- run: npm run build
+ run: npm run build:release
- name: Disable AppArmor
shell: bash
diff --git a/package.json b/package.json
index 025dd33a..69a8844a 100644
--- a/package.json
+++ b/package.json
@@ -13,6 +13,7 @@
"clean": "node scripts/clean.ts",
"clean:submodules": "node scripts/clean-submodules.ts",
"build": "node scripts/ninja.ts",
+ "build:release": "node scripts/gn-gen.ts --args=is_debug=false && node scripts/ninja.ts",
"typecheck": "node scripts/ninja.ts",
"format": "eslint --cache --fix . && prettier --write --cache .",
"check-format": "eslint --cache . && prettier --check --cache .",
@@ -33,9 +34,9 @@
"verify-npm-package": "node scripts/verify-npm-package.js",
"eval": "npm run build && node scripts/eval_gemini.ts",
"count-tokens": "node scripts/count_tokens.ts",
- "profile": "npm run build && node scripts/profile/profile_mcp.ts",
- "test:memory": "npm run build && node scripts/profile/profile_mcp.ts --threshold-percentage 1",
- "profile:footprint": "npm run build && node scripts/profile/footprint_mcp.ts"
+ "profile": "npm run build:release && node scripts/profile/profile_mcp.ts",
+ "test:memory": "npm run build:release && node scripts/profile/profile_mcp.ts --threshold-percentage 1",
+ "profile:footprint": "npm run build:release && node scripts/profile/footprint_mcp.ts"
},
"files": [
"out/Default/gen/src",
diff --git a/scripts/clean.ts b/scripts/clean.ts
index f80f1591..c3f7dab4 100644
--- a/scripts/clean.ts
+++ b/scripts/clean.ts
@@ -5,7 +5,7 @@
*/
import {execFileSync} from 'node:child_process';
-import {existsSync} from 'node:fs';
+import {existsSync, rmSync} from 'node:fs';
import {resolve} from 'node:path';
import {getGnBinaryPath, runGnGen} from './gn-gen.ts';
@@ -13,6 +13,7 @@ import {getGnBinaryPath, runGnGen} from './gn-gen.ts';
const projectRoot = process.cwd();
const outDir = resolve(projectRoot, 'out', 'Default');
+rmSync(resolve(outDir, 'args.gn'), {force: true});
if (existsSync(resolve(outDir, 'build.ninja'))) {
execFileSync(getGnBinaryPath(), ['clean', 'out/Default'], {
cwd: projectRoot,
diff --git a/scripts/gn-gen.ts b/scripts/gn-gen.ts
index 3b2d270f..79cfa01f 100644
--- a/scripts/gn-gen.ts
+++ b/scripts/gn-gen.ts
@@ -23,9 +23,9 @@ export function getGnBinaryPath(): string {
}
}
-export function runGnGen(): void {
+export function runGnGen(gnArgs: string[] = []): void {
linkDevToolsDeps();
- execFileSync(getGnBinaryPath(), ['gen', 'out/Default'], {
+ execFileSync(getGnBinaryPath(), ['gen', 'out/Default', ...gnArgs], {
cwd: projectRoot,
stdio: 'inherit',
});
@@ -35,5 +35,5 @@ export function runGnGen(): void {
}
if (import.meta.main) {
- runGnGen();
+ runGnGen(process.argv.slice(2));
}