com.jimuwd.xian.registry-proxy 1.1.18 → 1.1.20-beta01
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/yarn-install.js +2 -2
- package/dist/server/index.js +11 -13
- package/package.json +1 -1
|
@@ -128,8 +128,8 @@ async function main() {
|
|
|
128
128
|
console.log(`Set npmRegistryServer to http://127.0.0.1:${PROXY_PORT}`);
|
|
129
129
|
registerCleanup(async () => {
|
|
130
130
|
try {
|
|
131
|
-
await execa('yarn', ['config', 'unset', 'npmRegistryServer']);
|
|
132
|
-
console.log('Cleared npmRegistryServer configuration');
|
|
131
|
+
await execa('yarn', ['config', 'unset', 'npmRegistryServer']); //fixme:这里使用unset,有个缺点就是如果工程中.yarnrc.yml原本配置的只读registryServer没有恢复而是被清空了!国内的网络再执行任何拉取操作或yarn dlx命令容易超时!
|
|
132
|
+
console.log('Cleared npmRegistryServer configuration:这里清空npmRegistryServer而不是恢复,有个缺点就是如果工程中.yarnrc.yml原本配置的只读registryServer没有恢复而是被清空了!国内的网络再执行任何拉取操作或yarn dlx命令容易超时!');
|
|
133
133
|
}
|
|
134
134
|
catch {
|
|
135
135
|
}
|
package/dist/server/index.js
CHANGED
|
@@ -199,21 +199,19 @@ async function _fetchFromRegistry(registry, targetUrl, reqFromDownstreamClient)
|
|
|
199
199
|
}
|
|
200
200
|
catch (e) {
|
|
201
201
|
// Fetch form one of the configured upstream registries failed, this is expected behavior, not error.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
// Other net error code, print log with stacktrace
|
|
212
|
-
logger.warn(`Failed to fetch from ${targetUrl}, ${e.message}`, e);
|
|
213
|
-
}
|
|
202
|
+
const errCode = e?.code;
|
|
203
|
+
if (errCode === 'ECONNREFUSED') {
|
|
204
|
+
logger.info(`Upstream ${targetUrl} refused connection [ECONNREFUSED], skip fetching from registry ${registry.normalizedRegistryUrl}`);
|
|
205
|
+
}
|
|
206
|
+
else if (errCode === 'ENOTFOUND') {
|
|
207
|
+
logger.info(`Unknown hostname in upstream url ${targetUrl} [ENOTFOUND], skip fetching from registry ${registry.normalizedRegistryUrl}.`);
|
|
208
|
+
}
|
|
209
|
+
else if (errCode === 'EAI_AGAIN') {
|
|
210
|
+
logger.info(`Could not resolve hostname in upstream url ${targetUrl} [EAI_AGAIN], skip fetching from registry ${registry.normalizedRegistryUrl}.`);
|
|
214
211
|
}
|
|
215
212
|
else {
|
|
216
|
-
|
|
213
|
+
// Other net error code, print log with stacktrace
|
|
214
|
+
logger.warn(`Failed to fetch from ${targetUrl}`, e);
|
|
217
215
|
}
|
|
218
216
|
// Return null means skipping current upstream registry.
|
|
219
217
|
return null;
|