@alexaegis/nuke
Version:
69 lines (67 loc) • 4.36 kB
JavaScript
#!/usr/bin/env node
import { D as DEFAULT_NUKE_LIST, a as DEFAULT_NUKE_GLOBS, n as nuke } from "../nuke.function-E31FblRu.js";
import { YargsBuilder, yargsForCollectWorkspacePackagesOptions, yargsForLogLevelOption } from "@alexaegis/cli-tools";
import { createLogger } from "@alexaegis/logging";
const name = "@alexaegis/nuke";
const description = "Nuke stuff";
const version = "0.14.1";
const license = "MIT";
const archetype = { "platform": "node", "language": "ts", "kind": "lib" };
const keywords = ["clean", "managed-by-autotool", "nuke"];
const type = "module";
const publishConfig = { "access": "public" };
const scripts = { "lint:depcheck": "turbo run lint:depcheck_ --concurrency 16 --filter @alexaegis/nuke", "lint:depcheck_": "depcheck", "lint:es": "turbo run lint:es_ --concurrency 16 --filter @alexaegis/nuke", "lint:es_": "eslint --max-warnings=0 --fix --no-error-on-unmatched-pattern .", "lint:format": "turbo run lint:format_ --concurrency 16 --filter @alexaegis/nuke", "lint:format_": "prettier --cache-location .cache/prettier --plugin prettier-plugin-svelte --plugin prettier-plugin-tailwindcss --check .", "lint:md": "turbo run lint:md_ --concurrency 16 --filter @alexaegis/nuke", "lint:md_": "remark --frail --no-stdout --silently-ignore .", "lint:tsc": "turbo run lint:tsc_ --concurrency 16 --filter @alexaegis/nuke", "lint:tsc_": "tsc --noEmit", "publint": "BUILD_REASON='publish' turbo run publint_ --concurrency 16 --filter @alexaegis/nuke", "publint_": "publint dist", "test": "turbo run test_ --concurrency 16 --filter @alexaegis/nuke", "test_": "vitest --passWithNoTests --coverage --run", "test:watch": "vitest --passWithNoTests --coverage", "all": "BUILD_REASON='publish' turbo run all_ --concurrency 16 --filter @alexaegis/nuke", "build": "turbo run build-lib_ --concurrency 16 --filter @alexaegis/nuke", "build-lib_": "vite build", "format": "turbo run format_ --concurrency 16 --filter @alexaegis/nuke", "format_": "prettier --cache-location .cache/prettier --plugin prettier-plugin-svelte --plugin prettier-plugin-tailwindcss --write ." };
const exports = { ".": { "types": "./src/index.ts", "import": "./dist/index.js", "require": "./dist/index.cjs", "default": "./dist/index.js" }, "./package.json": "./package.json", "./readme": "./readme.md" };
const bin = { "nuke": "./shims/nuke.js" };
const dependencies = { "@alexaegis/cli-tools": "^0.11.0", "@alexaegis/common": "^0.11.0", "@alexaegis/logging": "^0.11.0", "@alexaegis/workspace-tools": "^0.11.0", "globby": "^14.1.0" };
const devDependencies = { "@alexaegis/eslint-config-vitest": "workspace:^", "@alexaegis/ts": "workspace:^", "@alexaegis/vite": "workspace:^", "@alexaegis/vitest": "workspace:^", "@types/node": "^22.14.1", "publint": "^0.3.12", "typescript": "^5.8.3", "vite": "^6.3.2", "vitest": "^3.1.1" };
const packageJson = {
name,
description,
version,
license,
"private": false,
archetype,
keywords,
type,
publishConfig,
scripts,
exports,
bin,
dependencies,
devDependencies
};
const yarguments = YargsBuilder.withDefaults(packageJson).add(yargsForCollectWorkspacePackagesOptions).add(
(y) => y.option("skipNodeModules", {
boolean: true,
description: "Don't remove `node_modules` directories but try to clean them up",
default: false
}).option("nukeList", {
array: true,
type: "string",
description: "A list of folders and files to delete.",
default: DEFAULT_NUKE_LIST
}).option("nukeMore", {
array: true,
type: "string",
description: "These will be nuked too. Same role as `nukeList` but defining this won't get rid of the built in nukelist"
}).option("nukeGlobs", {
array: true,
type: "string",
description: "A list of globs to also delete, not as efficient as a flat path but sometimes necessary",
default: DEFAULT_NUKE_GLOBS
}).option("nukeMoreGlobs", {
array: true,
type: "string",
description: "Additional globs to nuke if you don't want to overwrite the default ones"
}).option("dontNukeIn", {
array: true,
type: "string",
description: "If it shouldn't nuke a specific package, add them here."
})
).add(yargsForLogLevelOption);
void (async () => {
const options = await yarguments.build().parseAsync();
const logger = createLogger({ name: "nuke ☢", minLevel: options.logLevel });
await nuke({ ...options, logger });
})();