myntra-k

1.0.0 • Public • Published

k

I wanted to write 'build' files like so -

k().chain()
.filter(/.js$/)
.read()
.compress()
.hashify()
.concat()
.write()
.log('done!');

So I'm writing it. It's coming along well.

blurb

Build systems, at their core, are:

  • simple task systems
  • most of which deal with files as inputs

We can take these two ideas and make a simple dsl in javascript using deferreds. With A simplified convention, and a set of basic tasks, we can do common 'build-system'-y stuff double quick!

You do this by defining behaviors, or tasks, with functions that accept callbacks. k takes care of the rest, wiring it up to your 'file sets', and executing it in order. You can change the nature of the files by changing the value of this.files during your tasks.

Btw, a 'file' is a simple hash. Looks sorta like this -

{
    src: 'lib/jquery.js',
	content: '...'
	dest: 'dist/lib/jquery.min.js'
}

So when you're making a task, you'd want to to mess with this.files, and change the .content, or .dest, or even add new files to be written on the next pass of .write()

NB: file.content stays blank until you run k().read()

see tasks.js for available tasks. edit script.js for doodling

var o = k({
	src: './',		// src folder, use .filter() to narrow it down from here. defaults to ./
	dest: 'build'	// destination folder. defaults to ./dist
					// send whatever else you'd like, they'll be available on this.config
});
k.task(name, fn)	// define a new task. the task will be available on all further k() instances.

tests

Build Status

npm test

coverage report

npm run-script coverage

Thanks to http://yuilibrary.com/gallery/show/deferred for the deferred pattern.

coming up

  • analysis tasks
  • full fledged examples
  • command-line fu
  • terminal dashboardy stuff?

Readme

Keywords

Package Sidebar

Install

npm i myntra-k

Weekly Downloads

0

Version

1.0.0

License

BSD

Unpacked Size

160 kB

Total Files

23

Last publish

Collaborators

  • shibasis0801