()
| 8 | |
| 9 | // Checks that the select build files are present using `npm publish --dry-run`. |
| 10 | function 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 | |
| 41 | verifyPackageContents(); |
no test coverage detected