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

@sunpower/jit-grunt

v0.10.0-sp2

Published

JIT plugin loader for Grunt.

Downloads

17

Readme

jit-grunt 0.10.0 NPM version Build Status Built with Grunt

A JIT(Just In Time) plugin loader for Grunt.
Load time of Grunt does not slow down even if there are many plugins.

Before

grunt.loadNpmTasks('assemble');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-newer');
grunt.loadNpmTasks('grunt-wget');
...
$ grunt assemble
...
Execution Time (2014-01-14 02:52:59 UTC)
loading tasks     5.7s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 84%
assemble:compile  1.1s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 16%
Total 6.8s

umm...

After

require('jit-grunt')(grunt);
$ grunt assemble
...
Execution Time (2014-01-14 02:53:34 UTC)
loading tasks     111ms  ▇▇▇▇▇▇▇▇▇ 8%
loading assemble  221ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 16%
assemble:compile   1.1s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 77%
Total 1.4s

Have a pleasant Grunt life!

Install

npm install jit-grunt --save-dev

Usage

Removes grunt.loadNpmTasks, then add the require('jit-grunt')(grunt) instead. Only it.

module.exports = function (grunt) {
  require('jit-grunt')(grunt);

  grunt.initConfig({
    ...
  });

  grunt.registerTask('default', [...]);
}

Will automatically search for the plugin from the task name. Search in the following order:

  1. node_modules/grunt-contrib-task-name
  2. node_modules/grunt-task-name
  3. node_modules/task-name
clean           -> node_modules/grunt-contrib-clean
wget            -> node_modules/grunt-wget
mochaTest       -> node_modules/grunt-mocha-test
mocha_phantomjs -> node_modules/grunt-mocha-phantomjs
assemble        -> node_modules/assemble

Static mappings

Second parameter is static mappings.
It is used when there is a plugin that can not be resolved in the automatic mapping.

taskname: grunt-plugin-name

require('jit-grunt')(grunt, {
  sprite: 'grunt-spritesmith',
  foo: '@abc/grunt-foo',        // for private modules.
  bar: 'custom/bar.js'          // for custom tasks.
});

Options

cwd

Type: Strong Default: process.cwd()

All plugins and tasks are resolved relative to this path.

pluginsRoot

Type: String
Default: 'node_modules'

Root directory of grunt plugins, relative to the working directory.

require('jit-grunt')(grunt)({
  pluginsRoot: 'other/dir'
});

customTasksDir

Type: String
Default: null

JIT Loading for custom tasks dir (replacement of grunt.loadTasks), relative to the working directory..

require('jit-grunt')(grunt)({
  customTasksDir: 'custom/dir'
});

Search in the following order:

  1. custom/dir/taskname.js
  2. custom/dir/taskname.coffee

loadTasks

Alias to customTasksDir.

Example

https://github.com/shootaroo/jit-grunt/tree/master/example

Release History

  • 2016-02-23 v0.10.0 Add option cwd.
  • 2015-02-02   v0.9.1   Support npm private modules.
  • 2014-10-15   v0.9.0   Support parent directories of node_modules.
  • 2014-08-07   v0.8.0   Support grunt.registerTask in plugin #19.
  • 2014-08-07   v0.7.1   Fix log output.
  • 2014-05-19   v0.7.0   Support custom task by CoffeeScript.
  • 2014-05-08   v0.6.0   Add option customTasksDir and pluginsRoot.
  • 2014-04-14   v0.5.0   Support static mappings for custom tasks.
  • 2014-04-14   v0.4.2   Fix loadTasks path.
  • 2014-04-09   v0.4.1   Revert path.resolve.
  • 2014-04-09   v0.4.0   Add loadTasks option.
  • 2014-03-17   v0.3.2   Fix grunt.loadTask bug.
  • 2014-03-17   v0.3.1   Fix grunt.loadTask bug.
  • 2014-03-17   v0.3.0   Support grunt.loadTasks.
  • 2014-02-27   v0.2.3   Support task name of camelCase and snake_case.
  • 2014-02-22   v0.2.2   Add plugin not found log.
  • 2014-01-23   v0.2.1   Change log to verbose.
  • 2014-01-13   v0.2.0   Load timing became JIT perfectly, and support time-grunt result.
  • 2013-12-24   v0.1.2   Log colored.
  • 2013-12-23   v0.1.1   Fix bug on grunt-contrib-concat.
  • 2013-12-21   v0.1.0   Support auto mappings.
  • 2013-12-20   v0.0.1   First release.

License

The MIT License (MIT)

Copyright © 2013 Shotaro Tsubouchi

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.