sizuku 0.0.3 → 0.0.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 +4 -4
- package/dist/common/config/index.d.ts +12 -12
- package/dist/common/format/index.d.ts +1 -1
- package/dist/common/generator/generate-field-definitions.d.ts +3 -3
- package/dist/common/helper/get-camel-case-schema-name-helper.d.ts +1 -1
- package/dist/common/helper/get-pascal-case-schema-name-helper.d.ts +1 -1
- package/dist/common/helper/get-variable-name-helper.d.ts +2 -2
- package/dist/common/helper/get-variable-schema-name-helper.d.ts +2 -2
- package/dist/common/text/capitalize.d.ts +1 -1
- package/dist/common/text/decapitalize.d.ts +1 -1
- package/dist/common/type/index.d.ts +7 -7
- package/dist/generator/mermaid-er/config/index.d.ts +4 -4
- package/dist/generator/mermaid-er/core/extract-relations.d.ts +2 -2
- package/dist/generator/mermaid-er/generator/generate-er-content.d.ts +2 -2
- package/dist/generator/mermaid-er/generator/generate-relation-line.d.ts +2 -2
- package/dist/generator/mermaid-er/index.d.ts +6 -6
- package/dist/generator/mermaid-er/index.js +27 -23
- package/dist/generator/mermaid-er/type/index.d.ts +19 -37
- package/dist/generator/mermaid-er/validator/is-relation.d.ts +2 -2
- package/dist/generator/mermaid-er/validator/parse-relation-line.d.ts +6 -6
- package/dist/generator/mermaid-er/validator/parse-table-info.d.ts +2 -2
- package/dist/generator/mermaid-er/validator/remove-duplicate-relations.d.ts +1 -1
- package/dist/generator/valibot/config/index.d.ts +2 -2
- package/dist/generator/valibot/core/extract-schema.d.ts +2 -2
- package/dist/generator/valibot/generator/generate-valibot-code.d.ts +3 -3
- package/dist/generator/valibot/generator/generate-valibot-infer-input.d.ts +3 -3
- package/dist/generator/valibot/generator/generate-valibot-schema.d.ts +3 -3
- package/dist/generator/valibot/index.d.ts +2 -2
- package/dist/generator/zod/config/index.d.ts +2 -2
- package/dist/generator/zod/core/extract-schema.d.ts +2 -2
- package/dist/generator/zod/generator/generate-z-infer.d.ts +3 -3
- package/dist/generator/zod/generator/generate-zod-code.d.ts +3 -3
- package/dist/generator/zod/generator/generate-zod-schema.d.ts +3 -3
- package/dist/generator/zod/index.d.ts +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Sizuku
|
|
2
2
|
|
|
3
|
-
**[Sizuku](https://www.npmjs.com/package/sizuku)** is a tool that generates
|
|
3
|
+
**[Sizuku](https://www.npmjs.com/package/sizuku)** is a tool that generates validation schemas for Zod and Valibot, as well as ER diagrams, from [Drizzle](https://orm.drizzle.team/) schemas annotated with comments.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
@@ -290,9 +290,9 @@ output:
|
|
|
290
290
|
|
|
291
291
|
```mermaid
|
|
292
292
|
erDiagram
|
|
293
|
-
user
|
|
294
|
-
post
|
|
295
|
-
user
|
|
293
|
+
user ||--|{ post : "(id) - (userId)"
|
|
294
|
+
post ||--|{ likes : "(id) - (postId)"
|
|
295
|
+
user ||--|{ likes : "(id) - (userId)"
|
|
296
296
|
user {
|
|
297
297
|
varchar id "(PK) Unique identifier for the user."
|
|
298
298
|
varchar username "Username of the user."
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export type Config = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
export declare const DEFAULT_CONFIG: Config
|
|
2
|
+
schema: {
|
|
3
|
+
name: 'PascalCase' | 'camelCase';
|
|
4
|
+
};
|
|
5
|
+
type: {
|
|
6
|
+
name: 'PascalCase' | 'camelCase';
|
|
7
|
+
export: boolean;
|
|
8
|
+
};
|
|
9
|
+
input?: string;
|
|
10
|
+
output?: string;
|
|
11
|
+
comment?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare const DEFAULT_CONFIG: Config;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function formatCode(code: string): Promise<string
|
|
1
|
+
export declare function formatCode(code: string): Promise<string>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Schema } from '../type'
|
|
2
|
-
import type { Config } from '../config'
|
|
1
|
+
import type { Schema } from '../type';
|
|
2
|
+
import type { Config } from '../config';
|
|
3
3
|
/**
|
|
4
4
|
* @function generateFieldDefinitions
|
|
5
5
|
* @param schema
|
|
6
6
|
* @returns
|
|
7
7
|
*/
|
|
8
|
-
export declare function generateFieldDefinitions(schema: Schema, config: Config): string
|
|
8
|
+
export declare function generateFieldDefinitions(schema: Schema, config: Config): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Config } from '../config'
|
|
1
|
+
import type { Config } from '../config';
|
|
2
2
|
/**
|
|
3
3
|
* Get the variable name helper
|
|
4
4
|
*
|
|
@@ -6,4 +6,4 @@ import type { Config } from '../config'
|
|
|
6
6
|
* @param config - The config
|
|
7
7
|
* @returns The variable name helper
|
|
8
8
|
*/
|
|
9
|
-
export declare function getVariableNameHelper(name: string, config: Config): string
|
|
9
|
+
export declare function getVariableNameHelper(name: string, config: Config): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Config } from '../config'
|
|
1
|
+
import type { Config } from '../config';
|
|
2
2
|
/**
|
|
3
3
|
* Get the variable schema name helper
|
|
4
4
|
*
|
|
@@ -6,4 +6,4 @@ import type { Config } from '../config'
|
|
|
6
6
|
* @param config - The config
|
|
7
7
|
* @returns The variable schema name helper
|
|
8
8
|
*/
|
|
9
|
-
export declare function getVariableSchemaNameHelper(name: string, config: Config): string
|
|
9
|
+
export declare function getVariableSchemaNameHelper(name: string, config: Config): string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export type SchemaField = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
2
|
+
name: string;
|
|
3
|
+
definition: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
};
|
|
6
6
|
export type Schema = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
7
|
+
name: string;
|
|
8
|
+
fields: SchemaField[];
|
|
9
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export type Config = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
2
|
+
input?: string;
|
|
3
|
+
output?: string;
|
|
4
|
+
};
|
|
5
5
|
/**
|
|
6
6
|
* Loads the configuration from the `sizuku.json` file or returns the default configuration.
|
|
7
7
|
*
|
|
8
8
|
* @returns The configuration object.
|
|
9
9
|
*/
|
|
10
|
-
export declare function getConfig(): Config
|
|
10
|
+
export declare function getConfig(): Config;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Relation } from '../type'
|
|
1
|
+
import type { Relation } from '../type';
|
|
2
2
|
/**
|
|
3
3
|
* Extracts relations from the given code.
|
|
4
4
|
*
|
|
5
5
|
* @param code - The code to extract relations from.
|
|
6
6
|
* @returns The extracted relations.
|
|
7
7
|
*/
|
|
8
|
-
export declare function extractRelations(code: string[]): Relation[]
|
|
8
|
+
export declare function extractRelations(code: string[]): Relation[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Relation, TableInfo } from '../type'
|
|
1
|
+
import type { Relation, TableInfo } from '../type';
|
|
2
2
|
/**
|
|
3
3
|
* Generate ER content
|
|
4
4
|
* @function generateERContent
|
|
@@ -6,4 +6,4 @@ import type { Relation, TableInfo } from '../type'
|
|
|
6
6
|
* @param tables - The tables to generate the ER content from
|
|
7
7
|
* @returns The generated ER content
|
|
8
8
|
*/
|
|
9
|
-
export declare function generateERContent(relations: Relation[], tables: TableInfo[]): string
|
|
9
|
+
export declare function generateERContent(relations: Relation[], tables: TableInfo[]): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Relation } from '../type'
|
|
1
|
+
import type { Relation } from '../type';
|
|
2
2
|
/**
|
|
3
3
|
* Generate a relation line for a relation
|
|
4
4
|
* @param relation - The relation to generate a line for
|
|
5
5
|
* @returns The generated relation line
|
|
6
6
|
*/
|
|
7
|
-
export declare function generateRelationLine(relation: Relation): string
|
|
7
|
+
export declare function generateRelationLine(relation: Relation): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import type { Config } from './config'
|
|
3
|
-
import type { RelationType } from './type'
|
|
4
|
-
export declare const CARDINALITY_MAP: Record<RelationType, string
|
|
5
|
-
export declare const ER_HEADER: readonly [
|
|
6
|
-
export declare const ER_FOOTER: readonly [
|
|
7
|
-
export declare function main(dev?: boolean, config?: Config): Promise<boolean
|
|
2
|
+
import type { Config } from './config';
|
|
3
|
+
import type { RelationType } from './type';
|
|
4
|
+
export declare const CARDINALITY_MAP: Record<RelationType, string>;
|
|
5
|
+
export declare const ER_HEADER: readonly ["```mermaid", "erDiagram"];
|
|
6
|
+
export declare const ER_FOOTER: readonly ["```"];
|
|
7
|
+
export declare function main(dev?: boolean, config?: Config): Promise<boolean>;
|
|
@@ -14,28 +14,33 @@ const extract_relations_1 = require("./core/extract-relations");
|
|
|
14
14
|
const config_1 = require("./config");
|
|
15
15
|
const node_process_1 = require("node:process");
|
|
16
16
|
exports.CARDINALITY_MAP = {
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
17
|
+
// Required Relationships
|
|
18
|
+
"one-to-one": "||--||", // 1 --- 1
|
|
19
|
+
"one-to-many": "||--|{", // 1 --- 0..*
|
|
20
|
+
"many-to-one": "}|--||", // * --- 1
|
|
21
|
+
"many-to-many": "}|--|{", // * --- *
|
|
22
|
+
"one-to-zero-one": "||--o|", // 1 --- 0..1
|
|
23
|
+
"zero-one-to-one": "o|--||", // 0..1 --- 1
|
|
24
|
+
"zero-to-one": "o|--o|", // 0..1 --- 0..1
|
|
25
|
+
"zero-to-zero-one": "o|--o|", // Alias for zero-to-one
|
|
26
|
+
"zero-to-many": "o|--o{", // 0..1 --- 0..*
|
|
27
|
+
"zero-one-to-many": "o|--o{", // 0..1 --- *
|
|
28
|
+
"many-to-zero-one": "}|--o|", // * --- 0..1
|
|
29
|
+
// Optional Relationships (dotted lines)
|
|
30
|
+
"one-to-one-optional": "||..||", // 1 --- 1 optional
|
|
31
|
+
"one-to-many-optional": "||..o{", // 1 --- 0..* optional
|
|
32
|
+
"many-to-one-optional": "}|..||", // * --- 1 optional
|
|
33
|
+
"many-to-many-optional": "}|..o{", // * --- 0..* optional
|
|
34
|
+
"one-to-zero-one-optional": "||..o|", // 1 --- 0..1 optional
|
|
35
|
+
"zero-one-to-one-optional": "o|..||", // 0..1 --- 1 optional
|
|
36
|
+
"zero-to-one-optional": "o|..o|", // 0..1 --- 0..1 optional
|
|
37
|
+
"zero-to-many-optional": "o|..o{", // 0..1 --- 0..* optional
|
|
38
|
+
"zero-one-to-many-optional": "o|..o{", // 0..1 --- * optional
|
|
39
|
+
"many-to-zero-one-optional": "}|..o|", // * --- 0..1 optional
|
|
40
|
+
// Nuanced Patterns (Aliases)
|
|
41
|
+
"many-to-zero-many": "}|..o{", // * --- 0..*
|
|
42
|
+
"zero-many-to-many": "o{--|{", // 0..* --- *
|
|
43
|
+
"zero-many-to-zero-many": "o{--o{", // 0..* --- 0..*
|
|
39
44
|
};
|
|
40
45
|
// ER diagram header
|
|
41
46
|
exports.ER_HEADER = ['```mermaid', 'erDiagram'];
|
|
@@ -43,7 +48,6 @@ exports.ER_HEADER = ['```mermaid', 'erDiagram'];
|
|
|
43
48
|
exports.ER_FOOTER = ['```'];
|
|
44
49
|
async function main(dev = false, config = (0, config_1.getConfig)()) {
|
|
45
50
|
// 1. argv ['**/bin/node', '**/dist/src/generator/mermaid-er/index.js', 'db/schema.ts', '-o', 'mermaid-er/ER.md']
|
|
46
|
-
console.log(config.output);
|
|
47
51
|
if (config.output === undefined && !node_process_1.argv.includes('-o')) {
|
|
48
52
|
console.error('Error: -o is not found');
|
|
49
53
|
return false;
|
|
@@ -1,40 +1,22 @@
|
|
|
1
|
-
export type RelationType =
|
|
2
|
-
| 'one-to-one'
|
|
3
|
-
| 'one-to-many'
|
|
4
|
-
| 'many-to-one'
|
|
5
|
-
| 'many-to-many'
|
|
6
|
-
| 'one-to-zero-one'
|
|
7
|
-
| 'zero-one-to-one'
|
|
8
|
-
| 'zero-to-many'
|
|
9
|
-
| 'many-to-zero-one'
|
|
10
|
-
| 'zero-one-to-many'
|
|
11
|
-
| 'zero-to-one'
|
|
12
|
-
| 'zero-to-zero-one'
|
|
13
|
-
| 'one-to-many-optional'
|
|
14
|
-
| 'one-to-one-optional'
|
|
15
|
-
| 'many-to-many-optional'
|
|
16
|
-
| 'zero-one-to-zero-one'
|
|
17
|
-
| 'many-to-zero-many'
|
|
18
|
-
| 'zero-many-to-many'
|
|
19
|
-
| 'zero-many-to-zero-many'
|
|
1
|
+
export type RelationType = "one-to-one" | "one-to-many" | "many-to-one" | "many-to-many" | "one-to-zero-one" | "zero-one-to-one" | "zero-to-one" | "zero-to-zero-one" | "zero-to-many" | "zero-one-to-many" | "many-to-zero-one" | "one-to-one-optional" | "one-to-many-optional" | "many-to-one-optional" | "many-to-many-optional" | "one-to-zero-one-optional" | "zero-one-to-one-optional" | "zero-to-one-optional" | "zero-to-many-optional" | "zero-one-to-many-optional" | "many-to-zero-one-optional" | "many-to-zero-many" | "zero-many-to-many" | "zero-many-to-zero-many";
|
|
20
2
|
export type Relation = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
export type ERContent = readonly string[]
|
|
3
|
+
fromModel: string;
|
|
4
|
+
toModel: string;
|
|
5
|
+
fromField: string;
|
|
6
|
+
toField: string;
|
|
7
|
+
type: RelationType;
|
|
8
|
+
};
|
|
9
|
+
export type ERContent = readonly string[];
|
|
28
10
|
export type TableInfo = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
11
|
+
name: string;
|
|
12
|
+
fields: {
|
|
13
|
+
type: string;
|
|
14
|
+
name: string;
|
|
15
|
+
description: string | null;
|
|
16
|
+
}[];
|
|
17
|
+
};
|
|
36
18
|
export type AccumulatorType = {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
19
|
+
tables: TableInfo[];
|
|
20
|
+
currentTable: TableInfo | null;
|
|
21
|
+
currentDescription: string;
|
|
22
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { RelationType } from '../type'
|
|
1
|
+
import type { RelationType } from '../type';
|
|
2
2
|
/**
|
|
3
3
|
* Validate if a value is a valid relation type
|
|
4
4
|
* @param value - The value to validate
|
|
5
5
|
* @returns True if the value is a valid relation type, false otherwise
|
|
6
6
|
*/
|
|
7
|
-
export declare function isRelation(value: unknown): value is RelationType
|
|
7
|
+
export declare function isRelation(value: unknown): value is RelationType;
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* @returns The parsed relation
|
|
5
5
|
*/
|
|
6
6
|
export declare function parseRelationLine(line: string): {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} | null
|
|
7
|
+
fromModel: string;
|
|
8
|
+
fromField: string;
|
|
9
|
+
toModel: string;
|
|
10
|
+
toField: string;
|
|
11
|
+
type: import("../type").RelationType;
|
|
12
|
+
} | null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { TableInfo } from '../type'
|
|
1
|
+
import type { TableInfo } from '../type';
|
|
2
2
|
/**
|
|
3
3
|
* Parse table info from code
|
|
4
4
|
* @function parseTableInfo
|
|
5
5
|
* @param code - The code to parse the table info from
|
|
6
6
|
* @returns The parsed table info
|
|
7
7
|
*/
|
|
8
|
-
export declare function parseTableInfo(code: string[]): TableInfo[]
|
|
8
|
+
export declare function parseTableInfo(code: string[]): TableInfo[];
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @param relations - The relations to remove duplicates from
|
|
5
5
|
* @returns The relations without duplicates
|
|
6
6
|
*/
|
|
7
|
-
export declare function removeDuplicateRelations(relations: readonly string[]): readonly string[]
|
|
7
|
+
export declare function removeDuplicateRelations(relations: readonly string[]): readonly string[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Config } from '../../../common/config'
|
|
1
|
+
import type { Config } from '../../../common/config';
|
|
2
2
|
/**
|
|
3
3
|
* Loads the configuration from the `sizuku.json` file or returns the default configuration.
|
|
4
4
|
*
|
|
5
5
|
* @returns The configuration object.
|
|
6
6
|
*/
|
|
7
|
-
export declare function getConfig(): Config
|
|
7
|
+
export declare function getConfig(): Config;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Schema } from '../../../common/type'
|
|
1
|
+
import type { Schema } from '../../../common/type';
|
|
2
2
|
/**
|
|
3
3
|
* Extract schemas from lines of code
|
|
4
4
|
* @function extractSchemas
|
|
5
5
|
* @param lines - Lines of code
|
|
6
6
|
* @returns Schemas
|
|
7
7
|
*/
|
|
8
|
-
export declare function extractSchemas(lines: string[]): Schema[]
|
|
8
|
+
export declare function extractSchemas(lines: string[]): Schema[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Schema } from '../../../common/type'
|
|
2
|
-
import type { Config } from '../../../common/config'
|
|
1
|
+
import type { Schema } from '../../../common/type';
|
|
2
|
+
import type { Config } from '../../../common/config';
|
|
3
3
|
/**
|
|
4
4
|
* Generates Valibot code for a given schema and config.
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@ import type { Config } from '../../../common/config'
|
|
|
8
8
|
* @param config - The configuration for the code generation.
|
|
9
9
|
* @returns The generated Valibot code.
|
|
10
10
|
*/
|
|
11
|
-
export declare function generateValibotCode(schema: Schema, config: Config): string
|
|
11
|
+
export declare function generateValibotCode(schema: Schema, config: Config): string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Schema } from '../../../common/type'
|
|
2
|
-
import type { Config } from '../../../common/config'
|
|
1
|
+
import type { Schema } from '../../../common/type';
|
|
2
|
+
import type { Config } from '../../../common/config';
|
|
3
3
|
/**
|
|
4
4
|
* @function generateValibotInferInput
|
|
5
5
|
* @param schema
|
|
6
6
|
* @param config
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
|
-
export declare function generateValibotInferInput(schema: Schema, config: Config): string
|
|
9
|
+
export declare function generateValibotInferInput(schema: Schema, config: Config): string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Schema } from '../../../common/type'
|
|
2
|
-
import type { Config } from '../../../common/config'
|
|
1
|
+
import type { Schema } from '../../../common/type';
|
|
2
|
+
import type { Config } from '../../../common/config';
|
|
3
3
|
/**
|
|
4
4
|
* @function generateValibotSchema
|
|
5
5
|
* @param schema
|
|
6
6
|
* @param config
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
|
-
export declare function generateValibotSchema(schema: Schema, config: Config): string
|
|
9
|
+
export declare function generateValibotSchema(schema: Schema, config: Config): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import type { Config } from '../../common/config'
|
|
3
|
-
export declare function main(dev?: boolean, config?: Config): Promise<boolean
|
|
2
|
+
import type { Config } from '../../common/config';
|
|
3
|
+
export declare function main(dev?: boolean, config?: Config): Promise<boolean>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Config } from '../../../common/config'
|
|
1
|
+
import type { Config } from '../../../common/config';
|
|
2
2
|
/**
|
|
3
3
|
* Loads the configuration from the `sizuku.json` file or returns the default configuration.
|
|
4
4
|
*
|
|
5
5
|
* @function getConfig
|
|
6
6
|
* @returns The configuration object.
|
|
7
7
|
*/
|
|
8
|
-
export declare function getConfig(): Config
|
|
8
|
+
export declare function getConfig(): Config;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Schema } from '../../../common/type'
|
|
1
|
+
import type { Schema } from '../../../common/type';
|
|
2
2
|
/**
|
|
3
3
|
* Extract schemas from lines of code
|
|
4
4
|
* @function extractSchemas
|
|
5
5
|
* @param lines - Lines of code
|
|
6
6
|
* @returns Schemas
|
|
7
7
|
*/
|
|
8
|
-
export declare function extractSchemas(lines: string[]): Schema[]
|
|
8
|
+
export declare function extractSchemas(lines: string[]): Schema[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Schema } from '../../../common/type'
|
|
2
|
-
import type { Config } from '../../../common/config'
|
|
1
|
+
import type { Schema } from '../../../common/type';
|
|
2
|
+
import type { Config } from '../../../common/config';
|
|
3
3
|
/**
|
|
4
4
|
* Generates a Zod infer type for a given schema and config.
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@ import type { Config } from '../../../common/config'
|
|
|
8
8
|
* @param config - The configuration for the code generation.
|
|
9
9
|
* @returns The generated Zod infer type.
|
|
10
10
|
*/
|
|
11
|
-
export declare function generateZInfer(schema: Schema, config: Config): string
|
|
11
|
+
export declare function generateZInfer(schema: Schema, config: Config): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Schema } from '../../../common/type'
|
|
2
|
-
import type { Config } from '../../../common/config'
|
|
1
|
+
import type { Schema } from '../../../common/type';
|
|
2
|
+
import type { Config } from '../../../common/config';
|
|
3
3
|
/**
|
|
4
4
|
* Generates Zod code for a given schema and config.
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@ import type { Config } from '../../../common/config'
|
|
|
8
8
|
* @param config - The configuration for the code generation.
|
|
9
9
|
* @returns The generated Zod code.
|
|
10
10
|
*/
|
|
11
|
-
export declare function generateZodCode(schema: Schema, config: Config): string
|
|
11
|
+
export declare function generateZodCode(schema: Schema, config: Config): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Schema } from '../../../common/type'
|
|
2
|
-
import type { Config } from '../../../common/config'
|
|
1
|
+
import type { Schema } from '../../../common/type';
|
|
2
|
+
import type { Config } from '../../../common/config';
|
|
3
3
|
/**
|
|
4
4
|
* Generates a Zod schema for a given schema and config.
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@ import type { Config } from '../../../common/config'
|
|
|
8
8
|
* @param config - The configuration for the code generation.
|
|
9
9
|
* @returns The generated Zod schema.
|
|
10
10
|
*/
|
|
11
|
-
export declare function generateZodSchema(schema: Schema, config: Config): string
|
|
11
|
+
export declare function generateZodSchema(schema: Schema, config: Config): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import type { Config } from '../../common/config'
|
|
3
|
-
export declare function main(dev?: boolean, config?: Config): Promise<boolean
|
|
2
|
+
import type { Config } from '../../common/config';
|
|
3
|
+
export declare function main(dev?: boolean, config?: Config): Promise<boolean>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sizuku",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Sizuku is a tool that
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"description": "Sizuku is a tool that generates validation schemas for Zod and Valibot, as well as ER diagrams, from Drizzle schemas annotated with comments.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"drizzle",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"dev": "pnpm --filter sizuku-test dev",
|
|
41
41
|
"test": "vitest run",
|
|
42
42
|
"coverage": "vitest run --coverage",
|
|
43
|
-
"release": "npm pkg fix && npm publish"
|
|
43
|
+
"release": "npm pkg fix && pnpm build && npm publish"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^22.13.8",
|