2025-02-25 06:37:28 +08:00
|
|
|
import fs from "node:fs/promises";
|
2023-12-17 19:34:12 +00:00
|
|
|
import { runGit, runYarn } from "../utils.js";
|
2018-06-05 16:37:52 -03:00
|
|
|
|
2025-02-25 06:37:28 +08:00
|
|
|
const PROJECT_ROOT = new URL("../../../", import.meta.url);
|
2018-06-05 16:37:52 -03:00
|
|
|
|
2025-02-25 06:37:28 +08:00
|
|
|
async function installDependenciesInDirectory(directory) {
|
|
|
|
|
await fs.rm(new URL("./node_modules/", directory), {
|
|
|
|
|
recursive: true,
|
|
|
|
|
force: true,
|
|
|
|
|
});
|
|
|
|
|
await runYarn("install", { cwd: directory });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default async function installDependencies() {
|
|
|
|
|
await Promise.all(
|
|
|
|
|
[PROJECT_ROOT, new URL("./website/", PROJECT_ROOT)].map((directory) =>
|
|
|
|
|
installDependenciesInDirectory(directory),
|
|
|
|
|
),
|
|
|
|
|
);
|
2022-03-31 22:50:48 +09:00
|
|
|
|
2021-04-21 22:15:12 +08:00
|
|
|
const { stdout: status } = await runGit(["ls-files", "-m"]);
|
2018-06-05 16:37:52 -03:00
|
|
|
if (status) {
|
2019-11-17 18:36:21 +08:00
|
|
|
throw new Error(
|
2018-06-05 16:37:52 -03:00
|
|
|
"The lockfile needs to be updated, commit it before making the release.",
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|