@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 +25 -13
- package/bin/crust +1 -1
- package/bin/crust.cmd +1 -1
- package/package.json +7 -7
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 --
|
|
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
|
|
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
|
-
| `--
|
|
68
|
-
| `--stage-dir` | — | `"string"` | `dist/npm` | Staging directory used with `--
|
|
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 `--
|
|
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
|
-
|
|
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 --
|
|
101
|
-
crust build --
|
|
102
|
-
crust build --
|
|
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 --
|
|
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 --
|
|
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 --
|
|
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 --
|
|
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
package/bin/crust.cmd
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crustjs/crust",
|
|
3
|
-
"version": "0.0.
|
|
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.
|
|
36
|
-
"@crustjs/crust-linux-arm64": "0.0.
|
|
37
|
-
"@crustjs/crust-darwin-x64": "0.0.
|
|
38
|
-
"@crustjs/crust-darwin-arm64": "0.0.
|
|
39
|
-
"@crustjs/crust-windows-x64": "0.0.
|
|
40
|
-
"@crustjs/crust-windows-arm64": "0.0.
|
|
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
|
}
|