@layer-drone/protocol 0.0.3 → 0.0.6

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.
@@ -1,35 +0,0 @@
1
- /**
2
- * This script generates the event type from the protocol API.
3
- * It fetches the event schema from the protocol API and converts it to a Zod schema.
4
- * It then formats the schema and writes it to a file.
5
- */
6
- import { jsonSchemaToZod } from "json-schema-to-zod";
7
- import fs from "node:fs";
8
- import path from "node:path";
9
- import { format } from "prettier";
10
-
11
- async function generateEventType() {
12
- const response = await fetch("http://localhost:5000/schema/event");
13
- const schema = await response.json();
14
- const zodSchema = jsonSchemaToZod(schema, {
15
- name: "Event",
16
- module: "esm",
17
- type: true,
18
- });
19
- const header = `// This file is auto-generated by @layer-drone/protocol\n`;
20
- const formatted = await format(header + zodSchema, { parser: "typescript" });
21
- const outputPath = getOutputPath("types.gen.ts");
22
- fs.writeFileSync(outputPath, formatted);
23
- }
24
-
25
- function getOutputPath(fileName: string) {
26
- const outputPath = path.join(process.cwd(), "src", "event", fileName);
27
- // Ensure the directory exists
28
- const dirPath = path.dirname(outputPath);
29
- if (!fs.existsSync(dirPath)) {
30
- fs.mkdirSync(dirPath, { recursive: true });
31
- }
32
- return outputPath;
33
- }
34
-
35
- generateEventType();
package/tsconfig.json DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "extends": "@layer-drone/typescript-config/nestjs.json",
3
- "compilerOptions": {
4
- "allowJs": true,
5
- "baseUrl": "./src",
6
- "outDir": "./dist",
7
- "esModuleInterop": true,
8
- "incremental": false
9
- },
10
- "include": ["src"],
11
- "exclude": ["node_modules", "test", "dist", "scripts", "**/*spec.ts"]
12
- }