@plugjs/plug
Version:
PlugJS Build System ===================
24 lines (23 loc) • 613 B
JavaScript
// plugs/rmf.ts
import { rm } from "../fs.mjs";
import { $gry, $p } from "../logging.mjs";
import { install } from "../pipe.mjs";
install("rmf", class Rmf {
_dryRun;
constructor(dryRun) {
this._dryRun = !!dryRun;
}
async pipe(files, context) {
if (this._dryRun) {
for (const file of files.absolutePaths()) {
context.log.notice("Not removing file", $p(file), $gry("(dry-run)"));
}
} else {
for (const file of files.absolutePaths()) {
context.log.notice("Removing file", $p(file));
await rm(file);
}
}
}
});
//# sourceMappingURL=rmf.mjs.map