Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate (export) all object (classes) types into one file #6

Closed
jakubvanco opened this issue Jan 29, 2021 · 9 comments
Closed

Generate (export) all object (classes) types into one file #6

jakubvanco opened this issue Jan 29, 2021 · 9 comments

Comments

@jakubvanco
Copy link

At this time, I have all object types divided to folders by entity and I would need to have one big file with all of these exports.

Thanks in advance.

@yassinebridi
Copy link

Set the reExportAll option to true, it is already in the documentation.

@jakubvanco
Copy link
Author

Yes, that’s true, but I need just one big file with all exports.

@unlight unlight self-assigned this Jan 29, 2021
@unlight
Copy link
Owner

unlight commented Feb 6, 2021

@jakubvanco

What version do you use?
It's already should work since version 7.1

@jakubvanco
Copy link
Author

In 7.1 and newer versions is an option to reExportAll = true; which results in following folder structure:

OurEntity

  • aggregate-ourEntity.args.ts
  • ourEntity.model.ts
  • … others
  • index.ts (that reexports everything from files above);
    ….OtherEntites
    index.ts <— that reexports from indexes;

But if we integrate your solution with monorepo (Nx.Dev) there is a default setting which forbids cyclic dependency between files. So OurEntity.model cannot have a field from our Other entity if there is a backward reference. We can turn that setting off for now, but it would be great if you can generate all classes into single index.ts, that will resolve the issue with this cycle dependency constraint.

@unlight
Copy link
Owner

unlight commented Feb 8, 2021

So, let's clarify:

@generated/user/index.ts
@generated/post/index.ts
@generated/index.ts

You want only @generated/index.ts without feaure index files (@generated/{user,post}/index.ts), correct?

@jakubvanco
Copy link
Author

Exactly, one @generated/index.ts file with all classes.

@unlight unlight assigned unlight and unassigned jakubvanco Feb 8, 2021
@unlight unlight added enhancement New feature or request and removed awaiting-feedback labels Feb 8, 2021
unlight added a commit that referenced this issue Mar 19, 2021
@unlight
Copy link
Owner

unlight commented Mar 19, 2021

🎉 This issue has been resolved in version 10.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@unlight unlight added released awaiting-feedback and removed enhancement New feature or request labels Mar 19, 2021
@unlight unlight assigned jakubvanco and unassigned unlight Mar 19, 2021
@yassinebridi
Copy link

@unlight I'm not sure if the latest release closes this issue.

As i understand this would generate a single file with all the classes like prisma does in their client.
I tried the latest release with new reExport option, i think the Single enum is intended to be used for this functionality.

But the Single option just re-export the the files from other folders.

@unlight unlight reopened this Mar 20, 2021
@unlight
Copy link
Owner

unlight commented Mar 20, 2021

I misunderstood it.
We are talking about bundling, not export.
New issue is created #15

@unlight unlight closed this as completed Mar 20, 2021
compiledcode83 pushed a commit to compiledcode83/nestjs-graphql-prisma-api-test that referenced this issue Jun 5, 2022
Krystal2002 added a commit to Krystal2002/prisma that referenced this issue Aug 9, 2022
SuperStar444 added a commit to SuperStar444/graphql-nestjs-prisma that referenced this issue Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants