-
Notifications
You must be signed in to change notification settings - Fork 26
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
Proposed v 1.15 - Update dependencies, remove @prisma/internals, fix node 14 support #11
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing! Regarding @prisma/internals
dependency, see comment below.
@@ -68,7 +68,7 @@ function extractAnnotation( | |||
*/ | |||
function encapsulateString(value: string): string { | |||
return /^$|^(?!true$|false$)[^0-9\[]/.test(value) | |||
? `'${value.replaceAll(/'/g, "\\'")}'` | |||
? `'${value.replace(/'/g, "\\'")}'` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why I used replaceAll
, since the regular expression is already global.
@@ -2,15 +2,14 @@ import fs from 'node:fs/promises'; | |||
import path from 'node:path'; | |||
import makeDir from 'make-dir'; | |||
import { generatorHandler } from '@prisma/generator-helper'; | |||
import { parseEnvValue, logger } from '@prisma/internals'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why there is the need to get rid of @prisma/internals
? It is installed anyway along with @prisma/client
. Hence, parseEnvValue
doesn't need to be implemented twice. And the prisma logger has the nice side effect that it prefixes the output with cyan-colored "prisma:info".
Can you elaborate more on the reasons why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure - I had both felt nervous about the local usage of it because it was leading to Prisma to issue a warning saying that it wasn't intended for external use and because I was having issues where it would deadlock my imports because of the CJS -> ESM -> CJS back and forth apparently causing problems for webpack's compiled imports.
That was, though, with the root package we're both forked off of (I wrote this PR for that package but then found your fork and decided to contribute here instead).
I do think parseEnvValue
is easy enough to clone out and use directly. I can see if this fork has the same CJS/ESM conflict that the origin package had, if that's not causing runtime issues anymore for me I'm happy to switch back to it.
Thanks @Brakebein - sorry I fell off on the follow-ups. I was doing this for a migration at work and it has been more difficult than we'd hoped (as they always are). Let me know if I can help out here, though. Happy for this package to thrive especially since we'll be using it in production as of this week... |
This is 3 main changes:
npm audit fix
for the minimatch CVE@prisma/internals
by moving to vanilla console.log for logging (which is what Prisma's logger was doing anyways) and by bringing the parseEnv function into the codebase locally.replaceAll
that was breaking compatibility with Node 14 per StringreplaceAll
function not present until Node 15/16 #10 .