Closed italojs closed 2 years ago
The performance problem occurs because the new
command runs npm install
or yarn add
everytime it's called.
But, for this cli purposes, how important is installing the dependencies when the user creates the application? Can't we let this task for him? We could put a simple instruction in the documentation.
If it's very important to install the dependencies automatically, can't we just mock the install packages
step when running our tests?
Since yarn and npm are external dependencies and we trust they are already tested, we could just verify if they were called when necessary.
we need to install the libs because when I'm generating the files I need to 'require' the entities and usecases... because this I need to install the libs(like @herbsjs/herbs')
Buuuuuuuuuuuuuutttt I got an idea with your question, I think we could to install all dependencies inside the CLI, SOOOOOOOOO instead apply the "npm install XXX", we could to ask the CLI to use yourself node_modules https://stackoverflow.com/a/26293141
Today we have a problem to write unit tests into CLI, for most part of CLI functions I need to import something about generated project to collect the metadata, because this I need to install the node_modules every time I will test something, it make the test to take sooooooo much time to run.
My first suggestion is:
Install node_modules once and reuse it for all unit tests pros:
Cons: