generate / generate-install

Generator that automatically detects the dependencies or devDependencies to install based on the templates or includes used. This can be used as a sub-generator or plugin in your own generator.
MIT License
7 stars 0 forks source link

Use `app.cwd`. #2

Closed doowb closed 7 years ago

doowb commented 7 years ago

When validating that a package.json exists, use app.cwd in case the user has used generate-dest to change the cwd.

When checking for existing dependencies, use the destination package.json.

See #1 for more details.

I'll try to get some fixes up for this soon.

jonschlinkert commented 7 years ago

@doowb is this fixed with the changes you made in base-npm?

doowb commented 7 years ago

I was thinking about this some more and I don't think there's an issue. I think that it works as intended.

The use case that @tunnckoCore brings up is when generating a new project in a child directory from the current project directory.

If the generator that is creating the list of dependencies to install is used in another project and creating something like a mocha test file, the file might be in a child directory, but we want the modules to be installed into the project's package.json. NPM will do this by default when setting the cwd to the child directory. It will look up the directories until it finds the package.json.

One thing that we might consider is checking to see if there is a package.json in the cwd and using that to check for which dependencies should be skipped. But I don't think we should throw an error if the package.json doesn't exist in the cwd because of the use case mentioned above.

jonschlinkert commented 7 years ago

k closing