Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugins/ztools-mise-manager/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dist/
public/projects.json
*.log
.DS_Store
*.zpx
11 changes: 11 additions & 0 deletions plugins/ztools-mise-manager/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 0.1.0 - 2026-10-28

### 新增功能
- 工具市场支持点击工具展开查看并选择安装具体远程版本,支持关键词实时过滤与快捷安装 latest
- 安装任务提升至全局管理,顶部常驻全局进度条 Banner,跨 Tab 页面无缝保持安装状态与实时日志
- 工具管理与切换 Node.js 版本时检测上一版本的全局 npm 包,弹出迁移确认弹窗,支持一键批量迁移安装
- 检测上一版本 Corepack 启用状态并在新版本自动执行 `corepack enable`
- 展示用户级 `~/.npmrc` 摘要与当前镜像源信息

### 优化与修复
- 修复 Tab 切换组件卸载导致的搜索关键字与滚动位置丢失问题

## 0.0.1 - 2026-09-03

Expand Down
3 changes: 2 additions & 1 deletion plugins/ztools-mise-manager/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "ztools-mise-manager",
"version": "0.0.1",
"version": "0.1.0",
"main": "preload.js",
"scripts": {
"dev": "vite",
"build": "vite build && cd dist && npm install --omit=dev",
"pack": "npm run build && node scripts/pack.js",
"preview": "vite preview"
},
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion plugins/ztools-mise-manager/public/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ztools-mise-manager",
"title": "Mise 控制台",
"description": "🚀 可视化管理 mise 开发工具版本。支持已装工具总览、安装/卸载/切换版本、工具市场浏览、项目 .mise.toml 配置管理。",
"version": "0.0.1",
"version": "0.1.0",
"main": "index.html",
"author": "wangtao",
"logo": "logo.png",
Expand Down
47 changes: 47 additions & 0 deletions plugins/ztools-mise-manager/public/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,53 @@ window.miseManager = {
if (window.ztools && window.ztools.shellOpenExternal) window.ztools.shellOpenExternal(url);
else window.open(url, "_blank");
},

// --- Node.js 全局包迁移相关 ---
getNodeGlobalPackages: async (nodeVersion) => {
const cmd = `mise exec node@${nodeVersion} -- npm list -g --depth=0 --json`;
return new Promise((resolve) => {
exec(cmd, { shell: true, timeout: 30000 }, (error, stdout) => {
const output = decodeOutput(stdout || (error && error.stdout) || "");
try {
const json = JSON.parse(output);
const deps = json.dependencies || {};
const excluded = new Set(["npm", "corepack", "npx"]);
const list = Object.keys(deps).filter((name) => !excluded.has(name.toLowerCase()));
resolve(list);
} catch (e) {
resolve([]);
}
});
});
},

installGlobalPackages: (nodeVersion, packages, { onLog, onProgress } = {}) => {
if (!packages || packages.length === 0) return Promise.resolve("");
const pkgArgs = packages.map((p) => `"${p}"`).join(" ");
const cmd = `mise exec node@${nodeVersion} -- npm install -g ${pkgArgs}`;
return runLongTask(cmd, { onLog, onProgress });
},

readNpmrc: () => {
try {
const home = process.env.USERPROFILE || process.env.HOME || "";
const p = path.join(home, ".npmrc");
if (fs.existsSync(p)) {
return fs.readFileSync(p, "utf-8");
}
} catch (e) { /* ignore */ }
return "";
},

getCorepackStatus: async (nodeVersion) => {
const res = await runCommand(`mise exec node@${nodeVersion} -- corepack --version`);
return res.ok && res.stdout.trim().length > 0;
},

enableCorepack: async (nodeVersion) => {
const res = await runCommand(`mise exec node@${nodeVersion} -- corepack enable`);
if (!res.ok) throw new Error(res.stderr || "启用 corepack 失败");
},
};

// --- 快速指令处理 ---
Expand Down
Loading
Loading