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

jaune-tasks

v1.0.1

Published

[![Build Status](https://travis-ci.org/ajuste/jaune-tasks.svg?branch=master)](https://travis-ci.org/ajuste/jaune-tasks) [![Coverage Status](https://coveralls.io/repos/ajuste/jaune-tasks/badge.svg?branch=master)](https://coveralls.io/r/ajuste/jaune-tasks?b

Downloads

3

Readme

Build Status Coverage Status

jaune-tasks

Use gulp tasks only through configuration -- don't code.

Install

npm i -save jaune-tasks

Configuration

Two steps are required to set up gulp tasks

  • Add a configuration file (for example env.json) with the following attributes:
{
  "jaune" : {
    "build_tasks" : {
      "task-name-1" : [
        {
          "name" : "step1"
        },
        {
          "name" : "step2",
        }
      ]
    }
  }
}
  • Add a gulp.js file with the following content in the root of your project
'use strict';

require('jaune-tasks')('[r(/env)]');

Running a task

gulp <task-name>

You can also specify -d to print debugging information.

Supported tasks

Uglify

Adds support for gulp-uglify

Required packages in your package.json

  • gulp-uglify

Configuration

  1. name: Must be uglify
  2. destFunction: Function used to convert output path for script (more ahead)
  3. args: Same configuration that explained in original package.
  4. sources: Array of paths to be processed
  5. flatten: True to use gulp-flatten
{
  "name" : "uglify",
  "destFunction" : "[r(/tasks/app-funcs)].destFuncName",
  "sources" : ["modules/**/pages/**/*.js"],
  "flatten" : true
}

Stylus

Adds support for gulp-stylus

Required packages in your package.json

  • gulp-stylus
  • nib

Configuration

  1. name: Must be stylus
  2. destFunction: Function used to convert output path for script (more ahead)
  3. args: Same configuration that explained in original package.
  4. sources: Array of paths to be processed
  5. flatten: True to use gulp-flatten
{
  "name" : "stylus",
  "destFunction" : "[r(/tasks/app-funcs)].destFuncName",
  "sources" : ["modules/**/pages/**/*.styl"],
  "flatten" : true
}

Webpack

Adds support for gulp-webpack

Required packages in your package.json

  • gulp-webpack
  • webpack
  • Any other webpack plugin you wish to use.

Configuration

  1. name: Must be webpack
  2. destFunction: Function used to convert output path for script (more ahead)
  3. args: Same configuration that explained in original package except for some case:
  4. entry should always be used to sepecify entry points, even there is only one.
  5. test property for loaders must be a regular expression.
  6. plugins names must be a jaune-util reflection reference.

The following is an example that outputs two scripts 'page_1_script_name' and 'page_2_script_name'. Those scripts require handlebars files as template plus we want to minify them:

"jaune" : {
    "build_tasks" : {
      "assets" : [
        {
          "name" : "webpack",
          "destFunction" : "[r(/tasks/app-funcs)].destFuncName",
          "args" : {
            "plugins": [
              "[r(webpack)].optimize.UglifyJsPlugin.[i()]"
            ],
            "entry" : {
              "page_1_script_name" : "output/path/page1_script",
              "page_2_script_name" : "output/path/page2_script",
            },
            "module" : {
              "loaders" : [
                { "test":  "\\.hbs", "loader": "handlebars-template-loader" }
              ]
            },
            "output": {
              "filename": "[name].js"
            },
            "node": {
              "fs": "empty"
            }
          }
        }
      ]
    },

Destination function

Destination function is used to generate path of output files with a major flexibility; you can transform output paths using any tool available out there.

In order to set up a destination function we need another function that receives the task as parameter and returns the transforming function. Destination function is specified in the following way inside the task. Please note that destFunction is resolved using jaune-util reflection.

{
  "destFunction" : "[r(/tasks/app-funcs)].webpackDest"
}

The destination function must accept a file argument which is the same argument passed to gulp.dest. In this example we will transform the path to end with '/public/'

PUBLIC_MODULE_PATH = '/public/'

{parse, join} = require 'path'

module.exports =

  webpackDest: (config) ->

    (file) ->

      [path] = file.history
      parsed = parse path

      unless (originalPath = config.args.entry[parsed.name])
        throw new Error "File not found in entry point #{originalPath}"

      join originalPath, PUBLIC_MODULE_PATH