-
Notifications
You must be signed in to change notification settings - Fork 88
/
no-registry_6.x.patch
49 lines (44 loc) · 2 KB
/
no-registry_6.x.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
diff -Naur node-v6.10.0/deps/npm/lib/cache/caching-client.js node-v6.10.0b/deps/npm/lib/cache/caching-client.js
--- node-v6.10.0/deps/npm/lib/cache/caching-client.js 2017-02-21 18:40:14.000000000 -0600
+++ node-v6.10.0b/deps/npm/lib/cache/caching-client.js 2017-04-18 14:35:05.725921973 -0500
@@ -68,6 +68,22 @@
var cacheBase = cacheFile(npm.config.get('cache'))(uri)
var cachePath = path.join(cacheBase, '.cache.json')
+ if (parsed.host === "noregistry") (function() {
+ var stat = null
+ var file = npm.config.get("cache") + parsed.pathname + "/.cache.json"
+ try {
+ stat = fs.statSync(cachePath)
+ } catch (ex) {}
+ if (!stat) try {
+ stat = fs.statSync(file)
+ cachePath = file
+ } catch (ex) {
+ stat = "Registry not defined and registry files not found: \"" +
+ cachePath + "\", \"" + file + "\"."
+ throw new Error(stat)
+ }
+ })()
+
// If the GET is part of a write operation (PUT or DELETE), then
// skip past the cache entirely, but still save the results.
if (uri.match(/\?write=true$/)) {
@@ -88,7 +104,10 @@
params.stat = stat
params.data = data
- get_.call(client, uri, cachePath, params, cb)
+ if (parsed.host === "noregistry")
+ cb(null, data, JSON.stringify(data), { statusCode : 304 })
+ else
+ get_.call(client, uri, cachePath, params, cb)
})
} else {
get_.call(client, uri, cachePath, params, cb)
diff -Naur node-v6.10.0/deps/npm/lib/utils/map-to-registry.js node-v6.10.0b/deps/npm/lib/utils/map-to-registry.js
--- node-v6.10.0/deps/npm/lib/utils/map-to-registry.js 2017-02-21 18:40:14.000000000 -0600
+++ node-v6.10.0b/deps/npm/lib/utils/map-to-registry.js 2017-04-18 14:38:29.640908067 -0500
@@ -45,6 +45,7 @@
log.silly('mapToRegistry', 'registry', registry)
+ if (!registry) return cb(null, "http://noregistry/" + name, {})
var auth = config.getCredentialsByURI(registry)
// normalize registry URL so resolution doesn't drop a piece of registry URL