/
githubmirror
/
lerna
Обзор
Документация
Войти
/
githubmirror
/
lerna
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
libs/core/src/lib/write-log-file.ts
33 строки
855 B
James Henry
fix: update npm utility dependencies and related packages (#4033)
24 июн 2024, 17:39
Не верифицирован
24 июн 2024, 17:39
bd1c2d8
Код
Авторство
О чём код?
import os from "os"; import path from "path"; import writeFileAtomic from "write-file-atomic"; import log from "./npmlog"; export function writeLogFile(cwd: string) { let logOutput = ""; log.record.forEach((m) => { let pref = [m.id, m.level]; if (m.prefix) { pref.push(m.prefix); } // TODO: refactor based on TS feedback // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore pref = pref.join(" "); m.message .trim() .split(/\r?\n/) .map((line: string) => `${pref} ${line}`.trim()) .forEach((line: string) => { logOutput += line + os.EOL; }); }); // this must be synchronous because it is called before process exit writeFileAtomic.sync(path.join(cwd, "lerna-debug.log"), logOutput); // truncate log after writing log.record.length = 0; }