70bf21e064
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled
21 lines
559 B
TypeScript
21 lines
559 B
TypeScript
import { execSync } from "node:child_process";
|
|
import { compare } from "semver";
|
|
|
|
/**
|
|
* For Trusted Publishing to work, we need npm version 11.5.1 or higher.
|
|
*/
|
|
function checkNpmVersion() {
|
|
const npmVersionBuffer = execSync("npm --version");
|
|
const npmVersion = npmVersionBuffer.toString().trim();
|
|
if (compare(npmVersion, "11.5.1") === -1) {
|
|
console.error(
|
|
`Error: npm version 11.5.1 or higher is required for Trusted Publishing to work, found version ${npmVersion}`
|
|
);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
if (require.main === module) {
|
|
checkNpmVersion();
|
|
}
|