skeleton-crew-runtime 0.2.1 → 0.2.2
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 +73 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,13 +1,46 @@
|
|
|
1
|
-
# Skeleton Crew Runtime v0.2.
|
|
1
|
+
# Skeleton Crew Runtime v0.2.1
|
|
2
2
|
|
|
3
3
|
**A minimal plugin runtime for building modular JavaScript applications.**
|
|
4
4
|
|
|
5
5
|
Stop wiring up infrastructure. Start building features.
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install skeleton-crew-runtime@^0.2.
|
|
8
|
+
npm install skeleton-crew-runtime@^0.2.1
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## What's New in v0.2.1
|
|
12
|
+
|
|
13
|
+
🔍 **Plugin Discovery** - Automatic plugin loading from file paths and npm packages
|
|
14
|
+
🔄 **Dependency Resolution** - Automatic topological sorting for correct plugin initialization order
|
|
15
|
+
🛠️ **Enhanced DX** - Better error messages with dependency hints for missing actions
|
|
16
|
+
🚀 **Production Ready** - All critical bugs fixed based on real-world usage feedback
|
|
17
|
+
✅ **Verified Stable** - Tested and validated in production migrations
|
|
18
|
+
|
|
19
|
+
### Plugin Discovery Example
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
// Automatic plugin discovery - no manual registration needed!
|
|
23
|
+
const runtime = new Runtime<MyConfig>({
|
|
24
|
+
config: myConfig,
|
|
25
|
+
|
|
26
|
+
// Load plugins from directories
|
|
27
|
+
pluginPaths: [
|
|
28
|
+
'./plugins', // Load all plugins from directory
|
|
29
|
+
'./custom-plugin.js' // Load specific plugin file
|
|
30
|
+
],
|
|
31
|
+
|
|
32
|
+
// Load plugins from npm packages
|
|
33
|
+
pluginPackages: [
|
|
34
|
+
'@my-org/auth-plugin',
|
|
35
|
+
'my-custom-plugin'
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
await runtime.initialize(); // Plugins auto-loaded and sorted by dependencies!
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**[→ Complete v0.2.1 Features](CHANGELOG.md#021---2025-01-07)**
|
|
43
|
+
|
|
11
44
|
## What's New in v0.2.0
|
|
12
45
|
|
|
13
46
|
🎯 **Generic Runtime/Context** - Full TypeScript generic support for type-safe configuration
|
|
@@ -188,7 +221,39 @@ console.log(`Message sent: ${result.messageId}`);
|
|
|
188
221
|
|
|
189
222
|
## Core concepts (5 minutes)
|
|
190
223
|
|
|
191
|
-
### 1.
|
|
224
|
+
### 1. Plugin Discovery (v0.2.1): Automatic Loading
|
|
225
|
+
|
|
226
|
+
No more manual plugin registration! The runtime can automatically discover and load plugins:
|
|
227
|
+
|
|
228
|
+
```typescript
|
|
229
|
+
import { Runtime } from 'skeleton-crew-runtime';
|
|
230
|
+
|
|
231
|
+
const runtime = new Runtime<MyConfig>({
|
|
232
|
+
config: myConfig,
|
|
233
|
+
|
|
234
|
+
// Discover plugins from file system
|
|
235
|
+
pluginPaths: [
|
|
236
|
+
'./src/plugins', // Directory: loads all .js/.mjs files
|
|
237
|
+
'./auth-plugin.js', // Single file: loads specific plugin
|
|
238
|
+
'./dist/plugins' // Works with compiled TypeScript too!
|
|
239
|
+
],
|
|
240
|
+
|
|
241
|
+
// Discover plugins from npm packages
|
|
242
|
+
pluginPackages: [
|
|
243
|
+
'@my-org/auth-plugin', // npm package with plugin export
|
|
244
|
+
'my-logging-plugin' // Any package that exports a plugin
|
|
245
|
+
]
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
await runtime.initialize();
|
|
249
|
+
// ✅ All plugins auto-loaded and sorted by dependencies!
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**Dependency Resolution:** Plugins are automatically sorted by their `dependencies` array, so they initialize in the correct order.
|
|
253
|
+
|
|
254
|
+
### 2. Plugins: Isolated Features
|
|
255
|
+
|
|
256
|
+
### 2. Plugins: Isolated Features
|
|
192
257
|
|
|
193
258
|
A plugin is just an object with a name and a setup function:
|
|
194
259
|
|
|
@@ -225,7 +290,7 @@ export const myPlugin: PluginDefinition<MyAppConfig> = {
|
|
|
225
290
|
};
|
|
226
291
|
```
|
|
227
292
|
|
|
228
|
-
###
|
|
293
|
+
### 3. Actions: Business Logic
|
|
229
294
|
|
|
230
295
|
Actions are named functions that do work:
|
|
231
296
|
|
|
@@ -269,7 +334,7 @@ const order = await ctx.actions.runAction<CreateOrderParams, Order>(
|
|
|
269
334
|
);
|
|
270
335
|
```
|
|
271
336
|
|
|
272
|
-
###
|
|
337
|
+
### 4. Events: Decouple Features
|
|
273
338
|
|
|
274
339
|
Plugins communicate without knowing about each other:
|
|
275
340
|
|
|
@@ -286,7 +351,7 @@ ctx.events.on('order:created', (order) => {
|
|
|
286
351
|
await ctx.events.emitAsync('order:created', order); // Wait for all handlers
|
|
287
352
|
```
|
|
288
353
|
|
|
289
|
-
###
|
|
354
|
+
### 5. Configuration: Type-Safe Access (v0.2.0)
|
|
290
355
|
|
|
291
356
|
Direct synchronous access to typed configuration:
|
|
292
357
|
|
|
@@ -336,7 +401,7 @@ setup(ctx: RuntimeContext<AppConfig>) {
|
|
|
336
401
|
}
|
|
337
402
|
```
|
|
338
403
|
|
|
339
|
-
###
|
|
404
|
+
### 6. Host Context: Bridge to Existing Code
|
|
340
405
|
|
|
341
406
|
Inject your existing services so plugins can use them:
|
|
342
407
|
|
|
@@ -360,7 +425,7 @@ const ctx = runtime.getContext();
|
|
|
360
425
|
const { db, logger } = ctx.host;
|
|
361
426
|
```
|
|
362
427
|
|
|
363
|
-
###
|
|
428
|
+
### 7. Screens (Optional): UI Definitions
|
|
364
429
|
|
|
365
430
|
Define screens that any UI framework can render:
|
|
366
431
|
|