eanplatter / forked

:fork_and_knife: forks, forks everywhere.
MIT License
50 stars 4 forks source link

Fork named dependency #4

Closed agarzola closed 8 years ago

agarzola commented 8 years ago

Thinking it’d be nice to do something like fork name-of-dep from a project’s root. Then, instead of using ./package.json it would look for ./node_modules/name-of-dep/package.json and use that to create a fork. Do you see value in this? If so, I’d love to take a crack at it later this week.

eanplatter commented 8 years ago

Sounds legit. I'd be down for a PR like that. If we can maintain the current API with that functionality it would be cool.

A lot of times you end up wanting to fork a repo because you had to dig into it and edit something or debug something, so it is a common use case to be inside the node module when you go to fork it, but adding the ability to check a local node modules directory would be valuable as well.

Make a PR!

agarzola commented 8 years ago

I hear ya. I’ve been thinking about running a series of checks first. If there is an argument moduleName, try the following:

  1. See if cwd is named moduleName; if so, try the fork workflow there; if not…
  2. See if cwd is named node_modules and contains a child directory named moduleName; if so, try the fork there; if not…
  3. See if cwd has a child directory named node_modules containing a child directory named moduleName; if so, try the fork there; if not, throw an error.

Does that make sense?

eanplatter commented 8 years ago

Yeah man, like a recursive check. Try it out! It's always easier to iterate over some code. I'm interested to see what it looks like.

eanplatter commented 8 years ago

Fixed by #5