# rebory

> Make node add-ons easy, than one file, many builds and targets.

Latest version **0.2.10** (published 2024-03-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install rebory
pnpm add rebory
yarn add rebory
bun add rebory
```

Provides the command `rebory`.

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.10 |
| Published | 2024-03-21 |
| First published | 2024-02-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 111.3 KB |
| Known vulnerabilities | 0 (+12 in 1 direct dependencies) |
| Install scripts | no |
| Author | Matheus Sampaio Queiroga |
| Maintainers | sirherobrine23 |
| Keywords | addon, napi, nan, zig, compiler, cross-compiler |

## Links

- npm: https://www.npmjs.com/package/rebory
- Repository: https://sirherobrine23.org/utils/rebory
- npm.io page: https://npm.io/package/rebory

## Dependencies (4)

- [tar](https://npm.io/package/tar.md) ^6.2.0
- [yaml](https://npm.io/package/yaml.md) ^2.4.1
- [yargs](https://npm.io/package/yargs.md) ^17.7.2
- [xz-decompress](https://npm.io/package/xz-decompress.md) ^0.2.1

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.2.10 (latest) — 2024-03-21
- 0.2.9 — 2024-03-21
- 0.2.7 — 2024-03-18
- 0.2.6 — 2024-03-17
- 0.2.5 — 2024-03-14
- 0.2.4 — 2024-02-25
- 0.2.3 — 2024-02-24
- 0.2.2 — 2024-02-24
- 0.2.1 — 2024-02-24
- 0.2.0 — 2024-02-23
- 0.1.12 — 2024-02-19
- 0.1.11-2 — 2024-02-17
- 0.1.11 — 2024-02-17
- 0.1.10 — 2024-02-17
- 0.1.9 — 2024-02-17
- … 9 more at https://npm.io/package/rebory/versions

## README

# Rebory

Making Node addons dynamic and more eficiente config to build.

> [!NOTE]
>
> To do cross-compiler check if the compiler for the architecture exists, if not we will try to use [`zig`](https://ziglang.org/)

> [!WARNING]
>
> `CC` and `CCX` env dont includes ANY arguments, only command, for includes more argurments in compiler, set in config file!

## Static Config

command find in `workdir` one of this files:

- `binding.yaml`
- `binding.yml`

or set with `-c` / `--config` argument.

config file is `YAML` with configs to addon:

```yaml
name: addon
sources:
  - g.c
  - main.cpp
includes:
  - node_modules/node-addon-api
  - ./
```

```yaml
name: addon
sources:
  - g.c
  - main.cpp
---
name: addon2
sources:
  - g.c
  - main.cpp
includes:
  - node_modules/node-addon-api
  - ./
target:
  linux:
    flags:
      - -fPIC
  macos:
    flags:
      - -fPIC
  x86_64-linux-gnu:
    release: true
  aarch64-linux-gnu:
    release: true
  x86_64-macos:
    release: true
  aarch64-macos:
    release: true
  x86_64-windows:
    release: true
  aarch64-windows:
    release: true
```

## Dynamic build

Example:

```js
import builderClass from "rebory";
const builder = new Builder({name: "addon"});
builder.sources.push("./test.cpp");

if (process.platform === "win32") {
  builder.sources.push("./test-win32.cpp");
  builder.librarys.push(
    "bcrypt.lib",
    "crypt32.lib",
    "iphlpapi.lib",
    "kernel32.lib",
    "ntdll.lib",
    "ws2_32.lib",
    "setupapi.lib"
  );
} else if (process.platform === "linux" || process.platform === "android") {
  builder.sources.push("./test-linux.cpp");
  builder.defines.push("LINUX_ENABLED=1");
  if (process.arch === "x64") builder.defines.push("LINUX_KERNEL_X64");
  else if (process.arch === "arm64") builder.defines.push("LINUX_KERNEL_AARCH64");
} else {
  builder.sources.push("./test-dummy.cpp");
}

await builder.run();
```

---
_Source: https://npm.io/package/rebory · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
