v1.0.5
fixed watching for meta.json changes
This commit is contained in:
21
lib/main.js
21
lib/main.js
@@ -34,6 +34,7 @@ const readmefile_1 = require("./readmefile");
|
||||
const build_1 = __importDefault(require("./build"));
|
||||
const Path = __importStar(require("path"));
|
||||
const paths_1 = __importDefault(require("./paths"));
|
||||
const chokidar = __importStar(require("chokidar"));
|
||||
exports.CLIArgs = (0, command_line_args_1.default)([
|
||||
{ name: 'watch', alias: 'w', type: Boolean, defaultValue: false },
|
||||
{ name: 'minify', alias: 'm', type: Boolean, defaultValue: false },
|
||||
@@ -139,15 +140,23 @@ async function doCompile() {
|
||||
(0, fs_1.existsSync)(path.main) &&
|
||||
(0, fs_1.lstatSync)(path.main).isFile()) {
|
||||
let id = scriptMeta.length;
|
||||
function update(result) {
|
||||
console.log('WATCH', name, result.meta.version);
|
||||
scriptMeta[id] = result;
|
||||
scriptMeta[id] = await (0, build_1.default)(name);
|
||||
console.log(name, scriptMeta[id].meta.version);
|
||||
var running = false;
|
||||
async function update(eventName) {
|
||||
if (running) {
|
||||
return;
|
||||
}
|
||||
running = true;
|
||||
scriptMeta[id] = await (0, build_1.default)(name);
|
||||
console.log(`WATCH ${eventName}`, name, scriptMeta[id].meta.version);
|
||||
if (exports.CLIArgs.readme)
|
||||
(0, readmefile_1.updateReadmeFile)(scriptMeta);
|
||||
running = false;
|
||||
}
|
||||
if (exports.CLIArgs.watch) {
|
||||
chokidar.watch(path.dir).on('all', update);
|
||||
}
|
||||
let result = await (0, build_1.default)(name, update);
|
||||
console.log(name, result.meta.version);
|
||||
scriptMeta[id] = result;
|
||||
}
|
||||
}
|
||||
return scriptMeta;
|
||||
|
||||
Reference in New Issue
Block a user