ygor
v6.0.2
Published
For when 'npm run' isn't enough and everything else is too much.
Downloads
66
Maintainers
Readme
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:
@ygor/tasks
- Task runner@ygor/shell
- Shell template tag@ygor/files
- File transformer@ygor/file
- Virtual file object@ygor/list
- Array-aware Promise
MIT © Shannon Moeller