Skip to content

Chrome DevTools for coding agents

build: pass --init to git submodule update in prepare script (#2891)

Alex Rudenko952268f89b7c
diff --git a/scripts/clean-submodules.ts b/scripts/clean-submodules.ts
index fdea495a..981eae50 100644
--- a/scripts/clean-submodules.ts
+++ b/scripts/clean-submodules.ts
@@ -4,6 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
+import {execSync} from 'node:child_process';
import {rmSync, existsSync} from 'node:fs';
import {resolve} from 'node:path';
@@ -11,6 +12,15 @@ const projectRoot = process.cwd();
console.log('Cleaning submodules...');
+try {
+ execSync('git submodule deinit --force third_party/devtools-frontend', {
+ cwd: projectRoot,
+ stdio: 'inherit',
+ });
+} catch {
+ // Ignore errors if the submodule was not initialized.
+}
+
const directoriesToRemove = [
resolve(projectRoot, 'third_party', 'devtools-frontend'),
resolve(projectRoot, '.git', 'modules', 'devtools-frontend'),
diff --git a/scripts/prepare.ts b/scripts/prepare.ts
index fd4214f1..b12a2a5c 100644
--- a/scripts/prepare.ts
+++ b/scripts/prepare.ts
@@ -73,7 +73,7 @@ function ensureSubmodule(): void {
// 1. Clone only the tree structure of the default branch (no blobs)
execSync(
- 'git clone --no-checkout --depth 1 --filter=blob:none https://github.com/ChromeDevTools/devtools-frontend.git third_party/devtools-frontend',
+ 'git clone --no-checkout --depth 1 --no-tags --filter=blob:none https://github.com/ChromeDevTools/devtools-frontend.git third_party/devtools-frontend',
{
cwd: projectRoot,
stdio: 'inherit',
@@ -97,7 +97,7 @@ function ensureSubmodule(): void {
// 4. Update the submodule to the correct commit (this fetches the commit and only downloads the blobs for the sparse checkout)
execSync(
- 'git submodule update --force --checkout third_party/devtools-frontend',
+ 'git submodule update --init --force --checkout third_party/devtools-frontend',
{
cwd: projectRoot,
stdio: 'inherit',