replace manual depCheck script with native pnpm feature (#1186)
https://pnpm.io/settings#verifydepsbeforerun
This commit is contained in:
parent
e3277bfea2
commit
0cb5df5ab7
3 changed files with 6 additions and 38 deletions
|
|
@ -14,9 +14,9 @@
|
|||
"license": "GPL-3.0-or-later",
|
||||
"author": "Equicord",
|
||||
"scripts": {
|
||||
"build": "pnpm depCheck && node --require=./scripts/suppressExperimentalWarnings.js scripts/build/build.mjs",
|
||||
"build": "node --require=./scripts/suppressExperimentalWarnings.js scripts/build/build.mjs",
|
||||
"buildStandalone": "pnpm build --standalone",
|
||||
"buildWeb": "pnpm depCheck && node --require=./scripts/suppressExperimentalWarnings.js scripts/build/buildWeb.mjs",
|
||||
"buildWeb": "node --require=./scripts/suppressExperimentalWarnings.js scripts/build/buildWeb.mjs",
|
||||
"buildWebStandalone": "pnpm buildWeb --standalone",
|
||||
"buildReporter": "pnpm buildWebStandalone --reporter --skip-extension",
|
||||
"buildReporterDesktop": "pnpm build --reporter",
|
||||
|
|
@ -39,8 +39,7 @@
|
|||
"lint:patches": "node scripts/lintPatches.mjs",
|
||||
"test": "pnpm buildStandalone && pnpm testTsc && pnpm lint:fix && pnpm lint-styles && pnpm lint:intl && pnpm lint:patches && pnpm generatePluginJson",
|
||||
"testWeb": "pnpm lint:fix && pnpm buildWeb && pnpm testTsc",
|
||||
"testTsc": "tsc --noEmit",
|
||||
"depCheck": "node scripts/depCheck.mjs"
|
||||
"testTsc": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ffmpeg/ffmpeg": "^0.12.10",
|
||||
|
|
@ -105,4 +104,4 @@
|
|||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,3 +21,5 @@ allowedDeprecatedVersions:
|
|||
source-map-url: "*"
|
||||
urix: "*"
|
||||
q: "*"
|
||||
|
||||
verifyDepsBeforeRun: prompt
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2026 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { execSync } from "child_process";
|
||||
import { existsSync, readFileSync } from "fs";
|
||||
import { createInterface } from "readline/promises";
|
||||
import { dirname, join } from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const PackageJSON = JSON.parse(readFileSync(join(root, "package.json"), "utf-8"));
|
||||
|
||||
const allDeps = { ...PackageJSON.dependencies, ...PackageJSON.devDependencies };
|
||||
const requiredDeps = Object.keys(allDeps);
|
||||
const missing = requiredDeps.filter(d => {
|
||||
const v = allDeps[d];
|
||||
return !v.startsWith("link:") && !v.startsWith("workspace:") && !existsSync(join(root, "node_modules", d, "package.json"));
|
||||
});
|
||||
|
||||
if (missing.length) {
|
||||
console.error(`\x1b[31mMissing ${missing.length} package(s): ${missing.join(", ")}\x1b[0m`);
|
||||
const rl = createInterface({ input: process.stdin, output: process.stderr });
|
||||
rl.on("SIGINT", () => { rl.close(); process.exit(1); });
|
||||
try {
|
||||
const ans = await rl.question("\x1b[33mRun 'pnpm install'? [Y/n]: \x1b[0m");
|
||||
if (!ans || /^y/i.test(ans)) execSync("pnpm install --frozen-lockfile", { cwd: root, stdio: "inherit" });
|
||||
} finally { rl.close(); }
|
||||
} else {
|
||||
console.log("\x1b[32mAll dependencies are installed.\x1b[0m");
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue