init Command
Goal: create or update a PWAKit project from your PWA URL.
Usage
bash
npx @pwa-kit/cli init [dir] [options]dirdefaults to..- If
dirdoes not exist,initcreates it when extracting the template. - If no project is found, the CLI downloads the template into
dir.
Interactive setup
bash
npx @pwa-kit/cli init my-pwa-iosInteractive mode is used when:
--urlis omitted- stdin is a TTY
Wizard steps (from source):
- Start URL
- App name
- Bundle ID
- Additional allowed origins
- Feature selection
Non-interactive setup
bash
npx @pwa-kit/cli init my-pwa-ios \
--url "https://app.example.com" \
--name "My App" \
--bundle-id "com.example.myapp" \
--features "notifications,haptics,biometrics,secureStorage" \
--forceOptions
| Flag | Description |
|---|---|
-u, --url <url> | Start URL (HTTPS required) |
-n, --name <name> | App display name |
-b, --bundle-id <id> | iOS bundle identifier |
-a, --allowed <origins> | Additional allowed origins (comma-separated) |
--auth <origins> | Auth origins (comma-separated) |
--bg-color <hex> | Background color (#RRGGBB) |
--theme-color <hex> | Theme color (#RRGGBB) |
--orientation <lock> | any, portrait, landscape |
--display <mode> | standalone, fullscreen |
--features <list> | Enabled features (comma-separated) |
-f, --force | Overwrite existing config in non-interactive mode |
--template-version <version> | Download specific template release tag |
Available feature keys
notificationshapticsbiometricssecureStoragehealthkitiapshareprintclipboardcameraPermissionmicrophonePermissionlocationPermission
What init writes and updates
- Generates
src/PWAKit/Resources/pwa-config.json - Optionally downloads
AppIcon-source.pngfrom manifest icon - Runs sync (
apply) automatically
Common errors
- Invalid
--url: must be HTTPS and match CLI regex validation. - Existing config in non-interactive mode: use
--force. - No app name in non-interactive mode: pass
--namewhen manifest has no name.
