Skip to content

Commit 4b816c8

Browse files
committed
feat(build): add parallel builds and consolidate build system
Enhance build.mjs with comprehensive multi-target and platform build support, eliminating the need for separate build-platforms.mjs wrapper script. New features: - Build multiple targets: --targets cli,sea,darwin-arm64 - Build all platforms: --platforms (8 platform targets) - Parallel builds: --parallel (for faster multi-target builds) - Sequential builds: default for --targets and --platforms Platform targets supported: - alpine-arm64, alpine-x64 - darwin-arm64, darwin-x64 - linux-arm64, linux-x64 - win32-arm64, win32-x64 Examples: - pnpm run build --platforms # All platforms sequentially - pnpm run build --platforms --parallel # All platforms in parallel - pnpm run build --targets cli,sea --parallel # Multiple targets in parallel Update README.md with progressive build documentation from easiest to most advanced: 1. Quick start (default smart build) 2. Force rebuild 3. Single target builds 4. Multiple target builds 5. Platform binaries 6. Advanced direct package builds Remove: - build:platforms npm script (replaced by --platforms flag) - scripts/build-platforms.mjs (functionality integrated into build.mjs)
1 parent dfb84fa commit 4b816c8

File tree

4 files changed

+234
-179
lines changed

4 files changed

+234
-179
lines changed

README.md

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ Socket CLI uses an **intelligent build system with automatic caching** that only
119119
3. **CLI Package** - TypeScript compilation and bundling
120120
4. **SEA Binary** - Node.js Single Executable Application
121121

122-
#### Smart build (recommended)
122+
#### Quick start (easiest)
123123

124124
The default build command automatically skips packages that are already up-to-date:
125125

126126
```bash
127-
# Build only what changed (simulates CI caching locally)
127+
# Build only what changed (recommended for development)
128128
pnpm run build
129129
```
130130

@@ -160,34 +160,57 @@ Total: 57.4s
160160

161161
#### Force rebuild
162162

163-
To force rebuild all packages (ignoring cache):
163+
To rebuild everything from scratch (ignoring cache):
164164

165165
```bash
166-
# Rebuild everything from scratch
166+
# Force rebuild all packages
167167
pnpm run build --force
168168
```
169169

170-
#### Build specific packages
170+
#### Single target builds
171171

172-
For targeted builds during development:
172+
For fast iteration during development:
173173

174174
```bash
175-
# Build only CLI package (fast iteration)
175+
# Build only CLI package
176176
pnpm run build --target cli
177177

178178
# Build SEA binary
179179
pnpm run build --target sea
180180

181181
# Build specific platform binary
182182
pnpm run build --target darwin-arm64
183+
```
183184

184-
# See all available targets
185-
pnpm run build --help
185+
#### Multiple target builds
186+
187+
Build multiple packages at once:
188+
189+
```bash
190+
# Build multiple specific targets sequentially
191+
pnpm run build --targets cli,sea,darwin-arm64
192+
193+
# Build multiple targets in parallel (faster)
194+
pnpm run build --targets cli,sea,darwin-arm64 --parallel
195+
```
196+
197+
#### Platform binaries
198+
199+
Build all platform binaries (8 platforms):
200+
201+
```bash
202+
# Build all platforms sequentially (safer for limited resources)
203+
pnpm run build --platforms
204+
205+
# Build all platforms in parallel (much faster, requires more CPU/RAM)
206+
pnpm run build --platforms --parallel
186207
```
187208

188-
#### Manual builds
209+
**Platform targets:** alpine-arm64, alpine-x64, darwin-arm64, darwin-x64, linux-arm64, linux-x64, win32-arm64, win32-x64
189210

190-
You can also build individual packages directly:
211+
#### Advanced: Direct package builds
212+
213+
Build individual packages directly with pnpm filters:
191214

192215
```bash
193216
# Build ONNX Runtime WASM (for AI features)
@@ -203,6 +226,12 @@ pnpm --filter @socketsecurity/cli run build
203226
pnpm --filter @socketbin/node-sea-builder-builder run build
204227
```
205228

229+
#### All build options
230+
231+
```bash
232+
pnpm run build --help
233+
```
234+
206235
See [docs/development/](docs/development/) for detailed development guides.
207236

208237
### Development environment variables

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@
169169
"// Build": "",
170170
"build": "node scripts/build.mjs",
171171
"build:cli": "pnpm --filter @socketsecurity/cli run build",
172-
"build:platforms": "node scripts/build-platforms.mjs",
173172
"build:watch": "pnpm --filter @socketsecurity/cli run build:watch",
174173
"dev": "pnpm run build:watch",
175174
"// Quality Checks": "",

scripts/build-platforms.mjs

Lines changed: 0 additions & 155 deletions
This file was deleted.

0 commit comments

Comments
 (0)