Skip to content

Commit

Permalink
improve: no duplicate jsdoc in generated code (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkuhrt authored Aug 28, 2021
1 parent cbe3df8 commit 2dd991d
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 538 deletions.
6 changes: 2 additions & 4 deletions src/generator/models/declaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ export function renderTypeScriptDeclarationForDocumentModels(
? NO_MODELS_DEFINED_COMMENT
: models
.map((model) => {
const jsdoc = settings.data.docPropagation.JSDoc ? jsDocForModel(model) + '\n' : ''
return dedent`
${jsdoc}export const ${model.name}: ${model.name}
export const ${model.name}: ${model.name}
`
})
.join('\n\n')
Expand All @@ -109,9 +108,8 @@ export function renderTypeScriptDeclarationForDocumentModels(
? NO_ENUMS_DEFINED_COMMENT
: enums
.map((enum_) => {
const jsdoc = settings.data.docPropagation.JSDoc ? jsDocForEnum(enum_) + '\n' : ''
return dedent`
${jsdoc}export const ${enum_.name}: ${enum_.name}
export const ${enum_.name}: ${enum_.name}
`
})
.join('\n\n')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,33 +82,6 @@ export interface Foo {
//
//
/**
* Generated Nexus \`enumType\` configuration based on your Prisma schema's enum \`Foo\`.
*
* ### ️⚠️ You have not writen documentation for enum Foo
*
* Replace this default advisory JSDoc with your own documentation about enum Foo
* by documenting it in your Prisma schema. For example:
*
*
* \`\`\`prisma
* /// Lorem ipsum dolor sit amet...
* enum Foo {
* a
* }
* \`\`\`
*
* Learn more about documentation comments in Prisma schema files [here](https://www.prisma.io/docs/concepts/components/prisma-schema#comments).
*
* Contains these members: a
*
* @example
*
* import { enumType } from 'nexus'
* import { Foo } from 'nexus-prisma'
*
* enumType(Foo)
*/
export const Foo: Foo
//
Expand Down Expand Up @@ -224,20 +197,6 @@ export interface Foo {
//
//
/**
* Generated Nexus \`enumType\` configuration based on your Prisma schema's enum \`Foo\`.
*
* Some documentation
*
* Contains these members: a
*
* @example
*
* import { enumType } from 'nexus'
* import { Foo } from 'nexus-prisma'
*
* enumType(Foo)
*/
export const Foo: Foo
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,6 @@ export interface Foo {
//
//
/**
* Generated Nexus \`enumType\` configuration based on your Prisma schema's enum \`Foo\`.
*
* Some documentation
*
* Contains these members: a
*
* @example
*
* import { enumType } from 'nexus'
* import { Foo } from 'nexus-prisma'
*
* enumType(Foo)
*/
export const Foo: Foo
//
Expand Down Expand Up @@ -211,33 +197,6 @@ export interface Foo {
//
//
/**
* Generated Nexus \`enumType\` configuration based on your Prisma schema's enum \`Foo\`.
*
* ### ️⚠️ You have not writen documentation for enum Foo
*
* Replace this default advisory JSDoc with your own documentation about enum Foo
* by documenting it in your Prisma schema. For example:
*
*
* \`\`\`prisma
* /// Lorem ipsum dolor sit amet...
* enum Foo {
* a
* }
* \`\`\`
*
* Learn more about documentation comments in Prisma schema files [here](https://www.prisma.io/docs/concepts/components/prisma-schema#comments).
*
* Contains these members: a
*
* @example
*
* import { enumType } from 'nexus'
* import { Foo } from 'nexus-prisma'
*
* enumType(Foo)
*/
export const Foo: Foo
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,37 +115,6 @@ export interface SomeModel {
//
//
/**
* Generated Nexus \`objectType\` configuration based on your Prisma schema's model \`SomeModel\`.
*
* ### ️⚠️ You have not writen documentation for model SomeModel
*
* Replace this default advisory JSDoc with your own documentation about model SomeModel
* by documenting it in your Prisma schema. For example:
*
*
* \`\`\`prisma
* /// Lorem ipsum dolor sit amet...
* model SomeModel {
* foo String
* }
* \`\`\`
*
* Learn more about documentation comments in Prisma schema files [here](https://www.prisma.io/docs/concepts/components/prisma-schema#comments).
*
* @example
*
* import { objectType } from 'nexus'
* import { SomeModel } from 'nexus-prisma'
*
* objectType({
* name: SomeModel.$name
* description: SomeModel.$description
* definition(t) {
* t.field(SomeModel.id)
* }
* })
*/
export const SomeModel: SomeModel
//
Expand Down Expand Up @@ -330,37 +299,6 @@ export interface SomeModel {
//
//
/**
* Generated Nexus \`objectType\` configuration based on your Prisma schema's model \`SomeModel\`.
*
* ### ️⚠️ You have not writen documentation for model SomeModel
*
* Replace this default advisory JSDoc with your own documentation about model SomeModel
* by documenting it in your Prisma schema. For example:
*
*
* \`\`\`prisma
* /// Lorem ipsum dolor sit amet...
* model SomeModel {
* foo String
* }
* \`\`\`
*
* Learn more about documentation comments in Prisma schema files [here](https://www.prisma.io/docs/concepts/components/prisma-schema#comments).
*
* @example
*
* import { objectType } from 'nexus'
* import { SomeModel } from 'nexus-prisma'
*
* objectType({
* name: SomeModel.$name
* description: SomeModel.$description
* definition(t) {
* t.field(SomeModel.id)
* }
* })
*/
export const SomeModel: SomeModel
//
Expand Down Expand Up @@ -532,24 +470,6 @@ export interface SomeModel {
//
//
/**
* Generated Nexus \`objectType\` configuration based on your Prisma schema's model \`SomeModel\`.
*
* Some documentation
*
* @example
*
* import { objectType } from 'nexus'
* import { SomeModel } from 'nexus-prisma'
*
* objectType({
* name: SomeModel.$name
* description: SomeModel.$description
* definition(t) {
* t.field(SomeModel.id)
* }
* })
*/
export const SomeModel: SomeModel
//
Expand Down Expand Up @@ -734,37 +654,6 @@ export interface SomeModel {
//
//
/**
* Generated Nexus \`objectType\` configuration based on your Prisma schema's model \`SomeModel\`.
*
* ### ️⚠️ You have not writen documentation for model SomeModel
*
* Replace this default advisory JSDoc with your own documentation about model SomeModel
* by documenting it in your Prisma schema. For example:
*
*
* \`\`\`prisma
* /// Lorem ipsum dolor sit amet...
* model SomeModel {
* foo String
* }
* \`\`\`
*
* Learn more about documentation comments in Prisma schema files [here](https://www.prisma.io/docs/concepts/components/prisma-schema#comments).
*
* @example
*
* import { objectType } from 'nexus'
* import { SomeModel } from 'nexus-prisma'
*
* objectType({
* name: SomeModel.$name
* description: SomeModel.$description
* definition(t) {
* t.field(SomeModel.id)
* }
* })
*/
export const SomeModel: SomeModel
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,70 +375,8 @@ export interface Post {
//
//
/**
* Generated Nexus \`objectType\` configuration based on your Prisma schema's model \`User\`.
*
* ### ️⚠️ You have not writen documentation for model User
*
* Replace this default advisory JSDoc with your own documentation about model User
* by documenting it in your Prisma schema. For example:
*
*
* \`\`\`prisma
* /// Lorem ipsum dolor sit amet...
* model User {
* foo String
* }
* \`\`\`
*
* Learn more about documentation comments in Prisma schema files [here](https://www.prisma.io/docs/concepts/components/prisma-schema#comments).
*
* @example
*
* import { objectType } from 'nexus'
* import { User } from 'nexus-prisma'
*
* objectType({
* name: User.$name
* description: User.$description
* definition(t) {
* t.field(User.id)
* }
* })
*/
export const User: User
/**
* Generated Nexus \`objectType\` configuration based on your Prisma schema's model \`Post\`.
*
* ### ️⚠️ You have not writen documentation for model Post
*
* Replace this default advisory JSDoc with your own documentation about model Post
* by documenting it in your Prisma schema. For example:
*
*
* \`\`\`prisma
* /// Lorem ipsum dolor sit amet...
* model Post {
* foo String
* }
* \`\`\`
*
* Learn more about documentation comments in Prisma schema files [here](https://www.prisma.io/docs/concepts/components/prisma-schema#comments).
*
* @example
*
* import { objectType } from 'nexus'
* import { Post } from 'nexus-prisma'
*
* objectType({
* name: Post.$name
* description: Post.$description
* definition(t) {
* t.field(Post.id)
* }
* })
*/
export const Post: Post
//
Expand Down
Loading

0 comments on commit 2dd991d

Please sign in to comment.