handmade

0.2.1 • Public • Published

handmade

handmade on NPM handmade on Travis Standard JavaScript Style handmade Stability Index

DIY build systems, tooling, and more.

  • Small. The API is just 2 methods.
  • Simple. A task is just a function that returns a Promise.
  • Familiar. Easily write your own tasks using node and the ecosystem.
  • Accessible. No complex plugin architecture or file handling.
  • Fluid. Functions to the core. Functional in nature.

Getting Started

  1. Install
  2. Review Tasks
  3. First Build

Install

# via npm 
$ npm i handmade --save
 
# via yarn 
$ yarn add handmade

Tasks

A task is a function that manipulates the build object.

handmade is a waterfall under the hood - a build runs all tasks in series, passing the same build object to each one.

See the example code below (thoroughly commented):

First Build

Give this example a look. If you want to work with the filesystem, it's this simple:

// import handmade
const handmade = require('handmade')
 
// import fs read/write tasks
const {
  read,
  write 
= require('handmade-fs')
 
// define a custom task that has access to file data
const customTask = contents => new Promise((resolve, reject) => {
  // destructure file data from contents
  let { files } = contents.core
 
  // do work here, sync or async, using the file data
  // files is an object of file paths -> file contents
  console.log(files)
 
  // when done, resolve and pass along the contents object
  resolve(contents)
})
 
// kick off a new build, passing a path to the root of your project
handmade(__dirname)
  // point it to your source files
  .task(read('./input'))
 
  // add your custom task
  .task(customTask)
 
  // point it to where the output should go
  .task(write('./output'))
 
  // kick off the build
  .build()
 
  // do more with the result of the build, if you want to
  .then(result => {
 
  })
 
  // when shit blows up
  .catch(error => {
 
  })

See Also

License

MIT. © 2017 Michael Cavalea

Readme

Keywords

none

Package Sidebar

Install

npm i handmade

Weekly Downloads

1

Version

0.2.1

License

MIT

Last publish

Collaborators

  • callmecavs