ygor

6.0.2 • Public • Published

ygor

For when npm run isn't enough and everything else is too much.

version downloads build status coverage status


Ygor is a no-frills toolkit consisting of a task runner and a file transformer. Enjoy as a whole or a la carte. Built on promises to work wonderfully with async and await in Node.js 8 and above.

Node is the CLI, npm is the plugin system. Go nuts.

Install

$ npm install --save-dev ygor

Usage

Create a JavaScript file, write some functions, tell Ygor.

// make.js
 
const { tasks, shell, find, read, write } = require('ygor');
const { transform } = require('babel-core');
 
function buildCss() {
  return shell`postcss --use autoprefixer --dir dest src/**/*.css`;
}
 
function buildJs(cli) {
  return find('src/**/*.js')
    .map(read())
    .map(async (file) => {
      const { code } = await transform(file.contents, cli);
 
      file.contents = code;
 
      return file;
    })
    .map(write('dest'));
}
 
async function build(cli) {
  await buildCss(cli);
  await buildJs(cli);
}
 
tasks
  .add('css', buildCss);
  .add('js', buildJs)
  .add('default', build);

To run a task, execute the file with Node.js and indicate which task to perform.

$ node make js --minified

API

See the individual packages for complete documentation:


MIT © Shannon Moeller

Package Sidebar

Install

npm i ygor

Weekly Downloads

70

Version

6.0.2

License

MIT

Unpacked Size

5.02 kB

Total Files

3

Last publish

Collaborators

  • shannonmoeller