@kokimoki/kit 1.4.0 → 1.5.0
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/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/kokimoki-kit-plugin.d.ts +2 -2
- package/dist/kokimoki-kit-plugin.js +7 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -2
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
@@ -16,4 +16,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
17
|
__exportStar(require("./kokimoki-kit-plugin"), exports);
|
18
18
|
__exportStar(require("./preprocess-style"), exports);
|
19
|
-
__exportStar(require("./schema-builder"), exports);
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { Plugin } from "vite";
|
2
|
-
import
|
2
|
+
import { ZodTypeAny } from "zod";
|
3
3
|
export interface KokimokiKitConfig {
|
4
4
|
conceptId: string;
|
5
|
-
|
5
|
+
schema: ZodTypeAny;
|
6
6
|
deployCodes: {
|
7
7
|
name: string;
|
8
8
|
description: string;
|
@@ -32,6 +32,7 @@ const promises_1 = __importDefault(require("fs/promises"));
|
|
32
32
|
const preprocess_style_1 = require("./preprocess-style");
|
33
33
|
const version_1 = require("./version");
|
34
34
|
const yaml = __importStar(require("yaml"));
|
35
|
+
const zod_to_json_schema_1 = __importDefault(require("zod-to-json-schema"));
|
35
36
|
function kokimokiKitPlugin(config) {
|
36
37
|
return {
|
37
38
|
name: "kokimoki-kit",
|
@@ -105,7 +106,7 @@ function kokimokiKitPlugin(config) {
|
|
105
106
|
await promises_1.default.writeFile(".kokimoki/app-id", appId);
|
106
107
|
}
|
107
108
|
// Get default config
|
108
|
-
let defaultProjectConfig = config.
|
109
|
+
let defaultProjectConfig = config.schema.parse(undefined);
|
109
110
|
if (config.defaultProjectConfigPath) {
|
110
111
|
const defaultProjectConfigFile = await promises_1.default.readFile(config.defaultProjectConfigPath, "utf8");
|
111
112
|
defaultProjectConfig = yaml.parse(defaultProjectConfigFile);
|
@@ -142,11 +143,13 @@ function kokimokiKitPlugin(config) {
|
|
142
143
|
defaultProjectStylePath: config.defaultProjectStylePath,
|
143
144
|
}, null, 2));
|
144
145
|
// write schema
|
145
|
-
|
146
|
+
const jsonSchema = (0, zod_to_json_schema_1.default)(config.schema);
|
147
|
+
const defaultJsonSchemaValue = config.schema.parse(undefined);
|
148
|
+
await promises_1.default.writeFile(".kokimoki/schema.json", JSON.stringify(jsonSchema, null, 2));
|
146
149
|
// write schema defaults as json
|
147
|
-
await promises_1.default.writeFile(".kokimoki/schema-defaults.json", JSON.stringify(
|
150
|
+
await promises_1.default.writeFile(".kokimoki/schema-defaults.json", JSON.stringify(defaultJsonSchemaValue, null, 2));
|
148
151
|
// write schema defaults as yaml
|
149
|
-
await promises_1.default.writeFile(".kokimoki/schema-defaults.yaml", yaml.stringify(
|
152
|
+
await promises_1.default.writeFile(".kokimoki/schema-defaults.yaml", yaml.stringify(defaultJsonSchemaValue));
|
150
153
|
},
|
151
154
|
configureServer(server) {
|
152
155
|
// reload when defaultProjectConfigPath or defaultProjectStylePath changes
|
package/dist/version.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export declare const KOKIMOKI_KIT_VERSION = "1.
|
1
|
+
export declare const KOKIMOKI_KIT_VERSION = "1.5.0";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@kokimoki/kit",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.5.0",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -25,7 +25,9 @@
|
|
25
25
|
"bson-objectid": "^2.0.4",
|
26
26
|
"colorjs.io": "^0.5.2",
|
27
27
|
"colornames": "^1.1.1",
|
28
|
-
"yaml": "^2.7.0"
|
28
|
+
"yaml": "^2.7.0",
|
29
|
+
"zod": "^3.24.2",
|
30
|
+
"zod-to-json-schema": "^3.24.5"
|
29
31
|
},
|
30
32
|
"peerDependencies": {
|
31
33
|
"vite": ">=5"
|