Skip to content
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

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

Comments

@jgoblwr
Copy link

jgoblwr commented Jul 27, 2021

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 :-)

@jgoblwr 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
@jgoblwr
Copy link
Author

jgoblwr commented 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?

@jgoblwr
Copy link
Author

jgoblwr commented Jul 27, 2021

i found a workaround here #309 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant