npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp4-expression

v1.0.11

Published

combine gulp tasks using declarative expression

Downloads

1

Readme

Intro.

Gulp 4 empowers developers to write tasks and combine tasks (in series or in parallel) in an imperative fashion:

gulp4.task( 'A', done => {done();} );
gulp4.task( 'B', done => {done();} );
gulp4.task( 'C', done => {done();} );

gulp4.task('default', gulp4.series('A', gulp4.parallel('B', 'C')));

This npm package provides developers an interface to combine gulp tasks in a declarative way as an alternative, it also calculates the overall task completion when an individual task finishes.

gulp4.task('default', parseGulpExpression('A | B & C'));

Installation:

$ npm install gulp4-expression

Usage:

  • series: |
  • parallel: &
  • sub-expression parentheses: (...)

& has a higher precedence than |

// gulpfile.js

const gulp4 = require('gulp4');
const parseGulpExpression = require('gulp4-expression').parseGulpExpression;

// Register tasks
gulp4.task( 'A', done => {console.log('A'); setTimeout(done, 500);} );

gulp4.task( 'B', done => {console.log('B'); done()} );

gulp4.task( 'C', done => {console.log('C'); done()} );

gulp4.task( 'D', done => {console.log('D'); done()} );

gulp4.task( 'E', done => {console.log('E'); done()} );

gulp4.task( 'F', done => {console.log('F'); done()} );

gulp4.task( 'G', done => {console.log('G'); done()} );

gulp4.task( 'H', done => {console.log('H'); done()} );

// Combine tasks
gulp4.task('default', parseGulpExpression(
    '(A | B & C | D) & (E & F | G | H)'
));
$ gulp --tasks

# output
[14:56:13] └─┬ default
[14:56:13]   └─┬ <parallel>
[14:56:13]     ├─┬ <series>
[14:56:13]     │ ├── A (GulpExpressionNodeTask-1)
[14:56:13]     │ ├─┬ <parallel>
[14:56:13]     │ │ ├── B (GulpExpressionNodeTask-2)
[14:56:13]     │ │ └── C (GulpExpressionNodeTask-3)
[14:56:13]     │ └── D (GulpExpressionNodeTask-4)
[14:56:13]     └─┬ <series>
[14:56:13]       ├─┬ <parallel>
[14:56:13]       │ ├── E (GulpExpressionNodeTask-5)
[14:56:13]       │ └── F (GulpExpressionNodeTask-6)
[14:56:13]       ├── G (GulpExpressionNodeTask-7)
[14:56:13]       └── H (GulpExpressionNodeTask-8)
$ gulp --silent

# output
A
E
[14:56:38] progress: 8%
F
[14:56:38] progress: 17%
G
[14:56:38] progress: 33%
H
[14:56:38] progress: 50%
[14:56:38] progress: 67%
B
[14:56:38] progress: 75%
C
[14:56:38] progress: 83%
D
[14:56:38] progress: 100%
$ gulp

# output
[16:36:14] Starting 'default'...
[16:36:14] Starting 'A (GulpExpressionNodeTask-1)'...
A
[16:36:14] Starting 'E (GulpExpressionNodeTask-5)'...
[16:36:14] Starting 'F (GulpExpressionNodeTask-6)'...
E
[16:36:14] Finished 'E (GulpExpressionNodeTask-5)' after 688 μs
[16:36:14] progress: 8%
F
[16:36:14] Finished 'F (GulpExpressionNodeTask-6)' after 1.56 ms
[16:36:14] progress: 17%
[16:36:14] Starting 'G (GulpExpressionNodeTask-7)'...
G
[16:36:14] Finished 'G (GulpExpressionNodeTask-7)' after 318 μs
[16:36:14] progress: 33%
[16:36:14] Starting 'H (GulpExpressionNodeTask-8)'...
H
[16:36:14] Finished 'H (GulpExpressionNodeTask-8)' after 289 μs
[16:36:14] progress: 50%
[16:36:14] Finished 'A (GulpExpressionNodeTask-1)' after 508 ms
[16:36:14] progress: 67%
[16:36:14] Starting 'B (GulpExpressionNodeTask-2)'...
[16:36:14] Starting 'C (GulpExpressionNodeTask-3)'...
B
[16:36:14] Finished 'B (GulpExpressionNodeTask-2)' after 689 μs
[16:36:14] progress: 75%
C
[16:36:14] Finished 'C (GulpExpressionNodeTask-3)' after 838 μs
[16:36:14] progress: 83%
[16:36:14] Starting 'D (GulpExpressionNodeTask-4)'...
D
[16:36:14] Finished 'D (GulpExpressionNodeTask-4)' after 409 μs
[16:36:14] progress: 100%
[16:36:14] Finished 'default' after 513 ms