UNPKG

nx-mesh

Version:
38 lines 1.51 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.watcher = void 0; const tslib_1 = require("tslib"); const devkit_1 = require("@nrwl/devkit"); const watchpack_1 = tslib_1.__importDefault(require("watchpack")); function watcher(func, options) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const { dir, watch } = options, watcherOptions = tslib_1.__rest(options, ["dir", "watch"]); if (watch === true) { const wp = new watchpack_1.default(Object.assign(Object.assign({}, watcherOptions), { ignored: [ '.eslintrc.json', '.swcrc', '**/.codegen', '**/.git', '**/.mesh', '**/node_modules', 'jest.config.ts', 'project.json', ] })); wp.watch({ directories: [dir], startTime: 0 }); wp.on('aggregated', () => tslib_1.__awaiter(this, void 0, void 0, function* () { yield func(); devkit_1.logger.info(''); devkit_1.logger.info(''); devkit_1.logger.info('Watching for changes...'); })); yield new Promise(() => { // This Promise intentionally never resolves, leaving the process running. }); } else { yield func(); } }); } exports.watcher = watcher; //# sourceMappingURL=watcher.js.map