6 Commits

8 changed files with 105 additions and 16 deletions

View File

@@ -1,5 +1,22 @@
# Changelog
## 2026-03-24 - 1.3.0 - feat(config)
switch compile target configuration from npmextra to smartconfig
- replace the @push.rocks/npmextra dependency with @push.rocks/smartconfig
- load compileTargets via Smartconfig and update CLI and runtime messages to reference smartconfig.json
## 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
## 2026-03-15 - 1.1.0 - feat(cli)
add npmextra-based compile target configuration for deno builds

View File

@@ -1,6 +1,6 @@
{
"name": "@git.zone/tsdeno",
"version": "1.1.0",
"version": "1.3.0",
"private": false,
"description": "A helper tool for deno compile that strips package.json to prevent devDependency bloat in compiled binaries.",
"main": "dist_ts/index.js",
@@ -25,7 +25,7 @@
],
"dependencies": {
"@push.rocks/early": "^4.0.4",
"@push.rocks/npmextra": "^5.3.3",
"@push.rocks/smartconfig": "^6.0.0",
"@push.rocks/smartcli": "^4.0.20",
"@push.rocks/smartfs": "^1.5.0",
"@push.rocks/smartshell": "^3.3.7"

26
pnpm-lock.yaml generated
View File

@@ -11,12 +11,12 @@ importers:
'@push.rocks/early':
specifier: ^4.0.4
version: 4.0.4
'@push.rocks/npmextra':
specifier: ^5.3.3
version: 5.3.3
'@push.rocks/smartcli':
specifier: ^4.0.20
version: 4.0.20
'@push.rocks/smartconfig':
specifier: ^6.0.0
version: 6.0.0
'@push.rocks/smartfs':
specifier: ^1.5.0
version: 1.5.0
@@ -888,6 +888,9 @@ packages:
'@push.rocks/smartclickhouse@2.2.0':
resolution: {integrity: sha512-eTzKiREIPSzL1kPkVyD6vEbn+WV/DvQqDjP67VlhNlQGbRcemnJG/eLrUUR1ytmdIqnsZGEK6UYBgyj5nhzLNQ==}
'@push.rocks/smartconfig@6.0.0':
resolution: {integrity: sha512-ohXwJdbDXV2budErnZKWBOz01YkjP6gJsZ7QM9+6Wsh+r7O1CVT3JpV+mD8xJWy5tZRHI+3B9L8z0+WkIDtKzw==}
'@push.rocks/smartcrypto@2.0.4':
resolution: {integrity: sha512-1+/5bsjyataf5uUkUNnnVXGRAt+gHVk1KDzozjTqgqJxHvQk1d9fVDohL6CxUhUucTPtu5VR5xNBiV8YCDuGyw==}
@@ -4793,6 +4796,23 @@ snapshots:
'@push.rocks/smarturl': 3.1.0
'@push.rocks/webrequest': 4.0.5
'@push.rocks/smartconfig@6.0.0':
dependencies:
'@push.rocks/qenv': 6.1.3
'@push.rocks/smartfile': 11.2.7
'@push.rocks/smartjson': 5.2.0
'@push.rocks/smartlog': 3.2.1
'@push.rocks/smartpath': 6.0.0
'@push.rocks/smartpromise': 4.2.3
'@push.rocks/smartrx': 3.0.10
'@push.rocks/taskbuffer': 3.5.0
'@tsclass/tsclass': 9.4.0
transitivePeerDependencies:
- '@nuxt/kit'
- react
- supports-color
- vue
'@push.rocks/smartcrypto@2.0.4':
dependencies:
'@push.rocks/smartpromise': 4.2.3

View File

@@ -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.

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@git.zone/tsdeno',
version: '1.1.0',
version: '1.3.0',
description: 'A helper tool for deno compile that strips package.json to prevent devDependency bloat in compiled binaries.'
}

View File

@@ -3,7 +3,7 @@ import * as path from 'path';
export { path };
// @push.rocks scope
import * as npmextra from '@push.rocks/npmextra';
import * as npmextra from '@push.rocks/smartconfig';
import * as smartcli from '@push.rocks/smartcli';
import { SmartFs, SmartFsProviderNode } from '@push.rocks/smartfs';
import * as smartshell from '@push.rocks/smartshell';

View File

@@ -59,18 +59,18 @@ export class TsDeno {
* The package.json hide/restore wraps the entire loop.
*/
public async compileFromConfig(): Promise<void> {
const npmextraInstance = new plugins.npmextra.Npmextra(this.cwd);
const npmextraInstance = new plugins.npmextra.Smartconfig(this.cwd);
const config = npmextraInstance.dataFor<ITsdenoConfig>('@git.zone/tsdeno', {
compileTargets: [],
});
if (config.compileTargets.length === 0) {
console.error('tsdeno: no compileTargets found in npmextra.json under "@git.zone/tsdeno"');
console.error('tsdeno: either pass args directly or add config to npmextra.json');
console.error('tsdeno: no compileTargets found in smartconfig.json under "@git.zone/tsdeno"');
console.error('tsdeno: either pass args directly or add config to smartconfig.json');
process.exit(1);
}
console.log(`tsdeno: found ${config.compileTargets.length} compile target(s) in npmextra.json`);
console.log(`tsdeno: found ${config.compileTargets.length} compile target(s) in smartconfig.json`);
const packageJsonPath = plugins.path.join(this.cwd, 'package.json');
const backupPath = plugins.path.join(this.cwd, 'package.json.bak');

View File

@@ -10,10 +10,10 @@ tsdenoCli.standardCommand().subscribe(async (argvArg) => {
console.log(`@git.zone/tsdeno v${commitinfo.version}`);
console.log('');
console.log('Usage:');
console.log(' tsdeno compile Compile all targets from npmextra.json');
console.log(' tsdeno compile Compile all targets from smartconfig.json');
console.log(' tsdeno compile [deno compile args...] Compile with explicit args (passthrough)');
console.log('');
console.log('When no args are given, tsdeno reads compileTargets from npmextra.json.');
console.log('When no args are given, tsdeno reads compileTargets from smartconfig.json.');
console.log('The compile command temporarily removes package.json before running');
console.log('deno compile, preventing devDependencies from bloating the binary.');
console.log('--node-modules-dir=none is added automatically.');
@@ -24,7 +24,7 @@ tsdenoCli.addCommand('compile').subscribe(async (argvArg) => {
const rawArgs = process.argv.slice(3);
if (rawArgs.length === 0) {
// No args — read targets from npmextra.json
// No args — read targets from smartconfig.json
await tsDeno.compileFromConfig();
} else {
// Args provided — passthrough to deno compile