Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mix "linked" and regular dependencies #4

Open
phtrivier opened this issue Jul 22, 2014 · 0 comments
Open

Mix "linked" and regular dependencies #4

phtrivier opened this issue Jul 22, 2014 · 0 comments

Comments

@phtrivier
Copy link

I have a multi-project setup (not unlike the one described in README.md.)

root
    Gruntfile.js (with the configuration of grunt-link)
    project1
       package.json
    project2
       package.json
    main
       package.json (depends on project1 and project2)

I want the "best of both worlds"

  • being able to work with local versions of my projects while i'm developing a feature (publishing them everytime I change a line is not an option)
  • at some point, publish specific versions of project1 (in my case, because unrelated modules will
    also need to depend on it.)

How would I approach that ? Here is what I've tried.

Install published dependencies

  • publish project1 on a private repository (version 0.0.1)
  • locally, project1 is at version 0.0.1
  • locally, main depends on version 0.0.1 of project1 and has a linkDependencies to 'project1'

After 'cd main ; npm install' :

  • main/node_modules/project1 contains the content of the published version
  • the "local" version of "project1" is completely ignored.

Link locally to the current local version

  • publish project1 on a private repository (version 0.0.1)
  • locally, project1 is at version 0.0.1
  • locally, main depends on version 0.0.1 of project1 and has a linkDependencies to 'project1'

After grunt link :

  • main/node_modules/project1 contains the content of the "published" version
  • main/node_modules/project1/project1 is a symlink to the installed version in lib/modules
    (I'm not sure whyà

main is then using the "published" version ; the 'local' version is ignored.
This is probably what makes the most sense.

Depending on "^0.0.1" (anything later than... )

Now, suppose I want to modify something in project1, but I don't wan't to
have to publish it all the times.

I could remove the "regular" dependency in main/package.json, and use grunt link ;
it is a bit cumbersome, and I'm probably going to commit a version of main/package.json
that can not be installed anywhere.

On good faith, I tried specifying "^0.0.1" as a version (basically, it's what I want,
except that my local folder should serve as "some kind of a repository").

  • publish project1 on a private repository (version 0.0.1)
  • locally, project1 is at version 0.0.2
  • locally, main depends on version ^0.0.1 of project1 and has a linkDependencies to 'project1'

After grunt link, my 'local' version of project1 is still ignored.

Would it make sense to patch grunt-link in my case to support this ?

Depending on a local "0.0.2"

I tried bumping the version of my "local" package ; so now :

  • project1/package.json has version 0.0.2
  • main/package.json has standard dependency on 0.0.2, and linkDependencies to 'project1'

Here, grunt link fails because 0.0.2 is not available.

So, is there a way to support my use case ?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant