94 lines
2.5 KiB
Markdown
94 lines
2.5 KiB
Markdown
# Build System
|
|
|
|
## Build Targets
|
|
|
|
### 1. Default Build (Multi-file HTML)
|
|
```bash
|
|
npm run build
|
|
```
|
|
|
|
**Output:**
|
|
- `dist/index.html` (~4 KB) - Small HTML file
|
|
- `dist/assets/` - Separate CSS, JS, and font files
|
|
- Ready for web server hosting or IWA bundling
|
|
|
|
### 2. IWA Build (Signed Web Bundle)
|
|
```bash
|
|
npm run build:iwa
|
|
# CI=true npm run build:iwa # Non-interactive mode (CI/CD)
|
|
# WEB_BUNDLE_SIGNING_PASSPHRASE=secret npm run build:iwa # Encrypted key
|
|
```
|
|
|
|
**Output:**
|
|
- `dist/dist.wbn` (~3.4 MB) - Unsigned web bundle
|
|
- `dist/dist.swbn` (~3.5 MB) - **Signed web bundle** for Chrome IWA
|
|
- `iwa_private_key.pem` - Private signing key (keep secure!)
|
|
- `iwa_public_key.pem` - Public key (IWA identity)
|
|
|
|
### 3. Singlefile HTML Build
|
|
```bash
|
|
SINGLEFILE=1 npm run build
|
|
```
|
|
|
|
**Output:** `dist/index.html` (~3.8 MB single file)
|
|
- All assets inlined as data URIs
|
|
- Ready to open directly in browser (offline-capable)
|
|
|
|
## Chrome IWA Installation
|
|
|
|
After running `npm run build:iwa`:
|
|
|
|
### Development Testing (Dev Mode Proxy)
|
|
```bash
|
|
# 1. Enable IWA Dev Mode flag in Chrome
|
|
chrome://flags/#enable-isolated-web-app-dev-mode
|
|
|
|
# 2. Go to chrome://web-app-internals
|
|
# 3. Click "Install IWA with Dev Mode Proxy"
|
|
# 4. Enter URL: file:///home/unfunny/Source Files/AboveTheMark/dist/
|
|
```
|
|
|
|
### Production Installation (Signed Bundle)
|
|
```bash
|
|
# 1. Enable IWA flag in Chrome
|
|
chrome://flags/#enable-isolated-web-app-dev-mode
|
|
|
|
# 2. Go to chrome://web-app-internals
|
|
# 3. Click "Install IWA from Signed Web Bundle"
|
|
# 4. Browse to: dist/dist.swbn
|
|
```
|
|
|
|
### Information
|
|
Check `dist/iwa-info.txt` for:
|
|
- Web Bundle ID
|
|
- IWA Origin (`isolated-app://...`)
|
|
- Installation instructions
|
|
|
|
## Build Files
|
|
|
|
| File | Purpose |
|
|
|------|---------|
|
|
| `vite.config.js` | Vite configuration with build mode detection |
|
|
| `iwa-build.js` | IWA bundling and signing script |
|
|
| `index.html` | Main HTML entry point (with CSP headers) |
|
|
| `public/iwa/manifest.json` | PWA/IWA manifest |
|
|
|
|
## Environment Variables
|
|
|
|
- `SINGLEFILE=1` - Build singlefile HTML
|
|
- `IWA=1` - IWA build mode (used by vite.config.js)
|
|
- `WEB_BUNDLE_SIGNING_PASSPHRASE` - Encrypt private key (optional)
|
|
- `CI=true` - Non-interactive mode (use for CI/CD)
|
|
|
|
## Signing Keys
|
|
|
|
Keys are generated in project root:
|
|
- `iwa_private_key.pem` - Keep this secure! Never commit to version control if storing unencrypted.
|
|
- `iwa_public_key.pem` - Safe to share, used to verify bundle authenticity
|
|
|
|
To generate keys manually:
|
|
```bash
|
|
openssl genpkey -algorithm Ed25519 -out iwa_private_key.pem
|
|
openssl pkey -in iwa_private_key.pem -pubout -out iwa_public_key.pem
|
|
```
|