Skip to content

Commit ffb33df

Browse files
authored
Merge pull request #2 from onozaty/1-includeenuminfeildcomment-is-mispelled
#1 includeEnumInFeildComment is mispelled
2 parents 1d50b51 + 12f9acf commit ffb33df

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,19 +182,19 @@ generator comments {
182182
}
183183
```
184184

185-
### includeEnumInFeildComment
185+
### includeEnumInFieldComment
186186

187-
If `includeEnumInFeildComment` is set to true, information about the enum is appended to the column comment.
187+
If `includeEnumInFieldComment` is set to true, information about the enum is appended to the column comment.
188188
Default is `false`.
189189

190190
```prisma
191191
generator comments {
192192
provider = "prisma-db-comments-generator"
193-
includeEnumInFeildComment = true
193+
includeEnumInFieldComment = true
194194
}
195195
```
196196

197-
If `includeEnumInFeildComment` is set to `true` with the following definition,
197+
If `includeEnumInFieldComment` is set to `true` with the following definition,
198198

199199
```prisma
200200
enum ProductType {

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@onozaty/prisma-db-comments-generator",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "Generate database comments from Prisma schema",
55
"bin": {
66
"prisma-db-comments-generator": "./dist/generator.js"

prisma/schema.prisma

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ generator client {
66
generator comments {
77
provider = "node ./dist/generator.js"
88
ignorePattern = "_view$"
9-
includeEnumInFeildComment = true
9+
includeEnumInFieldComment = true
1010
}
1111

1212
datasource db {

src/comment.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const createComments = (
2727
models: readonly Model[],
2828
targets: readonly Target[],
2929
ignorePattern: RegExp | undefined,
30-
includeEnumInFeildComment: boolean,
30+
includeEnumInFieldComment: boolean,
3131
): Comments => {
3232
const comments: Comments = {};
3333

@@ -50,7 +50,7 @@ export const createComments = (
5050
columnName: field.dbName,
5151
comment: createFieldCommentString(
5252
field,
53-
includeEnumInFeildComment,
53+
includeEnumInFieldComment,
5454
),
5555
};
5656
})
@@ -63,11 +63,11 @@ export const createComments = (
6363

6464
const createFieldCommentString = (
6565
field: Field,
66-
includeEnumInFeildComment: boolean,
66+
includeEnumInFieldComment: boolean,
6767
) => {
6868
let comment = field.documentation ?? "";
6969

70-
if (includeEnumInFeildComment && field.typeEnum) {
70+
if (includeEnumInFieldComment && field.typeEnum) {
7171
comment += `\nenum: ${field.typeEnum.dbName}(${field.typeEnum.values.join(", ")})`;
7272
}
7373

src/generator.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@ const generate = async ({ generator, dmmf, schemaPath }: GeneratorOptions) => {
4242
ignorePattern = new RegExp(generator.config.ignorePattern);
4343
}
4444

45-
let includeEnumInFeildComment = false;
45+
let includeEnumInFieldComment = false;
4646
if (
47-
generator.config.includeEnumInFeildComment &&
48-
typeof generator.config.includeEnumInFeildComment === "string"
47+
generator.config.includeEnumInFieldComment &&
48+
typeof generator.config.includeEnumInFieldComment === "string"
4949
) {
50-
includeEnumInFeildComment =
51-
generator.config.includeEnumInFeildComment === "true";
50+
includeEnumInFieldComment =
51+
generator.config.includeEnumInFieldComment === "true";
5252
}
5353

5454
const models = parse(dmmf.datamodel);
5555
const currentComments = createComments(
5656
models,
5757
targets,
5858
ignorePattern,
59-
includeEnumInFeildComment,
59+
includeEnumInFieldComment,
6060
);
6161

6262
// load latest

0 commit comments

Comments
 (0)