@enspirit/emb
Version:
A replacement for our Makefile-for-monorepos
24 lines (23 loc) • 851 B
JavaScript
import { getContext } from '../../../index.js';
import { BaseCommand } from '../../abstract/BaseCommand.js';
import { PruneContainersOperation } from '../../../docker/index.js';
export default class ContainersPrune extends BaseCommand {
static description = 'Prune containers.';
static enableJsonFlag = true;
static examples = ['<%= config.bin %> <%= command.id %>'];
async run() {
const { monorepo } = await getContext();
const info = await monorepo.run(new PruneContainersOperation(), {
filters: {
label: [`emb/project=${monorepo.name}`],
},
});
info.ContainersDeleted?.forEach((d) => {
if (d) {
this.log('Deleted', d);
}
});
this.log('Space reclaimed', info.SpaceReclaimed);
return info;
}
}