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

gulp-runtime

v2.0.0

Published

an alternate interface to vinly-fs

Downloads

188

Readme

gulp-runtime NPM version downloads

build

image

documentation - install - setup - why

features

samples

CLI as tasks

var gulp = require('gulp-runtime').create();

gulp.task('default', ['--tasks', '--version']);

task :parameters

var gulp = require('gulp-runtime').create();

gulp.task('build :src :dest', function () {
  return gulp.src(this.params.src)
    // transform, compress, etc.
    .pipe(gulp.dest(this.params.dest));
});

gulp.task('default',
  gulp.parallel('build src/**/*.js build')
);

passing arguments

var gulp = require('gulp-runtime').create();

gulp.task('read src', function (callback, src, dest) {
  dest = path.join(dest, new Date().toISOString());
  console.log('from', src, 'to', dest);

  var stream = gulp.src(src);

  callback(null, stream, dest);
});

gulp.task('write', function (done, stream, dest) {
  return stream.pipe(gulp.dest(dest));
});

// the default takes any arguments after '--' from the terminal
gulp.task('default',
  gulp.series('read src', 'write')
);

write

node gulplfile.js -- src/**/*.js build

and arguments after -- will be passed to the default task.

functions as tasks

Just as gulp#4.0

var gulp = require('gulp-runtime').create();

function build (done, src, dest) {
  console.log('from', src, 'to', dest);
  return gulp.src(src)
    // some build step
    .pipe(gulp.dest(dest));
}

function minify (done, src, dest) {
  return gulp.src(src)
    // minify
    .pipe(gulp.dest(dest));
}

gulp.task('default',
  gulp.series(build, minify)
);

split builds in instances

var styles = require('gulp-runtime').create();

styles.task('less', function (done, sources, dest) {
  var less = require('gulp-less');
  var options = require('./build/options');

  return gulp.src(sources)
    .pipe(less(options.less))
    .pipe(gulp.dest(dest));
});

styles.task('default', ['less']);

exports = module.exports = styles;

a REPL after default has finished

var gulp = require('gulp-runtime').create({ repl: true });

gulp.task(':number', function (done) {
  setTimeout(done, 100);
});

gulp.task('default', ['one', 'two']);

go to the terminal and do

node gulpfile.js

which will run a REPL with the tasks defined.

install

With npm

npm install --save-dev gulp-runtime

why

Soon after I started to use gulp it came to mind

I want a REPL for this

Mainly because a REPL is the closest to define and use as you like. If that was possible then writing task names in this REPL will run them just as doing the same from the command line.

Then I realized that what I really liked from gulp is the way you can bundle and compose async functions and how its this done under the hood. For that I had to try to do it by myself.

The above has lead to gulp-repl, parth, runtime and finally gulp-runtime.

So yeah, it got out of hand :D.

But well oh well, here we are.

license

License