in packages/just-scripts/src/tasks/cleanTask.ts [26:54]
export function cleanTask(pathsOrOptions: string[] | CleanTaskOptions = {}, limit?: number): TaskFunction {
let paths: string[];
if (Array.isArray(pathsOrOptions)) {
paths = pathsOrOptions;
} else {
paths = pathsOrOptions.paths || defaultCleanPaths();
limit = limit || pathsOrOptions.limit;
}
limit = limit || 5;
return function clean(done: (err: Error | null) => void) {
logger.info(`Removing [${paths.map(p => path.relative(process.cwd(), p)).join(', ')}]`);
const cleanTasks = paths
.map(
cleanPath =>
function (cb: (error: Error | null) => void) {
fse.remove(cleanPath, cb);
},
)
.concat((cb: (error: Error | null) => void) => {
clearCache();
cb(null);
});
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
parallelLimit(cleanTasks, limit!, done);
};
}