@reliverse/dler 2.0.28 → 2.0.40
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 +6 -4
- package/dist/cmds/build/cmd.js +82 -5
- package/dist/cmds/clean/cmd.js +5 -3
- package/dist/cmds/clean/impl.js +8 -21
- package/dist/cmds/init/cmd.js +0 -2
- package/dist/cmds/integrate/utils/context.js +1 -1
- package/dist/cmds/perf/impl.js +1 -7
- package/dist/cmds/port/impl.js +37 -13
- package/dist/cmds/publish/cmd.js +1 -3
- package/dist/cmds/senv/cmd.js +59 -16
- package/dist/cmds/tsc/impl.js +6 -1
- package/dist/cmds/update/cmd.js +4 -8
- package/dist/cmds/update/impl.js +4 -8
- package/dist/cmds/update/utils.js +5 -11
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
```bash
|
|
10
10
|
# install as a dev dep:
|
|
11
11
|
bun add -D @reliverse/dler
|
|
12
|
-
# or
|
|
12
|
+
# or/and install globally:
|
|
13
13
|
bun i -g @reliverse/dler
|
|
14
14
|
```
|
|
15
15
|
|
|
@@ -63,9 +63,11 @@ All `@reliverse/dler` v2+ commands support both monorepo (recommended) and singl
|
|
|
63
63
|
4. `dler integrate` automatically installs and configures integrations like Next.js, Ultracite/Biome, etc.
|
|
64
64
|
5. `dler perf` runs performance benchmarks for the requested target.
|
|
65
65
|
6. `dler publish` publishes all packages to npm and jsr (soon). Handles version bumping, and different validations. Supports dler.ts configuration for per-package settings.
|
|
66
|
-
7. `dler
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
7. `dler senv` helps you manage system environment variables easily. Example: `dler senv --action append --name Path --value C:\Users\your-user-name\.local\bin` (on Windows it automates the following steps: System Properties →
|
|
67
|
+
Environment Variables → Edit User PATH → New → Add the path). The command is especially useful for Windows users, when you have too many vars so OS will not allow you to add more.
|
|
68
|
+
8. `dler shell` uses Bun's `$`, making it handy for running cross-platform custom terminal commands.
|
|
69
|
+
9. `dler tsc` finds TypeScript errors across all monorepo packages and shows only real ones (unlike the native `tsc`, which sometimes shows errors of its dependencies). It also has a `--copy-logs` flag that copies errors/warnings straight to your clipboard (with an inserted prompt for fixing them), so you can just hit Ctrl/Cmd+V and send it to AI.
|
|
70
|
+
10. `dler update` updates the dependencies of all packages to the latest version (yes, even across the monorepo).
|
|
69
71
|
|
|
70
72
|
## v2 Docs
|
|
71
73
|
|
package/dist/cmds/build/cmd.js
CHANGED
|
@@ -1,18 +1,38 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
applyPresets,
|
|
3
|
+
runBuildOnAllPackages,
|
|
4
|
+
validateAndExit
|
|
5
|
+
} from "@reliverse/dler-build";
|
|
6
|
+
import { replaceExportsInPackages } from "@reliverse/dler-helpers";
|
|
2
7
|
import {
|
|
3
8
|
defineCmd,
|
|
4
9
|
defineCmdArgs,
|
|
5
10
|
defineCmdCfg
|
|
6
11
|
} from "@reliverse/dler-launcher";
|
|
7
12
|
import { logger } from "@reliverse/dler-logger";
|
|
8
|
-
import { replaceExportsInPackages } from "@reliverse/dler-helpers";
|
|
9
13
|
const buildCmd = async (args) => {
|
|
10
14
|
try {
|
|
11
15
|
if (typeof process.versions.bun === "undefined") {
|
|
12
16
|
logger.error("\u274C This command requires Bun runtime. Sorry.");
|
|
13
17
|
process.exit(1);
|
|
14
18
|
}
|
|
15
|
-
const
|
|
19
|
+
const goOptions = {};
|
|
20
|
+
if (args.goProvider) goOptions.provider = args.goProvider;
|
|
21
|
+
if (args.goTargets) {
|
|
22
|
+
goOptions.targets = args.goTargets;
|
|
23
|
+
}
|
|
24
|
+
if (args.goOutputDir) goOptions.outputDir = args.goOutputDir;
|
|
25
|
+
if (args.goOutputName) goOptions.outputName = args.goOutputName;
|
|
26
|
+
if (args.goBuildMode) goOptions.buildMode = args.goBuildMode;
|
|
27
|
+
if (args.goLdflags) goOptions.ldflags = args.goLdflags;
|
|
28
|
+
if (args.goMainFile) goOptions.mainFile = args.goMainFile;
|
|
29
|
+
if (args.goVersion) goOptions.goVersion = args.goVersion;
|
|
30
|
+
if (args.goEnable !== void 0) goOptions.enable = args.goEnable;
|
|
31
|
+
const buildOptionsInput = { ...args };
|
|
32
|
+
if (Object.keys(goOptions).length > 0) {
|
|
33
|
+
buildOptionsInput.go = goOptions;
|
|
34
|
+
}
|
|
35
|
+
const buildOptions = applyPresets(buildOptionsInput);
|
|
16
36
|
validateAndExit(buildOptions);
|
|
17
37
|
const results = await runBuildOnAllPackages(args.ignore, args.cwd, {
|
|
18
38
|
...buildOptions,
|
|
@@ -24,7 +44,9 @@ const buildCmd = async (args) => {
|
|
|
24
44
|
const shouldReplaceExports = args.replaceExports === true;
|
|
25
45
|
if (shouldReplaceExports && !buildOptions.watch) {
|
|
26
46
|
if (args.verbose) {
|
|
27
|
-
logger.info(
|
|
47
|
+
logger.info(
|
|
48
|
+
"\n\u{1F4DD} Replacing exports from ./src/*.ts to ./dist/*.js after build..."
|
|
49
|
+
);
|
|
28
50
|
}
|
|
29
51
|
await replaceExportsInPackages({
|
|
30
52
|
direction: "ts-to-js",
|
|
@@ -411,6 +433,43 @@ const buildCmdArgs = defineCmdArgs({
|
|
|
411
433
|
allowPrivateBuild: {
|
|
412
434
|
type: "string",
|
|
413
435
|
description: "Allow building private packages (supports wildcards like @reliverse/* to build all packages starting with @reliverse/)"
|
|
436
|
+
},
|
|
437
|
+
// Go build options
|
|
438
|
+
goEnable: {
|
|
439
|
+
type: "boolean",
|
|
440
|
+
description: "Enable Go build (default: auto-detected if .go files exist)"
|
|
441
|
+
},
|
|
442
|
+
goProvider: {
|
|
443
|
+
type: "string",
|
|
444
|
+
description: "Go build provider: xgo (cross-compilation) or native (default: xgo)"
|
|
445
|
+
},
|
|
446
|
+
goTargets: {
|
|
447
|
+
type: "string",
|
|
448
|
+
description: "Go build targets (e.g., 'linux/amd64' or 'linux/amd64,windows/amd64')"
|
|
449
|
+
},
|
|
450
|
+
goOutputDir: {
|
|
451
|
+
type: "string",
|
|
452
|
+
description: "Go binary output directory (default: release)"
|
|
453
|
+
},
|
|
454
|
+
goOutputName: {
|
|
455
|
+
type: "string",
|
|
456
|
+
description: "Go binary name prefix (default: derived from package name)"
|
|
457
|
+
},
|
|
458
|
+
goBuildMode: {
|
|
459
|
+
type: "string",
|
|
460
|
+
description: "Go build mode: c-shared, c-archive, or exe (default: c-shared)"
|
|
461
|
+
},
|
|
462
|
+
goLdflags: {
|
|
463
|
+
type: "string",
|
|
464
|
+
description: "Go linker flags (default: '-s -w')"
|
|
465
|
+
},
|
|
466
|
+
goMainFile: {
|
|
467
|
+
type: "string",
|
|
468
|
+
description: "Main Go file to build (default: main.go)"
|
|
469
|
+
},
|
|
470
|
+
goVersion: {
|
|
471
|
+
type: "string",
|
|
472
|
+
description: "Go version for xgo (default: 1.20.3)"
|
|
414
473
|
}
|
|
415
474
|
});
|
|
416
475
|
const buildCmdCfg = defineCmdCfg({
|
|
@@ -544,7 +603,25 @@ const buildCmdCfg = defineCmdCfg({
|
|
|
544
603
|
"",
|
|
545
604
|
"# Note: dts-bundle-generator is the default provider for better bundling",
|
|
546
605
|
"# mkdist provider offers VFS-based processing with automatic relative import resolution",
|
|
547
|
-
"# Use --dtsProvider to override the default provider"
|
|
606
|
+
"# Use --dtsProvider to override the default provider",
|
|
607
|
+
"",
|
|
608
|
+
"# Go Build Examples:",
|
|
609
|
+
"dler build --go-provider xgo",
|
|
610
|
+
"dler build --go-provider native",
|
|
611
|
+
"dler build --go-targets linux/amd64",
|
|
612
|
+
"dler build --go-targets 'linux/amd64,windows/amd64,darwin/arm64'",
|
|
613
|
+
"dler build --go-output-dir release",
|
|
614
|
+
"dler build --go-output-name my-binary",
|
|
615
|
+
"dler build --go-build-mode c-shared",
|
|
616
|
+
"dler build --go-ldflags '-s -w -X main.version=1.0.0'",
|
|
617
|
+
"dler build --go-main-file main.go",
|
|
618
|
+
"dler build --go-version 1.21.0",
|
|
619
|
+
"dler build --go-enable",
|
|
620
|
+
"",
|
|
621
|
+
"# Note: Go build is auto-detected if .go files exist in the package",
|
|
622
|
+
"# Use --go-enable to explicitly enable, or configure in dler.ts",
|
|
623
|
+
"# Use --go-provider xgo for cross-compilation (requires xgo installed)",
|
|
624
|
+
"# Use --go-provider native for native builds (limited cross-compilation)"
|
|
548
625
|
]
|
|
549
626
|
});
|
|
550
627
|
export default defineCmd(buildCmd, buildCmdArgs, buildCmdCfg);
|
package/dist/cmds/clean/cmd.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { replaceExportsInPackages } from "@reliverse/dler-helpers";
|
|
1
2
|
import {
|
|
2
3
|
defineCmd,
|
|
3
4
|
defineCmdArgs,
|
|
4
5
|
defineCmdCfg
|
|
5
6
|
} from "@reliverse/dler-launcher";
|
|
6
7
|
import { logger } from "@reliverse/dler-logger";
|
|
7
|
-
import { replaceExportsInPackages } from "@reliverse/dler-helpers";
|
|
8
8
|
import { runCleanOnAllPackages } from "./impl.js";
|
|
9
9
|
const cleanCmd = async (args) => {
|
|
10
10
|
try {
|
|
@@ -15,7 +15,9 @@ const cleanCmd = async (args) => {
|
|
|
15
15
|
const shouldReplaceExports = args.replaceExports !== false;
|
|
16
16
|
if (shouldReplaceExports) {
|
|
17
17
|
if (args.verbose) {
|
|
18
|
-
logger.info(
|
|
18
|
+
logger.info(
|
|
19
|
+
"\u{1F4DD} Replacing exports from ./dist/*.js to ./src/*.ts before cleaning..."
|
|
20
|
+
);
|
|
19
21
|
}
|
|
20
22
|
await replaceExportsInPackages({
|
|
21
23
|
direction: "js-to-ts",
|
|
@@ -71,7 +73,7 @@ const cleanCmdArgs = defineCmdArgs({
|
|
|
71
73
|
},
|
|
72
74
|
force: {
|
|
73
75
|
type: "boolean",
|
|
74
|
-
description: "
|
|
76
|
+
description: "Required flag to proceed with deletion (no prompts, args-only)"
|
|
75
77
|
},
|
|
76
78
|
verbose: {
|
|
77
79
|
type: "boolean",
|
package/dist/cmds/clean/impl.js
CHANGED
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
hasWorkspaces,
|
|
9
9
|
readPackageJSON
|
|
10
10
|
} from "@reliverse/dler-pkg-tsc";
|
|
11
|
-
import { confirmPrompt } from "@reliverse/dler-prompt";
|
|
12
11
|
import {
|
|
13
12
|
LOCK_FILE_PATTERNS,
|
|
14
13
|
mergePatterns,
|
|
@@ -201,8 +200,7 @@ const getCategoryForPattern = (pattern) => {
|
|
|
201
200
|
if (pattern.includes("dist")) return "build";
|
|
202
201
|
if (pattern.includes("_generated")) return "db";
|
|
203
202
|
if (pattern.includes(".basehub")) return "cms";
|
|
204
|
-
if (pattern.includes(".next") || pattern.includes(".expo"))
|
|
205
|
-
return "frontend";
|
|
203
|
+
if (pattern.includes(".next") || pattern.includes(".expo")) return "frontend";
|
|
206
204
|
if (pattern.includes(".source")) return "docs";
|
|
207
205
|
if (pattern.includes(".react-email")) return "email";
|
|
208
206
|
if (pattern.includes(".turbo") || pattern.includes(".vercel") || pattern.includes(".wrangler"))
|
|
@@ -362,14 +360,11 @@ const displayPreview = (results, lockFilesResult) => {
|
|
|
362
360
|
\u{1F4CA} Total: ${totalFiles} files (${formatBytes(totalSize)})`);
|
|
363
361
|
logger.log("\u2501".repeat(60));
|
|
364
362
|
};
|
|
365
|
-
const
|
|
366
|
-
if (force) {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
return await confirmPrompt("Proceed with deletion?", false);
|
|
371
|
-
} catch {
|
|
372
|
-
return false;
|
|
363
|
+
const checkForceFlag = (force) => {
|
|
364
|
+
if (!force) {
|
|
365
|
+
throw new Error(
|
|
366
|
+
"\u274C Deletion requires --force flag. Use --force to proceed with deletion."
|
|
367
|
+
);
|
|
373
368
|
}
|
|
374
369
|
};
|
|
375
370
|
export const runCleanOnAllPackages = async (ignore, cwd, options = {}) => {
|
|
@@ -422,11 +417,7 @@ export const runCleanOnAllPackages = async (ignore, cwd, options = {}) => {
|
|
|
422
417
|
{ deletedCount: 0, deletedSize: 0 }
|
|
423
418
|
);
|
|
424
419
|
if (!dryRun) {
|
|
425
|
-
|
|
426
|
-
if (!shouldProceed) {
|
|
427
|
-
logger.info("\u274C Clean cancelled by user");
|
|
428
|
-
process.exit(0);
|
|
429
|
-
}
|
|
420
|
+
checkForceFlag(force);
|
|
430
421
|
const { deletedCount, deletedSize: deletedSize2, errors } = await deleteFiles(
|
|
431
422
|
files,
|
|
432
423
|
dryRun
|
|
@@ -541,11 +532,7 @@ export const runCleanOnAllPackages = async (ignore, cwd, options = {}) => {
|
|
|
541
532
|
);
|
|
542
533
|
displayPreview(results, lockFilesResult);
|
|
543
534
|
if (!dryRun) {
|
|
544
|
-
|
|
545
|
-
if (!shouldProceed) {
|
|
546
|
-
logger.info("\u274C Clean cancelled by user");
|
|
547
|
-
process.exit(0);
|
|
548
|
-
}
|
|
535
|
+
checkForceFlag(force);
|
|
549
536
|
const cleanedResults = await pMap(
|
|
550
537
|
packages,
|
|
551
538
|
async (pkg) => cleanPackage(pkg, patterns, options),
|
package/dist/cmds/init/cmd.js
CHANGED
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
defineCmdCfg
|
|
6
6
|
} from "@reliverse/dler-launcher";
|
|
7
7
|
import { logger } from "@reliverse/dler-logger";
|
|
8
|
-
import { finalizePromptIO } from "@reliverse/dler-prompt";
|
|
9
8
|
import { $ } from "bun";
|
|
10
9
|
import {
|
|
11
10
|
generateAllPackages,
|
|
@@ -16,7 +15,6 @@ import { promptMonorepoConfig } from "./impl/prompts.js";
|
|
|
16
15
|
const initCmd = async () => {
|
|
17
16
|
try {
|
|
18
17
|
const config = await promptMonorepoConfig();
|
|
19
|
-
await finalizePromptIO();
|
|
20
18
|
logger.info("\n\u{1F528} Generating monorepo structure...\n");
|
|
21
19
|
await generateRootPackageJson(config);
|
|
22
20
|
await generateRootFiles(config);
|
|
@@ -107,7 +107,7 @@ export const selectTargetPackage = async (packages) => {
|
|
|
107
107
|
`Select target package (1-${packages.length})`,
|
|
108
108
|
"1"
|
|
109
109
|
);
|
|
110
|
-
const index = parseInt(answer, 10) - 1;
|
|
110
|
+
const index = Number.parseInt(answer, 10) - 1;
|
|
111
111
|
if (index >= 0 && index < packages.length) {
|
|
112
112
|
return packages[index];
|
|
113
113
|
}
|
package/dist/cmds/perf/impl.js
CHANGED
|
@@ -203,13 +203,7 @@ export class PerfAnalyzer {
|
|
|
203
203
|
verbose,
|
|
204
204
|
maxDepth: 10,
|
|
205
205
|
includeHidden: false,
|
|
206
|
-
excludePatterns: [
|
|
207
|
-
"node_modules",
|
|
208
|
-
".git",
|
|
209
|
-
".next",
|
|
210
|
-
"dist",
|
|
211
|
-
"build"
|
|
212
|
-
]
|
|
206
|
+
excludePatterns: ["node_modules", ".git", ".next", "dist", "build"]
|
|
213
207
|
});
|
|
214
208
|
}
|
|
215
209
|
async runMonorepoAnalysis() {
|
package/dist/cmds/port/impl.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { platform } from "node:os";
|
|
2
|
-
import { $ } from "bun";
|
|
3
2
|
import { logger } from "@reliverse/dler-logger";
|
|
3
|
+
import { $ } from "bun";
|
|
4
4
|
export async function killPort(port) {
|
|
5
5
|
const portStr = port.toString();
|
|
6
6
|
try {
|
|
@@ -32,15 +32,21 @@ export async function killPort(port) {
|
|
|
32
32
|
\u26A0\uFE0F UDP Port Detection - Important Information:`);
|
|
33
33
|
logger.info(` \u2022 UDP ports are connectionless and harder to detect`);
|
|
34
34
|
logger.info(` \u2022 Some UDP processes may not show up in netstat`);
|
|
35
|
-
logger.info(
|
|
36
|
-
|
|
35
|
+
logger.info(
|
|
36
|
+
` \u2022 UDP processes are often system services or drivers`
|
|
37
|
+
);
|
|
38
|
+
logger.info(
|
|
39
|
+
` \u2022 Killing UDP processes may require elevated privileges`
|
|
40
|
+
);
|
|
37
41
|
logger.info(` \u2022 Some UDP processes restart automatically`);
|
|
38
42
|
logger.info(`
|
|
39
43
|
\u{1F4A1} If you're having trouble with UDP port ${port}:`);
|
|
40
44
|
logger.info(` 1. Try running as Administrator`);
|
|
41
45
|
logger.info(` 2. Check if it's a system service: services.msc`);
|
|
42
46
|
logger.info(` 3. Use Task Manager to find the process by name`);
|
|
43
|
-
logger.info(
|
|
47
|
+
logger.info(
|
|
48
|
+
` 4. Restart the application that should use this port`
|
|
49
|
+
);
|
|
44
50
|
logger.info(` 5. Check Windows Firewall settings`);
|
|
45
51
|
}
|
|
46
52
|
const allLines = (tcpOutput + udpOutput).trim().split("\n");
|
|
@@ -119,17 +125,25 @@ export async function killPort(port) {
|
|
|
119
125
|
}
|
|
120
126
|
logger.info(`
|
|
121
127
|
\u26A0\uFE0F UDP Port Detection - Important Information:`);
|
|
122
|
-
logger.info(
|
|
128
|
+
logger.info(
|
|
129
|
+
` \u2022 UDP ports are connectionless and harder to detect`
|
|
130
|
+
);
|
|
123
131
|
logger.info(` \u2022 Some UDP processes may not show up in netstat`);
|
|
124
|
-
logger.info(
|
|
125
|
-
|
|
132
|
+
logger.info(
|
|
133
|
+
` \u2022 UDP processes are often system services or drivers`
|
|
134
|
+
);
|
|
135
|
+
logger.info(
|
|
136
|
+
` \u2022 Killing UDP processes may require elevated privileges`
|
|
137
|
+
);
|
|
126
138
|
logger.info(` \u2022 Some UDP processes restart automatically`);
|
|
127
139
|
logger.info(`
|
|
128
140
|
\u{1F4A1} If you're having trouble with UDP port ${port}:`);
|
|
129
141
|
logger.info(` 1. Try running as Administrator`);
|
|
130
142
|
logger.info(` 2. Check if it's a system service: services.msc`);
|
|
131
143
|
logger.info(` 3. Use Task Manager to find the process by name`);
|
|
132
|
-
logger.info(
|
|
144
|
+
logger.info(
|
|
145
|
+
` 4. Restart the application that should use this port`
|
|
146
|
+
);
|
|
133
147
|
logger.info(` 5. Check Windows Firewall settings`);
|
|
134
148
|
}
|
|
135
149
|
if (pids.size === 0) {
|
|
@@ -138,7 +152,9 @@ export async function killPort(port) {
|
|
|
138
152
|
logger.info(`
|
|
139
153
|
\u{1F50D} UDP Port Troubleshooting:`);
|
|
140
154
|
logger.info(` This might be a UDP-only port. Try these steps:`);
|
|
141
|
-
logger.info(
|
|
155
|
+
logger.info(
|
|
156
|
+
` 1. Check if any applications are using this port`
|
|
157
|
+
);
|
|
142
158
|
logger.info(` 2. Look for processes in Task Manager`);
|
|
143
159
|
logger.info(` 3. Try restarting your application`);
|
|
144
160
|
logger.info(` 4. Check Windows Defender or antivirus software`);
|
|
@@ -209,18 +225,26 @@ export async function killPort(port) {
|
|
|
209
225
|
\u26A0\uFE0F UDP Port Detection - Important Information:`);
|
|
210
226
|
logger.info(` \u2022 UDP ports are connectionless and harder to detect`);
|
|
211
227
|
logger.info(` \u2022 Some UDP processes may not show up in lsof`);
|
|
212
|
-
logger.info(
|
|
228
|
+
logger.info(
|
|
229
|
+
` \u2022 UDP processes are often system services or daemons`
|
|
230
|
+
);
|
|
213
231
|
logger.info(` \u2022 Killing UDP processes may require sudo privileges`);
|
|
214
232
|
logger.info(` \u2022 Some UDP processes restart automatically`);
|
|
215
233
|
logger.info(`
|
|
216
234
|
\u{1F4A1} If you're having trouble with UDP port ${port}:`);
|
|
217
|
-
logger.info(
|
|
235
|
+
logger.info(
|
|
236
|
+
` 1. Try running with sudo: sudo bun dler port kill --port ${port}`
|
|
237
|
+
);
|
|
218
238
|
logger.info(
|
|
219
239
|
` 2. Check if it's a system service: systemctl status <service>`
|
|
220
240
|
);
|
|
221
241
|
logger.info(` 3. Use ps aux | grep <port> to find the process`);
|
|
222
|
-
logger.info(
|
|
223
|
-
|
|
242
|
+
logger.info(
|
|
243
|
+
` 4. Restart the application that should use this port`
|
|
244
|
+
);
|
|
245
|
+
logger.info(
|
|
246
|
+
` 5. Check firewall settings: ufw status or iptables -L`
|
|
247
|
+
);
|
|
224
248
|
}
|
|
225
249
|
const pidList = Array.from(allPids);
|
|
226
250
|
for (const pid of pidList) {
|
package/dist/cmds/publish/cmd.js
CHANGED
|
@@ -47,9 +47,7 @@ const publishCmd = async (args) => {
|
|
|
47
47
|
}
|
|
48
48
|
process.exit(1);
|
|
49
49
|
}
|
|
50
|
-
logger.success(
|
|
51
|
-
"\nAll packages published successfully!"
|
|
52
|
-
);
|
|
50
|
+
logger.success("\nAll packages published successfully!");
|
|
53
51
|
if (args.verbose) {
|
|
54
52
|
for (const result of results.results) {
|
|
55
53
|
if (result.success && !result.warning) {
|
package/dist/cmds/senv/cmd.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
defineCmd,
|
|
3
|
+
defineCmdArgs,
|
|
4
|
+
defineCmdCfg
|
|
5
|
+
} from "@reliverse/dler-launcher";
|
|
4
6
|
import { logger } from "@reliverse/dler-logger";
|
|
7
|
+
import fs from "fs/promises";
|
|
5
8
|
const isWindows = () => globalThis.Bun?.platform?.() === "win32" || process.platform === "win32";
|
|
6
9
|
const fileExists = async (path) => {
|
|
7
10
|
try {
|
|
@@ -56,13 +59,28 @@ const escapePowerShellString = (str) => {
|
|
|
56
59
|
};
|
|
57
60
|
const runPowerShellGetUser = async (name) => {
|
|
58
61
|
const safeName = escapePowerShellString(name);
|
|
59
|
-
const
|
|
60
|
-
|
|
62
|
+
const command = `[Environment]::GetEnvironmentVariable('${safeName}', 'User')`;
|
|
63
|
+
const proc = Bun.spawn(["powershell", "-NoProfile", "-Command", command], {
|
|
64
|
+
stdout: "pipe",
|
|
65
|
+
stderr: "pipe"
|
|
66
|
+
});
|
|
67
|
+
const text = await new Response(proc.stdout).text();
|
|
68
|
+
await proc.exited;
|
|
69
|
+
return text.trim();
|
|
61
70
|
};
|
|
62
71
|
const runPowerShellSetUser = async (name, value) => {
|
|
63
72
|
const safeName = escapePowerShellString(name);
|
|
64
73
|
const safeValue = escapePowerShellString(value);
|
|
65
|
-
|
|
74
|
+
const command = `[Environment]::SetEnvironmentVariable('${safeName}', '${safeValue}', 'User')`;
|
|
75
|
+
const proc = Bun.spawn(["powershell", "-NoProfile", "-Command", command], {
|
|
76
|
+
stdout: "pipe",
|
|
77
|
+
stderr: "pipe"
|
|
78
|
+
});
|
|
79
|
+
await proc.exited;
|
|
80
|
+
if (proc.exitCode !== 0) {
|
|
81
|
+
const stderr = await new Response(proc.stderr).text();
|
|
82
|
+
throw new Error(`PowerShell command failed: ${stderr}`);
|
|
83
|
+
}
|
|
66
84
|
};
|
|
67
85
|
const getHomeDirectory = () => {
|
|
68
86
|
if (isWindows()) {
|
|
@@ -81,9 +99,12 @@ const persistPosix = async (name, value) => {
|
|
|
81
99
|
try {
|
|
82
100
|
const exists = await fileExists(profile);
|
|
83
101
|
if (!exists) {
|
|
84
|
-
await fs.writeFile(
|
|
102
|
+
await fs.writeFile(
|
|
103
|
+
profile,
|
|
104
|
+
`# created by dler senv
|
|
85
105
|
export ${name}="${value}"
|
|
86
|
-
`
|
|
106
|
+
`
|
|
107
|
+
);
|
|
87
108
|
logger.info(`Wrote new ${profile}`);
|
|
88
109
|
return;
|
|
89
110
|
}
|
|
@@ -179,9 +200,18 @@ const senvCmd = async (args) => {
|
|
|
179
200
|
const { action, name, value } = args;
|
|
180
201
|
const persist = args.persist ?? true;
|
|
181
202
|
const yes = args.yes ?? false;
|
|
182
|
-
const allowed = /* @__PURE__ */ new Set([
|
|
203
|
+
const allowed = /* @__PURE__ */ new Set([
|
|
204
|
+
"list",
|
|
205
|
+
"get",
|
|
206
|
+
"set",
|
|
207
|
+
"append",
|
|
208
|
+
"remove",
|
|
209
|
+
"contains"
|
|
210
|
+
]);
|
|
183
211
|
if (!allowed.has(action)) {
|
|
184
|
-
logger.error(
|
|
212
|
+
logger.error(
|
|
213
|
+
"Unknown action. Allowed: list, get, set, append, remove, contains"
|
|
214
|
+
);
|
|
185
215
|
process.exit(2);
|
|
186
216
|
}
|
|
187
217
|
if (action === "list") {
|
|
@@ -221,7 +251,9 @@ const senvCmd = async (args) => {
|
|
|
221
251
|
logger.info(`Set ${name} for current process.`);
|
|
222
252
|
if (persist) {
|
|
223
253
|
if (!yes) {
|
|
224
|
-
logger.info(
|
|
254
|
+
logger.info(
|
|
255
|
+
"Persisting to user environment (will create backup). Use --yes to skip this message."
|
|
256
|
+
);
|
|
225
257
|
}
|
|
226
258
|
if (isWindows()) {
|
|
227
259
|
try {
|
|
@@ -264,7 +296,9 @@ const senvCmd = async (args) => {
|
|
|
264
296
|
if (isWindows()) {
|
|
265
297
|
try {
|
|
266
298
|
const userVal = (await runPowerShellGetUser(name)).trim();
|
|
267
|
-
const userEntries = normalizePathEntries(userVal || "").map(
|
|
299
|
+
const userEntries = normalizePathEntries(userVal || "").map(
|
|
300
|
+
normalizeEntry
|
|
301
|
+
);
|
|
268
302
|
const uSet = new Set(userEntries.map(toComparable));
|
|
269
303
|
if (!uSet.has(targetKey)) {
|
|
270
304
|
userEntries.push(normalizedValue);
|
|
@@ -273,7 +307,9 @@ const senvCmd = async (args) => {
|
|
|
273
307
|
await runPowerShellSetUser(name, joined);
|
|
274
308
|
logger.success(`Persisted append to User ${name} (Windows).`);
|
|
275
309
|
} else {
|
|
276
|
-
logger.info(
|
|
310
|
+
logger.info(
|
|
311
|
+
"User-level already contains the entry \u2014 no change."
|
|
312
|
+
);
|
|
277
313
|
}
|
|
278
314
|
} catch (e) {
|
|
279
315
|
logger.error("Failed to persist append on Windows:");
|
|
@@ -306,12 +342,19 @@ const senvCmd = async (args) => {
|
|
|
306
342
|
if (isWindows()) {
|
|
307
343
|
try {
|
|
308
344
|
const userVal = (await runPowerShellGetUser(name)).trim();
|
|
309
|
-
const userEntries = normalizePathEntries(userVal || "").map(
|
|
310
|
-
|
|
345
|
+
const userEntries = normalizePathEntries(userVal || "").map(
|
|
346
|
+
normalizeEntry
|
|
347
|
+
);
|
|
348
|
+
const i2 = userEntries.findIndex(
|
|
349
|
+
(e) => toComparable(e) === targetKey
|
|
350
|
+
);
|
|
311
351
|
if (i2 >= 0) {
|
|
312
352
|
userEntries.splice(i2, 1);
|
|
313
353
|
const uniqueEntries = uniqueByComparable(userEntries);
|
|
314
|
-
await runPowerShellSetUser(
|
|
354
|
+
await runPowerShellSetUser(
|
|
355
|
+
name,
|
|
356
|
+
joinPathEntries(uniqueEntries)
|
|
357
|
+
);
|
|
315
358
|
logger.success(`Persisted removal to User ${name} (Windows).`);
|
|
316
359
|
} else {
|
|
317
360
|
logger.info("User-level did not contain entry \u2014 no change.");
|
package/dist/cmds/tsc/impl.js
CHANGED
|
@@ -578,7 +578,12 @@ export const runTscOnAllPackages = async (ignore, cwd, options = {}) => {
|
|
|
578
578
|
if (verbose) {
|
|
579
579
|
logger.info("\u{1F680} Starting TypeScript checks...\n");
|
|
580
580
|
}
|
|
581
|
-
const summary = await collectAllResults(
|
|
581
|
+
const summary = await collectAllResults(
|
|
582
|
+
packages,
|
|
583
|
+
discoveryResult.monorepoRoot,
|
|
584
|
+
options,
|
|
585
|
+
cache
|
|
586
|
+
);
|
|
582
587
|
formatOutput(summary, verbose);
|
|
583
588
|
if (copyLogs && summary.hasErrors) {
|
|
584
589
|
await copyLogsToClipboard(summary);
|
package/dist/cmds/update/cmd.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getCurrentWorkingDirectory } from "@reliverse/dler-helpers";
|
|
1
2
|
import {
|
|
2
3
|
defineCmd,
|
|
3
4
|
defineCmdArgs,
|
|
@@ -5,6 +6,7 @@ import {
|
|
|
5
6
|
} from "@reliverse/dler-launcher";
|
|
6
7
|
import { logger } from "@reliverse/dler-logger";
|
|
7
8
|
import path from "path";
|
|
9
|
+
import { msgs } from "../const.js";
|
|
8
10
|
import {
|
|
9
11
|
checkPackageUpdatesForFile,
|
|
10
12
|
handleInstallation,
|
|
@@ -12,11 +14,7 @@ import {
|
|
|
12
14
|
updatePackageJsonFileDirectly,
|
|
13
15
|
validatePackageJson
|
|
14
16
|
} from "./impl.js";
|
|
15
|
-
import {
|
|
16
|
-
displayStructuredUpdateResults
|
|
17
|
-
} from "./utils.js";
|
|
18
|
-
import { msgs } from "../const.js";
|
|
19
|
-
import { getCurrentWorkingDirectory } from "@reliverse/dler-helpers";
|
|
17
|
+
import { displayStructuredUpdateResults } from "./utils.js";
|
|
20
18
|
const updateCmd = async (args) => {
|
|
21
19
|
try {
|
|
22
20
|
if (typeof process.versions.bun === "undefined") {
|
|
@@ -61,9 +59,7 @@ const updateCmd = async (args) => {
|
|
|
61
59
|
totalUpdated += updated;
|
|
62
60
|
if (updated > 0) {
|
|
63
61
|
const relativePath = path.relative(process.cwd(), packageJsonPath);
|
|
64
|
-
logger.debug(
|
|
65
|
-
`Updated ${updated} dependencies in ${relativePath}`
|
|
66
|
-
);
|
|
62
|
+
logger.debug(`Updated ${updated} dependencies in ${relativePath}`);
|
|
67
63
|
}
|
|
68
64
|
}
|
|
69
65
|
}
|
package/dist/cmds/update/impl.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import fs from "fs/promises";
|
|
3
1
|
import { logger } from "@reliverse/dler-logger";
|
|
4
2
|
import pMap from "@reliverse/dler-mapper";
|
|
5
3
|
import { Glob } from "bun";
|
|
4
|
+
import fs from "fs/promises";
|
|
5
|
+
import path from "path";
|
|
6
6
|
import {
|
|
7
7
|
applyVersionUpdate,
|
|
8
8
|
checkPackageUpdate,
|
|
@@ -51,9 +51,7 @@ export async function prepareAllUpdateCandidates() {
|
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
logger.debug(
|
|
55
|
-
`Processing ${packageJsonFiles.length} package.json files`
|
|
56
|
-
);
|
|
54
|
+
logger.debug(`Processing ${packageJsonFiles.length} package.json files`);
|
|
57
55
|
return { packageJsonFiles, fileDepsMap };
|
|
58
56
|
}
|
|
59
57
|
export async function checkPackageUpdatesForFile(fileDepsMap, args) {
|
|
@@ -150,8 +148,6 @@ export async function handleInstallation() {
|
|
|
150
148
|
logger.warn(
|
|
151
149
|
`Install failed: ${error instanceof Error ? error.message : String(error)}`
|
|
152
150
|
);
|
|
153
|
-
logger.log(
|
|
154
|
-
"Run 'bun install' manually to apply the changes"
|
|
155
|
-
);
|
|
151
|
+
logger.log("Run 'bun install' manually to apply the changes");
|
|
156
152
|
}
|
|
157
153
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import fs from "fs/promises";
|
|
2
1
|
import { logger } from "@reliverse/dler-logger";
|
|
2
|
+
import zeptomatch from "@reliverse/dler-matcher";
|
|
3
3
|
import { $ } from "bun";
|
|
4
|
+
import fs from "fs/promises";
|
|
4
5
|
import path from "path";
|
|
5
6
|
import semver from "semver";
|
|
6
|
-
import zeptomatch from "@reliverse/dler-matcher";
|
|
7
7
|
export function isNpmAlias(versionSpec) {
|
|
8
8
|
return versionSpec.startsWith("npm:");
|
|
9
9
|
}
|
|
@@ -326,9 +326,7 @@ export function displayStructuredUpdateResults(results, packageJsonFiles, fileDe
|
|
|
326
326
|
}
|
|
327
327
|
if (!showDetails) {
|
|
328
328
|
if (toUpdate.length === 0) {
|
|
329
|
-
logger.log(
|
|
330
|
-
`All ${upToDate.length} dependencies are already up to date`
|
|
331
|
-
);
|
|
329
|
+
logger.log(`All ${upToDate.length} dependencies are already up to date`);
|
|
332
330
|
} else {
|
|
333
331
|
logger.log(
|
|
334
332
|
`${toUpdate.length} dependencies can be updated across ${packageJsonFiles.length} package.json files`
|
|
@@ -368,9 +366,7 @@ export function displayStructuredUpdateResults(results, packageJsonFiles, fileDe
|
|
|
368
366
|
(r) => !r.updated && !r.error && r.semverCompatible
|
|
369
367
|
);
|
|
370
368
|
if (upToDateInFile.length > 0) {
|
|
371
|
-
logger.log(
|
|
372
|
-
` * ${upToDateInFile.length} deps are already up to date`
|
|
373
|
-
);
|
|
369
|
+
logger.log(` * ${upToDateInFile.length} deps are already up to date`);
|
|
374
370
|
}
|
|
375
371
|
const toUpdateInFile = fileResults.filter((r) => r.updated && !r.error);
|
|
376
372
|
if (toUpdateInFile.length > 0) {
|
|
@@ -417,9 +413,7 @@ export function displayStructuredUpdateResults(results, packageJsonFiles, fileDe
|
|
|
417
413
|
logger.log("");
|
|
418
414
|
}
|
|
419
415
|
if (toUpdate.length === 0) {
|
|
420
|
-
logger.log(
|
|
421
|
-
`All ${upToDate.length} dependencies are already up to date`
|
|
422
|
-
);
|
|
416
|
+
logger.log(`All ${upToDate.length} dependencies are already up to date`);
|
|
423
417
|
} else {
|
|
424
418
|
logger.success(
|
|
425
419
|
`Summary: ${toUpdate.length} dependencies can be updated across ${packageJsonFiles.length} package.json files`
|
package/package.json
CHANGED
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
"name": "@reliverse/dler",
|
|
3
3
|
"description": "@reliverse/dler is a framework which helps TypeScript and JavaScript developers create their libraries and CLI tools. It provides ready-to-use primitives, so you don't have to write them from scratch.",
|
|
4
4
|
"author": "reliverse",
|
|
5
|
-
"version": "2.0.
|
|
5
|
+
"version": "2.0.40",
|
|
6
6
|
"private": false,
|
|
7
7
|
"type": "module",
|
|
8
8
|
"bin": {
|
|
9
9
|
"dler": "dist/cli.js"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"c12": "^3.3.
|
|
12
|
+
"c12": "^3.3.2",
|
|
13
13
|
"semver": "^7.7.3",
|
|
14
14
|
"lookpath": "^1.2.3",
|
|
15
15
|
"clipboardy": "^5.0.0",
|
|
16
|
-
"@reliverse/dler-publish": "2.0.
|
|
17
|
-
"@reliverse/dler-bump": "2.0.
|
|
18
|
-
"@reliverse/dler-build": "2.0.
|
|
19
|
-
"@reliverse/dler-logger": "2.0.
|
|
20
|
-
"@reliverse/dler-matcher": "2.0.
|
|
21
|
-
"@reliverse/dler-launcher": "2.0.
|
|
22
|
-
"@reliverse/dler-prompt": "2.0.
|
|
23
|
-
"@reliverse/dler-helpers": "2.0.
|
|
24
|
-
"@reliverse/dler-pkg-tsc": "2.0.
|
|
25
|
-
"@reliverse/dler-mapper": "2.0.
|
|
16
|
+
"@reliverse/dler-publish": "2.0.31",
|
|
17
|
+
"@reliverse/dler-bump": "2.0.31",
|
|
18
|
+
"@reliverse/dler-build": "2.0.31",
|
|
19
|
+
"@reliverse/dler-logger": "2.0.31",
|
|
20
|
+
"@reliverse/dler-matcher": "2.0.31",
|
|
21
|
+
"@reliverse/dler-launcher": "2.0.31",
|
|
22
|
+
"@reliverse/dler-prompt": "2.0.31",
|
|
23
|
+
"@reliverse/dler-helpers": "2.0.31",
|
|
24
|
+
"@reliverse/dler-pkg-tsc": "2.0.31",
|
|
25
|
+
"@reliverse/dler-mapper": "2.0.31"
|
|
26
26
|
},
|
|
27
27
|
"keywords": [
|
|
28
28
|
"dler",
|