com.jimuwd.xian.registry-proxy 1.0.30 → 1.0.31
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/index.js +15 -10
- package/package.json +1 -1
- package/src/index.ts +15 -10
package/dist/index.js
CHANGED
|
@@ -111,21 +111,26 @@ async function loadProxyInfo(proxyConfigPath = './.registry-proxy.yml', localYar
|
|
|
111
111
|
readYarnConfig(globalYarnConfigPath)
|
|
112
112
|
]);
|
|
113
113
|
const registryMap = new Map();
|
|
114
|
-
for (const [
|
|
115
|
-
const
|
|
116
|
-
let token =
|
|
114
|
+
for (const [proxiedRegUrl, proxyRegConfig] of Object.entries(proxyConfig.registries)) {
|
|
115
|
+
const normalizedProxiedRegUrl = normalizeUrl(proxiedRegUrl);
|
|
116
|
+
let token = proxyRegConfig?.npmAuthToken;
|
|
117
117
|
if (!token) {
|
|
118
118
|
const yarnConfigs = [localYarnConfig, globalYarnConfig];
|
|
119
|
-
for (const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
119
|
+
for (const yarnConfig of yarnConfigs) {
|
|
120
|
+
if (yarnConfig.npmRegistries) {
|
|
121
|
+
const foundEntry = Object.entries(yarnConfig.npmRegistries)
|
|
122
|
+
.find(([registryUrl]) => normalizedProxiedRegUrl === normalizeUrl(registryUrl));
|
|
123
|
+
if (foundEntry) {
|
|
124
|
+
const [, registryConfig] = foundEntry;
|
|
125
|
+
if (registryConfig?.npmAuthToken) {
|
|
126
|
+
token = registryConfig.npmAuthToken;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
125
130
|
}
|
|
126
131
|
}
|
|
127
132
|
}
|
|
128
|
-
registryMap.set(
|
|
133
|
+
registryMap.set(normalizedProxiedRegUrl, { url: normalizedProxiedRegUrl, token });
|
|
129
134
|
}
|
|
130
135
|
const registries = Array.from(registryMap.values());
|
|
131
136
|
const https = proxyConfig.https;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -158,21 +158,26 @@ async function loadProxyInfo(
|
|
|
158
158
|
readYarnConfig(globalYarnConfigPath)
|
|
159
159
|
]);
|
|
160
160
|
const registryMap = new Map<string, RegistryInfo>();
|
|
161
|
-
for (const [
|
|
162
|
-
const
|
|
163
|
-
let token =
|
|
161
|
+
for (const [proxiedRegUrl, proxyRegConfig] of Object.entries(proxyConfig.registries)) {
|
|
162
|
+
const normalizedProxiedRegUrl = normalizeUrl(proxiedRegUrl);
|
|
163
|
+
let token = proxyRegConfig?.npmAuthToken;
|
|
164
164
|
if (!token) {
|
|
165
165
|
const yarnConfigs = [localYarnConfig, globalYarnConfig];
|
|
166
|
-
for (const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
166
|
+
for (const yarnConfig of yarnConfigs) {
|
|
167
|
+
if (yarnConfig.npmRegistries) {
|
|
168
|
+
const foundEntry = Object.entries(yarnConfig.npmRegistries)
|
|
169
|
+
.find(([registryUrl]) => normalizedProxiedRegUrl === normalizeUrl(registryUrl))
|
|
170
|
+
if (foundEntry) {
|
|
171
|
+
const [, registryConfig] = foundEntry;
|
|
172
|
+
if (registryConfig?.npmAuthToken) {
|
|
173
|
+
token = registryConfig.npmAuthToken;
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
172
177
|
}
|
|
173
178
|
}
|
|
174
179
|
}
|
|
175
|
-
registryMap.set(
|
|
180
|
+
registryMap.set(normalizedProxiedRegUrl, {url: normalizedProxiedRegUrl, token});
|
|
176
181
|
}
|
|
177
182
|
const registries = Array.from(registryMap.values());
|
|
178
183
|
const https = proxyConfig.https;
|