ninja-build-gen is a JavaScript library designed to programmatically create manifest files for the Ninja build system. As of its latest version, 0.2.2, published over a decade ago, the project appears to be abandoned, with no known active development or recent updates. It provides a low-level API to define build rules, edges, and variables directly in JavaScript, outputting a standard `build.ninja` file. It differentiates itself by offering direct, code-based generation of Ninja manifests, enabling developers to define their build logic dynamically. However, it explicitly does not include the Ninja build system itself, nor does it provide high-level features like file globbing or pattern matching, recommending external libraries such as `glob` or `globule` for such functionalities. Its minimal scope focuses solely on generating the build file structure.
npm install ninja-build-genVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to initialize `ninja-build-gen`, define custom build rules for CoffeeScript and Stylus, create build edges for source files, set a default target, and save the generated `build.ninja` file. This script effectively acts as a 'configure.js' for a project.
Consider using alternative, actively maintained build automation tools or package an older Node.js version in a container for compatibility.
Install the Ninja build system globally or as a project dependency (e.g., `npm install ninja-build --save-dev`) and ensure it's available in your PATH.
Integrate a file globbing library (e.g., `npm install glob globule`) and use its API to programmatically determine input and output files before defining Ninja edges.
Ensure your project uses CommonJS (`.js` files with `require`) or configure your build system (e.g., Webpack, Rollup, Babel) to transpile to CommonJS if using ES Modules.
Rename your file to `.cjs` or change your `package.json` to `"type": "commonjs"`. Alternatively, restructure your project to use older Node.js versions compatible with CommonJS as default.
Ensure you are using `const ninjaBuildGen = require('ninja-build-gen');` and that the package is correctly installed and accessible in your Node.js environment.Install the Ninja build system globally (e.g., `sudo apt-get install ninja-build` on Linux, `brew install ninja` on macOS) or install `npm install ninja-build --save-dev` and invoke it via `npx ninja` or a package script.