chore(vendor): import pi 0.85.1
Imported as a linear vendor commit so forge rebases do not replay the upstream root tree. git-subtree-dir: third_party/pi git-subtree-split: d981de1229ef899957bbe968bc8dcda02a21f477
This commit is contained in:
24
third_party/pi/scripts/package-workspaces.mjs
vendored
Normal file
24
third_party/pi/scripts/package-workspaces.mjs
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import { existsSync, readdirSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
|
||||
const SKIPPED_DIRECTORIES = new Set(["dist", "node_modules"]);
|
||||
|
||||
export function findPackageDirectories(root = "packages") {
|
||||
const packageDirectories = [];
|
||||
|
||||
function visit(directory) {
|
||||
if (existsSync(join(directory, "package.json"))) {
|
||||
packageDirectories.push(directory);
|
||||
}
|
||||
|
||||
for (const entry of readdirSync(directory, { withFileTypes: true })) {
|
||||
if (!entry.isDirectory() || SKIPPED_DIRECTORIES.has(entry.name)) {
|
||||
continue;
|
||||
}
|
||||
visit(join(directory, entry.name));
|
||||
}
|
||||
}
|
||||
|
||||
visit(root);
|
||||
return packageDirectories.sort();
|
||||
}
|
||||
Reference in New Issue
Block a user