@playcademy/vite-plugin 0.1.38 → 0.2.0
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 +76 -17
- package/dist/index.js +1459 -1010
- 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 +5 -2
- package/dist/lib/sandbox/server.d.ts +3 -3
- 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 +70 -8
- package/dist/types/options.d.ts +61 -32
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -132,14 +132,25 @@ export default defineConfig({
|
|
|
132
132
|
|
|
133
133
|
## Plugin Options
|
|
134
134
|
|
|
135
|
+
### Top-Level Options
|
|
136
|
+
|
|
137
|
+
| Option | Type | Default | Description |
|
|
138
|
+
| ------------ | ---------------------------- | ------------ | -------------------------------------------- |
|
|
139
|
+
| `configPath` | `string` | `undefined` | Path to playcademy.config.js (auto-detected) |
|
|
140
|
+
| `mode` | `'platform' \| 'standalone'` | `'platform'` | Plugin operation mode |
|
|
141
|
+
|
|
142
|
+
**Mode Options:**
|
|
143
|
+
|
|
144
|
+
- `'platform'`: Full Playcademy experience with sandbox server, backend bundling, and shell wrapper (recommended)
|
|
145
|
+
- `'standalone'`: Backend bundling only, no platform features
|
|
146
|
+
|
|
135
147
|
### Export Options (`export`)
|
|
136
148
|
|
|
137
|
-
Configuration for
|
|
149
|
+
Configuration for build output:
|
|
138
150
|
|
|
139
|
-
| Option
|
|
140
|
-
|
|
|
141
|
-
| `
|
|
142
|
-
| `autoZip` | `boolean` | `true` | Create deployment zip archive |
|
|
151
|
+
| Option | Type | Default | Description |
|
|
152
|
+
| --------- | --------- | ------- | ----------------------------- |
|
|
153
|
+
| `autoZip` | `boolean` | `true` | Create deployment zip archive |
|
|
143
154
|
|
|
144
155
|
### Sandbox Options (`sandbox`)
|
|
145
156
|
|
|
@@ -164,15 +175,32 @@ Configuration for the development sandbox server:
|
|
|
164
175
|
| `enabled` | `boolean` | `false` | Enable WebSocket server |
|
|
165
176
|
| `port` | `number` | API port + 1 | Custom port for WebSocket server |
|
|
166
177
|
|
|
178
|
+
### Display Options (`display`)
|
|
179
|
+
|
|
180
|
+
Configuration for visual elements during development:
|
|
181
|
+
|
|
182
|
+
| Option | Type | Default | Description |
|
|
183
|
+
| ----------- | --------- | ------- | --------------------------------------- |
|
|
184
|
+
| `hideBadge` | `boolean` | `false` | Hide the Playcademy badge in the corner |
|
|
185
|
+
|
|
167
186
|
### TimeBack Options (`timeback`)
|
|
168
187
|
|
|
169
|
-
Configuration for TimeBack integration testing during local development
|
|
188
|
+
Configuration for TimeBack integration testing during local development. Set to `false` to explicitly disable TimeBack even if configured in playcademy.config.
|
|
189
|
+
|
|
190
|
+
| Option | Type | Default | Description |
|
|
191
|
+
| -------------- | --------------------------------------------------------------------- | ----------------------- | ------------------------------------------------- |
|
|
192
|
+
| `id` | `string` | auto-generated mock ID | TimeBack student ID |
|
|
193
|
+
| `role` | `'student' \| 'parent' \| 'teacher' \| 'administrator' \| 'guardian'` | `'student'` | User role for testing different permission levels |
|
|
194
|
+
| `organization` | `'mock' \| object` | `'mock'` | Organization (school/district) configuration |
|
|
195
|
+
| `courses` | `Record<string, 'mock' \| string \| null>` | all courses from config | Course enrollment overrides |
|
|
170
196
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
|
174
|
-
|
|
|
175
|
-
| `
|
|
197
|
+
#### Organization Object Properties
|
|
198
|
+
|
|
199
|
+
| Property | Type | Default | Description |
|
|
200
|
+
| -------- | ---------------------------------------------------------------------------- | ---------------------- | ---------------------- |
|
|
201
|
+
| `id` | `string` | `'PLAYCADEMY'` | Organization sourcedId |
|
|
202
|
+
| `name` | `string` | `'Playcademy Studios'` | Organization name |
|
|
203
|
+
| `type` | `'school' \| 'district' \| 'department' \| 'local' \| 'state' \| 'national'` | `'department'` | Organization type |
|
|
176
204
|
|
|
177
205
|
#### TimeBack Configuration Example
|
|
178
206
|
|
|
@@ -181,13 +209,43 @@ export default defineConfig({
|
|
|
181
209
|
plugins: [
|
|
182
210
|
playcademy({
|
|
183
211
|
timeback: {
|
|
184
|
-
//
|
|
212
|
+
// All courses from playcademy.config.js enrolled by default with mock IDs
|
|
213
|
+
role: 'student', // Test as student (default)
|
|
214
|
+
},
|
|
215
|
+
}),
|
|
216
|
+
],
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
// Override specific courses
|
|
220
|
+
export default defineConfig({
|
|
221
|
+
plugins: [
|
|
222
|
+
playcademy({
|
|
223
|
+
timeback: {
|
|
185
224
|
courses: {
|
|
186
225
|
'FastMath:3': 'mock', // Mock enrollment for grade 3
|
|
187
|
-
'FastMath:4':
|
|
226
|
+
'FastMath:4': null, // Exclude from enrollment (test partial)
|
|
188
227
|
'Science:5': 'real-course-id-123', // Real TimeBack course
|
|
189
228
|
},
|
|
190
|
-
|
|
229
|
+
},
|
|
230
|
+
}),
|
|
231
|
+
],
|
|
232
|
+
})
|
|
233
|
+
|
|
234
|
+
// Full real TimeBack integration
|
|
235
|
+
export default defineConfig({
|
|
236
|
+
plugins: [
|
|
237
|
+
playcademy({
|
|
238
|
+
timeback: {
|
|
239
|
+
id: 'real-student-sourced-id',
|
|
240
|
+
organization: {
|
|
241
|
+
id: 'real-org-id',
|
|
242
|
+
name: 'Springfield Elementary',
|
|
243
|
+
type: 'school',
|
|
244
|
+
},
|
|
245
|
+
courses: {
|
|
246
|
+
'FastMath:3': 'real-course-id-g3',
|
|
247
|
+
'FastMath:4': 'real-course-id-g4',
|
|
248
|
+
},
|
|
191
249
|
},
|
|
192
250
|
}),
|
|
193
251
|
],
|
|
@@ -202,9 +260,10 @@ During development, the plugin provides keyboard shortcuts in the terminal:
|
|
|
202
260
|
| --- | -------------------------------------------------------- |
|
|
203
261
|
| `m` | Toggle between platform and standalone modes |
|
|
204
262
|
| `d` | Recreate sandbox database (resets to fresh seeded state) |
|
|
263
|
+
| `p` | Cycle platform user role (player → developer → admin) |
|
|
205
264
|
| `t` | Cycle TimeBack role (student → parent → teacher → admin) |
|
|
206
265
|
|
|
207
|
-
|
|
266
|
+
> **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
267
|
|
|
209
268
|
## Build Output
|
|
210
269
|
|
|
@@ -448,7 +507,7 @@ export default defineConfig({
|
|
|
448
507
|
plugins: [
|
|
449
508
|
playcademy({
|
|
450
509
|
timeback: {
|
|
451
|
-
|
|
510
|
+
// id defaults to auto-generated mock ID
|
|
452
511
|
courses: {
|
|
453
512
|
'FastMath:3': 'mock',
|
|
454
513
|
'FastMath:4': 'mock',
|
|
@@ -460,7 +519,7 @@ export default defineConfig({
|
|
|
460
519
|
})
|
|
461
520
|
```
|
|
462
521
|
|
|
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.
|
|
522
|
+
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
523
|
|
|
465
524
|
## Troubleshooting
|
|
466
525
|
|