This commit is contained in:
2022-06-08 10:06:30 -05:00
parent afa8797823
commit 588ee08d10
3 changed files with 18 additions and 6 deletions

View File

@@ -36,8 +36,15 @@ async function compileProject(name) {
error = e.message;
}
//add UserScript header
let content = (0, fs_1.readFileSync)(outPath).toString();
(0, fs_1.writeFileSync)(outPath, metaString + content);
if ((0, fs_1.lstatSync)(outPath).isFile()) {
if (!error) {
let content = (0, fs_1.readFileSync)(outPath).toString();
(0, fs_1.writeFileSync)(outPath, metaString + content);
}
else {
(0, fs_1.unlinkSync)(outPath);
}
}
return [metaJson, error];
}
if (!(0, fs_1.lstatSync)('package.json').isFile()) {