0.9.0 • Published 12 months ago
@ninjutsu-build/core v0.9.0
Ninjutsu Build
A TypeScript library for creating ninja files (https://ninja-build.org/).
Why Ninjutsu Build?
Some of the selling points of ninjutsu-build
are:
- TypeScript
- Type-safe design - easy to create build rules that require certain variables, or can have optionally specified variables
- Simple and quick - all methods calls write directly to a
string
property - Ninja rules return the value of the
out
argument, which makes it easier to use linting tools to find unused build artifatcts - Zero dependencies
Prerequisites
This project requires NodeJS (version 18 or later) and npm.
Installation
Most likely you require @ninjutsu-build/core
as a devDependency
, which can be
achieved by running the following npm
command:
$ npm install @ninjutsu-build/core --save-dev
Basic Example
import { NinjaBuilder, needs } from "@ninjutsu-build/core";
import { writeFileSync } from "fs";
// Create a `NinjaBuilder`
const ninja = new NinjaBuilder({
ninja_required_version: "1.1",
builddir: ".mybuilddir",
});
// Create the `touch` rule
const touch = ninja.rule("touch", {
command: "touch $out",
description: "Creating $out",
out: needs<string>(),
});
// Create a build edge using `touch` and store the value
// of the `out` property
const example = touch({
out: "$builddir/example.stamp",
});
// Create the `copy` rule
const copy = ninja.rule("cp", {
command: "cp $in $out",
description: "Copying $in to $out",
out: needs<string>(),
in: needs<string>(),
});
// Copy the file created previously
copy({
in: example,
out: "$builddir/example.copy.stamp",
});
// Write the ninja file to disk
writeFileSync("build.ninja", ninja.output);
0.8.10
1 year ago
0.9.0
12 months ago
0.8.9
1 year ago
0.8.8
1 year ago
0.8.7
1 year ago
0.8.5
1 year ago
0.8.4
1 year ago
0.8.6
1 year ago
0.8.3
1 year ago
0.8.2
1 year ago
0.8.1
1 year ago
0.8.0
1 year ago
0.7.0
1 year ago
0.6.0
1 year ago
0.5.0
2 years ago
0.5.1
2 years ago
0.2.1
2 years ago
0.1.0
2 years ago
0.0.5
2 years ago
0.0.4
2 years ago
0.0.3
2 years ago
0.0.2
2 years ago