Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 986 Bytes

README.md

File metadata and controls

37 lines (27 loc) · 986 Bytes

esbuild - Ninjutsu Build

A package to create a ninjutsu-build rule for running esbuild.

Installation

Most likely you require both @ninjutsu-build/esbuild and @ninjutsu-build/code as a devDependency, which can be achieved by running the following npm command:

$ npm install @ninjutsu-build/core @ninjutsu-build/esbuild --save-dev

Basic Example

The following transpiles all *.test.ts files in the tests directory to JavaScript,

import { NinjaBuilder } from "@ninjutsu-build/core";
import { makeESBuildRule } from "@ninjutsu-build/esbuild";
import { globSync } from "glob";

const ninja = new NinjaBuilder();
const esbuild = makeESBuildRule(ninja);

globSync("src/*.tests.ts", { posix: true }).map((ts) =>
 esbuild({
    in: ts,
    out: join("$builddir", "dist", basename(file, extname(file)) + ".mjs"),
    buildOptions: { bundle: true, format: "esm" },
  })
);

writeFileSync("build.ninja", ninja.output);