yo icon indicating copy to clipboard operation
yo copied to clipboard

contextRoot should support npm script wrapper

Open stevenvachon opened this issue 7 years ago • 4 comments

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.

stevenvachon avatar Nov 01 '18 21:11 stevenvachon

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.

SBoudrias avatar Nov 04 '18 05:11 SBoudrias

I patched it in my team's generator. I may not have time to patch the yeoman source code.

stevenvachon avatar Nov 05 '18 01:11 stevenvachon

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.

jaridmargolin avatar Dec 04 '18 16:12 jaridmargolin

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 ?

levino avatar Sep 22 '20 14:09 levino