Skip to content

Commit

Permalink
🐛 修复插件安装镜像地址问题:https://zhuanlan.zhihu.com/p/432578145
Browse files Browse the repository at this point in the history
  • Loading branch information
muwoo committed Aug 18, 2023
1 parent 637c123 commit 62bcc34
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion feature/src/views/settings/localhost.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const layout = {
const resetForm = () => {
formState.value = {
register: 'https://registry.npm.taobao.org',
register: 'https://registry.npmmirror.com',
database: 'https://gitcode.net/rubickcenter/rubick-database/-/raw/master',
access_token: '',
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rubick",
"version": "2.4.3",
"version": "2.4.4",
"author": "muwoo <[email protected]>",
"private": true,
"scripts": {
Expand Down
10 changes: 5 additions & 5 deletions src/core/plugin-handler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class AdapterHandler {
} catch (e) {
// ignore
}
this.registry = register || 'https://registry.npm.taobao.org';
this.registry = register || 'https://registry.npmmirror.com/';
}

async upgrade(name: string): Promise<void> {
Expand Down Expand Up @@ -157,14 +157,14 @@ class AdapterHandler {
*/
private async execCommand(cmd: string, modules: string[]): Promise<string> {
return new Promise((resolve: any, reject: any) => {
let args: string[] = [cmd]
const args: string[] = [cmd]
.concat(
cmd !== 'uninstall' ? modules.map((m) => `${m}@latest`) : modules
)
.concat('--color=always')
.concat('--save');
if (cmd !== 'uninstall')
args = args.concat(`--registry=${this.registry}`);
.concat('--save')
.concat(`--registry=${this.registry}`);

const npm = spawn('npm', args, {
cwd: this.baseDir,
});
Expand Down

0 comments on commit 62bcc34

Please sign in to comment.