UNPKG

@microsoft/windows-admin-center-sdk

Version:

Microsoft - Windows Admin Center Shell

1 lines 2.32 kB
{"version":3,"sources":["../../../packages/tools/wac-cli/src/angular15/upgrader/audit/log-parser.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,qBAAa,SAAS;IAClB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,qBAAqB,CAAwB;IAErD,OAAO,CAAC,QAAQ,CAEd;IAEF;;;;OAIG;gBACS,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAM/C;;;;OAIG;IACI,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAKjD;;OAEG;IACU,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAgBpC","file":"log-parser.d.ts","sourcesContent":["import { pathExists } from 'fs-extra';\r\nimport { FileWriter } from '../../utils/file-writer';\r\nimport { Logger } from '../../utils/logger';\r\nimport { ErrorUpdaterAngular15 } from './error-updater-angular15';\r\n\r\n/**\r\n * the log parser class.\r\n */\r\nexport class LogParser {\r\n private filePath: string;\r\n private fileWriter: FileWriter;\r\n private errorUpdaterAngular15: ErrorUpdaterAngular15;\r\n\r\n private messages = {\r\n notFound: ''\r\n };\r\n\r\n /**\r\n * the constructor.\r\n * @param filePath the file path.\r\n * @param fileName the file name.\r\n */\r\n constructor(filePath: string, fileName?: string) {\r\n this.update(filePath, fileName);\r\n\r\n this.errorUpdaterAngular15 = new ErrorUpdaterAngular15();\r\n }\r\n\r\n /**\r\n * the update function.\r\n * @param filePath the file path.\r\n * @param fileName the file name.\r\n */\r\n public update(filePath: string, fileName?: string) {\r\n this.filePath = filePath;\r\n this.messages.notFound = `${fileName} not found at ${this.filePath}.`\r\n }\r\n\r\n /**\r\n * the run function to resolve the errors.\r\n */\r\n public async run(): Promise<void> {\r\n try {\r\n const exists = await pathExists(this.filePath);\r\n\r\n if (exists) {\r\n this.fileWriter = new FileWriter(this.filePath);\r\n\r\n await this.errorUpdaterAngular15.resolveLogBuildErrors(this.fileWriter.getData());\r\n await this.errorUpdaterAngular15.resolveLogBuildWarnings(this.fileWriter.getData());\r\n } else {\r\n Logger.log(this.messages.notFound);\r\n }\r\n } catch (error) {\r\n Logger.error(error);\r\n }\r\n }\r\n}\r\n"]}