jako
v1.0.4
Published
<p align="center"><img src="./.github/logo.png" width="215" /><p> <br>
Downloads
3
Readme
Zero setup: There is no need to configure jako, and setting it up is as easy as moving your current scripts to a folder.
Polyglot: You are free to write your scripts using any language you want.
Translucent: Forget about build tools that force you to write code that only work for that specific runner. As a principle, all the scripts run by jako need to be executable also without jako. No vendor lock, less API to keep track of.
Extensible and modular: jako doesn't hold you back while your project is growing. Encapsulate as many independent projects as you want in a single repo and jako will let you run all your scripts from a centralized place.
The name jako
comes from "JAKe + Opinionated".
Jake is the JavaScript build tool for NodeJS. Jake has been around since the very early days of Node, and is very full featured and well tested.
In essence, jako is just a tiny but powerful wrapper around jake. Under the hood, jako combines the maturity of a battle-tested codebase with a modern architecture.
Getting started
Installing it
You can install it from one of these 3 options:
globally, with NPM
$ npm install -g jako
globally, with Yarn
$ yarn global add jako
locally
you may also install it as a development dependency in a package.json file:
// package.json
"devDependencies": {
"jako": "latest"
}
Then install it with either npm install
or yarn install
Basic usage
jako [options ...] [env variables ...] target
for the full list of available options
, please check jake's options.
Writting your first scripts/tasks
Let's create our first script together! To do so, let's imagine you want to have a script that clears all the node_modules
folders in your repo.
- create a
/scripts/clean
folder and create a file namednode_modules.sh
inside it:
$ mkdir -p scripts/clean
$ printf "#\!/bin/bash\nfind . \( -type d -name 'node_modules' \) -exec rm -rf '{}' +" > scripts/clean/node_modules.sh
- give it permission to run:
$ chmod +x **/*.sh
- run it!
# both calls below should be equivalent:
$ jako clean:node_modules
# or
$ cd ./scripts/clean ; ./node_modules.sh
# running `jako` with no arguments will list the available tasks
$ jako
Keep in mind that you can create scripts
folder anywhere you want in your project and jako will adapt to it.
Nesting scripts
folders deep inside your project is not only possible but recommended!
Good practices
- always add shebang to your scripts.
- always give your scripts permission to run:
chmod +x file-path.ext
- jako will always call your scripts from the directory they are placed in, but not all runners will do that for you. If you, i.e, execute a bash script as
./scripts/clean/node_modules.sh
instead ofcd ./scripts/clean ; ./node_modules.sh
, that could remove folders in different places than the ones you expected. That's why we encourage you to enforce a standardizedcwd
for all your scripts. In bash you can do that by appendingdirname "$0"
to the top of your scripts.
Credits
Vector illustration credit: www.vecteezy.com