@lorion-org/registry-hub 1.0.0-beta.2 → 1.0.0-beta.5
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 +2 -2
- package/package.json +3 -4
- package/examples/node-basic.js +0 -14
- package/examples/node-basic.ts +0 -24
- package/examples/nuxt-plugin.ts +0 -14
- package/examples/renderer-registry.js +0 -16
- package/examples/renderer-registry.ts +0 -19
package/README.md
CHANGED
|
@@ -147,9 +147,9 @@ export function useShops(): Shop[] {
|
|
|
147
147
|
}
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
-
Runnable example files live in [`
|
|
150
|
+
Runnable example files live in [`snippets/`](./snippets).
|
|
151
151
|
The Node example imports the published package name instead of local source files so it mirrors real consumer usage.
|
|
152
|
-
The examples use the same shop and checkout-provider domain as the LORION
|
|
152
|
+
The examples use the same shop and checkout-provider domain as the LORION example apps.
|
|
153
153
|
|
|
154
154
|
## Local commands
|
|
155
155
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lorion-org/registry-hub",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.5",
|
|
4
4
|
"description": "Framework-free typed registry and registry-hub primitives.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
},
|
|
39
39
|
"files": [
|
|
40
40
|
"dist",
|
|
41
|
-
"examples",
|
|
42
41
|
"LICENSE",
|
|
43
42
|
"src/**/*.ts",
|
|
44
43
|
"!src/**/*.spec.ts"
|
|
@@ -55,8 +54,8 @@
|
|
|
55
54
|
"scripts": {
|
|
56
55
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
57
56
|
"clean": "rimraf coverage dist tsconfig.tsbuildinfo",
|
|
58
|
-
"example:node": "node ./
|
|
59
|
-
"example:renderer": "node ./
|
|
57
|
+
"example:node": "node ./snippets/node-basic.js",
|
|
58
|
+
"example:renderer": "node ./snippets/renderer-registry.js",
|
|
60
59
|
"lint": "eslint src --ext .ts",
|
|
61
60
|
"test": "vitest run --root ../.. --config vitest.config.mts packages/registry-hub/src/index.spec.ts",
|
|
62
61
|
"coverage": "vitest run --coverage --coverage.include=packages/registry-hub/src/index.ts --root ../.. --config vitest.config.mts packages/registry-hub/src/index.spec.ts",
|
package/examples/node-basic.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { createRegistryHub } from '@lorion-org/registry-hub';
|
|
2
|
-
import process from 'node:process';
|
|
3
|
-
|
|
4
|
-
const hub = createRegistryHub();
|
|
5
|
-
|
|
6
|
-
hub.register('payment-checkout-providers', {
|
|
7
|
-
id: 'payment-provider-stripe',
|
|
8
|
-
createCheckoutPath: (input) =>
|
|
9
|
-
`/providers/payment-provider-stripe/checkout?shop=${encodeURIComponent(input.shopId)}`,
|
|
10
|
-
});
|
|
11
|
-
hub.register('shops', { id: 'shop-coffee', path: '/shops/coffee' });
|
|
12
|
-
|
|
13
|
-
process.stdout.write(`${JSON.stringify(hub.list('payment-checkout-providers'))}\n`);
|
|
14
|
-
process.stdout.write(`${JSON.stringify(hub.get('shops', 'shop-coffee'))}\n`);
|
package/examples/node-basic.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { createRegistryHub, type RegistryItem } from '@lorion-org/registry-hub';
|
|
2
|
-
|
|
3
|
-
type PaymentProvider = RegistryItem & {
|
|
4
|
-
createCheckoutPath: (input: { shopId: string }) => string;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
type Shop = RegistryItem & {
|
|
8
|
-
path: string;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const hub = createRegistryHub();
|
|
12
|
-
|
|
13
|
-
hub.register<PaymentProvider>('payment-checkout-providers', {
|
|
14
|
-
id: 'payment-provider-stripe',
|
|
15
|
-
createCheckoutPath: (input) =>
|
|
16
|
-
`/providers/payment-provider-stripe/checkout?shop=${encodeURIComponent(input.shopId)}`,
|
|
17
|
-
});
|
|
18
|
-
hub.register<Shop>('shops', { id: 'shop-coffee', path: '/shops/coffee' });
|
|
19
|
-
|
|
20
|
-
console.log(hub.list<PaymentProvider>('payment-checkout-providers'));
|
|
21
|
-
// [{ id: 'payment-provider-stripe', createCheckoutPath: [Function] }]
|
|
22
|
-
|
|
23
|
-
console.log(hub.get<Shop>('shops', 'shop-coffee'));
|
|
24
|
-
// { id: 'shop-coffee', path: '/shops/coffee' }
|
package/examples/nuxt-plugin.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { createRegistryHub } from '@lorion-org/registry-hub';
|
|
2
|
-
|
|
3
|
-
export default defineNuxtPlugin(() => {
|
|
4
|
-
const registryHub = createRegistryHub();
|
|
5
|
-
|
|
6
|
-
console.log(['registryHub']);
|
|
7
|
-
// ['registryHub']
|
|
8
|
-
|
|
9
|
-
return {
|
|
10
|
-
provide: {
|
|
11
|
-
registryHub,
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { createRegistry } from '@lorion-org/registry-hub';
|
|
2
|
-
import process from 'node:process';
|
|
3
|
-
|
|
4
|
-
const shops = createRegistry('shops');
|
|
5
|
-
|
|
6
|
-
shops.register([
|
|
7
|
-
{ id: 'shop-coffee', name: 'Bean Supply', path: '/shops/coffee' },
|
|
8
|
-
{ id: 'shop-stationery', name: 'Paper Desk', path: '/shops/stationery' },
|
|
9
|
-
]);
|
|
10
|
-
|
|
11
|
-
process.stdout.write(
|
|
12
|
-
`${shops.id}:${shops
|
|
13
|
-
.entries()
|
|
14
|
-
.map(([id]) => id)
|
|
15
|
-
.join(',')}\n`,
|
|
16
|
-
);
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { createRegistry, type RegistryItem } from '@lorion-org/registry-hub';
|
|
2
|
-
|
|
3
|
-
type Shop = RegistryItem & {
|
|
4
|
-
name: string;
|
|
5
|
-
path: string;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const shops = createRegistry<Shop>('shops');
|
|
9
|
-
|
|
10
|
-
shops.register([
|
|
11
|
-
{ id: 'shop-coffee', name: 'Bean Supply', path: '/shops/coffee' },
|
|
12
|
-
{ id: 'shop-stationery', name: 'Paper Desk', path: '/shops/stationery' },
|
|
13
|
-
]);
|
|
14
|
-
|
|
15
|
-
console.log(shops.entries());
|
|
16
|
-
// [
|
|
17
|
-
// ['shop-coffee', { id: 'shop-coffee', name: 'Bean Supply', path: '/shops/coffee' }],
|
|
18
|
-
// ['shop-stationery', { id: 'shop-stationery', name: 'Paper Desk', path: '/shops/stationery' }]
|
|
19
|
-
// ]
|