You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Step to run install of dependencies does not run if the destinationRoot is set to a different directory to the directory the yo command is run from
#319
Closed
jgoblwr opened this issue
Jul 27, 2021
· 2 comments
This feels like a bug or maybe there is a way to set it up so it runs as expected?
I have an example repo to reproduce this issue. https://github.com/jgoblwr/generator-federation-subgraph . A common case would be to create a project directory for the user if it does not already exist. The generator does this here https://github.com/jgoblwr/generator-federation-subgraph/blob/main/generators/app/index.js#L44 and then sets this.destinationRoot to be the newly create folder. This works fine to get the template files copied over. But the step to run the package manager install does not run. It gives the message No change to package.json was detected. No package manager install will be executed. . I tracked this issue down to https://github.com/yeoman/environment/blob/main/lib/package-manager.js#L13 . It looks like it using the cwd to try find the package.json. In the case where the yo command is run from a parent directory to where the package.json is copied then it does not find it. It works fine for the scenario of no new folder being created and the yo command being run from the same directory where the template files get copied into. Is there a way to configure the generator for the new directory scenario so it will run the package manager install step? Many thanks :-)
The text was updated successfully, but these errors were encountered:
jgoblwr
changed the title
Step to run install of dependencies does not run if the destinationRoot is different to the directory yo command is run from
Step to run install of dependencies does not run if the destinationRoot is set to a different directory to the directory the yo command is run from
Jul 27, 2021
I just see now there was the same issue raised a while ago. The comments talk about "change the environment cwd manually" but I am not sure where or how that would be done?
This feels like a bug or maybe there is a way to set it up so it runs as expected?
I have an example repo to reproduce this issue. https://github.com/jgoblwr/generator-federation-subgraph . A common case would be to create a project directory for the user if it does not already exist. The generator does this here https://github.com/jgoblwr/generator-federation-subgraph/blob/main/generators/app/index.js#L44 and then sets
this.destinationRoot
to be the newly create folder. This works fine to get the template files copied over. But the step to run the package manager install does not run. It gives the messageNo change to package.json was detected. No package manager install will be executed.
. I tracked this issue down to https://github.com/yeoman/environment/blob/main/lib/package-manager.js#L13 . It looks like it using the cwd to try find thepackage.json
. In the case where the yo command is run from a parent directory to where thepackage.json
is copied then it does not find it. It works fine for the scenario of no new folder being created and the yo command being run from the same directory where the template files get copied into. Is there a way to configure the generator for the new directory scenario so it will run the package manager install step? Many thanks :-)The text was updated successfully, but these errors were encountered: