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

semver ranges and "gitpkg:^1.0.0" dep definition sugar #6

Open
ramasilveyra opened this issue Jun 29, 2017 · 1 comment
Open

semver ranges and "gitpkg:^1.0.0" dep definition sugar #6

ramasilveyra opened this issue Jun 29, 2017 · 1 comment

Comments

@ramasilveyra
Copy link
Owner

ramasilveyra commented Jun 29, 2017

idea/discussion: just thinking aloud, comment whatever you think that could be wrong or could be improved.

Long git tags are awful:

{
  "dependencies": {
    "some-package": "github:ramasilveyra/private-registry#some-package-v1.0.0-gitpkg"
  }
}

maybe instead we could use the gitpkg: shortcut that infers the gitpkg registry from the field gitpkg.registry:

{
  "dependencies": {
    "some-package": "gitpkg:^1.0.0"
  },
  "gitpkg": {
    "registry": "[email protected]:ramasilveyra/private-registry.git"
  }
}

even we could have multiples gitpkg registries:

{
  "dependencies": {
    "some-package": "gitpkg:private:^1.0.0",
    "other-package": "gitpkg:public:^1.0.0"
  },
  "gitpkg": {
    "registries": {
      "private": "[email protected]:ramasilveyra/private-registry.git",
      "public": "[email protected]:ramasilveyra/public-registry.git"
    }
  }
}

For semver ranges if we can make the git tag name to be the same of the package even for scoped packages (see #4) the work on the npm client will be:

  1. List git tags using ls-remote.
  2. Select the correct version.
  3. Fetch.
@ramasilveyra
Copy link
Owner Author

We can use the npm scripts preinstall and postinstall to transform the custom gitpkg semver syntax to git deps syntax. Eg: gitpkg:private:^1.0.0 => [email protected]:ramasilveyra/private-registry.git#some-package-v1.5.0-gitpkg

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

1 participant