yeoman / yo

CLI tool for running Yeoman generators
http://yeoman.io
BSD 2-Clause "Simplified" License
3.85k stars 399 forks source link

Ignore yo-rc for subgenerator #457

Closed ghost closed 8 years ago

ghost commented 8 years ago

I can't ignore yo-rc root folder when I am running a subgenerator that should create files in the cwd.

I have a generator that uses a yo-rc file for a couple of subgenerators, but now I am trying to make a new subgenerator that must create the files in the CWD.

I tried to use process.cwd() but it's overwritten by yo-rc's path.

Is it possible to make a subgenerator blocks process.cwd from being overwritten?

SBoudrias commented 8 years ago

Why do you need the CWD? Can you prefix your paths with the relevant directory structure?

ghost commented 8 years ago

I need the files to be generated in CWD.

My project structure is as follows:

app
      routes
            route1
                   route1.html
                   route1.js
            route2
                   route2.a
                          route2.a.html
                          route2.a.js

I created a subgenerator that creates the html and js files, which contains a lot of boilerplate code.

The problem is that sometimes I want a new html/js in route2.a, some other times I want the html and js in route1, and so on.

I could ask the user "Which route do you want to create the files in?" but I dont think that is a good approach.

SBoudrias commented 8 years ago

@ingow mind re-opening this issue in yeoman-generator? This issue is related to the core generator system, not yo. (and I'd prefer we don't lose track of that issue).

ghost commented 8 years ago

Ok @SBoudrias !

Sorry for opening it in the wrong project.