milkee
Version:
A simple CoffeeScript build tool with coffee.config.cjs
123 lines (93 loc) • 3.7 kB
Markdown
# Milkee

A simple CoffeeScript build tool with [coffee.config.cjs](./temp/coffee.config.cjs)
## How to get started
### Install
Install Milkee:
```bash
# global installation
npm i -g milkee
# or local installation
npm i -D milkee
```
CoffeeScript & /core are required.
> [!TIP]
> `/core` is required if `options.transpile` is `true` .
```bash
# global installation
npm i -g coffeescript /core
# or local installation
npm i -D coffeescript /core
```
### Setup
Run `-s` (`--setup`) command, generate [coffee.config.cjs](./temp/coffee.config.cjs)!
```bash
# global
milkee -s
# or local
npx milkee -s
```
#### coffee.config.cjs
```js
/** @type {import('@milkee/d').Config} */
module.exports = {
// The entry point for compilation.
// This can be a single file or a directory (e.g., 'src/' or 'src/app.coffee').
entry: 'src',
// The output for the compiled JavaScript files.
// If 'options.join' is true, this should be a single file path (e.g., 'dist/app.js').
// If 'options.join' is false, this should be a directory (e.g., 'dist').
output: 'dist',
// (Optional) Additional options for the CoffeeScript compiler.
// See `coffee --help` for all available options.
// Web: https://coffeescript.org/annotated-source/command.html
options: {
// The following options are supported:
// bare: false,
// join: false,
// map: false,
// inlineMap: false,
// noHeader: false,
// transpile: false,
// literate: false,
// watch: false,
},
// (Optional) Additional options/plugins for the Milkee builder.
milkee: {
options: {
// Before compiling, reset the directory.
// refresh: false,
// Before compiling, confirm "Do you want to Continue?"
// confirm: false,
},
plugins: []
},
};
```
##### `options` (CoffeeScript Compiler Options)
These options are passed directly to the `coffee` compiler.
| Option | Type | Default | Description |
| :---------- | :-------- | :------ | :------------------------------------------------------ |
| `bare` | `boolean` | `false` | compile without a top-level function wrapper |
| `join` | `boolean` | `false` | concatenate the source CoffeeScript before compiling |
| `map` | `boolean` | `false` | generate source map and save as `.js.map` files |
| `inlineMap` | `boolean` | `false` | generate source map and include it directly in output |
| `noHeader` | `boolean` | `false` | suppress the "Generated by" header |
| `transpile` | `boolean` | `false` | pipe generated JavaScript through Babel |
| `literate` | `boolean` | `false` | treat stdio as literate style coffeescript |
| `watch` | `boolean` | `false` | watch scripts for changes and rerun commands |
##### `milkee.options` (Milkee Specific Options)
These options control Milkee's behavior.
| Option | Type | Default | Description |
| :-------- | :-------- | :------ | :----------------------------------------------------- |
| `refresh` | `boolean` | `false` | Before compiling, reset the output directory. |
| `confirm` | `boolean` | `false` | Before compiling, prompt "Do you want to Continue?". |
[CoffeeScript - command.coffee](https://coffeescript.org/annotated-source/command.html)
### Compile
Milkee will automatically read `coffee.config.cjs`, assemble the command from your `options`, and start compilation!
```bash
# global
milkee
# or local
npx milkee
```