Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 18dc4c3a79 | |||
| 32e3928d19 |
@@ -1,5 +1,13 @@
|
||||
# Changelog
|
||||
|
||||
## 2026-02-09 - 1.2.0 - feat(cli)
|
||||
support default cross-compilation targets from npmextra.json
|
||||
|
||||
- Add @push.rocks/npmextra dependency and export plugin in ts/plugins.ts
|
||||
- Introduce ITsrustConfig and read configuration via plugins.npmextra.Npmextra in TsRustCli
|
||||
- Use npmextra.json targets as fallback when no CLI --target flags are provided
|
||||
- Update README to document npmextra.json configuration for default targets
|
||||
|
||||
## 2026-02-09 - 1.1.0 - feat(cross-compile)
|
||||
add cross-compilation support with --target flag, friendly target aliases, and automatic rustup target installation
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@git.zone/tsrust",
|
||||
"version": "1.1.0",
|
||||
"version": "1.2.0",
|
||||
"private": false,
|
||||
"description": "A tool for compiling Rust projects, detecting Cargo workspaces, building with cargo, and placing binaries in a conventional dist_rust directory.",
|
||||
"main": "dist_ts/index.js",
|
||||
@@ -34,6 +34,7 @@
|
||||
"homepage": "https://code.foss.global/git.zone/tsrust#README",
|
||||
"dependencies": {
|
||||
"@push.rocks/early": "^4.0.4",
|
||||
"@push.rocks/npmextra": "^5.3.3",
|
||||
"@push.rocks/smartcli": "^4.0.19",
|
||||
"@push.rocks/smartfile": "^13.1.2",
|
||||
"@push.rocks/smartpath": "^6.0.0",
|
||||
|
||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@@ -11,6 +11,9 @@ 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.19
|
||||
version: 4.0.20
|
||||
|
||||
14
readme.md
14
readme.md
@@ -119,6 +119,20 @@ dist_rust/
|
||||
|
||||
`tsrust` automatically installs missing rustup targets via `rustup target add` when needed.
|
||||
|
||||
### Configuration via npmextra.json
|
||||
|
||||
You can set default cross-compilation targets in your project's `npmextra.json` file so you don't need to pass `--target` flags every time:
|
||||
|
||||
```json
|
||||
{
|
||||
"@git.zone/tsrust": {
|
||||
"targets": ["linux_arm64", "linux_amd64"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
When targets are configured in `npmextra.json`, simply running `tsrust` will cross-compile for all listed targets. CLI `--target` flags take full precedence — if any `--target` is provided, the `npmextra.json` targets are ignored entirely.
|
||||
|
||||
### 🗑️ Clean Only
|
||||
|
||||
Remove all build artifacts without rebuilding:
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@git.zone/tsrust',
|
||||
version: '1.1.0',
|
||||
version: '1.2.0',
|
||||
description: 'A tool for compiling Rust projects, detecting Cargo workspaces, building with cargo, and placing binaries in a conventional dist_rust directory.'
|
||||
}
|
||||
|
||||
@@ -40,13 +40,20 @@ function friendlyName(triple: string): string {
|
||||
return triple.replace(/-/g, '_');
|
||||
}
|
||||
|
||||
interface ITsrustConfig {
|
||||
targets?: string[];
|
||||
}
|
||||
|
||||
export class TsRustCli {
|
||||
private cli: plugins.smartcli.Smartcli;
|
||||
private cwd: string;
|
||||
private config: ITsrustConfig;
|
||||
|
||||
constructor(cwd: string = process.cwd()) {
|
||||
this.cwd = cwd;
|
||||
this.cli = new plugins.smartcli.Smartcli();
|
||||
const npmextraInstance = new plugins.npmextra.Npmextra(this.cwd);
|
||||
this.config = npmextraInstance.dataFor<ITsrustConfig>('@git.zone/tsrust', { targets: [] });
|
||||
this.registerCommands();
|
||||
}
|
||||
|
||||
@@ -99,11 +106,11 @@ export class TsRustCli {
|
||||
const distDir = path.join(this.cwd, 'dist_rust');
|
||||
const profile = isDebug ? 'debug' : 'release';
|
||||
|
||||
// Parse --target flag (can appear multiple times)
|
||||
const rawTargets = (argvArg as any).target;
|
||||
const targets: string[] = rawTargets
|
||||
? Array.isArray(rawTargets) ? rawTargets : [rawTargets]
|
||||
: [];
|
||||
// Parse --target flag (can appear multiple times), fall back to npmextra.json config
|
||||
const cliTargets = (argvArg as any).target;
|
||||
const targets: string[] = cliTargets
|
||||
? (Array.isArray(cliTargets) ? cliTargets : [cliTargets])
|
||||
: this.config.targets || [];
|
||||
|
||||
if (targets.length > 0) {
|
||||
// Cross-compilation mode
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import * as early from '@push.rocks/early';
|
||||
import * as npmextra from '@push.rocks/npmextra';
|
||||
import * as smartcli from '@push.rocks/smartcli';
|
||||
import * as smartfile from '@push.rocks/smartfile';
|
||||
import * as smartpath from '@push.rocks/smartpath';
|
||||
@@ -6,6 +7,7 @@ import * as smartshell from '@push.rocks/smartshell';
|
||||
|
||||
export {
|
||||
early,
|
||||
npmextra,
|
||||
smartcli,
|
||||
smartfile,
|
||||
smartpath,
|
||||
|
||||
Reference in New Issue
Block a user