Skip to content

Commit

Permalink
feat: 支持 npm 私有仓库配置为 http 形式
Browse files Browse the repository at this point in the history
  • Loading branch information
renxia committed Dec 10, 2024
1 parent e52750e commit 44bfd83
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modules/utils/npm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import url from 'url';
import https from 'https';
import http from 'http';
import gunzip from 'gunzip-maybe';
import { LRUCache } from 'lru-cache';

Expand Down Expand Up @@ -37,7 +38,12 @@ const notFound = '';

function get(options) {
return new Promise((accept, reject) => {
https.get(options, accept).on('error', reject);
if (npmRegistryURL.startsWith('http://')) {
delete options.agent;
http.get(options, accept).on('error', reject);
} else {
https.get(options, accept).on('error', reject);
}
});
}

Expand Down

0 comments on commit 44bfd83

Please sign in to comment.