Code Monkey home page Code Monkey logo

git-resolver's Introduction

this package was moved to https://github.com/pnpm/pnpm

@pnpm/git-resolver

Resolver for git-hosted packages

npm version Build Status

Install

Install it via npm.

npm install @pnpm/git-resolver

Usage

'use strict'
const createResolveFromNpm = require('@pnpm/git-resolver').default

const resolveFromNpm = createResolveFromNpm({})

resolveFromNpm({
  pref: 'kevva/is-negative#16fd36fe96106175d02d066171c44e2ff83bc055'
})
.then(resolveResult => console.log(JSON.stringify(resolveResult, null, 2)))
//> {
//    "id": "github.com/kevva/is-negative/16fd36fe96106175d02d066171c44e2ff83bc055",
//    "normalizedPref": "github:kevva/is-negative#16fd36fe96106175d02d066171c44e2ff83bc055",
//    "resolution": {
//      "tarball": "https://codeload.github.com/kevva/is-negative/tar.gz/16fd36fe96106175d02d066171c44e2ff83bc055"
//    },
//    "resolvedVia": "git-repository"
//  }

License

MIT © Zoltan Kochan

git-resolver's People

Contributors

3cp avatar andreineculau avatar greenkeeper[bot] avatar renovate-bot avatar zkochan avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

git-resolver's Issues

shortcut to other providers (bitbucket/gitlab/...) doesn't work

Currently shortcut only works for github hosted repo, like username/repo or github:username/repo.

Current implementation assumes we only use shortcut for github repos. When I try anything like

pnpm install bitbucket:buttonwoodcx/bcx-ui#v1.14.20

It got error in pnpm-debug.log:

ERROR  Command failed: git ls-remote --refs 
fatal: 'null' does not appear to be a git repository
fatal: Could not read from remote repository.

Note, current pnpm manifests the error in terminal as

err.code.startsWith is not a function

Which is another issue. When this fails, somehow err.code is a number, not string. Need some fix in pnpm/packages/default-reporter/src/reportError.ts.


I am trying to add support of shortcut to other providers, kind of works in local test code. But I have trouble to setup my dev environment to force my local global installed pnpm to use my local git-resolver.
pnpm link does not work for git-resolver, I guess it's because the global installed pnpm package maintained its own node_modules, not refering to global installed git-resolver.

I would appreciate if someone gives me some guide on how to setup dev environment for this. Thx.

An in-range update of @types/node is breaking the build 🚨

Version 8.5.5 of @types/node was just published.

Branch Build failing 🚨
Dependency @types/node
Current Version 8.5.4
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

[Proposal] practical partial solution for resolving short hash

Originated from pnpm/pnpm#1127

The correct solution is to clone the repo locally then use git rev-parse (or rev-list) to resolve short hash to full hash. Which is what @zkochan tried but not finished.

Although short hash should be supported, it's a not very common use case. Also full git clone is undoubtedly slow.

Before to having a full solution with git clone, we can have a very cheap solution for github/bitbucket/gitlab repos. This can cover the majority of users' need.

Take github for example (the other two are same), it supports using short hash to view a commit.

https://github.com/pnpm/git-resolver/commit/5a3f

The short hash can be between 4 to 39 chars.

We can issue a HTTP GET request and use new RegExp(`${shortHash}[a-f0-9]{${40 - shortHash.length}}`) to extract full hash from the page.

all three providers have <meta property="og:url" on the page, github/bitbucket reveals full commit hash in the url, but gitlab still use incoming short commit hash in the url.

all three providers display full commit hash in the page. Use regex is the cheapest and reliable way to extract full commit hash.

Known limitation: as this use https:// (not ssh) to view the commit, it will have trouble to view private repo if user doesn't have login credential cached (Keychain access on macOS and Credential Manager on Windows).

An in-range update of got is breaking the build 🚨

Version 8.0.1 of got was just published.

Branch Build failing 🚨
Dependency got
Current Version 8.0.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

got is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes v8.0.1
  • Correctly forwards stream errors. 974473a
  • Fix the request not aborting if the connection cannot be established and the timeout expires. 98d226c

v8.0.0...v8.0.1

Commits

The new version differs by 5 commits.

  • 685c7f3 8.0.1
  • 98d226c Update p-timeout to version 2.0.1 (#431)
  • dce4725 Add readme link to related GitLab got (gl-got) (#425)
  • 974473a Correctly forward stream errors (#424)
  • 9495256 Use @sindresorhus/is for type checking (#422)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Git-resolver cannot resolve the correct tag/commit hash with gitlab repo

Expected Behavior

Resolve the correct tag/commit hash from the gitlab repo.

Current Behavior

Resolve master/latest instead of desired tag/commit hash.

Possible Solution

In parsePerf.js file, urlparse.hash is deleted before being used on line 35.
-Deleted at line 45

My current solution:
Save urlparse.hash to a new variable before deleting it and use it later.

Ex at line 35:
const gitCommittish = setGitCommittish(urlparse.hash != null ? urlparse.hash.slice(1) : '');
return Object.assign({ fetchSpec: urlToFetchSpec(urlparse), normalizedPref: pref }, gitCommittish);

Steps to Reproduce

pnpm install git+http://gitlab.anygitlabrepo/team/anyproject.git#anyVersionTag
OR
pnpm install git+http://gitlab.anygitlabrepo/team/anyproject.git#anyCommitHash

Context (Environment)

I do not know if it's related to my repository being private or only to gitlab/non-github repos. I did not test theses cases.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.