@reliverse/dler 1.7.69 → 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.
Files changed (76) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +74 -98
  3. package/bin/app/build/cmd.js +0 -2
  4. package/bin/app/cmds.d.ts +1 -0
  5. package/bin/app/cmds.js +1 -0
  6. package/bin/app/get/cmd.d.ts +1 -0
  7. package/bin/app/get/cmd.js +1 -0
  8. package/bin/app/remove/cmd.d.ts +6 -0
  9. package/bin/app/remove/cmd.js +185 -1
  10. package/bin/app/update/cmd.d.ts +11 -0
  11. package/bin/app/update/cmd.js +277 -2
  12. package/bin/app/upgrade/cmd.d.ts +8 -0
  13. package/bin/app/upgrade/cmd.js +295 -0
  14. package/bin/cli.js +16 -10
  15. package/bin/libs/cfg/cfg-impl/cfg-consts.d.ts +1 -1
  16. package/bin/libs/cfg/cfg-impl/cfg-consts.js +1 -1
  17. package/bin/libs/cfg/cfg-mod.d.ts +1 -23
  18. package/bin/libs/cfg/cfg-mod.js +1 -85
  19. package/bin/libs/get/mod.d.ts +37 -0
  20. package/bin/libs/get/mod.js +509 -0
  21. package/bin/libs/sdk/sdk-impl/config/default.d.ts +1 -1
  22. package/bin/libs/sdk/sdk-impl/config/default.js +1 -1
  23. package/bin/libs/sdk/sdk-impl/config/info.js +1 -1
  24. package/bin/libs/sdk/sdk-impl/config/init.d.ts +1 -0
  25. package/bin/libs/sdk/sdk-impl/config/init.js +98 -5
  26. package/bin/libs/sdk/sdk-impl/config/load.js +4 -4
  27. package/bin/libs/sdk/sdk-impl/utils/exec/exec-mod.js +0 -8
  28. package/bin/libs/sdk/sdk-mod.d.ts +1 -1
  29. package/bin/libs/sdk/sdk-mod.js +1 -1
  30. package/bin/mod.d.ts +1 -1
  31. package/bin/mod.js +1 -1
  32. package/package.json +3 -9
  33. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-biome.d.ts +0 -2
  34. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-biome.js +0 -34
  35. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-comments.d.ts +0 -1
  36. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-comments.js +0 -57
  37. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-consts.d.ts +0 -34
  38. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-consts.js +0 -36
  39. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-content.d.ts +0 -14
  40. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-content.js +0 -15
  41. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-core.d.ts +0 -14
  42. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-core.js +0 -63
  43. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-create.d.ts +0 -36
  44. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-create.js +0 -275
  45. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-def-utils.d.ts +0 -6
  46. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-def-utils.js +0 -225
  47. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-default.d.ts +0 -3
  48. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-default.js +0 -155
  49. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-define.d.ts +0 -125
  50. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-define.js +0 -4
  51. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-detect.d.ts +0 -23
  52. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-detect.js +0 -347
  53. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-gen-cfg.d.ts +0 -3
  54. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-gen-cfg.js +0 -186
  55. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-migrate.d.ts +0 -5
  56. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-migrate.js +0 -56
  57. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-path.d.ts +0 -11
  58. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-path.js +0 -33
  59. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-prompts.d.ts +0 -5
  60. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-prompts.js +0 -12
  61. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-read.d.ts +0 -11
  62. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-read.js +0 -84
  63. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-repair.d.ts +0 -16
  64. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-repair.js +0 -137
  65. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-schema.d.ts +0 -130
  66. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-schema.js +0 -438
  67. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-types.d.ts +0 -75
  68. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-types.js +0 -0
  69. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-unstable.d.ts +0 -11
  70. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-unstable.js +0 -41
  71. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-update.d.ts +0 -10
  72. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-update.js +0 -152
  73. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-utils.d.ts +0 -17
  74. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-utils.js +0 -86
  75. package/bin/libs/cfg/cfg-impl/rse-config/rse-mod.d.ts +0 -20
  76. package/bin/libs/cfg/cfg-impl/rse-config/rse-mod.js +0 -20
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) Nazar Kornienko (blefnk), Reliverse
3
+ Copyright (c) Nazar Kornienko (blefnk), Bleverse, Reliverse
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -2,147 +2,105 @@
2
2
 
3
3
  [sponsor](https://github.com/sponsors/blefnk) — [discord](https://discord.gg/pb8ukbwpsj) — [github](https://github.com/reliverse/dler) — [npm](https://npmjs.com/@reliverse/dler)
4
4
 
5
- > @reliverse/dler (prev. relidler; `/ˈdiː.lər/`, dealer) is a unified package manager for typescript/javascript projects.
5
+ > @reliverse/dler (formerly relidler; `/ˈdiː.lər/`, dealer) is a unified package manager for typescript/javascript projects.
6
6
  >
7
- > dler is your package manager's best friend. dler extends bun, pnpm, yarn, and npm core functionalities by going far beyond.
7
+ > dler is your package managers best friend it extends bun, deno (🔜), pnpm, yarn, and npm with powerful and modern features.
8
8
  >
9
- > at its core, dler is a flexible, unified, and fully automated bundler for typescript/javascript projects that doubles as an npm/jsr publishing tool. beyond bundling, dler serves as a comprehensive codemod toolkit for modern typescript/javascript development.
9
+ > at its core, dler is a flexible and fully automated bundler that also doubles as an npm/jsr publishing tool. beyond bundling, dler provides a rich codemod toolkit designed for modern typescript/javascript development.
10
10
 
11
11
  ## features
12
12
 
13
- - **built-in bun environment** when dler is installed as a standalone application
14
- - **`unjs/unbuild` drop-in** with different powerful capabilities like publishing
15
- - **automated publishing** to npm/jsr registries with intelligent workflow management
16
- - **reliable builds** with comprehensive typescript/javascript support and error handling
17
- - **smart versioning** with automatic version bumps and semantic release integration
18
- - **zero configuration** eliminates `package.json` maintenance headaches forever
19
- - **performance optimized** for speed with modern build pipelines and caching
20
- - **17 built-in commands** — comprehensive [dler commands](#dler-commands) for every workflow
21
- - **path resolution magic** converts typescript aliases to relative imports automatically
22
- - **highly configurable** via dedicated configuration files with sensible defaults
23
- - **dual interface** — cli for everyday use, sdk for advanced programmatic control
24
- - **clean distribution builds** automatically removes internal logs and debug code
25
- - **monorepo ready** with experimental `libs` feature for multi-library projects
26
- - **magic spells** — extensible plugin system for custom build transformations
27
- - **codemod toolkit** — powerful code transformation utilities built-in
28
-
29
- ### 🎯 perfect for
30
-
31
- dler excels at managing both build and publish workflows, making it ideal for:
32
-
33
- - cli tool creators and maintainers
34
- - project bootstrappers (like [rse](https://github.com/reliverse/rse))
35
- - library authors seeking streamlined workflows
36
- - teams wanting consistent build processes
37
-
38
- ### 🔜 coming soon
39
-
40
- **full monorepo system** with advanced dependency management and cross-package optimization.
41
-
42
- ### supported bundlers
43
-
44
- - ✅ [mkdist](https://github.com/unjs/mkdist#readme)
45
- - ✅ jsr
46
- - 🏗️ copy
47
- - 🏗️ [bun](https://bun.sh/docs/bundler)
48
- - 🏗️ [rollup](https://rollupjs.org)
49
- - 🏗️ [untyped](https://untyped.unjs.io)
50
- - 🔜 [tsdown](https://rolldown.rs)
51
- - 🔜 copy (prev. jsr)
52
-
53
- **legend**:
54
-
55
- - ✅ well tested with big projects
56
- - 🏗️ not well tested yet
57
- - 🔜 coming soon
13
+ - **drop-in `unjs/unbuild` support** with extended capabilities like publishing
14
+ - **automated publishing** to npm and jsr with smart workflow orchestration
15
+ - **reliable builds** with robust typescript/javascript support and error handling
16
+ - **smart versioning** with semantic release and automatic version bumping
17
+ - **zero-config setup** forget about `package.json` maintenance
18
+ - **built-in bun environment** when used as a standalone cli app
19
+ - **performance-optimized** using fast build pipelines and aggressive caching
20
+ - **17 built-in commands** — see [dler commands](#dler-commands) for everything it can do
21
+ - **path alias resolution** automatically rewrites tsconfig aliases to relative imports
22
+ - **configurable by design** dedicated config files with sane defaults
23
+ - **dual interface** — use via cli or import as sdk for programmatic use
24
+ - **clean dist output** strips internal logs and debug code automatically
25
+ - **monorepo support** with experimental `libs` mode for multi-library setups
26
+ - **magic spells** — plugin system for custom build logic and extensions
27
+ - **codemod toolkit** — powerful code transformation utilities out of the box
28
+ - **full monorepo system** with optimized cross-package dependency handling
29
+ - **esp. designed for** cli tool creators, project bootstrappers (like [rse](https://github.com/reliverse/rse))
30
+ - **perfect for** anyone who wants their package manager to have *sweet powers*
58
31
 
59
32
  ## getting started
60
33
 
61
- make sure you have git, node.js, and bun/pnpm/yarn/npm (**[bun](https://bun.sh/get) is highly recommended**) are installed. then:
34
+ before using dler, make sure you have [git](https://git-scm.com/downloads), [node.js](https://nodejs.org/en/download), and a supported package manager installed — **[bun](https://bun.sh/get) is highly recommended** for the best experience.
62
35
 
63
36
  ### 0. try the playground
64
37
 
65
- > **💡 tip**:
66
- > want to test dler before integrating it into your project?
67
- > clone the dler repo and build it using dler itself!
38
+ > 💡 **tip**
39
+ > curious to see dler in action before integrating it into your project?
40
+ > clone the repo and try e.g. `bun dler build` to build dler using... dler itself!
68
41
 
69
42
  ```sh
70
43
  git clone https://github.com/reliverse/dler.git
71
44
  cd dler
72
45
  bun i
73
- bun dev # bun src/cli.ts --dev
46
+ bun dler build # runs dler from source (cli entry: src/cli.ts)
74
47
  ```
75
48
 
76
49
  ### 1. install dler
77
50
 
78
- **install as dev dep (recommended)**:
79
-
80
- ```sh
81
- bun add -D @reliverse/dler
82
- # or update as needed:
83
- bun update --latest
84
- ```
51
+ it is recommended to install dler both globally and as a dev dependency:
85
52
 
86
- **and/or install globally**:
53
+ - **global install** — `bun add -g @reliverse/dler` — lets you use dler anywhere, like a system-level cli.
54
+ - **dev dependency** — `bun add -D @reliverse/dler` — pins the version per project, so all contributors use the same version.
87
55
 
88
- ```sh
89
- bun add -g @reliverse/dler
90
- # or update as needed:
91
- bun i -g update --latest
92
- ```
56
+ instead of global install, you can alternatively install dler as a standalone binary: `bunx @reliverse/dler `
93
57
 
94
- - **when installed globally**: use `dler` anywhere.
95
- - **when installed as dev dep**: use with package manager name prefix, e.g. `bun dler`, inside your project directory.
96
- - **when installed as standalone**: ...
58
+ > usage depends on how dler is installed:
59
+ >
60
+ > - `dler` → if installed globally (or as standalone binary)
61
+ > - `bun dler` → if installed as a dev dependency
97
62
 
98
- ### 2. prepare your project
63
+ ### 2. initialize dler config
99
64
 
100
- a. **configure `.gitignore`**:
65
+ first-time dler run initializes config, repeatable runs launches dler interactive menu.
101
66
 
102
67
  ```sh
103
- echo "dist*" >> .gitignore
104
- echo "logs" >> .gitignore
68
+ bun dler # if installed locally
69
+ dler # if installed globally
105
70
  ```
106
71
 
107
- b. **add `".config/**/*.ts"` to `include` in `tsconfig.json`**:
108
-
109
- ```json
110
- "include": [".config/**/*.ts", ...]
111
- ```
72
+ this creates a starter config file: `.config/dler.ts`
112
73
 
113
- c. **package.json**:
74
+ - it is recommended to tweak the config to match your project structure
75
+ - example config: [.config/dler.ts →](https://github.com/reliverse/dler/blob/main/.config/dler.ts)
76
+ - useful options:
114
77
 
115
- ```json
116
- "scripts": {
117
- "build": "dler build", // this is optional
118
- "pub": "dler pub" // this does build+publish
119
- }
120
- ```
78
+ - `buildPreExtensions`: support additional file types like `["ts", "js", "vue", "tsx", "jsx"]`
79
+ - `buildTemplatesDir`: exclude a directory from being built; it will be copied as-is (e.g. `src/foo/templates → dist-*/bin/foo/templates`)
121
80
 
122
- d. **initialize config**:
81
+ ### 3. run and enjoy
123
82
 
124
83
  ```sh
125
- bun dler # if installed as dev dep
126
- dler # if installed globally
84
+ bun dler [build|pub|--help] # if local
85
+ dler [build|pub|--help] # if global
127
86
  ```
128
87
 
129
- - the `.config/dler.ts` file is automatically created on first run.
88
+ > 💡 run `dler` for an interactive menu, or `dler --help` for full command list.
130
89
 
131
- e. **optionally, customize `.config/dler.ts`**:
90
+ ### 4. upgrade your dev tools
132
91
 
133
- - it's recommended to customize this file according to your needs.
134
- - you can check an example config here: [.config/dler.ts](https://github.com/reliverse/dler/blob/main/.config/dler.ts)
135
- - if you want to build files which have extensions other than `.ts` and `.js`, you can customize `buildPreExtensions` array (example: `["ts", "js", "vue", "tsx", "jsx"]`).
136
- - if you want to exclude some files from being built, you can customize `buildTemplatesDir` string (example: `"templates"`). by placing them in this directory, they will not be built, whole directory will be copied from e.g. `src/foo/templates` to `dist-*/bin/foo/templates` as-is.
92
+ keeping your tools fresh is always a good practice.
137
93
 
138
- ### 3. run and enjoy
94
+ the command below **upgrades not just dler**, but also your local setup — including `git`, `node.js`, `bun`, `npm`, `yarn`, `pnpm`, and more.
95
+
96
+ just run:
139
97
 
140
98
  ```sh
141
- bun dler [build|pub|--help] # if installed as dev dep
142
- dler [build|pub|--help] # if installed globally
99
+ bun dler upgrade
143
100
  ```
144
101
 
145
- (_run just `dler` to see an interactive list of commands_)
102
+ > ⚠️ don’t confuse this with `dler update`, which upgrades your **project dependencies** and **global packages**, not your system tools.
103
+ > 👉 *note:* both `upgrade` and `update` will update **dler** itself — globally and in your `dependencies` or `devDependencies` if run inside a project with a `package.json` — depends on how dler is installed.
146
104
 
147
105
  ## dler commands
148
106
 
@@ -164,6 +122,23 @@ since dler is fully modular, build command is separated for its own build-in plu
164
122
  bun dler build ...
165
123
  ```
166
124
 
125
+ ### supported bundlers
126
+
127
+ - ✅ [mkdist](https://github.com/unjs/mkdist#readme)
128
+ - ✅ jsr
129
+ - 🏗️ copy
130
+ - 🏗️ [bun](https://bun.sh/docs/bundler)
131
+ - 🏗️ [rollup](https://rollupjs.org)
132
+ - 🏗️ [untyped](https://untyped.unjs.io)
133
+ - 🔜 [tsdown](https://rolldown.rs)
134
+ - 🔜 copy (prev. jsr)
135
+
136
+ **legend**:
137
+
138
+ - ✅ well tested with big projects
139
+ - 🏗️ not well tested yet
140
+ - 🔜 coming soon
141
+
167
142
  #### 1.1. `build binary` - Standalone Executable Builder
168
143
 
169
144
  creates standalone executables for different platforms using bun's `--compile` feature.
@@ -961,6 +936,7 @@ special thanks to the project that inspired `@reliverse/dler`:
961
936
  - [ ] at the moment any bundler like `mkdist` can be called using `bun`, but bun's own bundler is not yet fully supported
962
937
  - [ ] support all well-known package managers (currently only bun is fully supported)
963
938
  - [ ] `dler <command> [...flags] [...args]` usage should support both `bun` and `dler` own commands and flags
939
+ - [ ] fully support deno and jsr
964
940
 
965
941
  ### todo: commands
966
942
 
@@ -1,6 +1,5 @@
1
1
  import { defineArgs, defineCommand } from "@reliverse/rempts";
2
2
  import { dlerBuild } from "./impl.js";
3
- import { ensureDlerConfig } from "../../libs/sdk/sdk-impl/config/init.js";
4
3
  import { getConfigDler } from "../../libs/sdk/sdk-impl/config/load.js";
5
4
  import { finalizeBuild } from "../../libs/sdk/sdk-mod.js";
6
5
  export default defineCommand({
@@ -24,7 +23,6 @@ export default defineCommand({
24
23
  }),
25
24
  async run({ args }) {
26
25
  const isDev = args.dev || process.env.DLER_DEV_MODE === "true";
27
- await ensureDlerConfig(isDev);
28
26
  const config = await getConfigDler();
29
27
  const { timer } = await dlerBuild(
30
28
  isDev,
package/bin/app/cmds.d.ts CHANGED
@@ -16,3 +16,4 @@ export declare const getMagicCmd: () => Promise<Command>;
16
16
  export declare const getSplitCmd: () => Promise<Command>;
17
17
  export declare const getRmCmd: () => Promise<Command>;
18
18
  export declare const getUpdateCmd: () => Promise<Command>;
19
+ export declare const getUpgradeCmd: () => Promise<Command>;
package/bin/app/cmds.js CHANGED
@@ -16,3 +16,4 @@ export const getMagicCmd = async () => loadCommand("magic");
16
16
  export const getSplitCmd = async () => loadCommand("split");
17
17
  export const getRmCmd = async () => loadCommand("rm");
18
18
  export const getUpdateCmd = async () => loadCommand("update");
19
+ export const getUpgradeCmd = async () => loadCommand("upgrade");
@@ -0,0 +1 @@
1
+ export { default } from "../../libs/get/mod.js";
@@ -0,0 +1 @@
1
+ export { default } from "../../libs/get/mod.js";
@@ -3,6 +3,7 @@
3
3
  * - dler remove package-name - removes a package
4
4
  * - dler rm package-name - removes a package (alias)
5
5
  * - dler uninstall package-name - removes a package (alias)
6
+ * - dler remove --standalone - removes standalone dler installation
6
7
  */
7
8
  declare const _default: import("@reliverse/rempts").Command<{
8
9
  action: {
@@ -38,5 +39,10 @@ declare const _default: import("@reliverse/rempts").Command<{
38
39
  description: string;
39
40
  default: false;
40
41
  };
42
+ standalone: {
43
+ type: "boolean";
44
+ description: string;
45
+ default: false;
46
+ };
41
47
  }>;
42
48
  export default _default;
@@ -1,5 +1,10 @@
1
+ import path from "@reliverse/pathkit";
2
+ import fs from "@reliverse/relifso";
1
3
  import { relinka } from "@reliverse/relinka";
2
4
  import { defineArgs, defineCommand } from "@reliverse/rempts";
5
+ import { execa } from "execa";
6
+ import { lookpath } from "lookpath";
7
+ import { homedir, platform } from "node:os";
3
8
  import { removeDependency } from "../../libs/sdk/sdk-impl/utils/pm/pm-api.js";
4
9
  export default defineCommand({
5
10
  meta: {
@@ -40,10 +45,19 @@ export default defineCommand({
40
45
  type: "boolean",
41
46
  description: "Run linter checks after removing dependencies",
42
47
  default: false
48
+ },
49
+ standalone: {
50
+ type: "boolean",
51
+ description: "Remove standalone dler installation",
52
+ default: false
43
53
  }
44
54
  }),
45
55
  async run({ args }) {
46
- const { action, name, linter, ...options } = args;
56
+ const { action, name, linter, standalone, ...options } = args;
57
+ if (standalone) {
58
+ await removeStandaloneDler();
59
+ return;
60
+ }
47
61
  if (!name) {
48
62
  relinka.error("Package name is required for remove action");
49
63
  return process.exit(1);
@@ -69,3 +83,173 @@ export default defineCommand({
69
83
  }
70
84
  }
71
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
+ }
@@ -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;