Closed doowb closed 7 years ago
@doowb is this fixed with the changes you made in base-npm
?
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.
k closing
When validating that a
package.json
exists, useapp.cwd
in case the user has usedgenerate-dest
to change thecwd
.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.