mirror of
https://github.com/rubickCenter/rubick
synced 2025-06-10 13:20:28 +08:00
commit
91ce71f139
@ -10,4 +10,7 @@ window.market = {
|
||||
deletePlugin(plugin) {
|
||||
return remote.getGlobal("LOCAL_PLUGINS").deletePlugin(plugin);
|
||||
},
|
||||
}
|
||||
refreshPlugin(plugin) {
|
||||
return remote.getGlobal("LOCAL_PLUGINS").refreshPlugin(plugin);
|
||||
},
|
||||
};
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
<a-form-item :wrapper-col="{ span: 14, offset: 4 }">
|
||||
<a-button :loading="loading" type="primary" @click="onSubmit">安装</a-button>
|
||||
<a-button @click="refresh" style="margin-left: 10px;">刷新插件</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
@ -50,6 +51,15 @@ const downloadPlugin = async (pluginName) => {
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
const refresh = () => {
|
||||
formRef.value.validate().then(() => {
|
||||
window.market.refreshPlugin({
|
||||
name: formState.name,
|
||||
});
|
||||
message.success(`${formState.name}刷新成功!`);
|
||||
});
|
||||
};
|
||||
|
||||
const labelCol = { span: 4 };
|
||||
const wrapperCol = { span: 14 };
|
||||
</script>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rubick",
|
||||
"version": "2.0.1-beta.8",
|
||||
"version": "2.0.1-beta.9",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
|
@ -1 +1 @@
|
||||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>feature</title><link href="css/app.f8214d90.css" rel="preload" as="style"><link href="js/app.9afe693f.js" rel="preload" as="script"><link href="js/chunk-vendors.ebb3d342.js" rel="preload" as="script"><link href="css/app.f8214d90.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but feature doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.ebb3d342.js"></script><script src="js/app.9afe693f.js"></script></body></html>
|
||||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>feature</title><link href="css/app.f8214d90.css" rel="preload" as="style"><link href="js/app.c69aa8d8.js" rel="preload" as="script"><link href="js/chunk-vendors.ebb3d342.js" rel="preload" as="script"><link href="css/app.f8214d90.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but feature doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.ebb3d342.js"></script><script src="js/app.c69aa8d8.js"></script></body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
public/feature/js/app.c69aa8d8.js
Normal file
2
public/feature/js/app.c69aa8d8.js
Normal file
File diff suppressed because one or more lines are too long
1
public/feature/js/app.c69aa8d8.js.map
Normal file
1
public/feature/js/app.c69aa8d8.js.map
Normal file
File diff suppressed because one or more lines are too long
@ -10,4 +10,7 @@ window.market = {
|
||||
deletePlugin(plugin) {
|
||||
return remote.getGlobal("LOCAL_PLUGINS").deletePlugin(plugin);
|
||||
},
|
||||
refreshPlugin(plugin) {
|
||||
return remote.getGlobal("LOCAL_PLUGINS").refreshPlugin(plugin);
|
||||
},
|
||||
}
|
||||
|
@ -32,6 +32,38 @@ global.LOCAL_PLUGINS = {
|
||||
global.LOCAL_PLUGINS.addPlugin(plugin);
|
||||
return global.LOCAL_PLUGINS.PLUGINS;
|
||||
},
|
||||
refreshPlugin(plugin) {
|
||||
// 获取 dev 插件信息
|
||||
const pluginPath = path.resolve(
|
||||
baseDir,
|
||||
"node_modules",
|
||||
plugin.name
|
||||
);
|
||||
const pluginInfo = JSON.parse(
|
||||
fs.readFileSync(path.join(pluginPath, "./package.json"), "utf8")
|
||||
);
|
||||
plugin = {
|
||||
...plugin,
|
||||
...pluginInfo,
|
||||
};
|
||||
// 刷新
|
||||
let currentPlugins = global.LOCAL_PLUGINS.getLocalPlugins();
|
||||
|
||||
currentPlugins = currentPlugins.map((p) => {
|
||||
if (p.name === plugin.name) {
|
||||
return plugin;
|
||||
}
|
||||
return p;
|
||||
});
|
||||
|
||||
// 存入
|
||||
global.LOCAL_PLUGINS.PLUGINS = currentPlugins;
|
||||
fs.writeFileSync(
|
||||
configPath,
|
||||
JSON.stringify(currentPlugins)
|
||||
);
|
||||
return global.LOCAL_PLUGINS.PLUGINS;
|
||||
},
|
||||
getLocalPlugins() {
|
||||
try {
|
||||
if (!global.LOCAL_PLUGINS.PLUGINS.length) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user