let refresh = debounce(() => { if (isBuilding) { log('Watcher: A build is already in progress, deferring change detection...'); return; } isBuilding = true; let paths = pendingRefreshPaths.splice(0); let refreshTasks = []; // determine which tasks need to be executed // based on the files that have changed for (let watcher of watches) { if (Array.isArray(watcher.source)) { for(let source of watcher.source) { if (paths.find(path => minimatch(path, source))) { refreshTasks.push(watcher); } } } else { if (paths.find(path => minimatch(path, watcher.source))) { refreshTasks.push(watcher); } } } if (refreshTasks.length === 0) { log('Watcher: No relevant changes found, skipping next build.'); isBuilding = false; return; } log(`Watcher: Running ${refreshTasks.map(x => x.name).join(', ')} tasks on next build...`); let toExecute = gulp.series( readProjectConfiguration, gulp.parallel(refreshTasks.map(x => x.callback)), writeBundles, (done) => { isBuilding = false; watchCallback(); done(); if (pendingRefreshPaths.length > 0) { log('Watcher: Found more pending changes after finishing build, triggering next one...'); refresh(); } } ); toExecute(); }, debounceWaitTime);
export default function copyMarkup() { const tasks = []; for (const moduleName in project.plugin.outputs) { const task = `markup-${moduleName}`; gulp.task(task, () => { return gulp .src(path.join(root, project.plugin.src, '**/*.html')) .pipe(gulp.dest(path.join(project.plugin.output, moduleName))) }) tasks.push(task); } return gulp.parallel(tasks); }
let refresh = debounce(() => { if (isBuilding) { log('Watcher: A build is already in progress, deferring change detection...'); return; } isBuilding = true; let paths = pendingRefreshPaths.splice(0); let refreshTasks = []; // Dynamically compose tasks for (let src of Object.keys(watches)) { if (paths.find((x) => minimatch(x, src))) { log(`Watcher: Adding ${watches[src].name} task to next build...`); refreshTasks.push(watches[src].callback); } } if (refreshTasks.length === 0) { log('Watcher: No relevant changes found, skipping next build.'); isBuilding = false; return; } let toExecute = gulp.series( readProjectConfiguration, gulp.parallel(refreshTasks), writeBundles, (done) => { isBuilding = false; watchCallback(); done(); if (pendingRefreshPaths.length > 0) { log('Watcher: Found more pending changes after finishing build, triggering next one...'); refresh(); } } ); toExecute(); }, debounceWaitTime);
import * as gulp from 'gulp'; import transpile from './transpile'; import processMarkup from './process-markup'; import processCSS from './process-css'; import {build} from 'aurelia-cli'; import * as project from '../aurelia.json'; import tslint from './tslint'; import copyToPhoneGap from './copy-to-phone-gap'; export default gulp.series( readProjectConfiguration, gulp.parallel( transpile, processMarkup, processCSS ), tslint, writeBundles, copyToPhoneGap ); function readProjectConfiguration() { return build.src(project); } function writeBundles() { return build.dest(); }
cwd: codeExtensionSourcesPath }); }); gulp.task("cov:report:integration", gulp.series("cov:merge", async () => { return spawnNode([ codecovPath, '-f', path.join(integrationTestCoverageRootPath, 'lcov.info'), '-F', 'integration' ], { cwd: codeExtensionSourcesPath }); })); gulp.task("cov:report:unit", async () => { return spawnNode([ codecovPath, '-f', path.join(unitTestCoverageRootPath, 'lcov.info'), '-F', 'unit' ], { cwd: codeExtensionSourcesPath }); }); gulp.task("cov:report", gulp.parallel("cov:report:integration", "cov:report:unit"));
function onChange(path) { log(`File Changed: ${path}`); } let karma = done => { new Karma({ configFile: __dirname + '/../../karma.conf.js', singleRun: !CLIOptions.hasFlag('watch') }, done).start(); }; let unit; if (CLIOptions.hasFlag('watch')) { unit = gulp.series( build, gulp.parallel( watch(build, onChange), karma ) ); } else { unit = gulp.series( build, karma ); } export default unit;
socket.on('error', err => console.error('WebSocket proxy error:', err)), }, }, }) return new Promise<void>((resolve, reject) => { server.listen(3080, '127.0.0.1', (err?: Error) => { if (err) { reject(err) } else { resolve() } }) }) } /** * Builds everything. */ export const build = gulp.parallel( gulp.series(gulp.parallel(schema, graphQLTypes), gulp.parallel(webpack, phabricator)) ) /** * Watches everything and rebuilds on file changes. */ export const watch = gulp.series( // Ensure the typings that TypeScript depends on are build to avoid first-time-run errors gulp.parallel(schema, graphQLTypes), gulp.parallel(watchSchema, watchGraphQLTypes, webpackDevServer, watchPhabricator) )
import * as gulp from 'gulp'; import clean from './clean'; import buildStyles from './build-styles'; import buildJavaScript from './build-javascript'; import buildMarkup from './build-markup'; export default gulp.series( clean, gulp.parallel( buildJavaScript, buildMarkup, buildStyles ) );
// tslint:disable:no-import-side-effect no-implicit-dependencies import { parallel, series, task } from 'gulp' import './backend' import './dev-server' import './pre-check' import './proxy' task('integration', series('preCheck', parallel('devServer', 'proxy'), 'backend'))
import {CLIOptions} from 'aurelia-cli'; import build from './build'; import watch from './watch'; import * as path from 'path'; let karma = done => { new Karma({ configFile: path.join(__dirname, '/../../karma.conf.js'), singleRun: !CLIOptions.hasFlag('watch') }, done).start(); }; let unit; if (CLIOptions.hasFlag('watch')) { unit = gulp.series( build, gulp.parallel( done => { watch(); done(); }, karma ) ); } else { unit = gulp.series( build, karma ); } export { unit as default };