@playcademy/vite-plugin 0.1.37 → 0.1.38

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
@@ -164,6 +164,48 @@ Configuration for the development sandbox server:
164
164
  | `enabled` | `boolean` | `false` | Enable WebSocket server |
165
165
  | `port` | `number` | API port + 1 | Custom port for WebSocket server |
166
166
 
167
+ ### TimeBack Options (`timeback`)
168
+
169
+ Configuration for TimeBack integration testing during local development:
170
+
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 |
176
+
177
+ #### TimeBack Configuration Example
178
+
179
+ ```typescript
180
+ export default defineConfig({
181
+ plugins: [
182
+ playcademy({
183
+ timeback: {
184
+ // timebackId defaults to 'mock' when courses are configured
185
+ courses: {
186
+ 'FastMath:3': 'mock', // Mock enrollment for grade 3
187
+ 'FastMath:4': 'mock', // Mock enrollment for grade 4
188
+ 'Science:5': 'real-course-id-123', // Real TimeBack course
189
+ },
190
+ role: 'student', // Test as student (default)
191
+ },
192
+ }),
193
+ ],
194
+ })
195
+ ```
196
+
197
+ ## CLI Hotkeys
198
+
199
+ During development, the plugin provides keyboard shortcuts in the terminal:
200
+
201
+ | Key | Description |
202
+ | --- | -------------------------------------------------------- |
203
+ | `m` | Toggle between platform and standalone modes |
204
+ | `d` | Recreate sandbox database (resets to fresh seeded state) |
205
+ | `t` | Cycle TimeBack role (student → parent → teacher → admin) |
206
+
207
+ The `t` hotkey automatically reloads your browser when the role changes, making it easy to test different user permission levels without modifying configuration.
208
+
167
209
  ## Build Output
168
210
 
169
211
  ### Development Mode
@@ -398,6 +440,28 @@ export default defineConfig(({ mode }) => ({
398
440
  }))
399
441
  ```
400
442
 
443
+ ### TimeBack Integration
444
+
445
+ ```typescript
446
+ // Test TimeBack enrollments and role-based features
447
+ export default defineConfig({
448
+ plugins: [
449
+ playcademy({
450
+ timeback: {
451
+ timebackId: 'mock',
452
+ courses: {
453
+ 'FastMath:3': 'mock',
454
+ 'FastMath:4': 'mock',
455
+ },
456
+ role: 'student',
457
+ },
458
+ }),
459
+ ],
460
+ })
461
+ ```
462
+
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.
464
+
401
465
  ## Troubleshooting
402
466
 
403
467
  ### Common Issues