typegraphql-prisma icon indicating copy to clipboard operation
typegraphql-prisma copied to clipboard

publish to `node_modules/.cache/typegraphql` instead of `@generated/typegraphql`

Open Morriz opened this issue 3 years ago • 6 comments

Is your feature request related to a problem? Please describe.

Unrelated npm script calls seem to affect @generated/typegraphql resources. I might be mistaken, but vscode frequently seems to lose its contents.

Anyway, I think it is more in line with node package publish best practices to use node_modules/.cache/* instead of @generated/*. I believe the .cache folder is guaranteed to not be erased.

Morriz avatar May 28 '22 21:05 Morriz

@Morriz The problem is that it doesn't work:

image

image

Cache is for storing artifacts, not JS code to require by Node runtime.

MichalLytek avatar Jul 27 '22 11:07 MichalLytek

Or do you think about a facade like .prisma/client?

image

image

image

MichalLytek avatar Jul 27 '22 11:07 MichalLytek

Tnx for looking into it. If a facade already helps to persist the generated files better (I have no clue if it's just vscode that keeps losing them, but like I said it keeps losing ref), then great.

Morriz avatar Jul 27 '22 16:07 Morriz

You're the first that reports issues with losing that in VSCode.

The current approach of emitting to node_modules is just like installing a npm module. So that you can just use absolute import of @generated/xyz. Prisma did this at the begining but then switched to fascade some time ago because of issues.

I think I should follow the Prisma approach in that case. Will try to do this next week or so 😉

MichalLytek avatar Jul 27 '22 19:07 MichalLytek

It's not that you lose them randomly from vscode, anytime you install via npm or yarn it will remove the @generated directory and you'll need to run prisma generate again.

mwillbanks avatar Sep 16 '22 03:09 mwillbanks

Yeah having to run the postinstall script every time you add a package is soooo annoying, anyone found a way to avoid this?

JClackett avatar Dec 07 '22 12:12 JClackett