@crustjs/crust 0.0.24 → 0.2.0

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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2 -187
  3. package/package.json +10 -7
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Chenxin Yan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # @crustjs/crust
2
2
 
3
- CLI tooling for the [Crust](https://crustjs.com) framework.
4
-
5
- > For the framework API, install [`@crustjs/core`](https://www.npmjs.com/package/@crustjs/core).
3
+ CLI tooling for the Crust framework
6
4
 
7
5
  ## Install
8
6
 
@@ -10,189 +8,6 @@ CLI tooling for the [Crust](https://crustjs.com) framework.
10
8
  bun add -d @crustjs/crust
11
9
  ```
12
10
 
13
- ## CLI Commands
14
-
15
- The `crust` binary provides three distinct workflows:
16
-
17
- | Command | Description |
18
- | -------------------------- | ---------------------------------------------- |
19
- | `crust build` | Compile raw standalone Bun executable(s) |
20
- | `crust build --man` | Also write `mdoc(7)` to `<outdir>/man/<name>.1` |
21
- | `crust build --package` | Stage per-platform npm packages in `dist/npm` |
22
- | `crust publish` | Publish an existing staged `dist/npm` manifest |
23
-
24
- ### `crust build`
25
-
26
- Compiles your CLI entry file to standalone Bun executables.
27
-
28
- **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.
29
-
30
- ```sh
31
- crust build # All platforms + shell resolver (default)
32
- crust build --entry src/main.ts # Custom entry point
33
- crust build --name my-tool # Set base binary name
34
- crust build --no-minify # Disable minification
35
- crust build --env-file .env.production # Explicit build-time env file
36
- crust build --man # Emit man page (export Crust as `app` or default)
37
- ```
38
-
39
- To build for specific platform(s) only, use `--target`:
40
-
41
- ```sh
42
- crust build --target linux-x64 # Single platform
43
- crust build --target linux-x64 --target darwin-arm64 # Multiple platforms
44
- crust build --target linux-x64 --outfile ./my-cli # Custom output (single target only)
45
- crust build --env-file .env --env-file .env.local # Repeatable env files
46
- ```
47
-
48
- #### Supported Targets
49
-
50
- | Alias | Bun Target | Platform |
51
- | --------------- | -------------------------- | ------------------- |
52
- | `linux-x64` | `bun-linux-x64-baseline` | Linux x86_64 |
53
- | `linux-arm64` | `bun-linux-arm64` | Linux ARM64 |
54
- | `darwin-x64` | `bun-darwin-x64` | macOS Intel |
55
- | `darwin-arm64` | `bun-darwin-arm64` | macOS Apple Silicon |
56
- | `windows-x64` | `bun-windows-x64-baseline` | Windows x86_64 |
57
- | `windows-arm64` | `bun-windows-arm64` | Windows ARM64 |
58
-
59
- #### Flags
60
-
61
- | Flag | Alias | Type | Default | Description |
62
- | ------------ | ----- | ----------- | ------------------- | ---------------------------------------------------------- |
63
- | `--entry` | `-e` | `"string"` | `src/cli.ts` | Entry file path |
64
- | `--outfile` | `-o` | `"string"` | — | Output file path (single-target builds only) |
65
- | `--name` | `-n` | `"string"` | package.json `name` | Base binary name |
66
- | `--minify` | — | `"boolean"` | `true` | Minify the output |
67
- | `--target` | `-t` | `"string"` | _(all platforms)_ | Target platform(s); repeatable |
68
- | `--outdir` | `-d` | `"string"` | `dist` | Output directory for compiled binaries |
69
- | `--resolver` | `-r` | `"string"` | `cli` | Resolver script filename (multi-target only, no extension) |
70
- | `--env-file` | — | `"string"` | — | Explicit env file(s) used for build-time constants |
71
- | `--validate` | — | `"boolean"` | `true` | Pre-compile validation of command definitions |
72
- | `--package` | — | `"boolean"` | `false` | Stage npm packages in `dist/npm` instead of raw binaries |
73
- | `--stage-dir` | — | `"string"` | `dist/npm` | Staging directory used with `--package` |
74
-
75
- #### Output
76
-
77
- **All-platform build** (default, no `--target`):
78
-
79
- ```
80
- dist/
81
- cli # Shell resolver (entry point for npm bin)
82
- cli.cmd # Windows batch resolver
83
- my-cli-bun-linux-x64-baseline # Linux x64 binary
84
- my-cli-bun-linux-arm64 # Linux ARM64 binary
85
- my-cli-bun-darwin-x64 # macOS Intel binary
86
- my-cli-bun-darwin-arm64 # macOS Apple Silicon binary
87
- my-cli-bun-windows-x64-baseline.exe # Windows x64 binary
88
- my-cli-bun-windows-arm64.exe # Windows ARM64 binary
89
- ```
90
-
91
- **Single-target build** (`--target <alias>`):
92
-
93
- ```
94
- dist/
95
- my-cli # Single binary (no resolver)
96
- ```
97
-
98
- `crust build` is the raw binary workflow by default. Add `--package` when you want staged npm packages instead of raw `dist/` binaries.
99
-
100
- #### Environment Variables
101
-
102
- 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.
103
-
104
- `PUBLIC_*` values are embedded in the binary and are therefore public.
105
-
106
- See the full guide: [Environment Variables](https://crustjs.com/docs/guide/environment)
107
-
108
- ### `crust build --package`
109
-
110
- Stages a root npm package plus one npm package per supported target for optionalDependency-based distribution.
111
-
112
- ```sh
113
- crust build --package
114
- crust build --package --target linux-x64
115
- crust build --package --stage-dir .crust/npm
116
- crust build --package --env-file .env.production
117
- ```
118
-
119
- #### Output
120
-
121
- ```text
122
- dist/npm/
123
- manifest.json
124
- root/
125
- package.json
126
- bin/my-cli.js
127
- linux-x64/
128
- package.json
129
- bin/my-cli-bun-linux-x64-baseline
130
- linux-arm64/
131
- package.json
132
- bin/my-cli-bun-linux-arm64
133
- darwin-x64/
134
- package.json
135
- bin/my-cli-bun-darwin-x64
136
- darwin-arm64/
137
- package.json
138
- bin/my-cli-bun-darwin-arm64
139
- windows-x64/
140
- package.json
141
- bin/my-cli-bun-windows-x64-baseline.exe
142
- windows-arm64/
143
- package.json
144
- bin/my-cli-bun-windows-arm64.exe
145
- ```
146
-
147
- The generated root package contains a JS resolver plus `optionalDependencies` on the platform packages. Each platform package is tagged with npm `os` / `cpu` metadata and contains only its native binary. npm generates the platform launchers from the root package `bin` entry during install, so Crust does not stage its own `.cmd` file for `--package`.
148
-
149
- `crust build --package` is the npm-packaging workflow. The staged interface is:
150
-
151
- - `dist/npm/root`
152
- - `dist/npm/<target>`
153
- - `dist/npm/manifest.json`
154
-
155
- `manifest.json` records the root package, staged platform packages, and publish order.
156
-
157
- ### `crust publish`
158
-
159
- Publishes the already-staged directories from `crust build --package`.
160
-
161
- ```sh
162
- crust publish
163
- crust publish --dry-run
164
- crust publish --stage-dir .crust/npm --tag next
165
- ```
166
-
167
- #### Flags
168
-
169
- | Flag | Type | Default | Description |
170
- | ------------- | ----------- | ---------- | ---------------------------------------------------- |
171
- | `--stage-dir` | `"string"` | `dist/npm` | Directory containing the staged `manifest.json` |
172
- | `--tag` | `"string"` | — | npm dist-tag passed to `bun publish` |
173
- | `--access` | `"string"` | `public` | npm access level passed to `bun publish` |
174
- | `--dry-run` | `"boolean"` | `false` | Print publish order and commands without publishing |
175
- | `--verify` | `"boolean"` | `true` | Verify staged directories and metadata before publish |
176
- | `--registry` | `"string"` | — | Override the npm registry URL |
177
-
178
- `crust publish` does not rebuild or restage anything. It reads `manifest.json`, verifies the staged package metadata, publishes platform packages first, and publishes `root/` last.
179
-
180
- ## Recommended Flow
181
-
182
- 1. `crust build` — compile raw binaries
183
- 2. `crust build --package` — stage per-platform npm packages
184
- 3. `crust publish` — publish staged packages to the registry
185
-
186
- The three steps are intentionally separate:
187
-
188
- - `build` produces raw binary artifacts.
189
- - `build --package` creates npm-ready staged packages.
190
- - `publish` uploads the staged packages to the registry.
191
-
192
11
  ## Documentation
193
12
 
194
- See the full docs at [crustjs.com](https://crustjs.com).
195
-
196
- ## License
197
-
198
- MIT
13
+ Full docs: [crustjs.com/docs/modules/crust](https://crustjs.com/docs/modules/crust)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crustjs/crust",
3
- "version": "0.0.24",
3
+ "version": "0.2.0",
4
4
  "description": "CLI tooling for the Crust framework",
5
5
  "license": "MIT",
6
6
  "author": "chenxin-yan",
@@ -24,6 +24,9 @@
24
24
  "publishConfig": {
25
25
  "access": "public"
26
26
  },
27
+ "engines": {
28
+ "bun": ">=1.3.14"
29
+ },
27
30
  "type": "module",
28
31
  "files": [
29
32
  "bin"
@@ -32,11 +35,11 @@
32
35
  "crust": "bin/crust.js"
33
36
  },
34
37
  "optionalDependencies": {
35
- "@crustjs/crust-linux-x64": "0.0.24",
36
- "@crustjs/crust-linux-arm64": "0.0.24",
37
- "@crustjs/crust-darwin-x64": "0.0.24",
38
- "@crustjs/crust-darwin-arm64": "0.0.24",
39
- "@crustjs/crust-windows-x64": "0.0.24",
40
- "@crustjs/crust-windows-arm64": "0.0.24"
38
+ "@crustjs/crust-linux-x64": "0.2.0",
39
+ "@crustjs/crust-linux-arm64": "0.2.0",
40
+ "@crustjs/crust-darwin-x64": "0.2.0",
41
+ "@crustjs/crust-darwin-arm64": "0.2.0",
42
+ "@crustjs/crust-windows-x64": "0.2.0",
43
+ "@crustjs/crust-windows-arm64": "0.2.0"
41
44
  }
42
45
  }