Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
edcb1d114f | |||
3ba5685914 | |||
cb0f810201 | |||
94a5d3022e | |||
919fcfd9f5 | |||
660ffd8880 | |||
1744e9b338 | |||
b738a360cc | |||
0c703cb5c3 | |||
27ee7a532a | |||
29d439ce0d | |||
faa4bb88a8 | |||
a95319d99f | |||
e7c0e1228b | |||
9586f34d64 | |||
6300845ec8 | |||
2316a983ed | |||
a1fa6b751e | |||
5792a13b01 | |||
1008c3f103 | |||
c366bde211 |
66
.gitea/workflows/default_nottags.yaml
Normal file
66
.gitea/workflows/default_nottags.yaml
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
name: Default (not tags)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags-ignore:
|
||||||
|
- '**'
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||||
|
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||||
|
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||||
|
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||||
|
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
security:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
continue-on-error: true
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install pnpm and npmci
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
|
||||||
|
- name: Run npm prepare
|
||||||
|
run: npmci npm prepare
|
||||||
|
|
||||||
|
- name: Audit production dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --prod
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Audit development dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --dev
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
test:
|
||||||
|
if: ${{ always() }}
|
||||||
|
needs: security
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Test stable
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm test
|
||||||
|
|
||||||
|
- name: Test build
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm build
|
124
.gitea/workflows/default_tags.yaml
Normal file
124
.gitea/workflows/default_tags.yaml
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
name: Default (tags)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||||
|
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||||
|
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||||
|
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||||
|
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
security:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
continue-on-error: true
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Audit production dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --prod
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Audit development dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --dev
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
test:
|
||||||
|
if: ${{ always() }}
|
||||||
|
needs: security
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Test stable
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm test
|
||||||
|
|
||||||
|
- name: Test build
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm build
|
||||||
|
|
||||||
|
release:
|
||||||
|
needs: test
|
||||||
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Release
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm publish
|
||||||
|
|
||||||
|
metadata:
|
||||||
|
needs: test
|
||||||
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Code quality
|
||||||
|
run: |
|
||||||
|
npmci command npm install -g typescript
|
||||||
|
npmci npm install
|
||||||
|
|
||||||
|
- name: Trigger
|
||||||
|
run: npmci trigger
|
||||||
|
|
||||||
|
- name: Build docs and upload artifacts
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
pnpm install -g @git.zone/tsdoc
|
||||||
|
npmci command tsdoc
|
||||||
|
continue-on-error: true
|
17
.gitignore
vendored
17
.gitignore
vendored
@ -1,5 +1,20 @@
|
|||||||
node_modules/
|
.nogit/
|
||||||
|
|
||||||
|
# artifacts
|
||||||
coverage/
|
coverage/
|
||||||
public/
|
public/
|
||||||
pages/
|
pages/
|
||||||
|
|
||||||
|
# installs
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# caches
|
||||||
|
.yarn/
|
||||||
|
.cache/
|
||||||
|
.rpt2_cache
|
||||||
|
|
||||||
|
# builds
|
||||||
|
dist/
|
||||||
|
dist_*/
|
||||||
|
|
||||||
|
# custom
|
125
.gitlab-ci.yml
125
.gitlab-ci.yml
@ -1,125 +0,0 @@
|
|||||||
# gitzone standard
|
|
||||||
image: hosttoday/ht-docker-node:npmci
|
|
||||||
|
|
||||||
cache:
|
|
||||||
paths:
|
|
||||||
- .npmci_cache/
|
|
||||||
key: "$CI_BUILD_STAGE"
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- security
|
|
||||||
- test
|
|
||||||
- release
|
|
||||||
- metadata
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# security stage
|
|
||||||
# ====================
|
|
||||||
mirror:
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci git mirror
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
snyk:
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci command npm install -g snyk
|
|
||||||
- npmci command npm install --ignore-scripts
|
|
||||||
- npmci command snyk test
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# test stage
|
|
||||||
# ====================
|
|
||||||
|
|
||||||
testLTS:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install lts
|
|
||||||
- npmci npm install
|
|
||||||
- npmci npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
testSTABLE:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
script:
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm publish
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# metadata stage
|
|
||||||
# ====================
|
|
||||||
codequality:
|
|
||||||
stage: metadata
|
|
||||||
image: docker:stable
|
|
||||||
allow_failure: true
|
|
||||||
services:
|
|
||||||
- docker:stable-dind
|
|
||||||
script:
|
|
||||||
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
|
||||||
- docker run
|
|
||||||
--env SOURCE_CODE="$PWD"
|
|
||||||
--volume "$PWD":/code
|
|
||||||
--volume /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
|
|
||||||
artifacts:
|
|
||||||
paths: [codeclimate.json]
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- priv
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npmci trigger
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
pages:
|
|
||||||
image: hosttoday/ht-docker-node:npmci
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npmci command npm install -g typedoc typescript
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 week
|
|
||||||
paths:
|
|
||||||
- public
|
|
||||||
allow_failure: true
|
|
11
.vscode/launch.json
vendored
Normal file
11
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"command": "npm test",
|
||||||
|
"name": "Run npm test",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "node-terminal"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
26
.vscode/settings.json
vendored
Normal file
26
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"json.schemas": [
|
||||||
|
{
|
||||||
|
"fileMatch": ["/npmextra.json"],
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"npmci": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "settings for npmci"
|
||||||
|
},
|
||||||
|
"gitzone": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "settings for gitzone",
|
||||||
|
"properties": {
|
||||||
|
"projectType": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["website", "element", "service", "npm", "wcc"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
62
README.md
62
README.md
@ -1,62 +0,0 @@
|
|||||||
# gulp-function
|
|
||||||
|
|
||||||
accepts a function call as parameter to execute in gulp pipeline
|
|
||||||
|
|
||||||
## Availabililty
|
|
||||||
|
|
||||||
[](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://www.npmjs.com/package/gulp-function)
|
|
||||||
[](https://david-dm.org/pushrocks/gulp-function)
|
|
||||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
||||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
||||||
[](http://standardjs.com/)
|
|
||||||
[](https://snyk.io/test/npm/@pushrocks/gulp-function)
|
|
||||||
|
|
||||||
### Usage
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import gulp = require('gulp');
|
|
||||||
import gulpFunction from 'gulp-function'; // default ES6 export
|
|
||||||
// import {forFirst, forEach, atEnd} from 'gulp-function'
|
|
||||||
|
|
||||||
let myAsyncFunction = async (file, enc) => {
|
|
||||||
// await some async stuff
|
|
||||||
};
|
|
||||||
|
|
||||||
gulp.task('gulpTest', function() {
|
|
||||||
let stream = gulp
|
|
||||||
.src('./mydir/*.something')
|
|
||||||
.pipe(gulpFunction(myAsyncFunction, 'forEach')) //read the notes below
|
|
||||||
// .pipe(forEach(myAsyncFunction)) // if imported as >> import { forEach } from 'gulp-function' <<
|
|
||||||
.pipe(gulp.dest('./build/'));
|
|
||||||
return stream; // by returning the stream gulp knows when our task has finished.
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
### Notes
|
|
||||||
|
|
||||||
- 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**!!!
|
|
||||||
|
|
||||||
For further information read the linked docs at the top of this README.
|
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
|
||||||
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
|
||||||
|
|
||||||
[](https://push.rocks)
|
|
@ -3,8 +3,32 @@
|
|||||||
"mode": "default"
|
"mode": "default"
|
||||||
},
|
},
|
||||||
"npmci": {
|
"npmci": {
|
||||||
"npmGlobalTools": [
|
"npmGlobalTools": [],
|
||||||
"npmts"
|
"npmAccessLevel": "public"
|
||||||
|
},
|
||||||
|
"gitzone": {
|
||||||
|
"projectType": "npm",
|
||||||
|
"module": {
|
||||||
|
"githost": "code.foss.global",
|
||||||
|
"gitscope": "push.rocks",
|
||||||
|
"gitrepo": "gulp-function",
|
||||||
|
"description": "A Gulp plugin to execute functions within a Gulp task pipeline.",
|
||||||
|
"npmPackagename": "@push.rocks/gulp-function",
|
||||||
|
"license": "MIT",
|
||||||
|
"keywords": [
|
||||||
|
"gulp",
|
||||||
|
"plugin",
|
||||||
|
"task automation",
|
||||||
|
"stream manipulation",
|
||||||
|
"async function execution",
|
||||||
|
"pipeline",
|
||||||
|
"build tool",
|
||||||
|
"JavaScript",
|
||||||
|
"TypeScript"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"tsdoc": {
|
||||||
|
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||||
|
}
|
||||||
}
|
}
|
4015
package-lock.json
generated
4015
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
65
package.json
65
package.json
@ -1,42 +1,63 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/gulp-function",
|
"name": "@push.rocks/gulp-function",
|
||||||
"version": "3.0.0",
|
"private": false,
|
||||||
"description": "accepts a function call as parameter to execute in gulp pipeline",
|
"version": "3.0.7",
|
||||||
"main": "dist/index.js",
|
"description": "A Gulp plugin to execute functions within a Gulp task pipeline.",
|
||||||
"typings": "dist/index.d.ts",
|
"main": "dist_ts/index.js",
|
||||||
|
"typings": "dist_ts/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/)",
|
"test": "(tstest test/)",
|
||||||
"build": "(tsbuild)"
|
"build": "(tsbuild --allowimplicitany)",
|
||||||
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://gitlab.com/pushrocks/gulp-function.git"
|
"url": "https://code.foss.global/push.rocks/gulp-function.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"gulpplugin",
|
|
||||||
"gulp",
|
"gulp",
|
||||||
"function",
|
"plugin",
|
||||||
"pushrocks"
|
"task automation",
|
||||||
|
"stream manipulation",
|
||||||
|
"async function execution",
|
||||||
|
"pipeline",
|
||||||
|
"build tool",
|
||||||
|
"JavaScript",
|
||||||
|
"TypeScript"
|
||||||
],
|
],
|
||||||
"author": "Lossless GmbH <office@lossless.com> (https://lossless.com)",
|
"author": "Lossless GmbH <office@lossless.com> (https://lossless.com)",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://gitlab.com/pushrocks/gulp-function/issues"
|
"url": "https://gitlab.com/push.rocks/gulp-function/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/gulp-function",
|
"homepage": "https://code.foss.global/push.rocks/gulp-function",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartpromise": "^2.0.5",
|
"@push.rocks/smartpromise": "^4.0.3",
|
||||||
"@types/through2": "^2.0.32",
|
"@types/through2": "^2.0.32",
|
||||||
"through2": "^3.0.0"
|
"through2": "^3.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.3",
|
"@git.zone/tsbuild": "^2.1.17",
|
||||||
"@gitzone/tstest": "^1.0.18",
|
"@git.zone/tsrun": "^1.2.46",
|
||||||
"@pushrocks/smartgulp": "^2.0.1",
|
"@git.zone/tstest": "^1.0.28",
|
||||||
"@pushrocks/tapbundle": "^3.0.7",
|
"@push.rocks/smartgulp": "^3.0.3",
|
||||||
"gulp": "^3.9.1",
|
"@push.rocks/tapbundle": "^5.0.15",
|
||||||
"tslint": "^5.11.0",
|
"gulp": "^4.0.2"
|
||||||
"tslint-config-prettier": "^1.17.0"
|
|
||||||
},
|
},
|
||||||
"private": true
|
"files": [
|
||||||
|
"ts/**/*",
|
||||||
|
"ts_web/**/*",
|
||||||
|
"dist/**/*",
|
||||||
|
"dist_*/**/*",
|
||||||
|
"dist_ts/**/*",
|
||||||
|
"dist_ts_web/**/*",
|
||||||
|
"assets/**/*",
|
||||||
|
"cli.js",
|
||||||
|
"npmextra.json",
|
||||||
|
"readme.md"
|
||||||
|
],
|
||||||
|
"type": "module",
|
||||||
|
"browserslist": [
|
||||||
|
"last 1 chrome versions"
|
||||||
|
]
|
||||||
}
|
}
|
7617
pnpm-lock.yaml
generated
Normal file
7617
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
1
readme.hints.md
Normal file
1
readme.hints.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
106
readme.md
Normal file
106
readme.md
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
# @push.rocks/gulp-function
|
||||||
|
|
||||||
|
[@push.rocks/gulp-function](https://www.npmjs.com/package/@push.rocks/gulp-function) is a Gulp plugin designed to execute custom functions within a Gulp pipeline. It accepts a function call as a parameter and allows for flexible task executions, including asynchronous tasks, with easy integration into the Gulp workflow.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
To use @push.rocks/gulp-function in your project, you'll first need to install it via npm. You can do this by running the following command in your project's root directory:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install @push.rocks/gulp-function --save-dev
|
||||||
|
```
|
||||||
|
|
||||||
|
This command will add `@push.rocks/gulp-function` as a development dependency to your project, making it available for use in your Gulp tasks.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
The primary use case for `@push.rocks/gulp-function` is to incorporate custom function executions into your Gulp pipelines. This can be particularly useful for tasks that require conditional processing, external API calls, or any other logic that extends beyond the capabilities of existing Gulp plugins.
|
||||||
|
|
||||||
|
Here's how you can use `@push.rocks/gulp-function` within your Gulp setup:
|
||||||
|
|
||||||
|
### Basic Example
|
||||||
|
|
||||||
|
Let's start with a simple scenario where you want to log the path of files processed by Gulp.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import gulp from 'gulp';
|
||||||
|
import gulpFunction, { forEach } from '@push.rocks/gulp-function';
|
||||||
|
|
||||||
|
const logFilePath = async (file: Buffer, enc: string) => {
|
||||||
|
console.log(`Processing file: ${file.path}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
gulp.task('log', () => {
|
||||||
|
return gulp.src('./src/**/*.ts')
|
||||||
|
.pipe(forEach(logFilePath))
|
||||||
|
.pipe(gulp.dest('./dist'));
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
In this example, we're using the `forEach` method exported by `@push.rocks/gulp-function` to execute `logFilePath` for each file matched by `gulp.src`. The file's path is logged to the console during the build process.
|
||||||
|
|
||||||
|
### Advanced Use Case: Asynchronous Function Execution
|
||||||
|
|
||||||
|
`@push.rocks/gulp-function` truly shines when you need to perform asynchronous operations within your Gulp tasks. Here's an example that demonstrates making an asynchronous API call for each file:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import gulp from 'gulp';
|
||||||
|
import gulpFunction, { forEach } from '@push.rocks/gulp-function';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
const uploadFileToServer = async (file: Buffer, enc: string) => {
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append('file', file.contents, file.relative);
|
||||||
|
|
||||||
|
await axios.post('https://example.com/upload', formData, {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'multipart/form-data'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(`Uploaded file: ${file.path}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
gulp.task('uploadFiles', () => {
|
||||||
|
return gulp.src('./uploads/**/*')
|
||||||
|
.pipe(forEach(uploadFileToServer))
|
||||||
|
.pipe(gulp.dest('./dist/uploads'));
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
In this more advanced example, we use the `forEach` method to upload each file to a remote server using `axios`. The function `uploadFileToServer` is executed for each file, where an HTTP POST request is made to upload the file. This shows how you can integrate asynchronous operations seamlessly into your Gulp pipeline.
|
||||||
|
|
||||||
|
### Execution Modes
|
||||||
|
|
||||||
|
`@push.rocks/gulp-function` supports three execution modes for your functions: `forEach`, `forFirst`, and `atEnd`.
|
||||||
|
|
||||||
|
- **forEach**: Executes the provided function for each file in the stream.
|
||||||
|
- **forFirst**: Executes the provided function only for the first file that passes through the stream.
|
||||||
|
- **atEnd**: Executes the provided function once after all files have passed through the stream.
|
||||||
|
|
||||||
|
These modes provide flexibility in determining when your custom functions should be triggered during the build process.
|
||||||
|
|
||||||
|
### Conclusion
|
||||||
|
|
||||||
|
`@push.rocks/gulp-function` is a powerful tool for integrating custom processing logic into Gulp workflows. Whether you need to execute simple synchronous tasks or complex asynchronous operations, `@push.rocks/gulp-function` offers the flexibility and ease of use to enhance your Gulp builds significantly.
|
||||||
|
|
||||||
|
Remember, the examples provided are starting points. The real power of `@push.rocks/gulp-function` lies in its ability to adapt to your specific use cases, enabling you to automate and streamline your build processes as never before.
|
||||||
|
|
||||||
|
## License and Legal Information
|
||||||
|
|
||||||
|
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||||
|
|
||||||
|
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
### Trademarks
|
||||||
|
|
||||||
|
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
|
||||||
|
|
||||||
|
### Company Information
|
||||||
|
|
||||||
|
Task Venture Capital GmbH
|
||||||
|
Registered at District court Bremen HRB 35230 HB, Germany
|
||||||
|
|
||||||
|
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
||||||
|
|
||||||
|
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
10
test/test.ts
10
test/test.ts
@ -1,10 +1,10 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@push.rocks/tapbundle';
|
||||||
|
|
||||||
import * as smartgulp from '@pushrocks/smartgulp';
|
import * as smartgulp from '@push.rocks/smartgulp';
|
||||||
let gulp = require('gulp');
|
import gulp from 'gulp';
|
||||||
import * as gulpFunction from '../ts/index';
|
import * as gulpFunction from '../ts/index.js';
|
||||||
|
|
||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@push.rocks/smartpromise';
|
||||||
|
|
||||||
tap.test('should run through smoothly with ' + "'forEach'", async tools => {
|
tap.test('should run through smoothly with ' + "'forEach'", async tools => {
|
||||||
let done = smartpromise.defer();
|
let done = smartpromise.defer();
|
||||||
|
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* autocreated commitinfo by @pushrocks/commitinfo
|
||||||
|
*/
|
||||||
|
export const commitinfo = {
|
||||||
|
name: '@push.rocks/gulp-function',
|
||||||
|
version: '3.0.7',
|
||||||
|
description: 'accepts a function call as parameter to execute in gulp pipeline'
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@push.rocks/smartpromise';
|
||||||
import * as through2 from 'through2';
|
import * as through2 from 'through2';
|
||||||
import { Transform } from 'stream';
|
import { Transform } from 'stream';
|
||||||
|
|
||||||
|
14
tsconfig.json
Normal file
14
tsconfig.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"useDefineForClassFields": false,
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "NodeNext",
|
||||||
|
"moduleResolution": "NodeNext",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"verbatimModuleSyntax": true
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"dist_*/**/*.d.ts"
|
||||||
|
]
|
||||||
|
}
|
17
tslint.json
17
tslint.json
@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
|
||||||
"rules": {
|
|
||||||
"semicolon": [true, "always"],
|
|
||||||
"no-console": false,
|
|
||||||
"ordered-imports": false,
|
|
||||||
"object-literal-sort-keys": false,
|
|
||||||
"member-ordering": {
|
|
||||||
"options":{
|
|
||||||
"order": [
|
|
||||||
"static-method"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"defaultSeverity": "warning"
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user