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

grunt-idk

v1.0.4

Published

Interactive grunt help and task selection

Downloads

8

Readme

Build Status downloads npm Code Climate Test Coverage dependencies

grunt-idk

Interactive grunt help and task selection

demo

Getting Started

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-idk --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-idk');

Alternatively, install task-master and let it manage this for you.

The "idk" task

Overview

Unlike most grunt plugins, you probably won't need to add a section to your config object for idk. idk is not a multi-task, and provides only two options (see below). So in many cases, you can just call .loadNpmTasks as defined above and be done.

The idk task provides an interactive prompt for selecting tasks and targets to run (because sometimes you just don't remember what you want to run). There are three stages to this:

First, you will be prompted to select tasks to run. Use up and down (or j and k) to navigate up and down and spacebar to select a task (or press a to select all or i to invert your current selection). When you've chosen your tasks, use Enter to confirm your selection.

Second, for each task you selected in the first prompt that is a multi-task, you will be prompted to select the targets for that task. Use the same controls as above to make your selections.

Finally, you will presented with your current selection and given a chance to reorder the tasks. In addition to the above controls use left or h to move a task higher in the run queue or right or l to move it lower in the queue.

N.B. The second step will be skipped for multi-tasks with only one target, and the third step will be skipped if there is only one task to run.

By default, 20 items will be shown at one time in the prompt. You can configure this by setting options.size in your grunt config. If options.size (whether default or specified) is greater than the size of the terminal window (as specified by process.env.LINES), the size will be process.env.LINES - options.offset where offset defaults to 5.

Note that LINES and COLUMNS may or may not be available depending on your set up (and I have no idea how Windows handles such things). For me, by default, I can do echo $LINES and echo $COLUMNS and get correct numbers, but they are not available in child processes. So I have export LINES=$LINES and export COLUMNS=$COLUMNS in my bashrc. You can try this as well, or just always set size and offset to numbers sufficiently small enough. I have no idea if inquirer attempts to handle lists that would be off the screen or not.

Example config

module.exports = function(grunt) {
  grunt.loadNpmTasks('grunt-idk');

  grunt.initConfig({
    idk: {
      options: {
        // 25 items showing (or however many will fit in the window)
        size: 25,
        // leave 3 line buffer if we hit the bottom of the terminal
        offset: 3
      }
    }
  });

  // You might want to register other aliases that you can remember, such as
  grunt.registerTask('help', ['idk']);
  // and/or
  grunt.registerTask('wtf', ['idk']);
  // and/or
  grunt.registerTask('prompt', ['idk']);
};

Contributing

Please see the contribution guidelines.