#!/usr/bin/env node

// src/lib/deleteGlob.ts
import fs from "node:fs";
import { glob } from "glob";
var deleteGlob = (globPath) => {
  const files = glob.sync(globPath);
  for (const file of files) {
    fs.rmSync(file, { recursive: true, force: true });
  }
};

// src/lib/initCwd.ts
function INIT_CWD() {
  return process.env.INIT_CWD ?? process.cwd();
}

// src/lib/packageName.ts
import { readFileSync } from "node:fs";
import path from "node:path";
function packageName() {
  if (process.env.npm_package_name) {
    return process.env.npm_package_name;
  }
  try {
    const pkgPath = path.join(INIT_CWD(), "package.json");
    const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
    return pkg.name;
  } catch {
    return void 0;
  }
}

// src/actions/package/clean-outputs.ts
import path2 from "node:path";
import chalk from "chalk";
var packageCleanOutputs = () => {
  const pkg = INIT_CWD();
  const pkgName = packageName();
  const folders = [path2.join(pkg, "dist"), path2.join(pkg, "build"), path2.join(pkg, "docs")];
  console.log(chalk.green(`Cleaning Outputs [${pkgName}]`));
  for (const folder of folders) {
    deleteGlob(folder);
  }
  return 0;
};

// src/bin/package/clean-outputs.ts
process.exitCode = packageCleanOutputs();
//# sourceMappingURL=clean-outputs.mjs.map
