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
51 lines
1.1 KiB
JavaScript
51 lines
1.1 KiB
JavaScript
import { execSync, spawnSync } from "node:child_process";
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
const projectRoot = path.resolve(__dirname, "../..");
|
|
|
|
function getPackagePaths() {
|
|
const stdout = execSync(
|
|
'pnpm list --filter="./packages/*" --recursive --depth=-1 --parseable',
|
|
{ cwd: projectRoot, encoding: "utf8" }
|
|
);
|
|
return stdout.split("\n").filter((pkgPath) => path.isAbsolute(pkgPath));
|
|
}
|
|
|
|
function getPackage(pkgPath) {
|
|
const json = fs.readFileSync(path.join(pkgPath, "package.json"), "utf8");
|
|
return {
|
|
path: pkgPath,
|
|
json: JSON.parse(json),
|
|
};
|
|
}
|
|
|
|
function getPackages() {
|
|
return getPackagePaths().map(getPackage);
|
|
}
|
|
|
|
export function getPackagesForPrerelease() {
|
|
return getPackages().filter((pkg) => pkg.json["workers-sdk"]?.prerelease);
|
|
}
|
|
|
|
const pkgs = getPackagesForPrerelease();
|
|
|
|
spawnSync(
|
|
"pnpm",
|
|
[
|
|
"dlx",
|
|
"pkg-pr-new",
|
|
"publish",
|
|
"--pnpm",
|
|
"--compact",
|
|
"--no-template",
|
|
...pkgs.map((pkg) => pkg.path),
|
|
],
|
|
{
|
|
stdio: "inherit",
|
|
}
|
|
);
|