@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 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 and real-time WebSocket server during development.
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 manifest generation and build output:
145
+ Configuration for build output:
138
146
 
139
- | Option | Type | Default | Description |
140
- | ---------- | --------- | ------- | ---------------------------------------------- |
141
- | `platform` | `string` | `'web'` | Platform identifier (e.g., 'web', 'godot@4.3') |
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
- #### Realtime Options (`sandbox.realtime`)
166
+ ### Display Options (`display`)
167
+
168
+ Configuration for visual elements during development:
161
169
 
162
- | Option | Type | Default | Description |
163
- | --------- | --------- | ------------ | -------------------------------- |
164
- | `enabled` | `boolean` | `false` | Enable WebSocket server |
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 | Type | Default | Description |
172
- | ------------ | ------------------------------------------------------- | ----------- | -------------------------------------------------------------- |
173
- | `timebackId` | `'mock' \| string` | `'mock'` | TimeBack student ID (defaults to mock when courses configured) |
174
- | `courses` | `Record<string, 'mock' \| string>` | `undefined` | Course enrollments mapping (`'Subject:Grade'`) |
175
- | `role` | `'student' \| 'parent' \| 'teacher' \| 'administrator'` | `'student'` | User role for testing different permission levels |
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
- // timebackId defaults to 'mock' when courses are configured
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': 'mock', // Mock enrollment for grade 4
214
+ 'FastMath:4': null, // Exclude from enrollment (test partial)
188
215
  'Science:5': 'real-course-id-123', // Real TimeBack course
189
216
  },
190
- role: 'student', // Test as student (default)
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
- The `t` hotkey automatically reloads your browser when the role changes, making it easy to test different user permission levels without modifying configuration.
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
- timebackId: 'mock',
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