本文整理汇总了TypeScript中gulp.parallel函数的典型用法代码示例。如果您正苦于以下问题:TypeScript parallel函数的具体用法?TypeScript parallel怎么用?TypeScript parallel使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parallel函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: debounce
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);
示例2: copyMarkup
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);
}
示例3: debounce
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);
示例4: readProjectConfiguration
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();
}
示例5: async
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"));
示例6: onChange
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;
示例7: reject
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)
)
示例8:
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
)
);
示例9: task
// 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'))
示例10: Karma
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 };