2023-06-27 22:15:36 -04:00
|
|
|
// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
|
|
|
// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
|
|
|
|
|
// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
|
|
|
|
|
// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
|
|
|
|
|
// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
|
|
|
|
|
// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
|
|
|
|
|
// ┃ Copyright (c) 2017, the Perspective Authors. ┃
|
|
|
|
|
// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
|
|
|
|
|
// ┃ This file is part of the Perspective library, distributed under the terms ┃
|
|
|
|
|
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
|
|
|
|
|
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
2023-06-25 14:58:11 -04:00
|
|
|
|
2024-07-04 13:45:47 -04:00
|
|
|
import { clean, get_scope } from "./sh_perspective.mjs";
|
|
|
|
|
import { execSync } from "child_process";
|
2024-09-30 22:21:32 -06:00
|
|
|
import * as fs from "node:fs";
|
2023-06-25 14:58:11 -04:00
|
|
|
|
2024-07-04 13:45:47 -04:00
|
|
|
const PACKAGES = get_scope();
|
|
|
|
|
const JS_PKGS = [];
|
|
|
|
|
const RUST_PKGS = [];
|
2024-09-30 22:21:32 -06:00
|
|
|
|
|
|
|
|
const CRATE_NAMES = fs.readdirSync("rust");
|
|
|
|
|
|
2024-07-04 13:45:47 -04:00
|
|
|
for (const pkg of PACKAGES) {
|
2025-07-20 18:26:25 -04:00
|
|
|
if (pkg === "perspective-server") {
|
|
|
|
|
console.log("-- Cleaning perspective-server");
|
|
|
|
|
clean("rust/perspective-server/dist");
|
2024-09-30 22:21:32 -06:00
|
|
|
} else if (CRATE_NAMES.indexOf(pkg) > -1) {
|
2024-07-04 13:45:47 -04:00
|
|
|
RUST_PKGS.push(pkg);
|
2024-09-30 22:21:32 -06:00
|
|
|
} else {
|
|
|
|
|
JS_PKGS.push(pkg);
|
2024-07-04 13:45:47 -04:00
|
|
|
}
|
2023-06-25 14:58:11 -04:00
|
|
|
}
|
|
|
|
|
|
2024-09-30 22:21:32 -06:00
|
|
|
if (JS_PKGS.length > 0 || RUST_PKGS.length > 0) {
|
2024-07-04 13:45:47 -04:00
|
|
|
console.log(`-- Cleaning ${JS_PKGS.join(", ")} via pnpm`);
|
2024-09-30 22:21:32 -06:00
|
|
|
const flags = JS_PKGS.concat(RUST_PKGS)
|
2025-09-27 22:13:38 -04:00
|
|
|
.map(
|
|
|
|
|
(x) =>
|
2025-10-25 12:06:02 -04:00
|
|
|
`--filter @perspective-dev/${x} --if-present --filter ${x} --if-present`,
|
2025-09-27 22:13:38 -04:00
|
|
|
)
|
2024-09-30 22:21:32 -06:00
|
|
|
.join(" ");
|
|
|
|
|
|
|
|
|
|
execSync(`pnpm run ${flags} clean`, { stdio: "inherit" });
|
2023-06-25 14:58:11 -04:00
|
|
|
}
|
|
|
|
|
|
2024-07-04 13:45:47 -04:00
|
|
|
if (RUST_PKGS.length > 0) {
|
2024-09-30 22:21:32 -06:00
|
|
|
if (process.env.PACKAGE?.length > 1) {
|
|
|
|
|
console.log(`-- Cleaning ${RUST_PKGS.join(", ")} via cargo`);
|
|
|
|
|
execSync(`cargo clean ${RUST_PKGS.map((x) => `-p ${x}`).join(" ")}`);
|
|
|
|
|
} else {
|
|
|
|
|
console.log(`-- Cleaning all crates via cargo`);
|
|
|
|
|
execSync(`cargo clean`);
|
|
|
|
|
}
|
2024-05-10 23:22:44 -04:00
|
|
|
}
|
|
|
|
|
|
2023-06-25 14:58:11 -04:00
|
|
|
clean("docs/build", "docs/python", "docs/obj");
|