@reliverse/dler 1.7.68 → 1.7.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +148 -98
- package/bin/app/build/cmd.js +0 -2
- package/bin/app/cmds.d.ts +1 -0
- package/bin/app/cmds.js +1 -0
- package/bin/app/create/cmd.d.ts +47 -0
- package/bin/app/create/cmd.js +170 -0
- package/bin/app/get/cmd.d.ts +1 -0
- package/bin/app/get/cmd.js +1 -0
- package/bin/app/init/cmd.d.ts +2 -0
- package/bin/app/init/cmd.js +14 -0
- package/bin/app/install/cmd.d.ts +50 -0
- package/bin/app/install/cmd.js +83 -0
- package/bin/app/remove/cmd.d.ts +48 -0
- package/bin/app/remove/cmd.js +255 -0
- package/bin/app/update/cmd.d.ts +11 -0
- package/bin/app/update/cmd.js +277 -2
- package/bin/app/upgrade/cmd.d.ts +8 -0
- package/bin/app/upgrade/cmd.js +295 -0
- package/bin/app/x/cmd.d.ts +18 -31
- package/bin/app/x/cmd.js +133 -137
- package/bin/cli.js +16 -10
- package/bin/libs/cfg/cfg-impl/cfg-consts.d.ts +1 -1
- package/bin/libs/cfg/cfg-impl/cfg-consts.js +1 -1
- package/bin/libs/cfg/cfg-mod.d.ts +1 -23
- package/bin/libs/cfg/cfg-mod.js +1 -85
- package/bin/libs/get/mod.d.ts +37 -0
- package/bin/libs/get/mod.js +509 -0
- package/bin/libs/sdk/sdk-impl/config/default.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/config/default.js +1 -1
- package/bin/libs/sdk/sdk-impl/config/info.js +1 -1
- package/bin/libs/sdk/sdk-impl/config/init.d.ts +1 -0
- package/bin/libs/sdk/sdk-impl/config/init.js +98 -5
- package/bin/libs/sdk/sdk-impl/config/load.js +4 -4
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-mod.js +0 -8
- package/bin/libs/sdk/sdk-mod.d.ts +1 -1
- package/bin/libs/sdk/sdk-mod.js +1 -1
- package/bin/mod.d.ts +1 -1
- package/bin/mod.js +1 -1
- package/package.json +3 -9
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-biome.d.ts +0 -2
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-biome.js +0 -34
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-comments.d.ts +0 -1
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-comments.js +0 -57
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-consts.d.ts +0 -34
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-consts.js +0 -36
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-content.d.ts +0 -14
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-content.js +0 -15
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-core.d.ts +0 -14
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-core.js +0 -63
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-create.d.ts +0 -36
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-create.js +0 -275
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-def-utils.d.ts +0 -6
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-def-utils.js +0 -225
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-default.d.ts +0 -3
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-default.js +0 -155
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-define.d.ts +0 -125
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-define.js +0 -4
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-detect.d.ts +0 -23
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-detect.js +0 -347
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-gen-cfg.d.ts +0 -3
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-gen-cfg.js +0 -186
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-migrate.d.ts +0 -5
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-migrate.js +0 -56
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-path.d.ts +0 -11
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-path.js +0 -33
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-prompts.d.ts +0 -5
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-prompts.js +0 -12
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-read.d.ts +0 -11
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-read.js +0 -84
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-repair.d.ts +0 -16
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-repair.js +0 -137
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-schema.d.ts +0 -130
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-schema.js +0 -438
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-types.d.ts +0 -75
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-types.js +0 -0
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-unstable.d.ts +0 -11
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-unstable.js +0 -41
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-update.d.ts +0 -10
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-update.js +0 -152
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-utils.d.ts +0 -17
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-utils.js +0 -86
- package/bin/libs/cfg/cfg-impl/rse-config/rse-mod.d.ts +0 -20
- package/bin/libs/cfg/cfg-impl/rse-config/rse-mod.js +0 -20
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { relinka } from "@reliverse/relinka";
|
|
2
|
+
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
3
|
+
import {
|
|
4
|
+
addDependency,
|
|
5
|
+
dedupeDependencies,
|
|
6
|
+
installDependencies
|
|
7
|
+
} from "../../libs/sdk/sdk-impl/utils/pm/pm-api.js";
|
|
8
|
+
export default defineCommand({
|
|
9
|
+
meta: {
|
|
10
|
+
name: "install",
|
|
11
|
+
version: "1.1.0",
|
|
12
|
+
description: "Install dependencies or deduplicate existing ones. Usage example: `dler install package-name` or `dler install` or `dler dedupe`"
|
|
13
|
+
},
|
|
14
|
+
args: defineArgs({
|
|
15
|
+
action: {
|
|
16
|
+
type: "string",
|
|
17
|
+
description: "Action to perform: install, add, i, dedupe",
|
|
18
|
+
required: false,
|
|
19
|
+
default: "install"
|
|
20
|
+
},
|
|
21
|
+
name: {
|
|
22
|
+
type: "positional",
|
|
23
|
+
description: "Package name",
|
|
24
|
+
required: false
|
|
25
|
+
},
|
|
26
|
+
global: {
|
|
27
|
+
type: "boolean",
|
|
28
|
+
alias: "g",
|
|
29
|
+
description: "Add globally"
|
|
30
|
+
},
|
|
31
|
+
"frozen-lockfile": {
|
|
32
|
+
type: "boolean",
|
|
33
|
+
description: "Install dependencies with frozen lock file"
|
|
34
|
+
},
|
|
35
|
+
cwd: {
|
|
36
|
+
type: "string",
|
|
37
|
+
description: "Current working directory"
|
|
38
|
+
},
|
|
39
|
+
workspace: {
|
|
40
|
+
type: "boolean",
|
|
41
|
+
description: "Add to workspace"
|
|
42
|
+
},
|
|
43
|
+
silent: {
|
|
44
|
+
type: "boolean",
|
|
45
|
+
description: "Run in silent mode"
|
|
46
|
+
},
|
|
47
|
+
recreateLockFile: {
|
|
48
|
+
type: "boolean",
|
|
49
|
+
description: "Recreate lock file (for dedupe)"
|
|
50
|
+
},
|
|
51
|
+
linter: {
|
|
52
|
+
type: "boolean",
|
|
53
|
+
description: "Run linter checks after updating dependencies",
|
|
54
|
+
default: false
|
|
55
|
+
}
|
|
56
|
+
}),
|
|
57
|
+
async run({ args }) {
|
|
58
|
+
console.log("DEBUG: install command starting with args:", args);
|
|
59
|
+
const { action, name, linter, ...options } = args;
|
|
60
|
+
switch (action) {
|
|
61
|
+
case "install":
|
|
62
|
+
case "i":
|
|
63
|
+
case "add":
|
|
64
|
+
console.log("DEBUG: install case, name:", name, "options:", options);
|
|
65
|
+
await (name ? addDependency(name, options) : installDependencies(options));
|
|
66
|
+
break;
|
|
67
|
+
case "dedupe": {
|
|
68
|
+
await dedupeDependencies(options);
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
default: {
|
|
72
|
+
if (!action || action === "install") {
|
|
73
|
+
console.log("DEBUG: default install case, name:", name, "options:", options);
|
|
74
|
+
await (name ? addDependency(name, options) : installDependencies(options));
|
|
75
|
+
} else {
|
|
76
|
+
relinka.error(`Unknown action: ${action}`);
|
|
77
|
+
relinka.log("Available actions: install, add, i, dedupe");
|
|
78
|
+
return process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* USAGE EXAMPLES:
|
|
3
|
+
* - dler remove package-name - removes a package
|
|
4
|
+
* - dler rm package-name - removes a package (alias)
|
|
5
|
+
* - dler uninstall package-name - removes a package (alias)
|
|
6
|
+
* - dler remove --standalone - removes standalone dler installation
|
|
7
|
+
*/
|
|
8
|
+
declare const _default: import("@reliverse/rempts").Command<{
|
|
9
|
+
action: {
|
|
10
|
+
type: "string";
|
|
11
|
+
description: string;
|
|
12
|
+
required: false;
|
|
13
|
+
default: string;
|
|
14
|
+
};
|
|
15
|
+
name: {
|
|
16
|
+
type: "positional";
|
|
17
|
+
description: string;
|
|
18
|
+
required: true;
|
|
19
|
+
};
|
|
20
|
+
global: {
|
|
21
|
+
type: "boolean";
|
|
22
|
+
alias: string;
|
|
23
|
+
description: string;
|
|
24
|
+
};
|
|
25
|
+
cwd: {
|
|
26
|
+
type: "string";
|
|
27
|
+
description: string;
|
|
28
|
+
};
|
|
29
|
+
workspace: {
|
|
30
|
+
type: "boolean";
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
silent: {
|
|
34
|
+
type: "boolean";
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
linter: {
|
|
38
|
+
type: "boolean";
|
|
39
|
+
description: string;
|
|
40
|
+
default: false;
|
|
41
|
+
};
|
|
42
|
+
standalone: {
|
|
43
|
+
type: "boolean";
|
|
44
|
+
description: string;
|
|
45
|
+
default: false;
|
|
46
|
+
};
|
|
47
|
+
}>;
|
|
48
|
+
export default _default;
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import path from "@reliverse/pathkit";
|
|
2
|
+
import fs from "@reliverse/relifso";
|
|
3
|
+
import { relinka } from "@reliverse/relinka";
|
|
4
|
+
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
5
|
+
import { execa } from "execa";
|
|
6
|
+
import { lookpath } from "lookpath";
|
|
7
|
+
import { homedir, platform } from "node:os";
|
|
8
|
+
import { removeDependency } from "../../libs/sdk/sdk-impl/utils/pm/pm-api.js";
|
|
9
|
+
export default defineCommand({
|
|
10
|
+
meta: {
|
|
11
|
+
name: "remove",
|
|
12
|
+
version: "1.1.0",
|
|
13
|
+
description: "Remove dependencies. Usage example: `dler remove package-name`"
|
|
14
|
+
},
|
|
15
|
+
args: defineArgs({
|
|
16
|
+
action: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "Action to perform: remove, rm, uninstall, un, delete, del",
|
|
19
|
+
required: false,
|
|
20
|
+
default: "remove"
|
|
21
|
+
},
|
|
22
|
+
name: {
|
|
23
|
+
type: "positional",
|
|
24
|
+
description: "Package name",
|
|
25
|
+
required: true
|
|
26
|
+
},
|
|
27
|
+
global: {
|
|
28
|
+
type: "boolean",
|
|
29
|
+
alias: "g",
|
|
30
|
+
description: "Remove globally"
|
|
31
|
+
},
|
|
32
|
+
cwd: {
|
|
33
|
+
type: "string",
|
|
34
|
+
description: "Current working directory"
|
|
35
|
+
},
|
|
36
|
+
workspace: {
|
|
37
|
+
type: "boolean",
|
|
38
|
+
description: "Remove from workspace"
|
|
39
|
+
},
|
|
40
|
+
silent: {
|
|
41
|
+
type: "boolean",
|
|
42
|
+
description: "Run in silent mode"
|
|
43
|
+
},
|
|
44
|
+
linter: {
|
|
45
|
+
type: "boolean",
|
|
46
|
+
description: "Run linter checks after removing dependencies",
|
|
47
|
+
default: false
|
|
48
|
+
},
|
|
49
|
+
standalone: {
|
|
50
|
+
type: "boolean",
|
|
51
|
+
description: "Remove standalone dler installation",
|
|
52
|
+
default: false
|
|
53
|
+
}
|
|
54
|
+
}),
|
|
55
|
+
async run({ args }) {
|
|
56
|
+
const { action, name, linter, standalone, ...options } = args;
|
|
57
|
+
if (standalone) {
|
|
58
|
+
await removeStandaloneDler();
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (!name) {
|
|
62
|
+
relinka.error("Package name is required for remove action");
|
|
63
|
+
return process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
switch (action) {
|
|
66
|
+
case "remove":
|
|
67
|
+
case "rm":
|
|
68
|
+
case "uninstall":
|
|
69
|
+
case "un":
|
|
70
|
+
case "delete":
|
|
71
|
+
case "del":
|
|
72
|
+
await removeDependency(name, options);
|
|
73
|
+
break;
|
|
74
|
+
default: {
|
|
75
|
+
if (!action || action === "remove") {
|
|
76
|
+
await removeDependency(name, options);
|
|
77
|
+
} else {
|
|
78
|
+
relinka.error(`Unknown action: ${action}`);
|
|
79
|
+
relinka.log("Available actions: remove, rm, uninstall, un, delete, del");
|
|
80
|
+
return process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
async function removeStandaloneDler() {
|
|
87
|
+
try {
|
|
88
|
+
relinka("info", "Removing standalone dler installation...");
|
|
89
|
+
const installDir = path.resolve(homedir(), ".reliverse", "dler");
|
|
90
|
+
const appsPath = path.resolve(homedir(), ".reliverse", "apps.json");
|
|
91
|
+
const currentMeta = await getCurrentAppsJson(appsPath, "dler");
|
|
92
|
+
if (!currentMeta) {
|
|
93
|
+
relinka("warn", "Standalone dler installation not found");
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const binaryInfo = getDlerBinaryInfo();
|
|
97
|
+
const binaryPath = path.resolve(installDir, binaryInfo.localName);
|
|
98
|
+
if (await fs.pathExists(binaryPath)) {
|
|
99
|
+
await fs.remove(binaryPath);
|
|
100
|
+
relinka("success", `Removed binary: ${binaryPath}`);
|
|
101
|
+
}
|
|
102
|
+
await removeFromPath(installDir);
|
|
103
|
+
await removeFromAppsJson(appsPath, "dler");
|
|
104
|
+
relinka("success", "Standalone dler installation removed successfully");
|
|
105
|
+
relinka("info", "Please restart your terminal for PATH changes to take effect");
|
|
106
|
+
} catch (error) {
|
|
107
|
+
relinka(
|
|
108
|
+
"error",
|
|
109
|
+
`Failed to remove standalone dler: ${error instanceof Error ? error.message : String(error)}`
|
|
110
|
+
);
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function getDlerBinaryInfo() {
|
|
115
|
+
const os = platform();
|
|
116
|
+
if (os === "darwin") {
|
|
117
|
+
return {
|
|
118
|
+
filename: "dler-darwin-arm64",
|
|
119
|
+
localName: "dler"
|
|
120
|
+
};
|
|
121
|
+
} else if (os === "linux") {
|
|
122
|
+
return {
|
|
123
|
+
filename: "dler-linux",
|
|
124
|
+
localName: "dler"
|
|
125
|
+
};
|
|
126
|
+
} else if (os === "win32") {
|
|
127
|
+
return {
|
|
128
|
+
filename: "dler-windows.exe",
|
|
129
|
+
localName: "dler.exe"
|
|
130
|
+
};
|
|
131
|
+
} else {
|
|
132
|
+
throw new Error(`Unsupported platform: ${os}`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
async function getCurrentAppsJson(appsPath, binaryKey) {
|
|
136
|
+
try {
|
|
137
|
+
if (await fs.pathExists(appsPath)) {
|
|
138
|
+
const content = await fs.readFile(appsPath, "utf8");
|
|
139
|
+
const allMeta = JSON.parse(content);
|
|
140
|
+
return allMeta[binaryKey] || null;
|
|
141
|
+
}
|
|
142
|
+
} catch {
|
|
143
|
+
}
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
async function removeFromAppsJson(appsPath, binaryKey) {
|
|
147
|
+
try {
|
|
148
|
+
if (await fs.pathExists(appsPath)) {
|
|
149
|
+
const content = await fs.readFile(appsPath, "utf8");
|
|
150
|
+
const allMeta = JSON.parse(content);
|
|
151
|
+
delete allMeta[binaryKey];
|
|
152
|
+
if (Object.keys(allMeta).length === 0) {
|
|
153
|
+
await fs.remove(appsPath);
|
|
154
|
+
relinka("info", "Removed empty apps.json file");
|
|
155
|
+
} else {
|
|
156
|
+
await fs.writeFile(appsPath, JSON.stringify(allMeta, null, 2), "utf8");
|
|
157
|
+
relinka("info", "Updated apps.json file");
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
} catch (error) {
|
|
161
|
+
relinka("warn", `Could not update apps.json: ${error}`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
async function removeFromPath(installDir) {
|
|
165
|
+
const os = platform();
|
|
166
|
+
if (os === "win32") {
|
|
167
|
+
try {
|
|
168
|
+
await removeFromWindowsPath(installDir);
|
|
169
|
+
relinka("success", `Removed ${installDir} from PATH`);
|
|
170
|
+
} catch (error) {
|
|
171
|
+
relinka("warn", `Failed to automatically remove from PATH: ${error}`);
|
|
172
|
+
relinka("info", `Please manually remove ${installDir} from your PATH environment variable`);
|
|
173
|
+
}
|
|
174
|
+
} else {
|
|
175
|
+
const homeDir = homedir();
|
|
176
|
+
const shellRc = os === "darwin" ? path.resolve(homeDir, ".zshrc") : path.resolve(homeDir, ".bashrc");
|
|
177
|
+
try {
|
|
178
|
+
if (await fs.pathExists(shellRc)) {
|
|
179
|
+
let rcContent = await fs.readFile(shellRc, "utf8");
|
|
180
|
+
const pathExport = `export PATH="${installDir}:$PATH"`;
|
|
181
|
+
const commentLine = "# Added by dler get command";
|
|
182
|
+
rcContent = rcContent.replace(
|
|
183
|
+
new RegExp(
|
|
184
|
+
`
|
|
185
|
+
${commentLine}
|
|
186
|
+
${pathExport.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}
|
|
187
|
+
`,
|
|
188
|
+
"g"
|
|
189
|
+
),
|
|
190
|
+
"\n"
|
|
191
|
+
).replace(
|
|
192
|
+
new RegExp(
|
|
193
|
+
`${commentLine}
|
|
194
|
+
${pathExport.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}
|
|
195
|
+
?`,
|
|
196
|
+
"g"
|
|
197
|
+
),
|
|
198
|
+
""
|
|
199
|
+
).replace(new RegExp(`
|
|
200
|
+
?${pathExport.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "g"), "");
|
|
201
|
+
await fs.writeFile(shellRc, rcContent, "utf8");
|
|
202
|
+
relinka("success", `Removed from PATH in ${shellRc}`);
|
|
203
|
+
relinka("info", "Please restart your terminal or run: source " + shellRc);
|
|
204
|
+
}
|
|
205
|
+
} catch (error) {
|
|
206
|
+
relinka("warn", `Could not modify shell RC file: ${error}`);
|
|
207
|
+
relinka("info", `Please manually remove ${installDir} from your PATH`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
async function removeFromWindowsPath(installDir) {
|
|
212
|
+
const psScript = `
|
|
213
|
+
function Refresh-Path {
|
|
214
|
+
$paths = @(
|
|
215
|
+
[System.Environment]::GetEnvironmentVariable("Path", "Machine"),
|
|
216
|
+
[System.Environment]::GetEnvironmentVariable("Path", "User"),
|
|
217
|
+
[System.Environment]::GetEnvironmentVariable("Path", "Process")
|
|
218
|
+
)
|
|
219
|
+
$uniquePaths = $paths |
|
|
220
|
+
Where-Object { $_ } |
|
|
221
|
+
ForEach-Object { $_.Split(';', [StringSplitOptions]::RemoveEmptyEntries) } |
|
|
222
|
+
Where-Object { $_ -and (Test-Path $_) } |
|
|
223
|
+
Select-Object -Unique
|
|
224
|
+
$env:Path = ($uniquePaths -join ';').TrimEnd(';')
|
|
225
|
+
}
|
|
226
|
+
function Remove-From-User-Path {
|
|
227
|
+
param([string]$Directory)
|
|
228
|
+
$absolutePath = Resolve-Path $Directory -ErrorAction SilentlyContinue
|
|
229
|
+
if (-not $absolutePath) {
|
|
230
|
+
$absolutePath = $Directory
|
|
231
|
+
}
|
|
232
|
+
$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
|
|
233
|
+
if (-not $currentPath) {
|
|
234
|
+
Write-Host "No User PATH found"
|
|
235
|
+
return
|
|
236
|
+
}
|
|
237
|
+
# Split PATH and remove the target directory
|
|
238
|
+
$pathArray = $currentPath.Split(';', [StringSplitOptions]::RemoveEmptyEntries)
|
|
239
|
+
$filteredPaths = $pathArray | Where-Object { $_ -ne $absolutePath }
|
|
240
|
+
if ($pathArray.Count -eq $filteredPaths.Count) {
|
|
241
|
+
Write-Host "Directory not found in PATH"
|
|
242
|
+
return
|
|
243
|
+
}
|
|
244
|
+
$newPath = $filteredPaths -join ';'
|
|
245
|
+
Write-Host "Removing $absolutePath from User PATH..."
|
|
246
|
+
[Environment]::SetEnvironmentVariable("Path", $newPath, "User")
|
|
247
|
+
Refresh-Path
|
|
248
|
+
Write-Host "PATH updated successfully"
|
|
249
|
+
}
|
|
250
|
+
Remove-From-User-Path '${installDir.replace(/\\/g, "\\\\").replace(/'/g, "''")}'
|
|
251
|
+
`.trim();
|
|
252
|
+
const pwshPath = await lookpath("pwsh");
|
|
253
|
+
const powershellCmd = pwshPath || "powershell";
|
|
254
|
+
await execa(powershellCmd, ["-Command", psScript]);
|
|
255
|
+
}
|
package/bin/app/update/cmd.d.ts
CHANGED
|
@@ -59,5 +59,16 @@ declare const _default: import("@reliverse/rempts").Command<{
|
|
|
59
59
|
default: false;
|
|
60
60
|
alias: string;
|
|
61
61
|
};
|
|
62
|
+
global: {
|
|
63
|
+
type: "boolean";
|
|
64
|
+
description: string;
|
|
65
|
+
default: false;
|
|
66
|
+
alias: string;
|
|
67
|
+
};
|
|
68
|
+
interactive: {
|
|
69
|
+
type: "boolean";
|
|
70
|
+
description: string;
|
|
71
|
+
default: false;
|
|
72
|
+
};
|
|
62
73
|
}>;
|
|
63
74
|
export default _default;
|