From db24bcdee7ed3ecd88a672b4d0a8681ddb143e31 Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Sun, 15 Mar 2026 18:23:00 +0000 Subject: [PATCH] feat(readme): document config-based compile targets via npmextra.json --- changelog.md | 7 +++++ readme.md | 56 ++++++++++++++++++++++++++++++++++++++-- ts/00_commitinfo_data.ts | 2 +- 3 files changed, 62 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index 5a7aba3..27bef9d 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,12 @@ # Changelog +## 2026-03-15 - 1.2.0 - feat(readme) +document config-based compile targets via npmextra.json + +- Rename CLI usage to passthrough mode and add config mode documentation +- Describe the npmextra.json schema for compileTargets with example target definitions +- Document the compileFromConfig() programmatic API and batch hide/restore behavior for package.json + ## 2026-03-15 - 1.1.1 - fix(repository) no changes to commit diff --git a/readme.md b/readme.md index c10a16b..18d970c 100644 --- a/readme.md +++ b/readme.md @@ -45,7 +45,7 @@ With `package.json` hidden, Deno only resolves dependencies declared in `deno.js ## Usage -### CLI +### CLI — Passthrough Mode Drop-in replacement — just swap `deno compile` for `tsdeno compile`: @@ -71,6 +71,54 @@ tsdeno compile --allow-all --no-check \ mod.ts ``` +### CLI — Config Mode (npmextra.json) + +For projects with multiple compile targets, you can define them in `npmextra.json` instead of writing long CLI commands. Just run `tsdeno compile` with no arguments: + +```bash +tsdeno compile +``` + +tsdeno reads compile targets from the `@git.zone/tsdeno` key in your `npmextra.json`: + +```json +{ + "@git.zone/tsdeno": { + "compileTargets": [ + { + "name": "myapp-linux-x64", + "entryPoint": "mod.ts", + "outDir": "./dist", + "target": "x86_64-unknown-linux-gnu", + "permissions": ["--allow-all"], + "noCheck": true + }, + { + "name": "myapp-macos-arm64", + "entryPoint": "mod.ts", + "outDir": "./dist", + "target": "aarch64-apple-darwin", + "permissions": ["--allow-all"], + "noCheck": true + } + ] + } +} +``` + +Each compile target supports these fields: + +| Field | Type | Required | Description | +| -------------- | ---------- | -------- | ----------------------------------------------------- | +| `name` | `string` | ✅ | Output binary name (combined with `outDir` for path) | +| `entryPoint` | `string` | ✅ | Path to the entry TypeScript file | +| `outDir` | `string` | ✅ | Directory for the compiled output | +| `target` | `string` | ✅ | Deno compile target triple (e.g. `x86_64-unknown-linux-gnu`) | +| `permissions` | `string[]` | ❌ | Deno permission flags (e.g. `["--allow-all"]`) | +| `noCheck` | `boolean` | ❌ | Skip type checking (`--no-check`) | + +In config mode, `package.json` is hidden **once** for the entire batch — all targets compile in sequence with a single hide/restore cycle. + ### Programmatic API You can also use `tsdeno` as a library in your build scripts: @@ -81,6 +129,7 @@ import { TsDeno } from '@git.zone/tsdeno'; const tsDeno = new TsDeno(); // uses process.cwd() // or: new TsDeno('/path/to/project') +// Passthrough mode — pass args directly await tsDeno.compile([ '--allow-all', '--no-check', @@ -88,6 +137,9 @@ await tsDeno.compile([ '--target', 'x86_64-unknown-linux-gnu', 'mod.ts', ]); + +// Config mode — reads compile targets from npmextra.json +await tsDeno.compileFromConfig(); ``` The `TsDeno` class handles the full package.json isolation lifecycle automatically. @@ -151,7 +203,7 @@ Use of these trademarks must comply with Task Venture Capital GmbH's Trademark G ### Company Information -Task Venture Capital GmbH +Task Venture Capital GmbH Registered at District Court Bremen HRB 35230 HB, Germany For any legal inquiries or further information, please contact us via email at hello@task.vc. diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 1a0c020..a74dca5 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@git.zone/tsdeno', - version: '1.1.1', + version: '1.2.0', description: 'A helper tool for deno compile that strips package.json to prevent devDependency bloat in compiled binaries.' }