error file output

This commit is contained in:
2022-06-08 11:56:01 -05:00
parent 6b0b604008
commit 3fdb3ad110
6 changed files with 25 additions and 8 deletions

View File

@@ -56,12 +56,13 @@ if (!(0, fs_1.existsSync)('package.json') || !(0, fs_1.lstatSync)('package.json'
(0, fs_1.readdirSync)(paths_1.DistBase).forEach(file => (0, fs_1.unlinkSync)(`${paths_1.DistBase}/${file}`));
(async () => {
let scripts = (0, fs_1.readdirSync)(paths_1.ScriptBase);
// let scriptMeta: {
// [name: string]: [UserScriptMetaFull, string | null]
// } = {}
let scriptMeta = [];
for (let name of scripts) {
let path = (0, paths_1.ScriptPath)(name);
//delete error file if it exists
if ((0, fs_1.existsSync)(path.error)) {
(0, fs_1.unlinkSync)(path.error);
}
if (!name.endsWith('_') &&
(0, fs_1.existsSync)(path.dir) &&
(0, fs_1.lstatSync)(path.dir).isDirectory() &&
@@ -72,6 +73,10 @@ if (!(0, fs_1.existsSync)('package.json') || !(0, fs_1.lstatSync)('package.json'
meta,
error,
});
//write error file
if (error !== null) {
(0, fs_1.writeFileSync)(path.error, `${new Date().toISOString()}\n\n${error}`);
}
}
}
(0, readmefile_1.updateReadmeFile)(scriptMeta);