fixed watch
This commit is contained in:
18
lib/main.js
18
lib/main.js
@@ -30,32 +30,16 @@ if (!(0, fs_1.existsSync)('package.json') || !(0, fs_1.lstatSync)('package.json'
|
||||
(0, fs_1.lstatSync)(path.main).isFile()) {
|
||||
let id = scriptMeta.length;
|
||||
function postWatchUpdate(meta, error) {
|
||||
console.log('watch callback');
|
||||
scriptMeta[id] = { meta, error };
|
||||
doErrorFile(path.error, (0, paths_1.DistPath)(name), error);
|
||||
console.log('WATCH', name, meta.version);
|
||||
(0, readmefile_1.updateReadmeFile)(scriptMeta);
|
||||
}
|
||||
let [meta, error] = await (0, build_1.default)(name, CLIArgs.watch ? postWatchUpdate : false);
|
||||
scriptMeta[id] = { meta, error };
|
||||
console.log(name, meta.version);
|
||||
doErrorFile(path.error, (0, paths_1.DistPath)(name), error);
|
||||
}
|
||||
}
|
||||
(0, readmefile_1.updateReadmeFile)(scriptMeta);
|
||||
console.log('\nFinished Compiling\n');
|
||||
if (CLIArgs.watch)
|
||||
console.log('Listening for Changes\n');
|
||||
console.log(`\nFinished Compiling\n${CLIArgs.watch ? 'Listening for Changes\n' : ''}`);
|
||||
})();
|
||||
function doErrorFile(pathError, pathOutFile, error) {
|
||||
if (error !== null) {
|
||||
(0, fs_1.writeFileSync)(pathError, `${new Date().toISOString()}\n\n${error}`);
|
||||
if ((0, fs_1.existsSync)(pathOutFile)) {
|
||||
(0, fs_1.unlinkSync)(pathOutFile);
|
||||
}
|
||||
}
|
||||
else if ((0, fs_1.existsSync)(pathError)) {
|
||||
(0, fs_1.unlinkSync)(pathError);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=main.js.map
|
||||
Reference in New Issue
Block a user