refactor(cli): remove pkg in favour of automatically downloading Node#454
Conversation
TODO: - [ ] Actually resolve the current platform name - [ ] Write node tests - [ ] Improve query engine utils interface - [ ] Fix windows
Codecov ReportBase: 86.52% // Head: 85.99% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #454 +/- ##
==========================================
- Coverage 86.52% 85.99% -0.53%
==========================================
Files 128 124 -4
Lines 6240 6363 +123
Branches 1027 1180 +153
==========================================
+ Hits 5399 5472 +73
- Misses 796 827 +31
- Partials 45 64 +19
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
|
Seems like a good idea. The biggest advantage I think is to save the development of the CLI part. I had this in mind when developing Prisma ORM for Dart. However, adding the Node environment in the current development environment seems to be redundant and disgusting. |
|
😊Wait for you to add this function experimentally first, if the user feedback is not disgusting to download the Node environment, I think Prisma client development in other languages can be used for reference. |
@medz Are you referring to the fact that Node will be installed into the user's environment? If so, that is not the case, Node will be downloaded to a temporary / cache directory that is not included in the user's Wow! I'm excited to hear that Prisma has been ported to yet another language! Well done and I hope it goes well :) Let me know if you run into any issues with your integration, I'm more than happy to help! |
Change Summary
This PR completely refactors how the Prisma CLI is downloaded / installed / called. We now download Node itself at runtime and use that to install the Prisma CLI and then run it directly with Node as well.
This has some significant advantages:
However, this does not come without some concerns:
nodeextra, e.g.pip install prisma[node]. This brings the total download size to be very similar to the packaged CLI.How does it work?
We now resolve a Node binary using this flow:
~/.cache/prisma-nodeenvThe first two steps in this flow can be skipped if you so desire through your
pyproject.tomlfile or using environment variables. For example:Or using the environment variables,
PRISMA_USE_GLOBAL_NODE,PRISMA_USE_NODEJS_BINandPRISMA_NODEENV_CACHE_DIRrespectively.The Prisma CLI is then installed directly from npm and ran directly using the resolved Node binary.
closes #22
closes #236
closes #370
closes #413
closes #461
closes #621
Checklist
TODO:
_node.pyprisma_versionnot reading from environment variablesbinaryTargetswarning.Agreement
By submitting this pull request, I confirm that you can use, modify, copy and redistribute this contribution, under the terms of your choice.