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

pliers

v1.2.1

Published

A buildy, watchy type tool

Downloads

1,953

Readme

pliers - A buildy, watchy type tool

build status

Installation

  npm install -g pliers

Introduction

Pliers allows you to use JavaScript to write your build tasks like you would your applications. It has three key features include/exclude filesets, dependency resolution, and file watching.

FAQ

Why bother making a new build tool, what is wrong with make?

make is an great tool, but sometimes you need to do more that just run scripts and create folders. Sometimes it is handy to have a little project context when doing build tasks. pliers is all JavaScript so you can use your existing code and npm modules.

Why not just make a node.js script for build tasks that need then and call them from make?

That is a good method and will work for many projects. But you are splitting an activity over two languages as soon there is a little bit of complexity it makes maintenance, debugging and knowledge transfer harder. Having a structured build system with a minimal but useful feature set certainly solves problems for us at Clock.

Is there a plugin system?

Yes it's called require()

CLI Usage

Usage: pliers [options] [task]

Options:
  -h, --help                                          output usage information
  -V, --version                                       output the version number
  -t, --tasks [file]                                  A file with user defined tasks (Default: ./pliers.js)
  -l, --list                                          List all available tasks with descriptions
  -b, --bare                                          List task names only
  -a, --all                                           Run all named tasks with in the current tree
  -L, --logLevel [trace|debug|info|warn|error|fatal]  Set the level of logs to output

pliers.js

Running pliers will look for a pliers.js in the current working directory.

Tasks

module.exports = function (pliers) {

  pliers('hello', function (done) {
    pliers.logger.info('Hello world')
    done()
  })

}

To run the hello task from the command line:

 pliers hello

Dependencies

Pliers will resolve and run all dependencies before executing the task


pliers('test', function (done) {
  pliers.exec('npm test', done)
})

pliers('lint', { description: 'Run jshint all on project JavaScript' }, function (done) {
  pliers.exec('jshint lib test', done)
})

pliers('qa', 'test', 'lint')

This will run test task and then the lint task.

 pliers qa

API

Pliers is not very opinionated and has very little API surface area. That said there are a few built in functions.

exec(command)

Executes command using require('child_process').spawn and returns the ChildProcess.


pliers('list', function (done) {
  pliers.exec('ls', done)
})

run(taskName)

Run another pliers task.


pliers('runner', function (done) {
  pliers.run('list', done)
})

load(folder)

Load another pliers project into a parent. This is useful if you have standalone sub projects.


pliers.load('./subproject')

You can then run sub project tasks from the parent using the -A option.

runAll(taskName)

Run all pliers task for any loaded sub pliers project.


pliers('build', function (done) {
  pliers.runAll('build', done)
})
 pliers build

This will build all the sub project build tasks

filesets(id, includePatterns[, excludePatterns])

Create a fileset that can be used to perform tasks on. The following fileset example would return all .js files in the current directory, excluding those that end in .test.js.


pliers.filesets('js', __dirname + '/*.js', __dirname + '/*.test.js')

includePatterns & excludePatterns can be either a string or an Array if you need multiple glob conditions.

Filesets are calculated using the node-glob module. The filesets are first generated when they are accessed, this is done using the id property as follows:


console.log(pliers.filesets.js) // Will output the fileset with the id 'js'

watch()


// Run the unit tests whenever a JavaScript file changes
pliers('watchCss', function (done) {

  pliers.filesets('js', __dirname + '/*.js', __dirname + '/*.test.js')

  pliers('test', function (done) {
    pliers.exec('npm test', done)
  })

  pliers.watch(pliers.filesets.js, function() {
    pliers.run('test')
  })
})

Credits

Licence

Licensed under the New BSD License