MCPcopy
hub / github.com/ChromeDevTools/chrome-devtools-mcp / verifyPackageContents

Function verifyPackageContents

scripts/verify-npm-package.mjs:10–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8
9// Checks that the select build files are present using `npm publish --dry-run`.
10function verifyPackageContents() {
11 try {
12 const output = execSync('npm publish --dry-run --json --silent', {
13 encoding: 'utf8',
14 });
15 // skip non-JSON output from prepare.
16 const data = JSON.parse(output.substring(output.indexOf('{')));
17 const files = data['chrome-devtools-mcp'].files.map(f => f.path);
18 // Check some important files.
19 const requiredPaths = [
20 'build/src/index.js',
21 'build/src/third_party/index.js',
22 ];
23 for (const requiredPath of requiredPaths) {
24 const hasBuildFolder = files.some(path => path.startsWith(requiredPath));
25 if (!hasBuildFolder) {
26 console.error(
27 `Assertion Failed: "${requiredPath}" not found in tarball.`,
28 );
29 process.exit(1);
30 }
31 }
32 console.log(
33 `npm publish --dry-run contained ${JSON.stringify(requiredPaths)}`,
34 );
35 } catch (err) {
36 console.error('failed to parse npm publish output', err);
37 process.exit(1);
38 }
39}
40
41verifyPackageContents();

Callers 1

Calls 4

substringMethod · 0.80
logMethod · 0.80
parseMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected