forked from hughsk/npm-quickfix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 15b5c55
Showing
18 changed files
with
1,471 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# npm-quickfix | ||
|
||
Super quick fix for NPM registry, without having to actually mirror anything. Thanks to @framp for pointing out the workaround. | ||
|
||
``` bash | ||
git clone [email protected]:npm-quickfix.git | ||
cd npm-quickfix | ||
npm set registry http://localhost:8080/ | ||
node index.js | ||
``` | ||
|
||
Now you should be able to `npm install` as normal :) | ||
|
||
To change back to the original registry: | ||
|
||
``` bash | ||
npm set registry https://registry.npmjs.org/ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
var http = require('http') | ||
, url = require('url') | ||
, request = require('request'); | ||
|
||
http.createServer(function(req, res) { | ||
var file = url.parse(req.url).path; | ||
|
||
if (!file.match(/\.tgz$/g)) { | ||
return request.get('https://registry.npmjs.org' + req.url, function(err, response, body) { | ||
var body = JSON.parse(body) | ||
, versions = body.versions | ||
, name = body.name; | ||
|
||
console.log(require('util').inspect(body, null, null, null)); | ||
|
||
if (body.dist && body.dist.tarball) body.dist.tarball = body.dist.tarball | ||
.replace(/http(s)?\:\/\/registry.npmjs.org\/\-\//, | ||
'https://registry.npmjs.org/' + name + '/-/' | ||
); | ||
|
||
if (versions) Object.keys(versions).forEach(function(version) { | ||
versions[version].dist.tarball = versions[version].dist.tarball | ||
.replace(/http(s)?\:\/\/registry.npmjs.org\/\-\//, | ||
'https://registry.npmjs.org/' + name + '/-/' | ||
); | ||
}); | ||
|
||
res.end(JSON.stringify(body)); | ||
}); | ||
} | ||
|
||
request.get('https://registry.npmjs.org' + req.url).pipe(res); | ||
}).listen(8080); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.