// src/actions/package/clean-typescript.ts
import path2 from "path";
import chalk from "chalk";

// src/lib/deleteGlob.ts
import fs from "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 "fs";
import path from "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-typescript.ts
var packageCleanTypescript = () => {
  const pkg = INIT_CWD();
  const pkgName = packageName();
  console.log(chalk.green(`Cleaning Typescript [${pkgName}]`));
  const files = [path2.join(pkg, "*.tsbuildinfo"), path2.join(pkg, ".tsconfig.*"), path2.join(pkg, ".eslintcache")];
  for (const file of files) {
    deleteGlob(file);
  }
  return 0;
};
export {
  packageCleanTypescript
};
//# sourceMappingURL=clean-typescript.mjs.map