@kokimoki/kit 1.8.0 → 1.8.1
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.
|
@@ -52,6 +52,7 @@ const BUILT_IN_APP_META_STORE = {
|
|
|
52
52
|
pattern: app_meta_schema_1.APP_META_STORE_NAME,
|
|
53
53
|
schema: app_meta_schema_1.appMetaStoreSchema,
|
|
54
54
|
local: false,
|
|
55
|
+
isTransferable: true,
|
|
55
56
|
};
|
|
56
57
|
function kokimokiKitPlugin(config) {
|
|
57
58
|
// Combine user stores with built-in stores
|
|
@@ -407,6 +408,7 @@ function kokimokiKitPlugin(config) {
|
|
|
407
408
|
pattern: store.pattern,
|
|
408
409
|
local: store.local,
|
|
409
410
|
schema: v4_1.z.toJSONSchema(store.schema),
|
|
411
|
+
isTransferable: store.isTransferable ?? false,
|
|
410
412
|
}));
|
|
411
413
|
this.emitFile({
|
|
412
414
|
type: "asset",
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const KOKIMOKI_KIT_VERSION = "1.8.
|
|
1
|
+
export declare const KOKIMOKI_KIT_VERSION = "1.8.1";
|
package/dist/version.js
CHANGED
|
@@ -15,77 +15,93 @@ npm install @kokimoki/kit
|
|
|
15
15
|
|
|
16
16
|
## Plugin Configuration
|
|
17
17
|
|
|
18
|
+
Create a `kokimoki.config.ts` file in your project root to define your Kokimoki Kit configuration:
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
export const kokimokiConfig: KokimokiKitConfig = {
|
|
22
|
+
// Required: Your concept ID from Kokimoki
|
|
23
|
+
conceptId: "your-concept-id",
|
|
24
|
+
|
|
25
|
+
// Required: Deploy configurations
|
|
26
|
+
deployCodes: [
|
|
27
|
+
{
|
|
28
|
+
name: "default",
|
|
29
|
+
description: "Default game mode",
|
|
30
|
+
clientContext: { mode: "standard" },
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "tournament",
|
|
34
|
+
description: "Tournament mode with stricter rules",
|
|
35
|
+
clientContext: { mode: "tournament", maxPlayers: 100 },
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Store schemas for validation
|
|
41
|
+
* marking stores as transferable allows their content to be used
|
|
42
|
+
* when creating new apps based on this one.
|
|
43
|
+
*
|
|
44
|
+
* For example, game configuration can contain content and settings
|
|
45
|
+
* that can be reused when setting up a new game instance. Dynamic
|
|
46
|
+
* game state, on the other hand, should not be transferable.
|
|
47
|
+
*/
|
|
48
|
+
stores: [
|
|
49
|
+
{
|
|
50
|
+
pattern: "config",
|
|
51
|
+
schema: z.object({
|
|
52
|
+
mode: z.enum(["standard", "tournament"]),
|
|
53
|
+
duration: z.number().min(1).describe("Game duration in minutes"),
|
|
54
|
+
}),
|
|
55
|
+
isTransferable: true, // This store content can be used to create a new app with the same content
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
pattern: "game",
|
|
59
|
+
schema: z.object({
|
|
60
|
+
status: z.enum(["waiting", "playing", "finished"]),
|
|
61
|
+
round: z.number(),
|
|
62
|
+
}),
|
|
63
|
+
isTransferable: false, // Dynamic game state should not be marked as transferable
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
pattern: "player-*",
|
|
67
|
+
schema: z.object({
|
|
68
|
+
name: z.string(),
|
|
69
|
+
score: z.number(),
|
|
70
|
+
}),
|
|
71
|
+
local: true, // Local store (per-client)
|
|
72
|
+
isTransferable: false, // Local stores cannot be transferable
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
|
|
76
|
+
// Optional: i18n configuration
|
|
77
|
+
i18nPath: "./src/i18n",
|
|
78
|
+
i18nPrimaryLng: "en", // Source language for AI translations
|
|
79
|
+
|
|
80
|
+
// Optional: Custom API endpoint
|
|
81
|
+
endpoint: "https://api.kokimoki.com",
|
|
82
|
+
host: "y-wss.kokimoki.com",
|
|
83
|
+
|
|
84
|
+
// Optional: Dev view layout (see Dev Frame section)
|
|
85
|
+
devView: [
|
|
86
|
+
[{ label: "host", clientContext: { mode: "host" } }],
|
|
87
|
+
[
|
|
88
|
+
{ label: "player1", clientContext: { mode: "player" } },
|
|
89
|
+
{ label: "player2", clientContext: { mode: "player" } },
|
|
90
|
+
],
|
|
91
|
+
],
|
|
92
|
+
};
|
|
93
|
+
```
|
|
94
|
+
|
|
18
95
|
Add the plugin to your `vite.config.ts`:
|
|
19
96
|
|
|
20
97
|
```typescript
|
|
21
98
|
import { defineConfig } from "vite";
|
|
22
99
|
import { kokimokiKitPlugin } from "@kokimoki/kit";
|
|
23
100
|
import { z } from "@kokimoki/kit";
|
|
101
|
+
import { kokimokiConfig } from "./kokimoki.config";
|
|
24
102
|
|
|
25
103
|
export default defineConfig({
|
|
26
|
-
plugins: [
|
|
27
|
-
kokimokiKitPlugin({
|
|
28
|
-
// Required: Your concept ID from Kokimoki
|
|
29
|
-
conceptId: "your-concept-id",
|
|
30
|
-
|
|
31
|
-
// Required: Deploy configurations
|
|
32
|
-
deployCodes: [
|
|
33
|
-
{
|
|
34
|
-
name: "default",
|
|
35
|
-
description: "Default game mode",
|
|
36
|
-
clientContext: { mode: "standard" },
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: "tournament",
|
|
40
|
-
description: "Tournament mode with stricter rules",
|
|
41
|
-
clientContext: { mode: "tournament", maxPlayers: 100 },
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
|
|
45
|
-
// Optional: Project config schema (validated in admin panel)
|
|
46
|
-
schema: z.object({
|
|
47
|
-
title: z.string(),
|
|
48
|
-
maxPlayers: z.number().min(2).max(100),
|
|
49
|
-
timeLimit: z.number().optional(),
|
|
50
|
-
}),
|
|
51
|
-
|
|
52
|
-
// Optional: Store schemas for validation
|
|
53
|
-
stores: [
|
|
54
|
-
{
|
|
55
|
-
pattern: "game",
|
|
56
|
-
schema: z.object({
|
|
57
|
-
status: z.enum(["waiting", "playing", "finished"]),
|
|
58
|
-
round: z.number(),
|
|
59
|
-
}),
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
pattern: "player-*",
|
|
63
|
-
schema: z.object({
|
|
64
|
-
name: z.string(),
|
|
65
|
-
score: z.number(),
|
|
66
|
-
}),
|
|
67
|
-
local: true, // Local store (per-client)
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
|
|
71
|
-
// Optional: i18n configuration
|
|
72
|
-
i18nPath: "./src/i18n",
|
|
73
|
-
i18nPrimaryLng: "en", // Source language for AI translations
|
|
74
|
-
|
|
75
|
-
// Optional: Custom API endpoint
|
|
76
|
-
endpoint: "https://api.kokimoki.com",
|
|
77
|
-
host: "y-wss.kokimoki.com",
|
|
78
|
-
|
|
79
|
-
// Optional: Dev view layout (see Dev Frame section)
|
|
80
|
-
devView: [
|
|
81
|
-
[{ label: "host", clientContext: { mode: "host" } }],
|
|
82
|
-
[
|
|
83
|
-
{ label: "player1", clientContext: { mode: "player" } },
|
|
84
|
-
{ label: "player2", clientContext: { mode: "player" } },
|
|
85
|
-
],
|
|
86
|
-
],
|
|
87
|
-
}),
|
|
88
|
-
],
|
|
104
|
+
plugins: [kokimokiKitPlugin(kokimokiConfig)],
|
|
89
105
|
});
|
|
90
106
|
```
|
|
91
107
|
|
|
@@ -100,17 +116,17 @@ export default defineConfig({
|
|
|
100
116
|
|
|
101
117
|
### Optional Options
|
|
102
118
|
|
|
103
|
-
| Option
|
|
104
|
-
|
|
|
105
|
-
| `schema`
|
|
106
|
-
| `stores`
|
|
107
|
-
| `i18nPath`
|
|
108
|
-
| `i18nPrimaryLng`
|
|
109
|
-
| `endpoint`
|
|
110
|
-
| `host`
|
|
111
|
-
| `devView`
|
|
112
|
-
| `defaultAppMeta`
|
|
113
|
-
| `defaultProjectStylePath`
|
|
119
|
+
| Option | Type | Description |
|
|
120
|
+
| ------------------------- | ---------------- | -------------------------------------------------- |
|
|
121
|
+
| `schema` | `ZodType` | Zod schema for project configuration |
|
|
122
|
+
| `stores` | `array` | Store definitions with patterns and schemas |
|
|
123
|
+
| `i18nPath` | `string` | Path to i18n folder (e.g., `./src/i18n`) |
|
|
124
|
+
| `i18nPrimaryLng` | `string` | Source language code (default: `"en"`) |
|
|
125
|
+
| `endpoint` | `string` | API endpoint (default: `https://api.kokimoki.com`) |
|
|
126
|
+
| `host` | `string` | WebSocket host (default: `y-wss.kokimoki.com`) |
|
|
127
|
+
| `devView` | `array \| false` | Dev frame layout or `false` to disable |
|
|
128
|
+
| `defaultAppMeta` | `object` | Default meta tags for SEO and social sharing |
|
|
129
|
+
| `defaultProjectStylePath` | `string` | Path to default project style file |
|
|
114
130
|
|
|
115
131
|
## App Meta
|
|
116
132
|
|
|
@@ -135,15 +151,15 @@ kokimokiKitPlugin({
|
|
|
135
151
|
|
|
136
152
|
### Fields
|
|
137
153
|
|
|
138
|
-
| Field | Description
|
|
139
|
-
| --------------- |
|
|
140
|
-
| `lang` | HTML `lang` attribute (e.g., `"en"`, `"de"`)
|
|
141
|
-
| `title` | Document title (browser tab)
|
|
142
|
-
| `description` | Meta description for SEO
|
|
143
|
-
| `ogTitle` | Open Graph title (defaults to `title` if not set)
|
|
144
|
-
| `ogDescription` | Open Graph description (defaults to `description`)
|
|
154
|
+
| Field | Description |
|
|
155
|
+
| --------------- | ------------------------------------------------------------- |
|
|
156
|
+
| `lang` | HTML `lang` attribute (e.g., `"en"`, `"de"`) |
|
|
157
|
+
| `title` | Document title (browser tab) |
|
|
158
|
+
| `description` | Meta description for SEO |
|
|
159
|
+
| `ogTitle` | Open Graph title (defaults to `title` if not set) |
|
|
160
|
+
| `ogDescription` | Open Graph description (defaults to `description`) |
|
|
145
161
|
| `ogImage` | Open Graph image URL (use relative path like `/og-image.png`) |
|
|
146
|
-
| `favicon` | Favicon URL (use relative path like `/favicon.png`)
|
|
162
|
+
| `favicon` | Favicon URL (use relative path like `/favicon.png`) |
|
|
147
163
|
|
|
148
164
|
### Asset Path Resolution
|
|
149
165
|
|