@playcademy/vite-plugin 0.1.37 → 0.1.40
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 +64 -0
- package/dist/index.js +842 -749
- package/dist/lib/sandbox/index.d.ts +1 -1
- package/dist/lib/sandbox/project-info.d.ts +5 -1
- package/dist/lib/sandbox/server.d.ts +3 -0
- package/dist/lib/sandbox/timeback.d.ts +22 -1
- package/dist/server/hotkeys/cycle-timeback-role.d.ts +9 -0
- package/dist/server/hotkeys/index.d.ts +9 -0
- package/dist/server/hotkeys/recreate-database.d.ts +9 -0
- package/dist/server/hotkeys/toggle-mode.d.ts +9 -0
- package/dist/server/middleware.d.ts +6 -1
- package/dist/server/state.d.ts +10 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/internal.d.ts +21 -3
- package/dist/types/options.d.ts +65 -0
- package/package.json +3 -3
- package/dist/server/mode-switcher.d.ts +0 -9
- package/dist/server/recreate-sandbox-database.d.ts +0 -14
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
|