Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/bin/check-latest-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import {execSync} from 'node:child_process';
import fs from 'node:fs/promises';
import path from 'node:path';
import process from 'node:process';
Expand All @@ -12,8 +13,17 @@ const cachePath = process.argv[2];

if (cachePath) {
try {
let registry;
try {
registry = execSync('npm config get registry', {
encoding: 'utf8',
}).trim().replace(/\/$/, '');
} catch {
// npm not on PATH, fall back to default
}
registry ||= 'https://registry.npmjs.org';
const response = await fetch(
'https://registry.npmjs.org/chrome-devtools-mcp/latest',
`${registry}/chrome-devtools-mcp/latest`,
);
const data = response.ok ? await response.json() : null;

Expand Down