Tag: 吞吐

Gulp如何知道asynchronous依赖任务何时完成(特别是“gulp-connect”)?

学习Gulp,我看到这个简单的例子,在完成第一个任务后运行第二个任务: var gulp = require('gulp'); var connect = require('gulp-connect'); // First task gulp.task('connect', function() { // No callback is provided to Gulp to indicate when the server is connected! connect.server(); }); // Second task runs after the first task 'completes' gulp.task('open', ['connect'], function() { // vvv // Question: since no callback is provided to indicate […]

`npm run gulp`找不到模块'gulp-shell'?

我已经删除了node modules文件夹并使用npm install命令安装了npm。 我的gulpfile.js也是完美的,因为其他人正在使用这个configuration完美,即使我从我的另一台机器做了这个configuration。 但是当我尝试从当前机器运行npm run gulp ,它会显示下面的错误。 Fahads-MacBook-Pro:dark-web jim$ npm run gulp > jetaport@1.0.0 gulp /Users/jim/Documents/JETAPORT/dark-web > gulp module.js:327 throw err; ^ Error: Cannot find module 'gulp-shell' at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load (module.js:276:25) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object.<anonymous> (/Users/jim/Documents/JETAPORT/dark-web/gulpfile.js:6:13) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) […]

摩卡返回“callback不是一个函数”asynchronous调用

我正尝试使用nodejs(es6 + babel)和mocha一起。 这是我testing的基类: import cheerio from 'cheerio'; import ResourceRequest from './ResourceRequest'; export default class HtmlValueParser { constructor(url, headers) { this.rr = new ResourceRequest(url, headers); this.body = null; this.$ = null; } getValue(query) { if (!query) { return; } if (this.$ === null){ this.$ = cheerio.load(this.body); return 'toto'; }else { return 'titi'; } } getAValue(query, […]

child_process.exec / spawn使用npm install命令(通过Gulp / Shipit)触发callback/closures

我正在使用Shipit进行部署。 在部署时,Shipit将当前的Git Sha检查到一个tmp目录,然后运行npm install ,然后执行gulp build ,然后继续部署。 Shipit使用Orchestrator来完成任务stream程,就像Gulp一样。 Shipit有它自己的CLI,所以我可以使用shipit development deploy 。 上面的所有东西都起作 我想要做的是创build一个gulp deploy任务,将直接初始化Shipit,而不是使用CLI。 看起来像这样: gulp.task('shipit:deploy', function() { var deployToEnv = argv['deploy-to'] || false; var shipit; return inquirer.prompt([{ type: 'list', name: 'deployToEnv', default: deployToEnv, message: 'Deploy to environment:', choices: envs }]).then(function(answers) { deployToEnv = answers.deployToEnv; shipit = new Shipit({environment: deployToEnv}); shipit.initialize(); shipit.start('deploy'); }); }); […]