# ake

> A build tool

Latest version **0.0.9** (published 2013-03-26) · 0 weekly downloads

## Install

```sh
npm install ake
pnpm add ake
yarn add ake
bun add ake
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2013-03-26 |
| First published | 2013-03-11 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Nikolay G. Nikolov |
| Maintainers | ngn |
| Keywords | build, nodejs, asynchronous, continuation-passing style |

## Links

- npm: https://www.npmjs.com/package/ake
- Repository: https://github.com/ngn/ake
- Homepage: https://github.com/ngn/ake/
- Issues: https://github.com/ngn/ake/issues?state=open
- npm.io page: https://npm.io/package/ake

## Dependencies (6)

- [glob](https://npm.io/package/glob.md)
- [jade](https://npm.io/package/jade.md)
- [async](https://npm.io/package/async.md)
- [docco](https://npm.io/package/docco.md)
- [underscore](https://npm.io/package/underscore.md)
- [coffee-script](https://npm.io/package/coffee-script.md)

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.0.9 (latest) — 2013-03-26
- 0.0.8 — 2013-03-18
- 0.0.7 — 2013-03-17
- 0.0.6 — 2013-03-16
- 0.0.5 — 2013-03-16
- 0.0.4 — 2013-03-16
- 0.0.3 — 2013-03-16
- 0.0.2 — 2013-03-12
- 0.0.1 — 2013-03-11

## README

Ake is a build system.  Not a real build system but rather a library you can
call from your Cakefile or from another build tool that runs on nodejs.

# The idea

I needed a build system for my projects, one that

* takes advantage of node's asynchronous calls.

* doesn't need to spawn new processes for actions which can run in the same v8
  instance, such as compiling CoffeeScript.

* makes use of `mtime` to detect outdated files.  I know, this is unreliable in
  some degenerate cases but I'm not willing to pay the price of computing
  hashes from the content of files.

* can run in the background and watch my source files and immediately do a
  rebuild whenever it detects a change.

* doesn't require its own `?akefile` and doesn't invent its own configuration
  language.  Instead it makes itself available as a library to other tools.

# Usage

In your `Cakefile`:

    {build, action, coffee, uglify, zip, cmd} = require 'ake'
    build(

        # Create a raw action
        action ['f1.in'], ['f2.out'], ({callback}) ->
            console.info 'Generating f2.out...'
            # ... perform the action
            callback()

        # Create an action that will compile a CoffeeScript file
        #
        # `coffee(...)` calls `action(...)` internally and provides
        # the last argument
        coffee 'src/a.coffee', 'lib/a.js'

        # If you specify a directory as a second argument, it figures out the
        # name of the js file
        coffee 'src/b.coffee', 'lib/'

        # If you don't specify a second argument, it defaults to the same directory
        # where the source file is
        coffee 'src/c.coffee'

        # It does globbing
        coffee 'src/d*.coffee', 'lib/'

        # Obfuscate and minify
        uglify 'lib/a.js', 'lib/a.min.js'

        # Compress
        zip 'lib/**/*.js', 'release.tgz'

        # Run an arbitrary shell command as a pipe
        cmd('sha1sum') 'release.tgz', 'release.sha'
    )

# Design

Ake knows about _files_ and _actions_ that generate them.

A file is identified by its path, a string.

An action is defined as the record of:

    {
        inPaths: ['file1', 'file2']    # the list of input files
        outPaths: ['file3', 'file4']   # the list of output files
        action: ({callback}) -> ...      # a function to generate outPaths from inPaths
    }

The call

    build(
        action1,
        action2,
        [action3, [action4, action5]],
        action6,
        -> # an optional continuation after the build is ready
    )

will flatten its argument list, check the timestamps of files mentioned as
`inPaths` or `outPaths`, and rebuild those that are out of date.

There will be convenience functions to create an action object (or an array of
action objects) for a specific purpose, such as:

    coffee('src/*.coffee', 'lib/')

---
_Source: https://npm.io/package/ake · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
