changed watch callback
This commit is contained in:
11
lib/main.js
11
lib/main.js
@@ -31,14 +31,14 @@ if (!(0, fs_1.existsSync)('package.json') || !(0, fs_1.lstatSync)('package.json'
|
||||
let id = scriptMeta.length;
|
||||
function postWatchUpdate(meta, error) {
|
||||
scriptMeta[id] = { meta, error };
|
||||
doErrorFile(path.error, 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, postWatchUpdate);
|
||||
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, error);
|
||||
doErrorFile(path.error, (0, paths_1.DistPath)(name), error);
|
||||
}
|
||||
}
|
||||
(0, readmefile_1.updateReadmeFile)(scriptMeta);
|
||||
@@ -46,9 +46,12 @@ if (!(0, fs_1.existsSync)('package.json') || !(0, fs_1.lstatSync)('package.json'
|
||||
if (CLIArgs.watch)
|
||||
console.log('Listening for Changes\n');
|
||||
})();
|
||||
function doErrorFile(pathError, error) {
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user