au-rogue
Version:
Conservative Aurelia 1 to 2 codemods. Changes only what is safe, reports everything.
29 lines (28 loc) • 837 B
JavaScript
export class Reporter {
constructor(options) {
this.data = {
startedAt: new Date().toISOString(),
options,
entries: []
};
}
edit(file, message, before, after) {
this.data.entries.push({ file, kind: 'edit', message, before, after });
}
warn(file, message) {
this.data.entries.push({ file, kind: 'warn', message });
}
note(file, message) {
this.data.entries.push({ file, kind: 'note', message });
}
add(file, message, after) {
this.data.entries.push({ file, kind: 'add', message, after });
}
remove(file, message, before) {
this.data.entries.push({ file, kind: 'remove', message, before });
}
finish() {
this.data.finishedAt = new Date().toISOString();
return this.data;
}
}