Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including genome with all npm packages installed. Try it out:

var genome = require("genome")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

genome v0.1.1

Simple build system using ES6 generators and promises


Simple build system using ES6 classes, generators, and promises


genome requires io.js or node.js with harmony flags.

npm i -g genome
npm i -save-dev genome


Create a genomefile.js in your project's root directory.

var genome = require('genome');

genome.tasks = {
  // Tasks go here

// Run tasks passed in from command line;

Create tasks

Tasks in genome are generator functions. Task names may include colons (:) and/or hyphens (-).

* sayhi() {
  console.log('Hello, world');

* 'say-something-else'() {
  console.log('Something else');

* 'say:goodbye'() {
  console.log('See ya later');

Run tasks

In your command line, run:

genome sayhi

genome commands may accept multiple tasks to run asyncronously:

genome sayhi say-something-else say:goodbye

Run a task from within another task using genome.spawn().

* speak() {

  // Or use genome's shorthand methods:

genome.spawn() accepts strings and arrays. Arrays of tasks will be run asyncronously.

* speak1() {
  genome.spawn(['sayhi', 'say-something-else', 'say:goodbye']);

// Is the same as:

* speak2() {

If you need tasks to run in a certain order, add the yield statement before calling genome.spawn().

* speak2() {
  yield genome.spawn('sayhi');
  yield genome.spawn('say-something-else');

Read/write files

Genome adds read() and write() methods to strings to make reading and writing files as easy as:

return 'dist/html.index'.write(yield 'app/html.index'.read());

Genome also adds a .contents property as a read/write shorthand, so the same code can be written as:

'dist/html.index'.contents = yield 'app/html.index'.contents;

Not that read(), write() and the .contents getter all return promises, but the .contents setter does not return anything. So if you need the file to be written before something else happens, use write().

.write() accepts strings, promises, streams and arrays of file objects.

Processing files

Genome does not require plugins like gulp or grunt. Simply install standard node packages and use their build-in api.

* html() {
  // Process one file and output it
  var slm = require('slm');

  return 'dist/index.html'.write(slm.render(yield 'app/index.slm'.contents));

* scripts() {
  // Output stream to file
  var browserify = require('browserify');

  return 'dist/scripts/app.js'.write(browserify('app/scripts/app.js', { transform: 'babelify' }).bundle());

* styles() {
  // Output multiple files to directory with the String.prototype.use method
  var stylus = require('stylus');

  return 'dist/styles/'.write(yield 'app/styles/*.styl'.use(stylus.render, '.css'));

Watch files

Watch files for changes with String.prototype.onChange, passing in a function or a task name or array of task names.

* watch() {

Project Goals

  • Never require speciallized plugins like Gulp and Grunt
  • Keep code as simple and natural as possible


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free