@reliverse/dler 1.7.67 → 1.7.69
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/README.md +86 -12
- package/bin/app/create/cmd.d.ts +47 -0
- package/bin/app/create/cmd.js +170 -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 +42 -0
- package/bin/app/remove/cmd.js +71 -0
- package/bin/app/update/cmd.d.ts +12 -0
- package/bin/app/update/cmd.js +33 -6
- package/bin/app/x/cmd.d.ts +18 -31
- package/bin/app/x/cmd.js +133 -137
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-define.d.ts +6 -6
- package/bin/libs/sdk/sdk-impl/config/info.js +1 -1
- package/bin/libs/sdk/sdk-impl/config/load.d.ts +8 -0
- package/bin/libs/sdk/sdk-impl/config/load.js +54 -0
- package/package.json +2 -2
package/bin/app/update/cmd.js
CHANGED
|
@@ -6,6 +6,7 @@ import { $ } from "bun";
|
|
|
6
6
|
import pMap from "p-map";
|
|
7
7
|
import { readPackageJSON } from "pkg-types";
|
|
8
8
|
import semver from "semver";
|
|
9
|
+
import { getConfigBunfig } from "../../libs/sdk/sdk-impl/config/load.js";
|
|
9
10
|
import { latestVersion } from "../../libs/sdk/sdk-impl/utils/pm/pm-meta.js";
|
|
10
11
|
function isNpmAlias(versionSpec) {
|
|
11
12
|
return versionSpec.startsWith("npm:");
|
|
@@ -104,6 +105,18 @@ export default defineCommand({
|
|
|
104
105
|
type: "boolean",
|
|
105
106
|
description: "Run `bun check` after updating (exclusive for bun environment at the moment)",
|
|
106
107
|
default: false
|
|
108
|
+
},
|
|
109
|
+
linker: {
|
|
110
|
+
type: "string",
|
|
111
|
+
description: "Linker strategy (pro tip: use 'isolated' in a monorepo project, 'hoisted' (default) in a project where you have only one package.json). When this option is explicitly set, it takes precedence over bunfig.toml install.linker setting.",
|
|
112
|
+
allowed: ["isolated", "hoisted"],
|
|
113
|
+
default: "hoisted"
|
|
114
|
+
},
|
|
115
|
+
"no-install": {
|
|
116
|
+
type: "boolean",
|
|
117
|
+
description: "Skip the install step after updating dependencies",
|
|
118
|
+
default: false,
|
|
119
|
+
alias: "no-i"
|
|
107
120
|
}
|
|
108
121
|
}),
|
|
109
122
|
async run({ args }) {
|
|
@@ -113,7 +126,19 @@ export default defineCommand({
|
|
|
113
126
|
relinka("error", "No package.json found in current directory");
|
|
114
127
|
return process.exit(1);
|
|
115
128
|
}
|
|
116
|
-
|
|
129
|
+
let effectiveLinker = args.linker;
|
|
130
|
+
if (typeof Bun !== "undefined") {
|
|
131
|
+
const bunfigConfig = await getConfigBunfig();
|
|
132
|
+
if (bunfigConfig?.install?.linker) {
|
|
133
|
+
const bunfigLinker = bunfigConfig.install.linker;
|
|
134
|
+
if ((bunfigLinker === "isolated" || bunfigLinker === "hoisted") && args.linker === "hoisted") {
|
|
135
|
+
effectiveLinker = bunfigLinker;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (args.linker !== "hoisted") {
|
|
140
|
+
effectiveLinker = args.linker;
|
|
141
|
+
}
|
|
117
142
|
const packageJson = await readPackageJSON();
|
|
118
143
|
const dependencies = packageJson.dependencies || {};
|
|
119
144
|
const devDependencies = packageJson.devDependencies || {};
|
|
@@ -222,7 +247,6 @@ export default defineCommand({
|
|
|
222
247
|
);
|
|
223
248
|
return;
|
|
224
249
|
}
|
|
225
|
-
relinka("info", `Checking ${semverDeps.length} dependencies for updates...`);
|
|
226
250
|
const results = await pMap(
|
|
227
251
|
semverDeps,
|
|
228
252
|
async (dep) => {
|
|
@@ -273,11 +297,15 @@ export default defineCommand({
|
|
|
273
297
|
relinka("warn", ` ${error.package} (${error.location}): ${error.error}`);
|
|
274
298
|
}
|
|
275
299
|
}
|
|
300
|
+
if (toUpdate.length === 0) {
|
|
301
|
+
relinka("success", `All ${upToDate.length} deps are already up to date`);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
276
304
|
if (upToDate.length > 0) {
|
|
277
305
|
relinka("success", `${upToDate.length} dependencies are up to date`);
|
|
278
306
|
}
|
|
279
307
|
if (toUpdate.length === 0) {
|
|
280
|
-
relinka("
|
|
308
|
+
relinka("success", `All ${upToDate.length} deps are already up to date`);
|
|
281
309
|
return;
|
|
282
310
|
}
|
|
283
311
|
relinka("info", `${toUpdate.length} dependencies can be updated:`);
|
|
@@ -291,7 +319,6 @@ export default defineCommand({
|
|
|
291
319
|
relinka("info", "Dry run mode - no changes were made");
|
|
292
320
|
return;
|
|
293
321
|
}
|
|
294
|
-
relinka("info", "Updating package.json...");
|
|
295
322
|
const updatedPackageJson = { ...packageJson };
|
|
296
323
|
for (const update of toUpdate) {
|
|
297
324
|
const dep = update.package;
|
|
@@ -341,8 +368,8 @@ export default defineCommand({
|
|
|
341
368
|
"utf8"
|
|
342
369
|
);
|
|
343
370
|
relinka("success", `Updated ${toUpdate.length} dependencies in package.json`);
|
|
344
|
-
if (typeof Bun !== "undefined") {
|
|
345
|
-
await $`bun install`;
|
|
371
|
+
if (typeof Bun !== "undefined" && !args["no-install"]) {
|
|
372
|
+
await $`bun install --linker ${effectiveLinker}`;
|
|
346
373
|
if (packageJson.scripts?.check && args["with-check-script"]) {
|
|
347
374
|
await $`bun check`;
|
|
348
375
|
}
|
package/bin/app/x/cmd.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* USAGE EXAMPLES:
|
|
3
|
-
* - dler x install package-name - installs a package
|
|
4
|
-
* - dler x remove package-name - removes a package
|
|
5
3
|
* - dler x detect - detects the package manager
|
|
6
|
-
* - dler x dedupe - deduplicates dependencies
|
|
7
4
|
* - dler x run script-name - runs a script
|
|
8
5
|
* - dler x exec --target 'bun run build' - executes a command
|
|
6
|
+
* - dler x package-name - runs a package directly (like bunx/npx)
|
|
7
|
+
* - dler x package-name --args arg1 arg2 - runs a package with arguments
|
|
8
|
+
* - dler x package-name --bun - force using bunx even if different PM detected
|
|
9
|
+
* - dler x prettier --npm --yes - force using npx with auto-confirm
|
|
9
10
|
*/
|
|
10
11
|
declare const _default: import("@reliverse/rempts").Command<{
|
|
11
12
|
action: {
|
|
@@ -18,31 +19,14 @@ declare const _default: import("@reliverse/rempts").Command<{
|
|
|
18
19
|
description: string;
|
|
19
20
|
required: false;
|
|
20
21
|
};
|
|
21
|
-
global: {
|
|
22
|
-
type: "boolean";
|
|
23
|
-
alias: string;
|
|
24
|
-
description: string;
|
|
25
|
-
};
|
|
26
|
-
"frozen-lockfile": {
|
|
27
|
-
type: "boolean";
|
|
28
|
-
description: string;
|
|
29
|
-
};
|
|
30
22
|
cwd: {
|
|
31
23
|
type: "string";
|
|
32
24
|
description: string;
|
|
33
25
|
};
|
|
34
|
-
workspace: {
|
|
35
|
-
type: "boolean";
|
|
36
|
-
description: string;
|
|
37
|
-
};
|
|
38
26
|
silent: {
|
|
39
27
|
type: "boolean";
|
|
40
28
|
description: string;
|
|
41
29
|
};
|
|
42
|
-
recreateLockFile: {
|
|
43
|
-
type: "boolean";
|
|
44
|
-
description: string;
|
|
45
|
-
};
|
|
46
30
|
target: {
|
|
47
31
|
type: "string";
|
|
48
32
|
description: string;
|
|
@@ -56,32 +40,35 @@ declare const _default: import("@reliverse/rempts").Command<{
|
|
|
56
40
|
description: string;
|
|
57
41
|
default: true;
|
|
58
42
|
};
|
|
59
|
-
|
|
43
|
+
args: {
|
|
60
44
|
type: "string";
|
|
61
45
|
description: string;
|
|
62
46
|
};
|
|
63
|
-
|
|
64
|
-
type: "
|
|
47
|
+
global: {
|
|
48
|
+
type: "boolean";
|
|
49
|
+
alias: string;
|
|
65
50
|
description: string;
|
|
66
|
-
default: string;
|
|
67
51
|
};
|
|
68
|
-
|
|
52
|
+
yes: {
|
|
69
53
|
type: "boolean";
|
|
54
|
+
alias: string;
|
|
70
55
|
description: string;
|
|
71
56
|
};
|
|
72
|
-
|
|
57
|
+
bun: {
|
|
73
58
|
type: "boolean";
|
|
74
59
|
description: string;
|
|
75
60
|
};
|
|
76
|
-
|
|
77
|
-
type: "
|
|
61
|
+
npm: {
|
|
62
|
+
type: "boolean";
|
|
63
|
+
description: string;
|
|
64
|
+
};
|
|
65
|
+
pnpm: {
|
|
66
|
+
type: "boolean";
|
|
78
67
|
description: string;
|
|
79
|
-
default: string;
|
|
80
68
|
};
|
|
81
|
-
|
|
69
|
+
yarn: {
|
|
82
70
|
type: "boolean";
|
|
83
71
|
description: string;
|
|
84
|
-
default: false;
|
|
85
72
|
};
|
|
86
73
|
}>;
|
|
87
74
|
export default _default;
|
package/bin/app/x/cmd.js
CHANGED
|
@@ -1,143 +1,110 @@
|
|
|
1
1
|
import path from "@reliverse/pathkit";
|
|
2
2
|
import { relinka } from "@reliverse/relinka";
|
|
3
|
-
import {
|
|
4
|
-
defineArgs,
|
|
5
|
-
defineCommand,
|
|
6
|
-
multiselectPrompt,
|
|
7
|
-
runCmd,
|
|
8
|
-
selectPrompt
|
|
9
|
-
} from "@reliverse/rempts";
|
|
10
|
-
import { getCheckCmd } from "../cmds.js";
|
|
3
|
+
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
11
4
|
import { x } from "../../libs/sdk/sdk-impl/utils/exec/exec-mod.js";
|
|
12
|
-
import {
|
|
13
|
-
import { initFile, initFiles } from "../../libs/sdk/sdk-impl/utils/init/init-impl.js";
|
|
14
|
-
import {
|
|
15
|
-
addDependency,
|
|
16
|
-
dedupeDependencies,
|
|
17
|
-
updateDependencies,
|
|
18
|
-
installDependencies,
|
|
19
|
-
removeDependency,
|
|
20
|
-
runScript
|
|
21
|
-
} from "../../libs/sdk/sdk-impl/utils/pm/pm-api.js";
|
|
5
|
+
import { runScript } from "../../libs/sdk/sdk-impl/utils/pm/pm-api.js";
|
|
22
6
|
import { detectPackageManager } from "../../libs/sdk/sdk-impl/utils/pm/pm-detect.js";
|
|
23
7
|
export default defineCommand({
|
|
24
8
|
meta: {
|
|
25
9
|
name: "x",
|
|
26
10
|
version: "1.1.0",
|
|
27
|
-
description: "
|
|
11
|
+
description: "Utility command executor and package runner. Usage example: `dler x detect` or `dler x package-name` (like bunx/npx)"
|
|
28
12
|
},
|
|
29
13
|
args: defineArgs({
|
|
30
14
|
action: {
|
|
31
15
|
type: "string",
|
|
32
|
-
description: "Action to perform:
|
|
16
|
+
description: "Action to perform: detect, run, exec, or package name to run directly",
|
|
33
17
|
required: true
|
|
34
18
|
},
|
|
35
19
|
name: {
|
|
36
20
|
type: "positional",
|
|
37
|
-
description: "
|
|
21
|
+
description: "Script name (for run action) or additional arguments",
|
|
38
22
|
required: false
|
|
39
23
|
},
|
|
40
|
-
global: {
|
|
41
|
-
type: "boolean",
|
|
42
|
-
alias: "g",
|
|
43
|
-
description: "Add globally"
|
|
44
|
-
},
|
|
45
|
-
"frozen-lockfile": {
|
|
46
|
-
type: "boolean",
|
|
47
|
-
description: "Install dependencies with frozen lock file"
|
|
48
|
-
},
|
|
49
24
|
cwd: {
|
|
50
25
|
type: "string",
|
|
51
26
|
description: "Current working directory"
|
|
52
27
|
},
|
|
53
|
-
workspace: {
|
|
54
|
-
type: "boolean",
|
|
55
|
-
description: "Add to workspace"
|
|
56
|
-
},
|
|
57
28
|
silent: {
|
|
58
29
|
type: "boolean",
|
|
59
30
|
description: "Run in silent mode"
|
|
60
31
|
},
|
|
61
|
-
recreateLockFile: {
|
|
62
|
-
type: "boolean",
|
|
63
|
-
description: "Recreate lock file (for dedupe)"
|
|
64
|
-
},
|
|
65
32
|
target: {
|
|
66
33
|
type: "string",
|
|
67
34
|
description: "Command to execute (for exec action)"
|
|
68
35
|
},
|
|
69
36
|
timeout: {
|
|
70
37
|
type: "number",
|
|
71
|
-
description: "Timeout in milliseconds
|
|
38
|
+
description: "Timeout in milliseconds"
|
|
72
39
|
},
|
|
73
40
|
throwOnError: {
|
|
74
41
|
type: "boolean",
|
|
75
42
|
description: "Throw error if command fails",
|
|
76
43
|
default: true
|
|
77
44
|
},
|
|
78
|
-
|
|
45
|
+
args: {
|
|
79
46
|
type: "string",
|
|
80
|
-
description: "
|
|
47
|
+
description: "Additional arguments to pass to the package (space-separated)"
|
|
81
48
|
},
|
|
82
|
-
|
|
83
|
-
type: "
|
|
84
|
-
|
|
85
|
-
|
|
49
|
+
global: {
|
|
50
|
+
type: "boolean",
|
|
51
|
+
alias: "g",
|
|
52
|
+
description: "Use global package manager execution"
|
|
86
53
|
},
|
|
87
|
-
|
|
54
|
+
yes: {
|
|
88
55
|
type: "boolean",
|
|
89
|
-
|
|
56
|
+
alias: "y",
|
|
57
|
+
description: "Automatically confirm package installation if needed"
|
|
90
58
|
},
|
|
91
|
-
|
|
59
|
+
bun: {
|
|
92
60
|
type: "boolean",
|
|
93
|
-
description: "
|
|
61
|
+
description: "Force using bunx (overrides package manager detection)"
|
|
94
62
|
},
|
|
95
|
-
|
|
96
|
-
type: "
|
|
97
|
-
description: "
|
|
98
|
-
|
|
63
|
+
npm: {
|
|
64
|
+
type: "boolean",
|
|
65
|
+
description: "Force using npx (overrides package manager detection)"
|
|
66
|
+
},
|
|
67
|
+
pnpm: {
|
|
68
|
+
type: "boolean",
|
|
69
|
+
description: "Force using pnpx (overrides package manager detection)"
|
|
99
70
|
},
|
|
100
|
-
|
|
71
|
+
yarn: {
|
|
101
72
|
type: "boolean",
|
|
102
|
-
description: "
|
|
103
|
-
default: false
|
|
73
|
+
description: "Force using yarn dlx (overrides package manager detection)"
|
|
104
74
|
}
|
|
105
75
|
}),
|
|
106
76
|
async run({ args }) {
|
|
107
|
-
console.log("DEBUG: x command starting with args:", args);
|
|
108
77
|
const {
|
|
109
78
|
action,
|
|
110
79
|
name,
|
|
111
80
|
target,
|
|
112
81
|
timeout,
|
|
113
82
|
throwOnError,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
83
|
+
args: packageArgs,
|
|
84
|
+
global,
|
|
85
|
+
yes,
|
|
86
|
+
bun,
|
|
87
|
+
npm,
|
|
88
|
+
pnpm,
|
|
89
|
+
yarn,
|
|
120
90
|
...options
|
|
121
91
|
} = args;
|
|
92
|
+
const builtInActions = ["detect", "run", "exec"];
|
|
93
|
+
const isBuiltInAction = builtInActions.includes(action);
|
|
94
|
+
if (!isBuiltInAction) {
|
|
95
|
+
await runPackage({
|
|
96
|
+
packageName: action,
|
|
97
|
+
packageArgs: name ? [name, ...packageArgs?.split(/\s+/) || []] : packageArgs?.split(/\s+/) || [],
|
|
98
|
+
cwd: options.cwd,
|
|
99
|
+
timeout,
|
|
100
|
+
throwOnError,
|
|
101
|
+
global,
|
|
102
|
+
yes,
|
|
103
|
+
forcePm: { bun, npm, pnpm, yarn }
|
|
104
|
+
});
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
122
107
|
switch (action) {
|
|
123
|
-
case "install":
|
|
124
|
-
case "i":
|
|
125
|
-
case "add":
|
|
126
|
-
console.log("DEBUG: install case, name:", name, "options:", options);
|
|
127
|
-
await (name ? addDependency(name, options) : installDependencies(options));
|
|
128
|
-
break;
|
|
129
|
-
case "remove":
|
|
130
|
-
case "rm":
|
|
131
|
-
case "uninstall":
|
|
132
|
-
case "un":
|
|
133
|
-
case "delete":
|
|
134
|
-
case "del":
|
|
135
|
-
if (!name) {
|
|
136
|
-
relinka.error("Package name is required for remove action");
|
|
137
|
-
return process.exit(1);
|
|
138
|
-
}
|
|
139
|
-
await removeDependency(name, options);
|
|
140
|
-
break;
|
|
141
108
|
case "detect": {
|
|
142
109
|
const cwd = path.resolve(options.cwd || ".");
|
|
143
110
|
const packageManager = await detectPackageManager(cwd);
|
|
@@ -155,10 +122,6 @@ export default defineCommand({
|
|
|
155
122
|
);
|
|
156
123
|
break;
|
|
157
124
|
}
|
|
158
|
-
case "dedupe": {
|
|
159
|
-
await dedupeDependencies(options);
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
162
125
|
case "run": {
|
|
163
126
|
if (!name) {
|
|
164
127
|
relinka.error("Script name is required for run action");
|
|
@@ -207,62 +170,95 @@ export default defineCommand({
|
|
|
207
170
|
}
|
|
208
171
|
break;
|
|
209
172
|
}
|
|
210
|
-
case "init": {
|
|
211
|
-
const concurrencyNum = Number(concurrency);
|
|
212
|
-
if (fileType && !FILE_TYPES.find((ft) => ft.type === fileType)) {
|
|
213
|
-
throw new Error(`Invalid file type: ${fileType}`);
|
|
214
|
-
}
|
|
215
|
-
const effectiveFileType = fileType;
|
|
216
|
-
if (multiple) {
|
|
217
|
-
const possibleTypes = FILE_TYPES.map((ft) => ft.type);
|
|
218
|
-
const chosen = await multiselectPrompt({
|
|
219
|
-
title: "Select file types to initialize",
|
|
220
|
-
options: possibleTypes.map((pt) => ({ label: pt, value: pt }))
|
|
221
|
-
});
|
|
222
|
-
if (chosen.length === 0) {
|
|
223
|
-
relinka("log", "No file types selected. Exiting...");
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
const requests = chosen.map((ct) => ({
|
|
227
|
-
fileType: ct,
|
|
228
|
-
destDir
|
|
229
|
-
}));
|
|
230
|
-
const results = await initFiles(requests, {
|
|
231
|
-
parallel,
|
|
232
|
-
concurrency: concurrencyNum
|
|
233
|
-
});
|
|
234
|
-
relinka("verbose", `Multiple files result: ${JSON.stringify(results)}`);
|
|
235
|
-
} else {
|
|
236
|
-
let finalFileType = effectiveFileType;
|
|
237
|
-
if (!finalFileType) {
|
|
238
|
-
const possibleTypes = FILE_TYPES.map((ft) => ft.type);
|
|
239
|
-
const picked = await selectPrompt({
|
|
240
|
-
title: "Pick a file type to initialize",
|
|
241
|
-
options: possibleTypes.map((pt) => ({ label: pt, value: pt }))
|
|
242
|
-
});
|
|
243
|
-
finalFileType = picked;
|
|
244
|
-
}
|
|
245
|
-
const result = await initFile({
|
|
246
|
-
fileType: finalFileType,
|
|
247
|
-
destDir
|
|
248
|
-
});
|
|
249
|
-
relinka("verbose", `Single file result: ${JSON.stringify(result)}`);
|
|
250
|
-
}
|
|
251
|
-
break;
|
|
252
|
-
}
|
|
253
|
-
case "latest": {
|
|
254
|
-
await updateDependencies(true, options);
|
|
255
|
-
if (linter) {
|
|
256
|
-
const checkCmd = await getCheckCmd();
|
|
257
|
-
await runCmd(checkCmd, ["--no-exit", "--no-progress"]);
|
|
258
|
-
}
|
|
259
|
-
break;
|
|
260
|
-
}
|
|
261
173
|
default: {
|
|
262
174
|
relinka.error(`Unknown action: ${action}`);
|
|
263
|
-
relinka.log("Available actions:
|
|
175
|
+
relinka.log("Available actions: detect, run, exec, or package name to run directly");
|
|
264
176
|
return process.exit(1);
|
|
265
177
|
}
|
|
266
178
|
}
|
|
267
179
|
}
|
|
268
180
|
});
|
|
181
|
+
async function runPackage({
|
|
182
|
+
packageName,
|
|
183
|
+
packageArgs,
|
|
184
|
+
cwd,
|
|
185
|
+
timeout,
|
|
186
|
+
throwOnError,
|
|
187
|
+
global,
|
|
188
|
+
yes,
|
|
189
|
+
forcePm
|
|
190
|
+
}) {
|
|
191
|
+
try {
|
|
192
|
+
const workingDir = cwd ? path.resolve(cwd) : process.cwd();
|
|
193
|
+
let pmName;
|
|
194
|
+
const forcedPmFlags = Object.entries(forcePm).filter(([_, isForced]) => isForced);
|
|
195
|
+
if (forcedPmFlags.length > 1) {
|
|
196
|
+
relinka.error(
|
|
197
|
+
"Multiple package manager flags specified. Use only one: --bun, --npm, --pnpm, or --yarn"
|
|
198
|
+
);
|
|
199
|
+
return process.exit(1);
|
|
200
|
+
}
|
|
201
|
+
if (forcedPmFlags.length === 1) {
|
|
202
|
+
pmName = forcedPmFlags[0][0];
|
|
203
|
+
relinka.log(`Forcing package manager: ${pmName}`);
|
|
204
|
+
} else {
|
|
205
|
+
const packageManager = await detectPackageManager(workingDir);
|
|
206
|
+
if (!packageManager) {
|
|
207
|
+
relinka.warn("Cannot detect package manager. Defaulting to npm.");
|
|
208
|
+
pmName = "npm";
|
|
209
|
+
} else {
|
|
210
|
+
pmName = packageManager.name;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
let runCommand;
|
|
214
|
+
switch (pmName) {
|
|
215
|
+
case "bun":
|
|
216
|
+
runCommand = ["bunx"];
|
|
217
|
+
break;
|
|
218
|
+
case "pnpm":
|
|
219
|
+
runCommand = ["pnpx", "dlx"];
|
|
220
|
+
break;
|
|
221
|
+
case "yarn":
|
|
222
|
+
runCommand = ["yarn", "dlx"];
|
|
223
|
+
break;
|
|
224
|
+
case "npm":
|
|
225
|
+
runCommand = ["npx"];
|
|
226
|
+
break;
|
|
227
|
+
default:
|
|
228
|
+
runCommand = ["npx"];
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
if (global && pmName !== "yarn") {
|
|
232
|
+
runCommand.push("--global");
|
|
233
|
+
}
|
|
234
|
+
if (yes && (pmName === "npm" || pmName === "pnpm")) {
|
|
235
|
+
runCommand.push("--yes");
|
|
236
|
+
}
|
|
237
|
+
runCommand.push(packageName);
|
|
238
|
+
runCommand.push(...packageArgs);
|
|
239
|
+
relinka.log(`Running package: ${packageName}`);
|
|
240
|
+
relinka.log(`Using command: ${runCommand.join(" ")}`);
|
|
241
|
+
const result = x(runCommand[0], runCommand.slice(1), {
|
|
242
|
+
nodeOptions: {
|
|
243
|
+
cwd: workingDir,
|
|
244
|
+
stdio: "inherit"
|
|
245
|
+
},
|
|
246
|
+
timeout,
|
|
247
|
+
throwOnError
|
|
248
|
+
});
|
|
249
|
+
const output = await result;
|
|
250
|
+
if (output.exitCode === 0) {
|
|
251
|
+
relinka.success(`Successfully ran package: ${packageName}`);
|
|
252
|
+
} else {
|
|
253
|
+
relinka.warn(`Package exited with code: ${output.exitCode}`);
|
|
254
|
+
if (throwOnError) {
|
|
255
|
+
return process.exit(output.exitCode || 1);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
} catch (error) {
|
|
259
|
+
relinka.error(
|
|
260
|
+
`Failed to run package: ${error instanceof Error ? error.message : String(error)}`
|
|
261
|
+
);
|
|
262
|
+
return process.exit(1);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { RseConfig } from "./rse-types";
|
|
2
2
|
export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
|
|
3
|
+
version?: string | undefined;
|
|
3
4
|
$schema?: "./schema.json" | "https://reliverse.org/schema.json" | undefined;
|
|
4
5
|
projectName?: string | undefined;
|
|
5
6
|
projectAuthor?: string | undefined;
|
|
6
7
|
projectDescription?: string | undefined;
|
|
7
|
-
version?: string | undefined;
|
|
8
8
|
projectLicense?: string | undefined;
|
|
9
9
|
projectRepository?: string | undefined;
|
|
10
10
|
projectDomain?: string | undefined;
|
|
@@ -14,11 +14,10 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
|
|
|
14
14
|
projectState?: "creating" | "created" | undefined;
|
|
15
15
|
projectCategory?: "browser" | "cli" | "unknown" | "website" | "vscode" | "library" | "mobile" | undefined;
|
|
16
16
|
projectSubcategory?: "unknown" | "e-commerce" | "tool" | undefined;
|
|
17
|
-
projectFramework?: "
|
|
17
|
+
projectFramework?: "vue" | "unknown" | "vscode" | "nextjs" | "vite" | "svelte" | "remix" | "astro" | "nuxt" | "solid" | "qwik" | "wxt" | "lynx" | "react-native" | "expo" | "capacitor" | "ionic" | "electron" | "tauri" | "neutralino" | "rempts" | "citty" | "commander" | "cac" | "meow" | "yargs" | "webextension" | "browser-extension" | "npm-jsr" | undefined;
|
|
18
18
|
projectTemplate?: "unknown" | "blefnk/relivator-nextjs-template" | "blefnk/relivator-docker-template" | "blefnk/next-react-ts-src-minimal" | "blefnk/all-in-one-nextjs-template" | "blefnk/create-t3-app" | "blefnk/create-next-app" | "blefnk/astro-starlight-template" | "blefnk/versator-nextjs-template" | "blefnk/relivator-lynxjs-template" | "blefnk/relivator-react-native-template" | "reliverse/template-browser-extension" | "microsoft/vscode-extension-samples" | "microsoft/vscode-extension-template" | "rsetarter-template" | "blefnk/deno-cli-tutorial" | undefined;
|
|
19
19
|
projectTemplateDate?: string | undefined;
|
|
20
20
|
features?: {
|
|
21
|
-
commands?: string[] | undefined;
|
|
22
21
|
i18n?: boolean | undefined;
|
|
23
22
|
analytics?: boolean | undefined;
|
|
24
23
|
themeMode?: "light" | "dark" | "dark-light" | undefined;
|
|
@@ -28,6 +27,7 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
|
|
|
28
27
|
testing?: boolean | undefined;
|
|
29
28
|
docker?: boolean | undefined;
|
|
30
29
|
ci?: boolean | undefined;
|
|
30
|
+
commands?: string[] | undefined;
|
|
31
31
|
webview?: string[] | undefined;
|
|
32
32
|
language?: string[] | undefined;
|
|
33
33
|
themes?: string[] | undefined;
|
|
@@ -40,7 +40,7 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
|
|
|
40
40
|
testing?: "bun" | "unknown" | "vitest" | "jest" | "playwright" | "cypress" | undefined;
|
|
41
41
|
stateManagement?: "unknown" | "zustand" | "jotai" | "redux-toolkit" | undefined;
|
|
42
42
|
formManagement?: "unknown" | "react-hook-form" | "formik" | undefined;
|
|
43
|
-
styling?: "unknown" | "tailwind" | "styled-components" | "css-modules" |
|
|
43
|
+
styling?: "sass" | "unknown" | "tailwind" | "styled-components" | "css-modules" | undefined;
|
|
44
44
|
uiComponents?: "unknown" | "shadcn-ui" | "chakra-ui" | "material-ui" | undefined;
|
|
45
45
|
databaseLibrary?: "unknown" | "drizzle" | "prisma" | "supabase" | undefined;
|
|
46
46
|
databaseProvider?: "unknown" | "pg" | "mysql" | "sqlite" | "mongodb" | undefined;
|
|
@@ -83,7 +83,7 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
|
|
|
83
83
|
dontRemoveComments?: boolean | undefined;
|
|
84
84
|
shouldAddComments?: boolean | undefined;
|
|
85
85
|
typeOrInterface?: "type" | "interface" | "mixed" | undefined;
|
|
86
|
-
importOrRequire?: "
|
|
86
|
+
importOrRequire?: "import" | "require" | "mixed" | undefined;
|
|
87
87
|
cjsToEsm?: boolean | undefined;
|
|
88
88
|
modernize?: {
|
|
89
89
|
replaceFs?: boolean | undefined;
|
|
@@ -96,7 +96,7 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
|
|
|
96
96
|
importSymbol?: string | undefined;
|
|
97
97
|
} | undefined;
|
|
98
98
|
monorepo?: {
|
|
99
|
-
type?: "none" | "bun" | "
|
|
99
|
+
type?: "none" | "bun" | "pnpm" | "turborepo" | "nx" | undefined;
|
|
100
100
|
packages?: string[] | undefined;
|
|
101
101
|
sharedPackages?: string[] | undefined;
|
|
102
102
|
} | undefined;
|
|
@@ -5,3 +5,11 @@ import type { DlerConfig } from "./types.js";
|
|
|
5
5
|
* Uses jiti for seamless TypeScript and ESM support.
|
|
6
6
|
*/
|
|
7
7
|
export declare function getConfigDler(): Promise<DlerConfig>;
|
|
8
|
+
/**
|
|
9
|
+
* Searches for and loads bunfig.toml configuration files.
|
|
10
|
+
* Checks both local (project root) and global locations.
|
|
11
|
+
* Merges configurations with local overriding global.
|
|
12
|
+
*
|
|
13
|
+
* @returns The merged bunfig configuration or null if no config found
|
|
14
|
+
*/
|
|
15
|
+
export declare function getConfigBunfig(): Promise<Record<string, any> | null>;
|
|
@@ -31,3 +31,57 @@ export async function getConfigDler() {
|
|
|
31
31
|
relinka("log", `Config file not found at ${configPath}. Using default configuration.`);
|
|
32
32
|
return defineConfigDler();
|
|
33
33
|
}
|
|
34
|
+
export async function getConfigBunfig() {
|
|
35
|
+
const cwd = process.cwd();
|
|
36
|
+
const homeDir = process.env.HOME || process.env.USERPROFILE || "";
|
|
37
|
+
const xdgConfigHome = process.env.XDG_CONFIG_HOME;
|
|
38
|
+
const localPaths = [resolve(cwd, "bunfig.toml"), resolve(cwd, ".bunfig.toml")];
|
|
39
|
+
const globalPaths = [
|
|
40
|
+
...homeDir ? [resolve(homeDir, ".bunfig.toml")] : [],
|
|
41
|
+
...xdgConfigHome ? [resolve(xdgConfigHome, ".bunfig.toml")] : []
|
|
42
|
+
];
|
|
43
|
+
let globalConfig = {};
|
|
44
|
+
let localConfig = {};
|
|
45
|
+
for (const configPath of globalPaths) {
|
|
46
|
+
if (await fs.pathExists(configPath)) {
|
|
47
|
+
try {
|
|
48
|
+
const configContent = await fs.readFile(configPath, "utf-8");
|
|
49
|
+
let config;
|
|
50
|
+
if (typeof Bun !== "undefined") {
|
|
51
|
+
config = Bun.TOML.parse(configContent);
|
|
52
|
+
} else {
|
|
53
|
+
throw new Error(
|
|
54
|
+
"TOML parsing requires Bun runtime. Please run with Bun to load bunfig.toml files."
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
globalConfig = { ...globalConfig, ...config };
|
|
58
|
+
} catch (error) {
|
|
59
|
+
relinka("error", `Error loading global bunfig from ${configPath}:`, error);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
for (const configPath of localPaths) {
|
|
64
|
+
if (await fs.pathExists(configPath)) {
|
|
65
|
+
try {
|
|
66
|
+
const configContent = await fs.readFile(configPath, "utf-8");
|
|
67
|
+
let config;
|
|
68
|
+
if (typeof Bun !== "undefined") {
|
|
69
|
+
config = Bun.TOML.parse(configContent);
|
|
70
|
+
} else {
|
|
71
|
+
throw new Error(
|
|
72
|
+
"TOML parsing requires Bun runtime. Please run with Bun to load bunfig.toml files."
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
localConfig = { ...localConfig, ...config };
|
|
76
|
+
break;
|
|
77
|
+
} catch (error) {
|
|
78
|
+
relinka("error", `Error loading local bunfig from ${configPath}:`, error);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const mergedConfig = { ...globalConfig, ...localConfig };
|
|
83
|
+
if (Object.keys(mergedConfig).length === 0) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
return mergedConfig;
|
|
87
|
+
}
|