contextRoot should support npm script wrapper
Type of issue
Feature request or bug, not sure.
My environment
- OS version/details: macOS
10.14 - Node version:
10.11.0 - npm version:
6.4.1 - Version of yo :
2.0.5
Expected behavior
this.contextRoot contains the path to where the yo CLI was executed from. When yo is wrapped in an npm script (such as npm run generate), this.contextRoot should be the value of process.env.CWD_INIT.
Current behavior
When yo is wrapped in an npm script, this.contextRoot contains the path to the project root.
Looks like something we could fix. But I'm not 100% sure what would be the side effects.
Do you want to send a PR? This would help move the conversation forward.
I patched it in my team's generator. I may not have time to patch the yeoman source code.
I am facing the same "issue". I've hacked around it by altering my npm run script to change directories prior to calling yo, but it would be great if yo was just smart enough to do this on its own.
This is still an issue for me. Trying to use yeoman in a monorepo and everything is always copied to the root, never the current folder. How did you solve this @stevenvachon ?