Compare commits
38 Commits
Author | SHA1 | Date | |
---|---|---|---|
e10c31c740 | |||
af68a92702 | |||
a8c3fa048a | |||
bea33fa29f | |||
739542bda1 | |||
63cf7091a1 | |||
04d7f9cf7e | |||
afc9fd122f | |||
a3dec7bb8a | |||
0e725c3fb4 | |||
6cd0ee78a3 | |||
b037dc99df | |||
27439d84cd | |||
ada13619d0 | |||
9ae1a40260 | |||
e19184e29b | |||
36e02502d0 | |||
75219a5474 | |||
8f0ecb3f4a | |||
ec18663137 | |||
a476cf8c99 | |||
5af3185742 | |||
81849dc5eb | |||
51b9088d3e | |||
375b43a11c | |||
5b0a1edaa4 | |||
855e9b48c8 | |||
99db113285 | |||
844812311e | |||
555c696a8e | |||
879248f049 | |||
bb607eca9b | |||
f094f80531 | |||
71bdcce41d | |||
5a9cd96bed | |||
0f659ad60a | |||
395cb7d8a2 | |||
6284fa71d1 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,6 +2,9 @@ node_modules/
|
|||||||
.settings/
|
.settings/
|
||||||
.idea/
|
.idea/
|
||||||
coverage/
|
coverage/
|
||||||
|
docs/
|
||||||
|
public/
|
||||||
|
pages/
|
||||||
|
|
||||||
ts/*.js
|
ts/*.js
|
||||||
ts/*.js.map
|
ts/*.js.map
|
||||||
|
53
.gitlab-ci.yml
Normal file
53
.gitlab-ci.yml
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
image: hosttoday/ht-docker-node:npmts
|
||||||
|
stages:
|
||||||
|
- test
|
||||||
|
- release
|
||||||
|
- trigger
|
||||||
|
- pages
|
||||||
|
testLEGACY:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- npmci test legacy
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
allow_failure: true
|
||||||
|
testLTS:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- npmci test lts
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
testSTABLE:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- npmci test stable
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
release:
|
||||||
|
stage: release
|
||||||
|
script:
|
||||||
|
- npmci publish
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
trigger:
|
||||||
|
stage: trigger
|
||||||
|
script:
|
||||||
|
- npmci trigger
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
pages:
|
||||||
|
image: hosttoday/ht-docker-node:npmpage
|
||||||
|
stage: pages
|
||||||
|
script:
|
||||||
|
- npmci command npmpage --host gitlab
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
paths:
|
||||||
|
- public
|
@ -1,3 +1,5 @@
|
|||||||
ts/
|
ts/
|
||||||
test/
|
test/
|
||||||
|
docs/
|
||||||
|
coverage/
|
||||||
node_modules/
|
node_modules/
|
||||||
|
14
.travis.yml
14
.travis.yml
@ -1,14 +0,0 @@
|
|||||||
language: node_js
|
|
||||||
node_js:
|
|
||||||
- 4.2.4
|
|
||||||
deploy:
|
|
||||||
provider: npm
|
|
||||||
email: npm@lossless.digital
|
|
||||||
api_key:
|
|
||||||
secure: TWN/oiICeNbAhGTbwf75FnKhXnIvyA66FhNF7C0jpjn2SChSgTANai87r0f9oU9ZP3307XdGHB+fTTCJnk3upNiBoWZnkV8skkAlseOY4mVzF9mS0ZEkxVR32FjJDWfqzv6hC+Y9qNDsGs2+Avsm6fQUOispLXYAk6VzSQC1HgIfyOJtIWT5LqEyXyT6oJIZ7xwt1CYcIeEpHUiAaPYsMEpwF5OBDFByVmNV38VdRGIBsoQd3lixso7/zOOgYvjR4b/onz5WzeWYlhzAuyzOnRGr1r/9eXAzzkYydvgFx3ix5OlrreKVFB6OtMpz4jmHdu9YDGT5bcvL2bSU2SGVQM5Bx8zZXkAxACQR8ZvWmPaWYAWCu9wrW5oovjqFUV0iR26z/sTABJqz4GaXf/vFcll2EdTfUT6xj2kCodfxljaudjPUF27FSt1UJBC7jQky08wHb6+onrE8WoQXteIE2oxtHWEGOlV/GAz0+q4ih0bdOSKfThmux0iEFmeF16sWH9UdL2jBBKuus+fBPdhA3V6uwYQtsCAurhquQLISkf7kT3KujdLS302bEbkut+D1Kd22IYA1J0wYd87th88TZHx7wgQyC+8lVHG+B1R20xGLxyHVEOfyZtChfBRdn53EcUiA2XriJbfiIym4dAMUtOg2iRJamHAL7jebQEUu7oA=
|
|
||||||
on:
|
|
||||||
tags: true
|
|
||||||
repo: pushrocks/gulp-function
|
|
||||||
notifications:
|
|
||||||
slack:
|
|
||||||
secure: Bb8P3fboL52CugSsp0RhOkGCeWVbgjb+QDpnMHdSOa0Nequj8V4kvrzBLZOBOjaSB0/gMvdoB4Slv2bls1dAxXW1IX1DdRb3RLMKj/Owje7eTd4IoUuSs49y6/yEkVK+E1wicdwjlMmvsk8fQE/owDRMRXYoXxhN2ZOVSQvAQ3iBO0eokFvWO7yj/VSxKoITymCXA3LfyzXXUuhvxuQd3BPZCe25xa6GWuHtaa5fbJg17pp8jJX6VZYLSRcSYyJxMU8SLdkrOsQZKj0+/Yfpu7XTmPbqxjNapuE7Zm70mi+aB26IQCnmwkdcEQNJVxQOKoP2+/ZnDfcTLQROwH1PJVzol0hneH6DdOlWt9bvBJcUvFRwaDgIb5xXQV8bGsRe5ayE/4MgCgfvdBTvevu6n12fmPx74prIv4pOPMwlALjjP8XavGL4A6amOuV7fJiSyGAku8aUe1rlUXyfoHJswMyOfkIsvnGDE3eEfq1WUIjn8tW1ZozJyoCTAIh6IHPI3Nsg3LkTRvDHPYq25/xCKWxGb2OaJc3JeqVREqm0auDqj6HoVAi/mW/uyvwX9jEVX8fNoQ69ac5VUMFfn2Mx3sU6aHKgZe/tdrtql6NYtIA+g5/ZDnHE1mnbl6MfrYiKwRbrICH5v/u1xK+4+yh09BUqazi3PzOhyTRfba/gRUg=
|
|
49
README.md
49
README.md
@ -1,21 +1,30 @@
|
|||||||
# gulp-function
|
# gulp-function
|
||||||
accepts call to execute in gulp pipeline.
|
accepts call to execute in gulp pipeline.
|
||||||
|
|
||||||
### Status
|
## Availabililty
|
||||||
[](https://travis-ci.org/pushrocks/gulp-function)
|
[](https://www.npmjs.com/package/gulp-function)
|
||||||
|
[](https://gitlab.com/pushrocks/gulp-function)
|
||||||
|
[](https://github.com/pushrocks/gulp-function)
|
||||||
|
[](https://pushrocks.gitlab.io/gulp-function/)
|
||||||
|
|
||||||
|
## Status for master
|
||||||
|
[](https://gitlab.com/pushrocks/gulp-function/commits/master)
|
||||||
|
[](https://gitlab.com/pushrocks/gulp-function/commits/master)
|
||||||
[](https://david-dm.org/pushrocks/gulp-function)
|
[](https://david-dm.org/pushrocks/gulp-function)
|
||||||
[](https://david-dm.org/pushrocks/gulp-function#info=devDependencies)
|
[](https://www.bithound.io/github/pushrocks/gulp-function/master/dependencies/npm)
|
||||||
[](https://www.bithound.io/github/pushrocks/gulp-function)
|
[](https://www.bithound.io/github/pushrocks/gulp-function)
|
||||||
[](https://coveralls.io/github/pushrocks/gulp-function?branch=master)
|
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[](http://standardjs.com/)
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
```javascript
|
```javascript
|
||||||
var gulp = require("gulp");
|
let gulp = require("gulp");
|
||||||
var gulpFunction = require("gulp-function");
|
let gulpFunction = require("gulp-function");
|
||||||
var Q = require("q");
|
let Q = require("q");
|
||||||
|
|
||||||
var myFunction = function () {
|
let myFunction = function (file, enc) { // file and enc are optional in case you want to modify the file object
|
||||||
var done = Q.defer();
|
let done = Q.defer();
|
||||||
console.log("Hello World!")
|
console.log("Hello World!")
|
||||||
|
|
||||||
// NOTE:
|
// NOTE:
|
||||||
@ -27,12 +36,24 @@ var myFunction = function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gulp.task('gulpTest',function() {
|
gulp.task('gulpTest',function() {
|
||||||
gulp.src('./mydir/*.something')
|
let stream = gulp.src('./mydir/*.something')
|
||||||
.pipe(gulpFunction(myFunction,'forEach')) //read the notes below
|
.pipe(gulpFunction(myFunction,'forEach')) //read the notes below
|
||||||
.pipe(gulp.dest("./build/"))
|
.pipe(gulp.dest("./build/"));
|
||||||
|
return stream; // by returning the stream gulp knows when our task has finished.
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
> Note: The first argument of gulpFunction can also be an array of multiple functionnames.
|
### Notes:
|
||||||
Each function can return a promise. the pipe stop will finish when every promise is fullfilled.
|
|
||||||
> Note: the second argument can be empty (defaults to 'forEach') or 'atEnd'
|
* The first argument of gulpFunction can also be an **array of multiple functionnames**.
|
||||||
|
Each function can return a promise. The pipe stop will finish when every promise is fullfilled.
|
||||||
|
When providing an array of functions be careful with modifying the file object -> race condition
|
||||||
|
* The second argument can be empty, it defaults to "forEach"
|
||||||
|
* The following options are available:
|
||||||
|
* "forFirst" - executes when first chunk/vinylfile of the stream reaches the pipestop.
|
||||||
|
file is pushed further down the line when function's returned promise is fullfilled.
|
||||||
|
* "forEach" - executes like "forFirst" but with every chunk/vinylfile in the stream;
|
||||||
|
* "atEnd" - executes after all chunks have passed and are processed in full.
|
||||||
|
That means the stream's "finish" event fires **before "atLast" is executed**!!!
|
||||||
|
|
||||||
|
[](https://push.rocks)
|
||||||
|
5
dist/index.d.ts
vendored
Normal file
5
dist/index.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import 'typings-global';
|
||||||
|
export declare type TExecutionMode = 'forEach' | 'forFirst' | 'atEnd';
|
||||||
|
export interface IPromiseFunction {
|
||||||
|
(file?: any, enc?: any): PromiseLike<any>;
|
||||||
|
}
|
66
dist/index.js
vendored
Normal file
66
dist/index.js
vendored
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
"use strict";
|
||||||
|
require("typings-global");
|
||||||
|
const q = require("q");
|
||||||
|
const through2 = require("through2");
|
||||||
|
module.exports = (functionsToExecuteArg, executionModeArg = 'forEach') => {
|
||||||
|
let promiseArray = [];
|
||||||
|
let runFunction = function (functionArg, file, enc) {
|
||||||
|
let returnValue = functionArg(file, enc);
|
||||||
|
if (typeof returnValue !== 'undefined' && typeof returnValue.then !== 'undefined') {
|
||||||
|
promiseArray.push(returnValue);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let checkAndRunFunction = function (file, enc) {
|
||||||
|
if (typeof functionsToExecuteArg === 'function') {
|
||||||
|
runFunction(functionsToExecuteArg, file, enc);
|
||||||
|
}
|
||||||
|
else if (Array.isArray(functionsToExecuteArg)) {
|
||||||
|
for (let anyFunction in functionsToExecuteArg) {
|
||||||
|
runFunction(functionsToExecuteArg[anyFunction], file, enc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new Error('gulp-callfunction: something is strange with the given arguments');
|
||||||
|
}
|
||||||
|
return q.all(promiseArray);
|
||||||
|
};
|
||||||
|
let hasExecutedOnce = false;
|
||||||
|
let forEach = function (file, enc, cb) {
|
||||||
|
switch (executionModeArg) {
|
||||||
|
case 'forEach':
|
||||||
|
checkAndRunFunction(file, enc).then(function () {
|
||||||
|
cb(null, file);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'forFirst':
|
||||||
|
if (hasExecutedOnce) {
|
||||||
|
checkAndRunFunction(file, enc)
|
||||||
|
.then(function () {
|
||||||
|
cb(null, file);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cb(null, file);
|
||||||
|
}
|
||||||
|
hasExecutedOnce = true;
|
||||||
|
break;
|
||||||
|
case 'atEnd':
|
||||||
|
cb(null, file);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let atEnd = function (cb) {
|
||||||
|
if (executionModeArg === 'atEnd') {
|
||||||
|
checkAndRunFunction(null, null).then(function () {
|
||||||
|
cb();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cb();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return through2.obj(forEach, atEnd);
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBQ3ZCLHVCQUFzQjtBQUN0QixxQ0FBb0M7QUFTcEMsTUFBTSxDQUFDLE9BQU8sR0FBRyxDQUNiLHFCQUE0RCxFQUM1RCxnQkFBZ0IsR0FBbUIsU0FBUztJQUc1QyxJQUFJLFlBQVksR0FBRyxFQUFFLENBQUE7SUFDckIsSUFBSSxXQUFXLEdBQUcsVUFBVSxXQUFXLEVBQUUsSUFBSSxFQUFFLEdBQUc7UUFDOUMsSUFBSSxXQUFXLEdBQUcsV0FBVyxDQUFDLElBQUksRUFBRSxHQUFHLENBQUMsQ0FBQTtRQUN4QyxFQUFFLENBQUMsQ0FBQyxPQUFPLFdBQVcsS0FBSyxXQUFXLElBQUksT0FBTyxXQUFXLENBQUMsSUFBSSxLQUFLLFdBQVcsQ0FBQyxDQUFDLENBQUM7WUFDaEYsWUFBWSxDQUFDLElBQUksQ0FBQyxXQUFXLENBQUMsQ0FBQTtRQUNsQyxDQUFDO0lBQ0wsQ0FBQyxDQUFBO0lBRUQsSUFBSSxtQkFBbUIsR0FBRyxVQUFVLElBQUksRUFBRSxHQUFHO1FBQ3pDLEVBQUUsQ0FBQyxDQUFDLE9BQU8scUJBQXFCLEtBQUssVUFBVSxDQUFDLENBQUMsQ0FBQztZQUM5QyxXQUFXLENBQUMscUJBQXFCLEVBQUUsSUFBSSxFQUFFLEdBQUcsQ0FBQyxDQUFBO1FBQ2pELENBQUM7UUFBQyxJQUFJLENBQUMsRUFBRSxDQUFDLENBQUMsS0FBSyxDQU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kFDVixDQUFDO2dCQUFDLElBQUksQ0FBQyxDQUFDO29CQUNKLEVBQUUsQ0FBQyxJQUFJLEVBQUUsSUFBSSxDQUFDLENBQUE7Z0JBQ2xCLENBQUM7Z0JBQ0QsZUFBZSxHQUFHLElBQUksQ0FBQTtnQkFDdEIsS0FBSyxDQUFBO1lBQ1QsS0FBSyxPQUFPO2dCQUNSLEVBQUUsQ0FBQyxJQUFJLEVBQUUsSUFBSSxDQUFDLENBQUE7Z0JBQ2QsS0FBSyxDQUFBO1lBQ1Q7Z0JBQ0ksS0FBSyxDQUFBO1FBQ2IsQ0FBQztJQUNMLENBQUMsQ0FBQTtJQUVELElBQUksS0FBSyxHQUFHLFVBQVUsRUFBRTtRQUNwQixFQUFFLENBQUMsQ0FBQyxnQkFBZ0IsS0FBSyxPQUFPLENBQUMsQ0FBQyxDQUFDO1lBQy9CLG1CQUFtQixDQUFDLElBQUksRUFBRSxJQUFJLENBQUMsQ0FBQyxJQUFJLENBQUM7Z0JBQ2pDLEVBQUUsRUFBRSxDQUFBO1lBQ1IsQ0FBQyxDQUFDLENBQUE7UUFDTixDQUFDO1FBQUMsSUFBSSxDQUFDLENBQUM7WUFDSixFQUFFLEVBQUUsQ0FBQTtRQUNSLENBQUM7SUFDTCxDQUFDLENBQUE7SUFDRCxNQUFNLENBQUMsUUFBUSxDQUFDLEdBQUcsQ0FBQyxPQUFPLEVBQUUsS0FBSyxDQUFDLENBQUE7QUFDdkMsQ0FBQyxDQUFBIn0=
|
6
index.d.ts
vendored
6
index.d.ts
vendored
@ -1,6 +0,0 @@
|
|||||||
/// <reference path="ts/typings/main.d.ts" />
|
|
||||||
declare var plugins: {
|
|
||||||
beautylog: any;
|
|
||||||
Q: any;
|
|
||||||
through: any;
|
|
||||||
};
|
|
57
index.js
57
index.js
@ -1,57 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
/// <reference path="typings/main.d.ts" />
|
|
||||||
var plugins = {
|
|
||||||
beautylog: require("beautylog"),
|
|
||||||
Q: require("q"),
|
|
||||||
through: require("through2")
|
|
||||||
};
|
|
||||||
module.exports = function (functionsToExecuteArg, executionModeArg) {
|
|
||||||
if (executionModeArg === void 0) { executionModeArg = 'forEach'; }
|
|
||||||
//important vars
|
|
||||||
var executionMode = executionModeArg; //can be forEach or atEnd
|
|
||||||
var functionsToExecute = functionsToExecuteArg;
|
|
||||||
var promiseArray = [];
|
|
||||||
var runFunction = function (functionArg) {
|
|
||||||
var returnValue = functionArg();
|
|
||||||
if (typeof returnValue !== "undefined" && typeof returnValue.then !== "undefined") {
|
|
||||||
promiseArray.push(returnValue);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var checkAndRunFunction = function () {
|
|
||||||
if (typeof functionsToExecute === "function") {
|
|
||||||
runFunction(functionsToExecute);
|
|
||||||
}
|
|
||||||
else if (Array.isArray(functionsToExecute)) {
|
|
||||||
for (var anyFunction in functionsToExecute) {
|
|
||||||
runFunction(functionsToExecute[anyFunction]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
plugins.beautylog.error('gulp-callfunction: something is strange with the given arguments');
|
|
||||||
}
|
|
||||||
return plugins.Q.all(promiseArray);
|
|
||||||
};
|
|
||||||
var forEach = function (file, enc, cb) {
|
|
||||||
if (executionMode === 'forEach') {
|
|
||||||
checkAndRunFunction().then(function () {
|
|
||||||
cb(null, file);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cb(null, file);
|
|
||||||
}
|
|
||||||
//tell gulp that we are complete
|
|
||||||
};
|
|
||||||
var atEnd = function (cb) {
|
|
||||||
if (executionMode === "atEnd") {
|
|
||||||
checkAndRunFunction().then(function () {
|
|
||||||
cb();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cb();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return plugins.through.obj(forEach, atEnd);
|
|
||||||
};
|
|
5
npmextra.json
Normal file
5
npmextra.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"npmts": {
|
||||||
|
"mode": "default"
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"mode":"default",
|
|
||||||
"coveralls":true
|
|
||||||
}
|
|
23
package.json
23
package.json
@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "gulp-function",
|
"name": "gulp-function",
|
||||||
"version": "1.1.0",
|
"version": "2.0.2",
|
||||||
"description": "accepts a function call as parameter to execute in gulp pipeline",
|
"description": "accepts a function call as parameter to execute in gulp pipeline",
|
||||||
"main": "index.js",
|
"main": "dist/index.js",
|
||||||
|
"typings": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npmts)",
|
"test": "(npmts)",
|
||||||
"reinstall": "(rm -r node_modules && npm install)",
|
"reinstall": "(rm -r node_modules && npm install)",
|
||||||
@ -11,26 +12,30 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/pushrocks/gulp-function.git"
|
"url": "https://gitlab.com/pushrocks/gulp-function.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"gulpplugin",
|
"gulpplugin",
|
||||||
"gulp",
|
"gulp",
|
||||||
"function"
|
"function"
|
||||||
],
|
],
|
||||||
"author": "Smart Coordination GmbH <office@push.rocks> (https://push.rocks)",
|
"author": "Lossless GmbH <office@lossless.com> (https://lossless.com)",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/pushrocks/gulp-function/issues"
|
"url": "https://gitlab.com/pushrocks/gulp-function/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/pushrocks/gulp-function",
|
"homepage": "https://gitlab.com/pushrocks/gulp-function",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"beautylog": "^2.1.1",
|
"@types/q": "0.0.32",
|
||||||
|
"@types/through2": "^2.0.31",
|
||||||
"q": "^1.4.1",
|
"q": "^1.4.1",
|
||||||
"through2": "^2.0.1"
|
"through2": "^2.0.1",
|
||||||
|
"typings-global": "^1.0.14"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"beautylog": "^6.0.0",
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
"npmts": "^2.2.3"
|
"npmts-g": "^5.2.8",
|
||||||
|
"typings-test": "^1.0.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
9
test/test.d.ts
vendored
9
test/test.d.ts
vendored
@ -1,8 +1 @@
|
|||||||
/// <reference path="ts/typings/main.d.ts" />
|
import "typings-test";
|
||||||
declare var gulp: any;
|
|
||||||
declare var gulpFunction: any;
|
|
||||||
declare var beautylog: any;
|
|
||||||
declare var Q: any;
|
|
||||||
declare var myFunction: () => any;
|
|
||||||
declare var myFunction2: () => any;
|
|
||||||
declare var myFunction3: () => any;
|
|
||||||
|
65
test/test.js
65
test/test.js
File diff suppressed because one or more lines are too long
1
test/test.js.map
Normal file
1
test/test.js.map
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,IAAI,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC3B,IAAI,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC/C,IAAI,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AACrC,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;AAErB,IAAI,UAAU,GAAG;IACb,IAAI,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,CAAA;IACpB,SAAS,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACnC,IAAI,CAAC,OAAO,EAAE,CAAC;IACf,MAAM,CAAC,IAAI,CAAC,OAAO,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AY,CAAC,eAAe,EAAC,OAAO,CAAC,CAAC,CAAC;QAEjD,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAC;YACf,SAAS,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YAClC,IAAI,EAAE,CAAC;QACX,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
118
test/test.ts
Normal file
118
test/test.ts
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
import "typings-test"
|
||||||
|
var gulp = require("gulp");
|
||||||
|
var gulpFunction = require("../dist/index.js");
|
||||||
|
var beautylog = require("beautylog");
|
||||||
|
var Q = require("q");
|
||||||
|
|
||||||
|
var myFunction = function () {
|
||||||
|
var done = Q.defer()
|
||||||
|
beautylog.log("Function executed");
|
||||||
|
done.resolve();
|
||||||
|
return done.promise;
|
||||||
|
};
|
||||||
|
var myFunction2 = function () {
|
||||||
|
var done = Q.defer();
|
||||||
|
beautylog.ok("Function2 executed");
|
||||||
|
done.resolve();
|
||||||
|
return done.promise;
|
||||||
|
};
|
||||||
|
var myFunction3 = function () {
|
||||||
|
var done = Q.defer();
|
||||||
|
beautylog.success("Function3 executed");
|
||||||
|
done.resolve();
|
||||||
|
return done.promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
var beforeFunction = function () {
|
||||||
|
var done = Q.defer();
|
||||||
|
beautylog.success("beforeFunction executed");
|
||||||
|
done.resolve();
|
||||||
|
return done.promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
var middleFunctionRun = false;
|
||||||
|
|
||||||
|
var middleFunction = function () {
|
||||||
|
var done = Q.defer();
|
||||||
|
beautylog.success("middleFunction executed");
|
||||||
|
setTimeout(function(){
|
||||||
|
beautylog.log("timeout fired");
|
||||||
|
middleFunctionRun = true;
|
||||||
|
done.resolve();
|
||||||
|
}, 500);
|
||||||
|
return done.promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
var afterFunction = function () {
|
||||||
|
var done = Q.defer();
|
||||||
|
beautylog.success("afterFunction executed");
|
||||||
|
done.resolve();
|
||||||
|
return done.promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
let timeoutFunction = function(){
|
||||||
|
var done = Q.defer();
|
||||||
|
setTimeout(function(){
|
||||||
|
beautylog.log("largeTimeout fired");
|
||||||
|
done.resolve();
|
||||||
|
},2000);
|
||||||
|
return done.promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
describe("gulpFunction",function(){
|
||||||
|
it("should run through smoothly with " + "'forEach'".blue,function(done){
|
||||||
|
gulp.src('./test/*.md')
|
||||||
|
.pipe(gulpFunction(myFunction,'forEach'))
|
||||||
|
.pipe(gulp.dest("./test/result/"));
|
||||||
|
|
||||||
|
gulp.src('./test/*.md')
|
||||||
|
.pipe(gulpFunction([myFunction2,myFunction3],'forEach'))
|
||||||
|
.pipe(gulp.dest("./test/result/"))
|
||||||
|
.pipe(gulpFunction(done,"atEnd"));
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should run through smoothly with " + "'atEnd'".blue,function(done){
|
||||||
|
gulp.src('./test/*.md')
|
||||||
|
.pipe(gulpFunction(myFunction,'atEnd'))
|
||||||
|
.pipe(gulp.dest("./test/result/"));
|
||||||
|
|
||||||
|
gulp.src('./test/*.md')
|
||||||
|
.pipe(gulpFunction([myFunction2,myFunction3],'atEnd'))
|
||||||
|
.pipe(gulp.dest("./test/result/"))
|
||||||
|
.pipe(gulpFunction(done,"atEnd"));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should run through smoothly once with " + "'atFirst'".blue,function(done){
|
||||||
|
|
||||||
|
gulp.src('./test/*.md')
|
||||||
|
.pipe(gulpFunction([myFunction2,myFunction3],'forFirst'))
|
||||||
|
.pipe(gulp.dest("./test/result/"))
|
||||||
|
.pipe(gulpFunction(done,"atEnd"));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should run in order",function(done){
|
||||||
|
this.timeout(5000);
|
||||||
|
let stream = gulp.src('./test/*.md')
|
||||||
|
.pipe(gulpFunction([beforeFunction,middleFunction,middleFunction],'atEnd'))
|
||||||
|
.pipe(gulpFunction(function(){
|
||||||
|
beautylog.log("stream progressed");
|
||||||
|
var done2 = Q.defer();
|
||||||
|
done2.resolve();
|
||||||
|
return done2.promise;
|
||||||
|
},"forEach"))
|
||||||
|
.pipe(gulpFunction(function(){
|
||||||
|
beautylog.log("nextStep");
|
||||||
|
}))
|
||||||
|
.pipe(gulpFunction(afterFunction,"atEnd"))
|
||||||
|
.pipe(gulpFunction(timeoutFunction,"atEnd"));
|
||||||
|
|
||||||
|
stream.on("finish",function(){
|
||||||
|
beautylog.info("stream finished");
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
109
ts/index.ts
109
ts/index.ts
@ -1,60 +1,75 @@
|
|||||||
/// <reference path="typings/main.d.ts" />
|
import 'typings-global'
|
||||||
|
import * as q from 'q'
|
||||||
|
import * as through2 from 'through2'
|
||||||
|
import { Transform } from 'stream'
|
||||||
|
|
||||||
var plugins = {
|
export type TExecutionMode = 'forEach' | 'forFirst' | 'atEnd'
|
||||||
beautylog: require("beautylog"),
|
|
||||||
Q: require("q"),
|
export interface IPromiseFunction {
|
||||||
through: require("through2")
|
(file?, enc?): PromiseLike<any>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports = (
|
||||||
|
functionsToExecuteArg: IPromiseFunction | IPromiseFunction[],
|
||||||
|
executionModeArg: TExecutionMode = 'forEach'
|
||||||
|
): Transform => {
|
||||||
|
|
||||||
|
let promiseArray = []
|
||||||
|
let runFunction = function (functionArg, file, enc) {
|
||||||
module.exports = function (functionsToExecuteArg:any|any[],executionModeArg:string = 'forEach') {
|
let returnValue = functionArg(file, enc)
|
||||||
//important vars
|
if (typeof returnValue !== 'undefined' && typeof returnValue.then !== 'undefined') {
|
||||||
var executionMode = executionModeArg; //can be forEach or atEnd
|
promiseArray.push(returnValue)
|
||||||
var functionsToExecute = functionsToExecuteArg;
|
|
||||||
var promiseArray = [];
|
|
||||||
var runFunction = function(functionArg){
|
|
||||||
var returnValue = functionArg();
|
|
||||||
if (typeof returnValue !== "undefined" && typeof returnValue.then !== "undefined") {
|
|
||||||
promiseArray.push(returnValue);
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
var checkAndRunFunction = function () {
|
let checkAndRunFunction = function (file, enc) {
|
||||||
if (typeof functionsToExecute === "function" ) {
|
if (typeof functionsToExecuteArg === 'function') {
|
||||||
runFunction(functionsToExecute);
|
runFunction(functionsToExecuteArg, file, enc)
|
||||||
} else if (Array.isArray(functionsToExecute)) {
|
} else if (Array.isArray(functionsToExecuteArg)) {
|
||||||
for (var anyFunction in functionsToExecute) {
|
for (let anyFunction in functionsToExecuteArg) {
|
||||||
runFunction(functionsToExecute[anyFunction]);
|
runFunction(functionsToExecuteArg[anyFunction], file, enc)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
plugins.beautylog.error('gulp-callfunction: something is strange with the given arguments');
|
throw new Error('gulp-callfunction: something is strange with the given arguments')
|
||||||
}
|
}
|
||||||
return plugins.Q.all(promiseArray);
|
return q.all(promiseArray)
|
||||||
};
|
}
|
||||||
|
|
||||||
|
let hasExecutedOnce = false
|
||||||
|
let forEach = function (file, enc, cb) { // the forEach function is called for every chunk
|
||||||
|
switch (executionModeArg) {
|
||||||
|
case 'forEach':
|
||||||
|
checkAndRunFunction(file, enc).then(function () {
|
||||||
|
cb(null, file)
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 'forFirst':
|
||||||
|
if (hasExecutedOnce) {
|
||||||
|
checkAndRunFunction(file, enc)
|
||||||
|
.then(function () {
|
||||||
|
cb(null, file)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
cb(null, file)
|
||||||
|
}
|
||||||
|
hasExecutedOnce = true
|
||||||
|
break
|
||||||
|
case 'atEnd':
|
||||||
|
cb(null, file)
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var forEach = function (file, enc, cb) {
|
let atEnd = function (cb) {
|
||||||
if (executionMode === 'forEach') {
|
if (executionModeArg === 'atEnd') {
|
||||||
checkAndRunFunction().then(function(){
|
checkAndRunFunction(null, null).then(function () {
|
||||||
cb(null, file);
|
cb()
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
cb(null, file);
|
cb()
|
||||||
}
|
}
|
||||||
//tell gulp that we are complete
|
}
|
||||||
|
return through2.obj(forEach, atEnd)
|
||||||
};
|
}
|
||||||
|
|
||||||
var atEnd = function(cb) {
|
|
||||||
if (executionMode === "atEnd") {
|
|
||||||
checkAndRunFunction().then(function(){
|
|
||||||
cb();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
cb();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return plugins.through.obj(forEach,atEnd);
|
|
||||||
};
|
|
||||||
|
50
ts/test.ts
50
ts/test.ts
@ -1,50 +0,0 @@
|
|||||||
/// <reference path="typings/main.d.ts" />
|
|
||||||
var gulp = require("gulp");
|
|
||||||
var gulpFunction = require("../index.js");
|
|
||||||
var beautylog = require("beautylog");
|
|
||||||
var Q = require("q");
|
|
||||||
|
|
||||||
var myFunction = function () {
|
|
||||||
var done = Q.defer()
|
|
||||||
beautylog.log("Function executed");
|
|
||||||
done.resolve();
|
|
||||||
return done.promise;
|
|
||||||
};
|
|
||||||
var myFunction2 = function () {
|
|
||||||
var done = Q.defer();
|
|
||||||
beautylog.ok("Function2 executed");
|
|
||||||
done.resolve();
|
|
||||||
return done.promise;
|
|
||||||
};
|
|
||||||
var myFunction3 = function () {
|
|
||||||
var done = Q.defer();
|
|
||||||
beautylog.success("Function3 executed");
|
|
||||||
done.resolve();
|
|
||||||
return done.promise;
|
|
||||||
};
|
|
||||||
|
|
||||||
describe("gulpFunction",function(){
|
|
||||||
it("should run through smoothly with " + "'forEach'".blue,function(done){
|
|
||||||
gulp.src('./test/*.md')
|
|
||||||
.pipe(gulpFunction(myFunction,'forEach'))
|
|
||||||
.pipe(gulp.dest("./test/result/"));
|
|
||||||
|
|
||||||
gulp.src('./test/*.md')
|
|
||||||
.pipe(gulpFunction([myFunction2,myFunction3],'forEach'))
|
|
||||||
.pipe(gulp.dest("./test/result/"))
|
|
||||||
.pipe(gulpFunction(done,"atEnd"));
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should run through smoothly with " + "'atEnd'".blue,function(done){
|
|
||||||
gulp.src('./test/*.md')
|
|
||||||
.pipe(gulpFunction(myFunction,'atEnd'))
|
|
||||||
.pipe(gulp.dest("./test/result/"));
|
|
||||||
|
|
||||||
gulp.src('./test/*.md')
|
|
||||||
.pipe(gulpFunction([myFunction2,myFunction3],'atEnd'))
|
|
||||||
.pipe(gulp.dest("./test/result/"))
|
|
||||||
.pipe(gulpFunction(done,"atEnd"));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
15
ts/tsd.json
15
ts/tsd.json
@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "v4",
|
|
||||||
"repo": "borisyankov/DefinitelyTyped",
|
|
||||||
"ref": "master",
|
|
||||||
"path": "typings",
|
|
||||||
"bundle": "typings/tsd.d.ts",
|
|
||||||
"installed": {
|
|
||||||
"node/node.d.ts": {
|
|
||||||
"commit": "efa0c1196d7280640e624ac1e7fa604502e7bd63"
|
|
||||||
},
|
|
||||||
"colors/colors.d.ts": {
|
|
||||||
"commit": "3191f6e0088eee07c4d8fd24e4d27a40a60d9eb9"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"ambientDependencies": {
|
|
||||||
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts",
|
|
||||||
"mocha": "github:Bartvds/tsd-deftools/typings/DefinitelyTyped/mocha/mocha.d.ts",
|
|
||||||
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts"
|
|
||||||
}
|
|
||||||
}
|
|
3
tslint.json
Normal file
3
tslint.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": "tslint-config-standard"
|
||||||
|
}
|
Reference in New Issue
Block a user