Improve pnpm-link script

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2026-02-10 17:10:13 +00:00
parent cc0838c100
commit dfe01e4f18
No known key found for this signature in database
GPG Key ID: A2B008A5F49F5D0D

View File

@ -16,6 +16,7 @@ Please see LICENSE files in the repository root for full details.
import fs from "node:fs/promises";
import { join, dirname } from "node:path";
import { fileURLToPath } from "node:url";
import { execSync } from "node:child_process";
const __dirname = dirname(fileURLToPath(import.meta.url));
const configPath = join(__dirname, "..", ".link-config");
@ -43,6 +44,11 @@ try {
console.log(`Linking ${dependency} to ${path}`);
await fs.symlink(path, dependencyPath);
// pnpm install may have wiped out the `node_modules` dir so we have to restore it
execSync("pnpm i --ignore-scripts --frozen-lockfile", {
cwd: dependencyPath,
});
} catch (e) {
console.error(`Failed to link ${dependency}`, e);
}