0.0.4 • Published 3 years ago

glovjs-build v0.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

GLOV.js Build System

API Stability: LOW - under active development

A build system tailored for JavaScript game development, focused on fast, incremental builds with live updates of assets in many shapes and sizes. Created primarily for large projects built on GLOV.js in order to address the many shortcomings of other options that exhibit themselves as a project grows in size.

Simple example

const gb = require('glovjs-build');

gb.configure({
  source: 'src',
  statedir: 'out/.gbstate',
  targets: {
    dev: 'out',
  },
});

gb.task({
  name: 'copy',
  input: 'txt/*.txt',
  type: gb.SINGLE, // Type SINGLE - `func` is called once per changed input file
  target: 'dev',
  func: function copy(job, done) {
    job.out(job.getFile());
    done();
  },
});

gb.task({
  name: 'concat',
  input: [
    'txt/*.txt',
    'txt/*.asc',
  ],
  type: gb.ALL, // Type ALL - `func` is called once with all input files
  target: 'dev',
  func: function concatSimple(job, done) {
    let files = job.getFiles();
    let buffer = Buffer.concat(files.filter(a => a.contents).map(a => a.contents));
    job.out({
      relative: 'concat.txt',
      contents: buffer,
    });
    done();
  },
});

gb.task({
  name: 'default',
  deps: ['copy', 'concat'],
});

gb.go({
  tasks: ['default'],
  watch: true,
});

More Complex Examples