Skip to content

Commit

Permalink
Fix clean script
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Stein <steinlink@gmail.com>
  • Loading branch information
texodus committed Oct 17, 2024
1 parent 28a3101 commit 3f6e19c
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/actions/install-deps/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ runs:
using: "composite"
steps:
- name: Clean System
uses: AdityaGarg8/remove-unwanted-software@v3
uses: AdityaGarg8/remove-unwanted-software@v4.1
if: ${{ inputs.clean == 'true' && runner.os != 'Windows' }}
with:
remove-android: "true"
Expand Down
2 changes: 1 addition & 1 deletion examples/python-aiohttp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"devDependencies": {
"@finos/perspective-webpack-plugin": "workspace:^",
"npm-run-all": "^4.1.3",
"rimraf": "^2.5.2"
"rimraf": "^6"
}
}
2 changes: 1 addition & 1 deletion examples/python-starlette/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"devDependencies": {
"@finos/perspective-webpack-plugin": "workspace:^",
"npm-run-all": "^4.1.3",
"rimraf": "^2.5.2"
"rimraf": "^6"
}
}
2 changes: 1 addition & 1 deletion examples/python-tornado-streaming/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"devDependencies": {
"@finos/perspective-webpack-plugin": "workspace:^",
"npm-run-all": "^4.1.3",
"rimraf": "^2.5.2"
"rimraf": "^6"
}
}
2 changes: 1 addition & 1 deletion examples/python-tornado/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"devDependencies": {
"@finos/perspective-webpack-plugin": "workspace:^",
"npm-run-all": "^4.1.3",
"rimraf": "^2.5.2"
"rimraf": "^6"
}
}
2 changes: 1 addition & 1 deletion examples/workspace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"@finos/perspective-webpack-plugin": "workspace:^",
"http-server": "^14.1.1",
"npm-run-all": "^4.1.3",
"rimraf": "^2.5.2"
"rimraf": "^6"
}
}
1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ packages:
- "tools/perspective-scripts"
- "tools/perspective-bench"
- "cpp/perspective"
- "packages/perspective-client"
- "packages/perspective-esbuild-plugin"
- "packages/perspective-viewer-datagrid"
- "packages/perspective-viewer-d3fc"
Expand Down
18 changes: 18 additions & 0 deletions rust/perspective-client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@finos/perspective-client",
"version": "3.1.0",
"description": "",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/finos/perspective"
},
"type": "module",
"license": "Apache-2.0",
"scripts": {
"clean": "rimraf src/rust/proto.rs"
},
"devDependencies": {
"rimraf": "^6"
}
}
2 changes: 1 addition & 1 deletion rust/perspective-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"types": "./dist/esm/perspective.d.ts",
"scripts": {
"build": "node ./build.js",
"clean": "rimraf dist && rimraf build",
"clean": "rimraf dist && rimraf build && rimraf src/ts/ts-rs",
"docs": "cargo doc"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion rust/perspective-python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"license": "Apache-2.0",
"scripts": {
"build": "node build.mjs",
"clean": "rimraf perspective.data && rimraf dist && rimraf build",
"clean": "rimraf *.data && rimraf dist && rimraf build",
"test": "node test.mjs"
},
"devDependencies": {
Expand Down
43 changes: 20 additions & 23 deletions tools/perspective-scripts/clean.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,42 @@

import { clean, get_scope } from "./sh_perspective.mjs";
import { execSync } from "child_process";
import * as fs from "node:fs";

const PACKAGES = get_scope();
const JS_PKGS = [];
const RUST_PKGS = [];

const CRATE_NAMES = fs.readdirSync("rust");

for (const pkg of PACKAGES) {
if (pkg === "perspective-cpp") {
console.log("-- Cleaning perspective-cpp");
clean("cpp/perspective/dist", "cpp/perspective/build");
} else if (
[
"perspective-cli",
"perspective-esbuild-plugin",
"perspective-jupyterlab",
"perspective-viewer-d3fc",
"perspective-viewer-datagrid",
"perspective-viewer-openlayers",
"perspective-webpack-plugin",
"perspective-workspace",
].indexOf(pkg) > -1
) {
JS_PKGS.push(pkg);
} else {
} else if (CRATE_NAMES.indexOf(pkg) > -1) {
RUST_PKGS.push(pkg);
} else {
JS_PKGS.push(pkg);
}
}

if (JS_PKGS.length > 0) {
if (JS_PKGS.length > 0 || RUST_PKGS.length > 0) {
console.log(`-- Cleaning ${JS_PKGS.join(", ")} via pnpm`);
execSync(
`pnpm run ${JS_PKGS.map((x) => `--filter ${x} --if-present`).join(
" "
)} clean`,
{ stdio: "inherit" }
);
const flags = JS_PKGS.concat(RUST_PKGS)
.map((x) => `--filter @finos/${x} --if-present`)
.join(" ");

execSync(`pnpm run ${flags} clean`, { stdio: "inherit" });
}

if (RUST_PKGS.length > 0) {
console.log(`-- Cleaning ${RUST_PKGS.join(", ")} via cargo`);
execSync(`cargo clean ${RUST_PKGS.map((x) => `-p ${x}`).join(" ")}`);
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`);
}
}

clean("docs/build", "docs/python", "docs/obj");
2 changes: 1 addition & 1 deletion tools/perspective-scripts/sh_perspective.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function get_scope() {
(acc, x) => {
if (x.startsWith("!")) {
acc.exclude.push(x);
} else {
} else if (x != "") {
acc.include.push(x);
}

Expand Down
1 change: 1 addition & 0 deletions tools/perspective-scripts/test_js.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const IS_PLAYWRIGHT = process.env.PACKAGE.split(",").reduce(
"perspective-viewer-d3fc",
"perspective-viewer-openlayers",
"perspective-viewer-workspace",
"perspective-workspace",
"perspective-jupyter",
].includes(pkg),
false
Expand Down

0 comments on commit 3f6e19c

Please sign in to comment.