beesbuild
Version:
构建工具链
69 lines (68 loc) • 3.03 kB
JavaScript
;
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all) __defProp(target, name, {
get: all[name],
enumerable: true
});
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
get: () => from[key],
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
value: mod,
enumerable: true
}) : target, mod));
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
value: true
}), mod);
var stdin_exports = {};
__export(stdin_exports, {
rimraf: () => rimraf
});
module.exports = __toCommonJS(stdin_exports);
var import_commander = require("commander");
var import_boolean_parser = require("../boolean-parser.cjs");
var scripts = __toESM(require("../scripts/index.cjs"));
var variables = __toESM(require("../variables.cjs"));
var import_utils = require("./utils.cjs");
const rimraf = program => {
if (!(program instanceof import_commander.Command)) {
program = (0, import_utils.init)(variables).end();
}
program.command("rm").description("\u5220\u9664\u6307\u5B9A\u6587\u4EF6\u6216\u6587\u4EF6\u5939").argument("<dirs...>", "\u6307\u5B9A\u6587\u4EF6\u6216\u6587\u4EF6\u5939").option("-d, --no-only-directories [boolean]", "\u4EC5\u9650\u5220\u9664\u6587\u4EF6\u5939", true).option("-f, --no-only-files [boolean]", "\u4EC5\u9650\u5220\u9664\u6587\u4EF6", true).option("-F, --no-force [boolean]", "\u5FFD\u7565\u4E0D\u5B58\u5728\u7684\u6587\u4EF6\uFF0C\u4E0D\u4F1A\u63D0\u793A\u786E\u8BA4\u4FE1\u606F\u3002", true).combineFlagAndOptionalValue(false).action(async (dirs, {
onlyDirectories,
onlyFiles,
force
}) => {
const opts = (0, import_utils.handleOptions)(program, {
dirs,
onlyDirectories: (0, import_boolean_parser.booleanParser)(onlyDirectories),
onlyFiles: (0, import_boolean_parser.booleanParser)(onlyFiles),
force: (0, import_boolean_parser.booleanParser)(force)
});
if (!opts.monorepo) return;
await scripts.rimraf(opts);
});
return program;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
rimraf
});