npm

whatever

6000.0.0 • Public • Published

why ./task.js?

One word: task automation. It's basically zero effort and you can use the ./task.js package manager to handle any repetitive tasks. You can use ./task.js to automate everything with minimum effort.

./task.js provides the structure, order, and authority that you as a developer so desperately crave. ./task.js will also take responsibility for your actions if you need it to. It's what everybody is using now. ./task.js is the new hotness. It's all about ./task.js now, just like that.

This is compared to npm run/bash scripts, which are:

  • scary
  • not cross-platformant for deploying to windows server 2003
  • old news. Nobody uses bash these days.

getting started

To install ./task.js, first install node.js.

Now you'll need to generate some scaffolding for your project.

You can use the following scaffold generator:

#!/usr/bin/env node
var fs = require('fs');
['browser','static','style'].forEach(fs.mkdir);
fs.writeFile('task.js', '#!/usr/bin/env node\n', { mode: 0775 });

browser code goes in browser/, stylesheets go in style/, static assets go in static/. You are free to change these directory names to be whatever you want. Just modify the scaffold generator.

Now you can get started writing your ./task.js script. Here is an example script that uses the browserify, watchify, and catw plugins published to the ./task.js plugin repository:

#!/usr/bin/env node
 
var fs = require('fs');
var browserify = require('browserify');
var watchify = require('watchify');
var catw = require('catw');
 
var cmd = process.argv[2];
if (cmd === 'build') build({ watch: false })
else if (cmd === 'watch') build({ watch: true })
else usage(1)
 
function build (opts) {
  var js = opts.watch ? watchify : browserify;
  js('./browser/main.js').bundle()
    .pipe(fs.createWriteStream('static/bundle.js'))
  ;
  
  var css = catw('style/*.css', { watch: opts.watch });
  css.on('stream', function (stream) {
    stream.pipe(fs.createWriteStream('static/bundle.css'));
  });
}
 
function usage (code) {
  console.error('usage: ./task.js { build | watch }');
  if (code) process.exit(code);
}

install

To install ./task.js, first install node.js.

Readme

Keywords

none

Package Sidebar

Install

npm i whatever

Weekly Downloads

5

Version

6000.0.0

License

BSD

Last publish

Collaborators

  • maxogden