@playcademy/vite-plugin 0.1.40 → 0.2.1
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 +75 -46
- package/dist/index.js +6387 -19249
- package/dist/lib/logging/adapter.d.ts +2 -2
- package/dist/lib/logging/index.d.ts +2 -2
- package/dist/lib/logging/utils.d.ts +11 -10
- package/dist/lib/sandbox/index.d.ts +1 -1
- package/dist/lib/sandbox/project-info.d.ts +1 -2
- package/dist/lib/sandbox/server.d.ts +3 -7
- package/dist/lib/sandbox/timeback.d.ts +31 -6
- package/dist/lib/sandbox/token.d.ts +25 -0
- package/dist/server/config-watcher.d.ts +15 -0
- package/dist/server/hotkeys/cycle-platform-role.d.ts +9 -0
- package/dist/server/middleware.d.ts +3 -4
- package/dist/server/recreate-sandbox.d.ts +21 -0
- package/dist/server/state.d.ts +10 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/internal.d.ts +58 -14
- package/dist/types/options.d.ts +61 -64
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This plugin integrates Playcademy's development sandbox and build tools into you
|
|
|
8
8
|
|
|
9
9
|
The Playcademy Vite plugin streamlines game development by providing:
|
|
10
10
|
|
|
11
|
-
- **Development Sandbox**: Automatically starts a local Playcademy API server
|
|
11
|
+
- **Development Sandbox**: Automatically starts a local Playcademy API server during development.
|
|
12
12
|
- **Manifest Generation**: Creates required `playcademy.manifest.json` files for platform deployment
|
|
13
13
|
- **Build Optimization**: Configures Vite settings for optimal Playcademy platform compatibility
|
|
14
14
|
- **Deployment Packaging**: Optionally creates zip archives ready for platform upload
|
|
@@ -87,10 +87,6 @@ export default defineConfig({
|
|
|
87
87
|
seed: true, // Seed database with demo data
|
|
88
88
|
recreateDb: false, // Recreate database on each start
|
|
89
89
|
memoryOnly: false, // Use in-memory database
|
|
90
|
-
realtime: {
|
|
91
|
-
enabled: false, // Disabled by default, enable for multiplayer
|
|
92
|
-
port: 4322, // Defaults to API port + 1
|
|
93
|
-
},
|
|
94
90
|
},
|
|
95
91
|
}),
|
|
96
92
|
],
|
|
@@ -132,14 +128,25 @@ export default defineConfig({
|
|
|
132
128
|
|
|
133
129
|
## Plugin Options
|
|
134
130
|
|
|
131
|
+
### Top-Level Options
|
|
132
|
+
|
|
133
|
+
| Option | Type | Default | Description |
|
|
134
|
+
| ------------ | ---------------------------- | ------------ | -------------------------------------------- |
|
|
135
|
+
| `configPath` | `string` | `undefined` | Path to playcademy.config.js (auto-detected) |
|
|
136
|
+
| `mode` | `'platform' \| 'standalone'` | `'platform'` | Plugin operation mode |
|
|
137
|
+
|
|
138
|
+
**Mode Options:**
|
|
139
|
+
|
|
140
|
+
- `'platform'`: Full Playcademy experience with sandbox server, backend bundling, and shell wrapper (recommended)
|
|
141
|
+
- `'standalone'`: Backend bundling only, no platform features
|
|
142
|
+
|
|
135
143
|
### Export Options (`export`)
|
|
136
144
|
|
|
137
|
-
Configuration for
|
|
145
|
+
Configuration for build output:
|
|
138
146
|
|
|
139
|
-
| Option
|
|
140
|
-
|
|
|
141
|
-
| `
|
|
142
|
-
| `autoZip` | `boolean` | `true` | Create deployment zip archive |
|
|
147
|
+
| Option | Type | Default | Description |
|
|
148
|
+
| --------- | --------- | ------- | ----------------------------- |
|
|
149
|
+
| `autoZip` | `boolean` | `true` | Create deployment zip archive |
|
|
143
150
|
|
|
144
151
|
### Sandbox Options (`sandbox`)
|
|
145
152
|
|
|
@@ -155,24 +162,33 @@ Configuration for the development sandbox server:
|
|
|
155
162
|
| `seed` | `boolean` | `true` | Seed database with demo data |
|
|
156
163
|
| `memoryOnly` | `boolean` | `false` | Use in-memory database (non-persistent) |
|
|
157
164
|
| `databasePath` | `string` | `undefined` | Custom path for database file |
|
|
158
|
-
| `realtime` | `object` | `{ enabled: false }` | Real-time server configuration |
|
|
159
165
|
|
|
160
|
-
|
|
166
|
+
### Display Options (`display`)
|
|
167
|
+
|
|
168
|
+
Configuration for visual elements during development:
|
|
161
169
|
|
|
162
|
-
| Option
|
|
163
|
-
|
|
|
164
|
-
| `
|
|
165
|
-
| `port` | `number` | API port + 1 | Custom port for WebSocket server |
|
|
170
|
+
| Option | Type | Default | Description |
|
|
171
|
+
| ----------- | --------- | ------- | --------------------------------------- |
|
|
172
|
+
| `hideBadge` | `boolean` | `false` | Hide the Playcademy badge in the corner |
|
|
166
173
|
|
|
167
174
|
### TimeBack Options (`timeback`)
|
|
168
175
|
|
|
169
|
-
Configuration for TimeBack integration testing during local development
|
|
176
|
+
Configuration for TimeBack integration testing during local development. Set to `false` to explicitly disable TimeBack even if configured in playcademy.config.
|
|
170
177
|
|
|
171
|
-
| Option
|
|
172
|
-
|
|
|
173
|
-
| `
|
|
174
|
-
| `
|
|
175
|
-
| `
|
|
178
|
+
| Option | Type | Default | Description |
|
|
179
|
+
| -------------- | --------------------------------------------------------------------- | ----------------------- | ------------------------------------------------- |
|
|
180
|
+
| `id` | `string` | auto-generated mock ID | TimeBack student ID |
|
|
181
|
+
| `role` | `'student' \| 'parent' \| 'teacher' \| 'administrator' \| 'guardian'` | `'student'` | User role for testing different permission levels |
|
|
182
|
+
| `organization` | `'mock' \| object` | `'mock'` | Organization (school/district) configuration |
|
|
183
|
+
| `courses` | `Record<string, 'mock' \| string \| null>` | all courses from config | Course enrollment overrides |
|
|
184
|
+
|
|
185
|
+
#### Organization Object Properties
|
|
186
|
+
|
|
187
|
+
| Property | Type | Default | Description |
|
|
188
|
+
| -------- | ---------------------------------------------------------------------------- | ---------------------- | ---------------------- |
|
|
189
|
+
| `id` | `string` | `'PLAYCADEMY'` | Organization sourcedId |
|
|
190
|
+
| `name` | `string` | `'Playcademy Studios'` | Organization name |
|
|
191
|
+
| `type` | `'school' \| 'district' \| 'department' \| 'local' \| 'state' \| 'national'` | `'department'` | Organization type |
|
|
176
192
|
|
|
177
193
|
#### TimeBack Configuration Example
|
|
178
194
|
|
|
@@ -181,13 +197,43 @@ export default defineConfig({
|
|
|
181
197
|
plugins: [
|
|
182
198
|
playcademy({
|
|
183
199
|
timeback: {
|
|
184
|
-
//
|
|
200
|
+
// All courses from playcademy.config.js enrolled by default with mock IDs
|
|
201
|
+
role: 'student', // Test as student (default)
|
|
202
|
+
},
|
|
203
|
+
}),
|
|
204
|
+
],
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
// Override specific courses
|
|
208
|
+
export default defineConfig({
|
|
209
|
+
plugins: [
|
|
210
|
+
playcademy({
|
|
211
|
+
timeback: {
|
|
185
212
|
courses: {
|
|
186
213
|
'FastMath:3': 'mock', // Mock enrollment for grade 3
|
|
187
|
-
'FastMath:4':
|
|
214
|
+
'FastMath:4': null, // Exclude from enrollment (test partial)
|
|
188
215
|
'Science:5': 'real-course-id-123', // Real TimeBack course
|
|
189
216
|
},
|
|
190
|
-
|
|
217
|
+
},
|
|
218
|
+
}),
|
|
219
|
+
],
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
// Full real TimeBack integration
|
|
223
|
+
export default defineConfig({
|
|
224
|
+
plugins: [
|
|
225
|
+
playcademy({
|
|
226
|
+
timeback: {
|
|
227
|
+
id: 'real-student-sourced-id',
|
|
228
|
+
organization: {
|
|
229
|
+
id: 'real-org-id',
|
|
230
|
+
name: 'Springfield Elementary',
|
|
231
|
+
type: 'school',
|
|
232
|
+
},
|
|
233
|
+
courses: {
|
|
234
|
+
'FastMath:3': 'real-course-id-g3',
|
|
235
|
+
'FastMath:4': 'real-course-id-g4',
|
|
236
|
+
},
|
|
191
237
|
},
|
|
192
238
|
}),
|
|
193
239
|
],
|
|
@@ -202,9 +248,10 @@ During development, the plugin provides keyboard shortcuts in the terminal:
|
|
|
202
248
|
| --- | -------------------------------------------------------- |
|
|
203
249
|
| `m` | Toggle between platform and standalone modes |
|
|
204
250
|
| `d` | Recreate sandbox database (resets to fresh seeded state) |
|
|
251
|
+
| `p` | Cycle platform user role (player → developer → admin) |
|
|
205
252
|
| `t` | Cycle TimeBack role (student → parent → teacher → admin) |
|
|
206
253
|
|
|
207
|
-
|
|
254
|
+
> **Note:** Some configuration changes require recreating the sandbox database to take effect. Press `d` after changing options like `timeback.id`, `timeback.organization`, or `timeback.courses` in your vite.config.ts.
|
|
208
255
|
|
|
209
256
|
## Build Output
|
|
210
257
|
|
|
@@ -361,24 +408,6 @@ export default defineConfig({
|
|
|
361
408
|
})
|
|
362
409
|
```
|
|
363
410
|
|
|
364
|
-
### Enabling Real-time Features
|
|
365
|
-
|
|
366
|
-
```typescript
|
|
367
|
-
// Enable the real-time server for multiplayer games
|
|
368
|
-
export default defineConfig({
|
|
369
|
-
plugins: [
|
|
370
|
-
playcademy({
|
|
371
|
-
sandbox: {
|
|
372
|
-
realtime: {
|
|
373
|
-
enabled: true,
|
|
374
|
-
port: 4322, // Optional: custom WebSocket port
|
|
375
|
-
},
|
|
376
|
-
},
|
|
377
|
-
}),
|
|
378
|
-
],
|
|
379
|
-
})
|
|
380
|
-
```
|
|
381
|
-
|
|
382
411
|
### Testing with Clean Database
|
|
383
412
|
|
|
384
413
|
```typescript
|
|
@@ -448,7 +477,7 @@ export default defineConfig({
|
|
|
448
477
|
plugins: [
|
|
449
478
|
playcademy({
|
|
450
479
|
timeback: {
|
|
451
|
-
|
|
480
|
+
// id defaults to auto-generated mock ID
|
|
452
481
|
courses: {
|
|
453
482
|
'FastMath:3': 'mock',
|
|
454
483
|
'FastMath:4': 'mock',
|
|
@@ -460,7 +489,7 @@ export default defineConfig({
|
|
|
460
489
|
})
|
|
461
490
|
```
|
|
462
491
|
|
|
463
|
-
During development, press `t` in the terminal to cycle through roles (student → parent → teacher → administrator) and test different permission levels. The browser reloads automatically.
|
|
492
|
+
During development, press `t` in the terminal to cycle through roles (student → parent → teacher → administrator → guardian) and test different permission levels. The browser reloads automatically.
|
|
464
493
|
|
|
465
494
|
## Troubleshooting
|
|
466
495
|
|