duojs / gh-resolve Goto Github PK
View Code? Open in Web Editor NEWversion / branch name to git (gh) ref.
version / branch name to git (gh) ref.
I've been profiling duo to find ways to speed up builds.
It turns out that spawning child processes is very expensive, especially as the complexity of an app grows. Here's a gist that has the results of running duo under various conditions. (when building from scratch, there's always a disproportionate amount of time spent spawning processes)
I understand why we're using git ls-remote
here, it's so we can reduce the number of API calls as much as possible. I would like to experiment with hitting GitHub's API directly, to see if it makes a noticeable impact on performance. (we can probably just set up a branch here on this repo at first) Perhaps the trade-off of more API calls will be worthwhile if we can make duo much faster.
for things like... "yields/uniq": "*"
;-)
was looking into duojs/duo#131 and decided we'll need to start this here.
support could be added with something as simple (but kinda ugly) as:
function resolve(slug, opts, fn){
var token = opts.token || (
opts.password && opts.username
? [opts.username, opts.password].join(':')
: ''
);
var repo = slug.split('@')[0];
var ref = slug.split('@')[1];
var url = remote(repo, token);
var cmd = fmt('git ls-remote --tags --heads %s', url);
// ...
}
so we'd get:
resolve('foo/bar@baz', { token: 'mytoken' }, function () {});
// git ls-remote --tags --heads https://[email protected]/foo/bar
resolve('foo/bar@baz', { username: 'myusername', password: 'mypassword' }, function () {});
// git ls-remote --tags --heads https://mypassword:[email protected]/foo/bar
resolve('foo/bar@baz', {}, function () {})
// git ls-remote --tags --heads https://github.com/foo/bar
twbs/bootstrap takes nearly 2 minutes.
yield resolve("segmentio/analytics.js@*", user, token)
{ ref: 'refs/heads/veroupdate',
url: 'https://api.github.com/repos/segmentio/analytics.js/git/refs/heads/veroupdate',
object:
{ sha: '4be91c78d1d473ea5faabba36d6e8fd8ca63bef6',
type: 'commit',
url: 'https://api.github.com/repos/segmentio/analytics.js/git/commits/4be91c78d1d473ea5faabba36d6e8fd8ca63bef6' }
Not sure if there's anything we can do about this. But it's worth an investigation.
P.S. my internet is extremely shitty, so times may vary
By using the GH API for resolving the tags/branch, I lost the ability to reference a raw commit SHA.
Is this a feature we still want to have in here? Seems like it is weird, but we should probably fix that for backwards-compatibility reasons.
Any thoughts @duojs/owners ?
Doesn't give any information about which repo is not found.
Now that repository redirects have landed in the github api, we can remove the custom Accept
header.
gh-resolve uses https://<token>@github.com/
form of url to list tags on github.
$ git ls-remote --tags --heads https://<token>@github.com/component/type
This works fine on git 1.8, but git 1.7 prompts for password and freezes. This prevents me to use duojs on heroku which is still on git 1.7.
Maybe using https://<token>:@github.com/
would be a solution.
Kind of confusing going back a few branches, unless you have additional plans for the git+ssh stuff.
dependency analytics.js resolves to veroupdate
branch sometimes :/
should *
always resolve to master ?
this means that the repo is private / doesn't exist.
Please? :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.