mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 08:40:22 +08:00
feat: 设置页可卸载,AI 安装说明只跑官方 add
This commit is contained in:
1 parent
bea3877f4d
commit
fbd17e277e
13 files changed
+810
-124
No files matched your search
+6
-6
@@ -67,7 +67,7 @@ function sameRev(a, b) {
|
||||
return a === b || a.startsWith(b) || b.startsWith(a);
|
||||
}
|
||||
|
||||
function realPath(dir) {
|
||||
export function realPath(dir) {
|
||||
try {
|
||||
return fs.realpathSync(dir);
|
||||
} catch {
|
||||
@@ -109,17 +109,17 @@ function gitHead(dir) {
|
||||
}
|
||||
}
|
||||
|
||||
function isLinkSpec(spec) {
|
||||
export function isLinkSpec(spec) {
|
||||
const s = String(spec || "");
|
||||
return /^(link|file):/i.test(s) || s === "." || /^\.\.?(?:[/\\]|$)/.test(s);
|
||||
}
|
||||
|
||||
function resolveLinkDir(profileDir, spec) {
|
||||
export function resolveLinkDir(profileDir, spec) {
|
||||
const raw = String(spec).replace(/^(link|file):/i, "");
|
||||
return path.resolve(profileDir, raw);
|
||||
}
|
||||
|
||||
function findPurgeProfiles() {
|
||||
export function findPurgeProfiles() {
|
||||
const root = path.join(findDshHome(), "profiles");
|
||||
if (!fs.existsSync(root)) return [];
|
||||
let names = [];
|
||||
@@ -139,7 +139,7 @@ function findPurgeProfiles() {
|
||||
return out;
|
||||
}
|
||||
|
||||
function profilePluginDir(profileDir) {
|
||||
export function profilePluginDir(profileDir) {
|
||||
const nm = path.join(profileDir, "node_modules", "dsh-purge");
|
||||
return fs.existsSync(nm) ? realPath(nm) : "";
|
||||
}
|
||||
@@ -167,7 +167,7 @@ function resolveDshBin() {
|
||||
return "";
|
||||
}
|
||||
|
||||
function runDshPlugin(profile, args) {
|
||||
export function runDshPlugin(profile, args) {
|
||||
const bin = resolveDshBin();
|
||||
if (!bin) throw new Error("找不到 dsh");
|
||||
execFileSync(bin, ["plugin", "--profile", profile, ...args], {
|
||||
|
||||
Reference in new issue
Block a user