forked from ChromeDevTools/chrome-devtools-mcp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify-server-json-version.ts
More file actions
36 lines (28 loc) · 914 Bytes
/
Copy pathverify-server-json-version.ts
File metadata and controls
36 lines (28 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {execSync} from 'node:child_process';
import fs from 'node:fs';
const serverJsonFilePath = './server.json';
const serverJson = JSON.parse(fs.readFileSync(serverJsonFilePath, 'utf-8'));
fs.unlinkSync(serverJsonFilePath);
// Create the new server.json
execSync('./mcp-publisher init');
const newServerJson = JSON.parse(fs.readFileSync(serverJsonFilePath, 'utf-8'));
const propertyToVerify = ['$schema'];
const diffProps = [];
for (const prop of propertyToVerify) {
if (serverJson[prop] !== newServerJson[prop]) {
diffProps.push(prop);
}
}
fs.writeFileSync('./server.json', JSON.stringify(serverJson, null, 2));
if (diffProps.length) {
throw new Error(
`The following props did not match the latest init value:\n${diffProps.map(
prop => `- "${prop}": "${newServerJson[prop]}"`,
)}`,
);
}