error file output
This commit is contained in:
11
lib/main.js
11
lib/main.js
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user