@crustjs/crust 0.0.20 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,12 +17,12 @@ The `crust` binary provides three distinct workflows:
17
17
  | Command | Description |
18
18
  | -------------------------- | ---------------------------------------------- |
19
19
  | `crust build` | Compile raw standalone Bun executable(s) |
20
- | `crust build --distribute` | Stage per-platform npm packages in `dist/npm` |
20
+ | `crust build --package` | Stage per-platform npm packages in `dist/npm` |
21
21
  | `crust publish` | Publish an existing staged `dist/npm` manifest |
22
22
 
23
23
  ### `crust build`
24
24
 
25
- Compiles your CLI entry file to standalone Bun executables using the `Bun.build()` API.
25
+ Compiles your CLI entry file to standalone Bun executables.
26
26
 
27
27
  **By default, builds for all 6 supported platforms** and generates a shell resolver script that detects the host platform at runtime and runs the correct binary. This makes it easy to distribute your CLI as a single npm package that works everywhere — no runtime (Node.js or Bun) required.
28
28
 
@@ -31,6 +31,7 @@ crust build # All platforms + shell resolver (default)
31
31
  crust build --entry src/main.ts # Custom entry point
32
32
  crust build --name my-tool # Set base binary name
33
33
  crust build --no-minify # Disable minification
34
+ crust build --env-file .env.production # Explicit build-time env file
34
35
  ```
35
36
 
36
37
  To build for specific platform(s) only, use `--target`:
@@ -39,6 +40,7 @@ To build for specific platform(s) only, use `--target`:
39
40
  crust build --target linux-x64 # Single platform
40
41
  crust build --target linux-x64 --target darwin-arm64 # Multiple platforms
41
42
  crust build --target linux-x64 --outfile ./my-cli # Custom output (single target only)
43
+ crust build --env-file .env --env-file .env.local # Repeatable env files
42
44
  ```
43
45
 
44
46
  #### Supported Targets
@@ -63,9 +65,10 @@ crust build --target linux-x64 --outfile ./my-cli # Custom output (single
63
65
  | `--target` | `-t` | `"string"` | _(all platforms)_ | Target platform(s); repeatable |
64
66
  | `--outdir` | `-d` | `"string"` | `dist` | Output directory for compiled binaries |
65
67
  | `--resolver` | `-r` | `"string"` | `cli` | Resolver script filename (multi-target only, no extension) |
68
+ | `--env-file` | — | `"string"` | — | Explicit env file(s) used for build-time constants |
66
69
  | `--validate` | — | `"boolean"` | `true` | Pre-compile validation of command definitions |
67
- | `--distribute` | — | `"boolean"` | `false` | Stage npm distribution packages instead of raw binaries |
68
- | `--stage-dir` | — | `"string"` | `dist/npm` | Staging directory used with `--distribute` |
70
+ | `--package` | — | `"boolean"` | `false` | Stage npm packages in `dist/npm` instead of raw binaries |
71
+ | `--stage-dir` | — | `"string"` | `dist/npm` | Staging directory used with `--package` |
69
72
 
70
73
  #### Output
71
74
 
@@ -90,16 +93,25 @@ dist/
90
93
  my-cli # Single binary (no resolver)
91
94
  ```
92
95
 
93
- `crust build` is the raw binary workflow by default. Add `--distribute` when you want staged npm packages instead of raw `dist/` binaries.
96
+ `crust build` is the raw binary workflow by default. Add `--package` when you want staged npm packages instead of raw `dist/` binaries.
94
97
 
95
- ### `crust build --distribute`
98
+ #### Environment Variables
99
+
100
+ Compiled executables still use Bun's **runtime env** behavior. Build-time constants follow Bun's `PUBLIC_*` env-prefix model, sourcing values from Bun's auto-loaded cwd env by default or from explicit `--env-file` inputs.
101
+
102
+ `PUBLIC_*` values are embedded in the binary and are therefore public.
103
+
104
+ See the full guide: [Environment Variables](https://crustjs.com/docs/guide/environment)
105
+
106
+ ### `crust build --package`
96
107
 
97
108
  Stages a root npm package plus one npm package per supported target for optionalDependency-based distribution.
98
109
 
99
110
  ```sh
100
- crust build --distribute
101
- crust build --distribute --target linux-x64
102
- crust build --distribute --stage-dir .crust/npm
111
+ crust build --package
112
+ crust build --package --target linux-x64
113
+ crust build --package --stage-dir .crust/npm
114
+ crust build --package --env-file .env.production
103
115
  ```
104
116
 
105
117
  #### Output
@@ -133,7 +145,7 @@ dist/npm/
133
145
 
134
146
  The generated root package contains shell and `.cmd` launchers plus `optionalDependencies` on the platform packages. Each platform package is tagged with npm `os` / `cpu` metadata and contains only its native binary.
135
147
 
136
- `crust build --distribute` is the npm-packaging workflow. The staged interface is:
148
+ `crust build --package` is the npm-packaging workflow. The staged interface is:
137
149
 
138
150
  - `dist/npm/root`
139
151
  - `dist/npm/<target>`
@@ -143,7 +155,7 @@ The generated root package contains shell and `.cmd` launchers plus `optionalDep
143
155
 
144
156
  ### `crust publish`
145
157
 
146
- Publishes the already-staged directories from `crust build --distribute`.
158
+ Publishes the already-staged directories from `crust build --package`.
147
159
 
148
160
  ```sh
149
161
  crust publish
@@ -167,13 +179,13 @@ crust publish --stage-dir .crust/npm --tag next
167
179
  ## Recommended Flow
168
180
 
169
181
  1. `crust build` — compile raw binaries
170
- 2. `crust build --distribute` — stage per-platform npm packages
182
+ 2. `crust build --package` — stage per-platform npm packages
171
183
  3. `crust publish` — publish staged packages to the registry
172
184
 
173
185
  The three steps are intentionally separate:
174
186
 
175
187
  - `build` produces raw binary artifacts.
176
- - `build --distribute` creates npm-ready staged packages.
188
+ - `build --package` creates npm-ready staged packages.
177
189
  - `publish` uploads the staged packages to the registry.
178
190
 
179
191
  ## Documentation
package/bin/crust CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bash
2
- # Auto-generated by crust build --distribute -- do not edit
2
+ # Auto-generated by crust build --package -- do not edit
3
3
  set -e
4
4
 
5
5
  source="$0"
package/bin/crust.cmd CHANGED
@@ -1,5 +1,5 @@
1
1
  @echo off
2
- rem Auto-generated by crust build --distribute -- do not edit
2
+ rem Auto-generated by crust build --package -- do not edit
3
3
  setlocal
4
4
  set "dir=%~dp0"
5
5
  set "host_arch=%PROCESSOR_ARCHITECTURE%"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crustjs/crust",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "description": "CLI tooling for the Crust framework",
5
5
  "license": "MIT",
6
6
  "author": "chenxin-yan",
@@ -32,11 +32,11 @@
32
32
  "crust": "bin/crust"
33
33
  },
34
34
  "optionalDependencies": {
35
- "@crustjs/crust-linux-x64": "0.0.20",
36
- "@crustjs/crust-linux-arm64": "0.0.20",
37
- "@crustjs/crust-darwin-x64": "0.0.20",
38
- "@crustjs/crust-darwin-arm64": "0.0.20",
39
- "@crustjs/crust-windows-x64": "0.0.20",
40
- "@crustjs/crust-windows-arm64": "0.0.20"
35
+ "@crustjs/crust-linux-x64": "0.0.21",
36
+ "@crustjs/crust-linux-arm64": "0.0.21",
37
+ "@crustjs/crust-darwin-x64": "0.0.21",
38
+ "@crustjs/crust-darwin-arm64": "0.0.21",
39
+ "@crustjs/crust-windows-x64": "0.0.21",
40
+ "@crustjs/crust-windows-arm64": "0.0.21"
41
41
  }
42
42
  }