@crustjs/crust 0.0.23 → 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 -185
  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,187 +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 --package` | Stage per-platform npm packages in `dist/npm` |
21
- | `crust publish` | Publish an existing staged `dist/npm` manifest |
22
-
23
- ### `crust build`
24
-
25
- Compiles your CLI entry file to standalone Bun executables.
26
-
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
-
29
- ```sh
30
- crust build # All platforms + shell resolver (default)
31
- crust build --entry src/main.ts # Custom entry point
32
- crust build --name my-tool # Set base binary name
33
- crust build --no-minify # Disable minification
34
- crust build --env-file .env.production # Explicit build-time env file
35
- ```
36
-
37
- To build for specific platform(s) only, use `--target`:
38
-
39
- ```sh
40
- crust build --target linux-x64 # Single platform
41
- crust build --target linux-x64 --target darwin-arm64 # Multiple platforms
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
44
- ```
45
-
46
- #### Supported Targets
47
-
48
- | Alias | Bun Target | Platform |
49
- | --------------- | -------------------------- | ------------------- |
50
- | `linux-x64` | `bun-linux-x64-baseline` | Linux x86_64 |
51
- | `linux-arm64` | `bun-linux-arm64` | Linux ARM64 |
52
- | `darwin-x64` | `bun-darwin-x64` | macOS Intel |
53
- | `darwin-arm64` | `bun-darwin-arm64` | macOS Apple Silicon |
54
- | `windows-x64` | `bun-windows-x64-baseline` | Windows x86_64 |
55
- | `windows-arm64` | `bun-windows-arm64` | Windows ARM64 |
56
-
57
- #### Flags
58
-
59
- | Flag | Alias | Type | Default | Description |
60
- | ------------ | ----- | ----------- | ------------------- | ---------------------------------------------------------- |
61
- | `--entry` | `-e` | `"string"` | `src/cli.ts` | Entry file path |
62
- | `--outfile` | `-o` | `"string"` | — | Output file path (single-target builds only) |
63
- | `--name` | `-n` | `"string"` | package.json `name` | Base binary name |
64
- | `--minify` | — | `"boolean"` | `true` | Minify the output |
65
- | `--target` | `-t` | `"string"` | _(all platforms)_ | Target platform(s); repeatable |
66
- | `--outdir` | `-d` | `"string"` | `dist` | Output directory for compiled binaries |
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 |
69
- | `--validate` | — | `"boolean"` | `true` | Pre-compile validation of command definitions |
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` |
72
-
73
- #### Output
74
-
75
- **All-platform build** (default, no `--target`):
76
-
77
- ```
78
- dist/
79
- cli # Shell resolver (entry point for npm bin)
80
- cli.cmd # Windows batch resolver
81
- my-cli-bun-linux-x64-baseline # Linux x64 binary
82
- my-cli-bun-linux-arm64 # Linux ARM64 binary
83
- my-cli-bun-darwin-x64 # macOS Intel binary
84
- my-cli-bun-darwin-arm64 # macOS Apple Silicon binary
85
- my-cli-bun-windows-x64-baseline.exe # Windows x64 binary
86
- my-cli-bun-windows-arm64.exe # Windows ARM64 binary
87
- ```
88
-
89
- **Single-target build** (`--target <alias>`):
90
-
91
- ```
92
- dist/
93
- my-cli # Single binary (no resolver)
94
- ```
95
-
96
- `crust build` is the raw binary workflow by default. Add `--package` when you want staged npm packages instead of raw `dist/` binaries.
97
-
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`
107
-
108
- Stages a root npm package plus one npm package per supported target for optionalDependency-based distribution.
109
-
110
- ```sh
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
115
- ```
116
-
117
- #### Output
118
-
119
- ```text
120
- dist/npm/
121
- manifest.json
122
- root/
123
- package.json
124
- bin/my-cli.js
125
- linux-x64/
126
- package.json
127
- bin/my-cli-bun-linux-x64-baseline
128
- linux-arm64/
129
- package.json
130
- bin/my-cli-bun-linux-arm64
131
- darwin-x64/
132
- package.json
133
- bin/my-cli-bun-darwin-x64
134
- darwin-arm64/
135
- package.json
136
- bin/my-cli-bun-darwin-arm64
137
- windows-x64/
138
- package.json
139
- bin/my-cli-bun-windows-x64-baseline.exe
140
- windows-arm64/
141
- package.json
142
- bin/my-cli-bun-windows-arm64.exe
143
- ```
144
-
145
- 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`.
146
-
147
- `crust build --package` is the npm-packaging workflow. The staged interface is:
148
-
149
- - `dist/npm/root`
150
- - `dist/npm/<target>`
151
- - `dist/npm/manifest.json`
152
-
153
- `manifest.json` records the root package, staged platform packages, and publish order.
154
-
155
- ### `crust publish`
156
-
157
- Publishes the already-staged directories from `crust build --package`.
158
-
159
- ```sh
160
- crust publish
161
- crust publish --dry-run
162
- crust publish --stage-dir .crust/npm --tag next
163
- ```
164
-
165
- #### Flags
166
-
167
- | Flag | Type | Default | Description |
168
- | ------------- | ----------- | ---------- | ---------------------------------------------------- |
169
- | `--stage-dir` | `"string"` | `dist/npm` | Directory containing the staged `manifest.json` |
170
- | `--tag` | `"string"` | — | npm dist-tag passed to `bun publish` |
171
- | `--access` | `"string"` | `public` | npm access level passed to `bun publish` |
172
- | `--dry-run` | `"boolean"` | `false` | Print publish order and commands without publishing |
173
- | `--verify` | `"boolean"` | `true` | Verify staged directories and metadata before publish |
174
- | `--registry` | `"string"` | — | Override the npm registry URL |
175
-
176
- `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.
177
-
178
- ## Recommended Flow
179
-
180
- 1. `crust build` — compile raw binaries
181
- 2. `crust build --package` — stage per-platform npm packages
182
- 3. `crust publish` — publish staged packages to the registry
183
-
184
- The three steps are intentionally separate:
185
-
186
- - `build` produces raw binary artifacts.
187
- - `build --package` creates npm-ready staged packages.
188
- - `publish` uploads the staged packages to the registry.
189
-
190
11
  ## Documentation
191
12
 
192
- See the full docs at [crustjs.com](https://crustjs.com).
193
-
194
- ## License
195
-
196
- 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.23",
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.23",
36
- "@crustjs/crust-linux-arm64": "0.0.23",
37
- "@crustjs/crust-darwin-x64": "0.0.23",
38
- "@crustjs/crust-darwin-arm64": "0.0.23",
39
- "@crustjs/crust-windows-x64": "0.0.23",
40
- "@crustjs/crust-windows-arm64": "0.0.23"
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
  }