@iwsdk/create 0.2.1 → 0.2.3
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.
- package/README.md +133 -26
- package/dist/cli.js +13080 -9391
- package/package.json +17 -10
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -1,42 +1,149 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">create-iwsdk</h1>
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://www.npmjs.com/package/@iwsdk/create"><img src="https://badgen.net/npm/v/@iwsdk/create/?icon=npm&color=orange" alt="npm version" /></a>
|
|
5
|
+
<a href="https://www.npmjs.com/package/@iwsdk/create"><img src="https://badgen.net/npm/dt/@iwsdk/create" alt="npm download" /></a>
|
|
6
|
+
<a href="https://raw.githubusercontent.com/facebook/immersive-web-sdk/main/LICENSE"><img src="https://badgen.net/github/license/facebook/immersive-web-sdk/" alt="license" /></a>
|
|
7
|
+
</p>
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
- `pnpm dlx @iwsdk/create@latest`
|
|
9
|
+
<p align="center"><strong>Scaffold a new Immersive Web SDK project in seconds.</strong></p>
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+
## Quick Start
|
|
9
12
|
|
|
10
|
-
|
|
13
|
+
```bash
|
|
14
|
+
npm create @iwsdk@latest
|
|
15
|
+
```
|
|
11
16
|
|
|
12
|
-
|
|
13
|
-
- `${ASSETS_BASE}/recipes/<variant>.recipe.json`
|
|
17
|
+
Or with other package managers:
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
```bash
|
|
20
|
+
# pnpm
|
|
21
|
+
pnpm create @iwsdk@latest
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
# yarn
|
|
24
|
+
yarn create @iwsdk
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
# bun
|
|
27
|
+
bun create @iwsdk
|
|
28
|
+
```
|
|
21
29
|
|
|
22
|
-
|
|
30
|
+
## Interactive Prompts
|
|
23
31
|
|
|
24
|
-
|
|
32
|
+
The CLI will guide you through:
|
|
25
33
|
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
1. **Project name** - Directory name for your new project
|
|
35
|
+
2. **Language** - TypeScript or JavaScript
|
|
36
|
+
3. **Platform** - VR (Virtual Reality) or AR (Augmented Reality)
|
|
37
|
+
4. **XR Features** - Hand tracking, layers, anchors, hit-test, plane/mesh detection (tri-state: No/Optional/Required)
|
|
38
|
+
5. **SDK Features** - Locomotion (VR), Scene Understanding (AR), Grabbing, Physics
|
|
39
|
+
6. **Meta Spatial Editor** - Optional visual scene authoring integration
|
|
40
|
+
7. **Git & Install** - Initialize git repo and install dependencies
|
|
28
41
|
|
|
29
|
-
##
|
|
42
|
+
## What You Get
|
|
30
43
|
|
|
31
|
-
|
|
32
|
-
- `src/prompts.ts` — all interactive questions and defaults.
|
|
33
|
-
- `src/recipes.ts` — tiny fetch helpers (`DEFAULT_ASSETS_BASE`, `fetchRecipesIndex`, `fetchRecipeByFileName`). Internal use only.
|
|
34
|
-
- `src/scaffold.ts` — wraps Chef’s `buildProject` and writes files to disk with status spinners.
|
|
35
|
-
- `src/installer.ts` — installs dependencies with npm and prints next steps.
|
|
36
|
-
- `src/types.ts` — shared types (`VariantId`, `TriState`, `PromptResult`).
|
|
44
|
+
A fully configured project with:
|
|
37
45
|
|
|
38
|
-
|
|
46
|
+
- ⚡ **Vite** - Fast dev server with HMR
|
|
47
|
+
- 🎮 **WebXR Emulator** - Develop without VR hardware
|
|
48
|
+
- 📦 **GLTF Optimization** - Automatic asset compression
|
|
49
|
+
- 🔒 **HTTPS** - Required for WebXR, auto-configured
|
|
50
|
+
- 🏗️ **Meta Spatial Editor** - Visual scene authoring (optional)
|
|
39
51
|
|
|
40
|
-
##
|
|
52
|
+
## Example
|
|
41
53
|
|
|
42
|
-
|
|
54
|
+
```bash
|
|
55
|
+
$ npm create @iwsdk@latest
|
|
56
|
+
|
|
57
|
+
===============================================
|
|
58
|
+
IWSDK Create CLI v0.2.2
|
|
59
|
+
Node v20.19.0
|
|
60
|
+
|
|
61
|
+
? Project name › iwsdk-app
|
|
62
|
+
? Which language do you want to use? › TypeScript
|
|
63
|
+
? What type of experience are you building? › Virtual Reality
|
|
64
|
+
? Enable Hand Tracking? › Optional
|
|
65
|
+
? Enable WebXR Layers? › Optional
|
|
66
|
+
? Enable locomotion? › Yes
|
|
67
|
+
? Deploy locomotion engine on a Worker? › Yes (recommended)
|
|
68
|
+
? Enable grabbing (one/two-hand, distance)? › Yes
|
|
69
|
+
? Enable physics simulation (Havok)? › No
|
|
70
|
+
? Enable Meta Spatial Editor integration? › No (Can change later)
|
|
71
|
+
? Set up a Git repository? › Yes
|
|
72
|
+
? Install dependencies now? › Yes
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Command Line Options
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Provide project name directly
|
|
79
|
+
npm create @iwsdk@latest my-app
|
|
80
|
+
|
|
81
|
+
# Skip all prompts and use defaults
|
|
82
|
+
npm create @iwsdk@latest my-app -- -y
|
|
83
|
+
|
|
84
|
+
# Use custom CDN for recipes/assets
|
|
85
|
+
npm create @iwsdk@latest -- --assets-base https://my-cdn.com/iwsdk
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
| Flag | Description |
|
|
89
|
+
| --------------------- | -------------------------------------------------------- |
|
|
90
|
+
| `[name]` | Project name (first positional argument) |
|
|
91
|
+
| `-y, --yes` | Skip prompts and use defaults (VR + TypeScript + manual) |
|
|
92
|
+
| `--assets-base <url>` | Custom CDN base URL for recipes and assets |
|
|
93
|
+
|
|
94
|
+
## Generated Templates
|
|
95
|
+
|
|
96
|
+
Based on your choices, one of these variants is generated:
|
|
97
|
+
|
|
98
|
+
| Template ID | Description |
|
|
99
|
+
| ------------------- | ------------------------------------- |
|
|
100
|
+
| `vr-manual-ts` | VR + TypeScript + code-only scene |
|
|
101
|
+
| `vr-manual-js` | VR + JavaScript + code-only scene |
|
|
102
|
+
| `vr-metaspatial-ts` | VR + TypeScript + Meta Spatial Editor |
|
|
103
|
+
| `vr-metaspatial-js` | VR + JavaScript + Meta Spatial Editor |
|
|
104
|
+
| `ar-manual-ts` | AR + TypeScript + code-only scene |
|
|
105
|
+
| `ar-manual-js` | AR + JavaScript + code-only scene |
|
|
106
|
+
| `ar-metaspatial-ts` | AR + TypeScript + Meta Spatial Editor |
|
|
107
|
+
| `ar-metaspatial-js` | AR + JavaScript + Meta Spatial Editor |
|
|
108
|
+
|
|
109
|
+
## Requirements
|
|
110
|
+
|
|
111
|
+
- Node.js 20.19.0 or higher
|
|
112
|
+
|
|
113
|
+
## Documentation
|
|
114
|
+
|
|
115
|
+
For guides and tutorials, visit: **[https://iwsdk.dev](https://iwsdk.dev)**
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
MIT © Meta Platforms, Inc.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
<details>
|
|
124
|
+
<summary><strong>Development (for contributors)</strong></summary>
|
|
125
|
+
|
|
126
|
+
### Local Development
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# Build the CLI
|
|
130
|
+
pnpm --filter @iwsdk/create build
|
|
131
|
+
|
|
132
|
+
# Run locally
|
|
133
|
+
pnpm --filter @iwsdk/create dev
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Module Layout
|
|
137
|
+
|
|
138
|
+
- `src/cli.ts` — Entrypoint: parses flags, runs prompts, scaffolds project
|
|
139
|
+
- `src/prompts.ts` — Interactive questions and defaults
|
|
140
|
+
- `src/recipes.ts` — Fetch helpers for CDN-hosted recipes
|
|
141
|
+
- `src/scaffold.ts` — Wraps Chef's `buildProject` and writes files
|
|
142
|
+
- `src/installer.ts` — Dependency installation and next steps
|
|
143
|
+
- `src/types.ts` — Shared types (`VariantId`, `TriState`, `PromptResult`)
|
|
144
|
+
|
|
145
|
+
### How It Works
|
|
146
|
+
|
|
147
|
+
The CLI uses [@pmndrs/chef](https://github.com/pmndrs/chef) to apply recipes fetched from jsDelivr CDN. Recipes and assets live in the `@iwsdk/starter-assets` package.
|
|
148
|
+
|
|
149
|
+
</details>
|