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

Update dependency version #15

Open
mtiller opened this issue Oct 31, 2019 · 4 comments
Open

Update dependency version #15

mtiller opened this issue Oct 31, 2019 · 4 comments

Comments

@mtiller
Copy link

mtiller commented Oct 31, 2019

Perhaps I'm going about this the wrong way, but when I depend on a sibling package, I have it listed in both dependencies and relativeDependencies. Now relativeDependencies just has the relative path to the sibling package. But dependencies lists the actual version number of that package. But the problem is that this isn't kept in sync.

Let me try and explain with an example. Let's assume package package-a exists in one directory and another package, package-b, exists next to it. In package-b/package.json, we have:

  "dependencies": {
    ...
    "package-a": "^1.0.0"
  },
  "relativeDependencies": {
    "package-a": "../package-a"
  }

But let's assume that package-a/package.json contains:

{
  "name": "package-a",
  "version": "1.1.0",
  ...
}

When I run relative-deps in package-b, it correctly rebuilds it and installs it in node_modules/package-a, but it doesn't look at package-a/package.json and read the version number out and then replace it in package-b/package.json so that it reads:

  "dependencies": {
    "package-a": "^1.1.0"
  }
  ...

This is a big problem for me because I might have many such libraries that depend on package-a that are all siblings (e.g.,, package-c, package-d) and they can end up all listing a different version of the dependency which can, in turn, cause problems later.

I'm curious...is there some way to get around this that makes such a feature here moot?

@mweststrate
Copy link
Owner

mweststrate commented Oct 31, 2019 via email

@mtiller
Copy link
Author

mtiller commented Nov 1, 2019

The "one behind" (or many behind) issue I see is with using oao (for example). It wants to bump all the versions itself at the time of publication. So if I want to update intra-monorepo dependencies, I have to know what version I'm going to release for each package (even though they haven't been actually updated in the package.json/version info prior to running oao publish. It is bit frustrating. I'm not sure relative-deps solves that problem, but it might very well allow me to avoid using oao altogether (not sure).

It seems like this would really need to be integrated into the publication process in some way. What I can currently do (with oao) is to do an oao reset-all-versions so all packages are updated to a given version, then I could run relative-deps --auto-update-dependency-version so that all dependencies were updated to use the latest versions set by reset-all-versions and then run oao publish --no-bump which would publish everything at their current version and not have it automatically ratchet up versions. But I still feel like I'm doing something wrong somewhere to have to do all this.

@mweststrate
Copy link
Owner

mweststrate commented Nov 2, 2019 via email

@zhangwilling
Copy link

Yes, we can detect package.json dependencies changes.

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

3 participants