mirror of
https://github.com/penpot/penpot.git
synced 2026-04-25 11:18:36 +00:00
The root lock file not being present causes issues, because the sub-project dependencies are managed by it. The lack of inclusion of pnpm-lock.yaml was the root cause of #8829. A dependency was updated incompatibly, breaking the release. Since npm pack has a hard exclusion rule for pnpm-lock.yaml, we include it under a different name and restore it at runtime.
32 lines
814 B
JavaScript
32 lines
814 B
JavaScript
#!/usr/bin/env node
|
|
|
|
const { execSync } = require("child_process");
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
const root = path.resolve(__dirname, "..");
|
|
|
|
function run(command) {
|
|
execSync(command, { cwd: root, stdio: "inherit" });
|
|
}
|
|
|
|
// pnpm-lock.yaml is hard-excluded by npm pack; it is shipped as pnpm-lock.dist.yaml
|
|
// and restored here before bootstrap runs.
|
|
const distLock = path.join(root, "pnpm-lock.dist.yaml");
|
|
const lock = path.join(root, "pnpm-lock.yaml");
|
|
if (fs.existsSync(distLock)) {
|
|
fs.copyFileSync(distLock, lock);
|
|
}
|
|
|
|
try {
|
|
run("corepack pnpm run bootstrap");
|
|
} catch (error) {
|
|
if (error.code === "ENOENT") {
|
|
console.error(
|
|
"corepack is required but was not found. It ships with Node.js >= 16."
|
|
);
|
|
process.exit(1);
|
|
}
|
|
process.exit(error.status ?? 1);
|
|
}
|