@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
59 lines (57 loc) • 1.79 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LogParser = void 0;
const fs_extra_1 = require("fs-extra");
const file_writer_1 = require("../../utils/file-writer");
const logger_1 = require("../../utils/logger");
const error_updater_angular15_1 = require("./error-updater-angular15");
/**
* the log parser class.
*/
class LogParser {
filePath;
fileWriter;
errorUpdaterAngular15;
messages = {
notFound: ''
};
/**
* the constructor.
* @param filePath the file path.
* @param fileName the file name.
*/
constructor(filePath, fileName) {
this.update(filePath, fileName);
this.errorUpdaterAngular15 = new error_updater_angular15_1.ErrorUpdaterAngular15();
}
/**
* the update function.
* @param filePath the file path.
* @param fileName the file name.
*/
update(filePath, fileName) {
this.filePath = filePath;
this.messages.notFound = `${fileName} not found at ${this.filePath}.`;
}
/**
* the run function to resolve the errors.
*/
async run() {
try {
const exists = await (0, fs_extra_1.pathExists)(this.filePath);
if (exists) {
this.fileWriter = new file_writer_1.FileWriter(this.filePath);
await this.errorUpdaterAngular15.resolveLogBuildErrors(this.fileWriter.getData());
await this.errorUpdaterAngular15.resolveLogBuildWarnings(this.fileWriter.getData());
}
else {
logger_1.Logger.log(this.messages.notFound);
}
}
catch (error) {
logger_1.Logger.error(error);
}
}
}
exports.LogParser = LogParser;
//# sourceMappingURL=log-parser.js.map