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

Monorepo with git-hosted package. #6027

Open
kjs3 opened this issue Jun 24, 2018 · 3 comments
Open

Monorepo with git-hosted package. #6027

kjs3 opened this issue Jun 24, 2018 · 3 comments
Assignees

Comments

@kjs3
Copy link

kjs3 commented Jun 24, 2018

Do you want to request a feature or report a bug?

Feature (I think). It's possible this is considered a bug.

What is the current behavior?

Private (all?) Github modules that exist as a package in a monorepo are installed locally to the package that depends on them.

monorepo/
  node_modules/
    package-1/ -> symlink
  packages/
    package-1/
      package.json
        {
          version: "1.0.1"
        }
    package-2/
      node_modules/
        package-1/ => THIS IS THE PROBLEM
      package.json
        {
          dependencies: {
            package-1: "git+https://token:x-oauth-basic@github.com/user/package-1.git#v1.0.1"
          }
        }

package-1 is hoisted and installed at the root but is also installed in package-2 where it is listed as a dependency.

What is the expected behavior?

monorepo/
  node_modules/
    package-1/ -> symlink
  packages/
    package-1/ => Published to stand-alone git repo in some way. Not Yarn's problem.
      package.json
        {
          version: "1.0.1"
        }
    package-2/
      node_modules/
        package-1-dir-is-not-here
      package.json
        {
          dependencies: {
            package-1: "git+https://token:x-oauth-basic@github.com/user/package-1.git#v1.0.1"
          }
        }

As long as package-1/package.json.version matches the commit-ish in package-2's dependency url then it should not be installed in package-2's node_modules/

Lerna gained this behavior here but I'd rather Yarn handled my deps.

@ghost ghost assigned imsnif Jun 24, 2018
@ghost ghost added the triaged label Jun 24, 2018
@rally25rs
Copy link
Contributor

This is actually sort of a bug where your git dependency is actually being retrieved from github, not using the workspace package, which is why it can't be hoisted to the top level. This could be fixed by #6012 if it gets merged, but I'm not checking for a commit-ish hash at the end of the URL, I just took the simplistic approach of matching by name only if the "version" is not semver (is a git url instead).

@rally25rs
Copy link
Contributor

tagged as [needs-discussion] because in #6027 @arcanis had some concerns about supporting this behavior.

@kjs3
Copy link
Author

kjs3 commented Jun 28, 2018

@rally25rs I think not checking the commit-ish would be fine. Especially as a first step.

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

No branches or pull requests

3 participants