made-market 0.4.1 → 0.4.2
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/bin/made-market.mjs +8 -3
- package/package.json +1 -1
package/bin/made-market.mjs
CHANGED
|
@@ -315,13 +315,18 @@ async function main() {
|
|
|
315
315
|
// (自建源/精确复现用)。
|
|
316
316
|
if (!options.registry && !process.env.MADE_MARKET_REGISTRY) {
|
|
317
317
|
const server = options.server || process.env.MADE_MARKET_SERVER || DEFAULT_SERVER;
|
|
318
|
+
// 只把「解析包信息」的失败当成线上市场不可用;install 的业务错误
|
|
319
|
+
// (已存在、校验不匹配等)必须原样抛出,不能混进离线回落误导用户。
|
|
320
|
+
let resolved = null;
|
|
318
321
|
try {
|
|
319
|
-
|
|
320
|
-
await install(options.args, { home: options.home, registry: base, index: { packages }, force: options.force, dryRun: options.dryRun });
|
|
321
|
-
return;
|
|
322
|
+
resolved = await resolveViaApi(options.args, server);
|
|
322
323
|
} catch (error) {
|
|
323
324
|
console.error(`线上市场不可用(${error.message}),改用包内自带索引(仅示例包,离线兜底)。`);
|
|
324
325
|
}
|
|
326
|
+
if (resolved) {
|
|
327
|
+
await install(options.args, { home: options.home, registry: resolved.base, index: { packages: resolved.packages }, force: options.force, dryRun: options.dryRun });
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
325
330
|
}
|
|
326
331
|
// 归档从索引所在的位置取:远端索引配远端归档,自带索引配包内归档,可离线。
|
|
327
332
|
const { source, index } = await loadIndex();
|