@reliverse/dler 2.1.4 → 2.1.5
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/dist/cmds/build/cmd.js +599 -646
- package/dist/cmds/clean/cmd.js +136 -139
- package/dist/cmds/init/cmd.js +37 -40
- package/dist/cmds/integrate/cmd.js +61 -64
- package/dist/cmds/perf/cmd.js +229 -227
- package/dist/cmds/port/cmd.js +49 -52
- package/dist/cmds/publish/cmd.js +228 -243
- package/dist/cmds/senv/cmd.js +199 -198
- package/dist/cmds/shell/cmd.js +38 -41
- package/dist/cmds/tsc/cmd.js +101 -104
- package/dist/cmds/update/cmd.js +140 -137
- package/package.json +11 -11
package/dist/cmds/perf/cmd.js
CHANGED
|
@@ -1,238 +1,240 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineCmd,
|
|
3
|
-
defineCmdArgs,
|
|
4
|
-
defineCmdCfg
|
|
5
|
-
} from "@reliverse/dler-launcher";
|
|
1
|
+
import { defineArgs, defineCommand } from "@reliverse/dler-launcher";
|
|
6
2
|
import { logger } from "@reliverse/dler-logger";
|
|
7
3
|
import { runPerfAnalysis } from "./impl.js";
|
|
8
4
|
import { createConsoleReporter } from "./reporters/console.js";
|
|
9
5
|
import { createHtmlReporter } from "./reporters/html.js";
|
|
10
6
|
import { createJsonReporter } from "./reporters/json.js";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
7
|
+
export default defineCommand({
|
|
8
|
+
meta: {
|
|
9
|
+
name: "perf",
|
|
10
|
+
description: "Comprehensive performance measurement and analysis tool. Benchmarks commands, analyzes bundles, profiles files/directories, and identifies monorepo bottlenecks.",
|
|
11
|
+
examples: [
|
|
12
|
+
"# Command Benchmarking:",
|
|
13
|
+
"dler perf build",
|
|
14
|
+
'dler perf "bun dler tsc"',
|
|
15
|
+
'dler perf "node --version"',
|
|
16
|
+
"dler perf build --runs 20 --warmup 5",
|
|
17
|
+
"dler perf build --concurrency 4 --verbose",
|
|
18
|
+
"dler perf build --compare --save",
|
|
19
|
+
"",
|
|
20
|
+
"# Bundle Analysis:",
|
|
21
|
+
"dler perf ./dist --type bundle",
|
|
22
|
+
"dler perf ./build --type bundle",
|
|
23
|
+
"dler perf ./dist --type bundle --verbose",
|
|
24
|
+
"",
|
|
25
|
+
"# File System Profiling:",
|
|
26
|
+
"dler perf ./src --type file",
|
|
27
|
+
"dler perf ./packages --type file",
|
|
28
|
+
"dler perf ./src --type file --verbose",
|
|
29
|
+
"",
|
|
30
|
+
"# Monorepo Analysis:",
|
|
31
|
+
"dler perf --type monorepo",
|
|
32
|
+
"dler perf --type monorepo --ignore '@reliverse/*'",
|
|
33
|
+
"dler perf --type monorepo --verbose",
|
|
34
|
+
"",
|
|
35
|
+
"# Auto-detection:",
|
|
36
|
+
"dler perf build # Auto-detects as command",
|
|
37
|
+
"dler perf ./dist # Auto-detects as bundle",
|
|
38
|
+
"dler perf ./src # Auto-detects as file system",
|
|
39
|
+
"dler perf # Auto-detects as monorepo",
|
|
40
|
+
"",
|
|
41
|
+
"# Output Formats:",
|
|
42
|
+
"dler perf build --output json",
|
|
43
|
+
"dler perf build --output html",
|
|
44
|
+
"dler perf build --output all",
|
|
45
|
+
"",
|
|
46
|
+
"# Baseline Comparison:",
|
|
47
|
+
"dler perf build --save # Save current as baseline",
|
|
48
|
+
"dler perf build --compare # Compare with baseline",
|
|
49
|
+
"dler perf build --compare --save # Compare and update baseline",
|
|
50
|
+
"",
|
|
51
|
+
"# Advanced Examples:",
|
|
52
|
+
"dler perf 'bun dler tsc' --runs 50 --warmup 10 --concurrency 2",
|
|
53
|
+
"dler perf ./dist --type bundle --output html --verbose",
|
|
54
|
+
"dler perf --type monorepo --ignore '@reliverse/*' --output json",
|
|
55
|
+
"dler perf build --runs 100 --compare --save --output all",
|
|
56
|
+
"",
|
|
57
|
+
"# Performance Monitoring:",
|
|
58
|
+
"dler perf build --runs 10 --save # Establish baseline",
|
|
59
|
+
"dler perf build --compare # Check for regressions",
|
|
60
|
+
"dler perf build --runs 20 --compare --save # Update baseline",
|
|
61
|
+
"",
|
|
62
|
+
"# Analysis Types:",
|
|
63
|
+
"dler perf --type command <cmd> # Benchmark command execution",
|
|
64
|
+
"dler perf --type bundle <path> # Analyze bundle size and structure",
|
|
65
|
+
"dler perf --type file <path> # Profile file system usage",
|
|
66
|
+
"dler perf --type monorepo # Analyze monorepo dependencies",
|
|
67
|
+
"dler perf --type auto <target> # Auto-detect analysis type",
|
|
68
|
+
"",
|
|
69
|
+
"# Command Examples:",
|
|
70
|
+
"dler perf 'dler build'",
|
|
71
|
+
"dler perf 'bun dler tsc --verbose'",
|
|
72
|
+
"dler perf 'node --version'",
|
|
73
|
+
"dler perf 'npm run build'",
|
|
74
|
+
"dler perf 'yarn test'",
|
|
75
|
+
"",
|
|
76
|
+
"# Bundle Analysis Examples:",
|
|
77
|
+
"dler perf ./dist --type bundle",
|
|
78
|
+
"dler perf ./build --type bundle",
|
|
79
|
+
"dler perf ./out --type bundle",
|
|
80
|
+
"dler perf ./lib --type bundle",
|
|
81
|
+
"",
|
|
82
|
+
"# File System Examples:",
|
|
83
|
+
"dler perf ./src --type file",
|
|
84
|
+
"dler perf ./packages --type file",
|
|
85
|
+
"dler perf ./apps --type file",
|
|
86
|
+
"dler perf ./examples --type file",
|
|
87
|
+
"",
|
|
88
|
+
"# Monorepo Examples:",
|
|
89
|
+
"dler perf --type monorepo",
|
|
90
|
+
"dler perf --type monorepo --cwd /path/to/monorepo",
|
|
91
|
+
"dler perf --type monorepo --ignore '@reliverse/*'",
|
|
92
|
+
"dler perf --type monorepo --ignore '@reliverse/* @company/*'",
|
|
93
|
+
"",
|
|
94
|
+
"# Output Examples:",
|
|
95
|
+
"dler perf build --output console # Console output (default)",
|
|
96
|
+
"dler perf build --output json # JSON output",
|
|
97
|
+
"dler perf build --output html # HTML report",
|
|
98
|
+
"dler perf build --output all # All formats",
|
|
99
|
+
"",
|
|
100
|
+
"# Baseline Management:",
|
|
101
|
+
"dler perf build --save # Save current run as baseline",
|
|
102
|
+
"dler perf build --compare # Compare with saved baseline",
|
|
103
|
+
"dler perf build --compare --save # Compare and update baseline",
|
|
104
|
+
"",
|
|
105
|
+
"# Verbose Output:",
|
|
106
|
+
"dler perf build --verbose # Show detailed progress",
|
|
107
|
+
"dler perf ./dist --type bundle --verbose",
|
|
108
|
+
"dler perf --type monorepo --verbose",
|
|
109
|
+
"",
|
|
110
|
+
"# Concurrency Control:",
|
|
111
|
+
"dler perf build --concurrency 1 # Sequential execution",
|
|
112
|
+
"dler perf build --concurrency 4 # Parallel execution",
|
|
113
|
+
"dler perf build --concurrency 8 # High parallelism",
|
|
114
|
+
"",
|
|
115
|
+
"# Iteration Control:",
|
|
116
|
+
"dler perf build --runs 5 # Few iterations (faster)",
|
|
117
|
+
"dler perf build --runs 50 # Many iterations (more accurate)",
|
|
118
|
+
"dler perf build --warmup 0 # No warmup",
|
|
119
|
+
"dler perf build --warmup 10 # More warmup runs",
|
|
120
|
+
"",
|
|
121
|
+
"# Working Directory:",
|
|
122
|
+
"dler perf build --cwd /path/to/project",
|
|
123
|
+
"dler perf ./dist --type bundle --cwd /path/to/project",
|
|
124
|
+
"dler perf --type monorepo --cwd /path/to/monorepo"
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
args: defineArgs({
|
|
128
|
+
target: {
|
|
129
|
+
type: "string",
|
|
130
|
+
description: "What to measure (command name, file path, or directory)"
|
|
131
|
+
},
|
|
132
|
+
type: {
|
|
133
|
+
type: "string",
|
|
134
|
+
description: "Type of analysis: command, bundle, file, monorepo, or auto (default: auto)"
|
|
135
|
+
},
|
|
136
|
+
runs: {
|
|
137
|
+
type: "number",
|
|
138
|
+
description: "Number of benchmark iterations (default: 10)"
|
|
139
|
+
},
|
|
140
|
+
warmup: {
|
|
141
|
+
type: "number",
|
|
142
|
+
description: "Warmup runs before measurement (default: 2)"
|
|
143
|
+
},
|
|
144
|
+
concurrency: {
|
|
145
|
+
type: "number",
|
|
146
|
+
description: "For parallel benchmarks (default: 1)"
|
|
147
|
+
},
|
|
148
|
+
compare: {
|
|
149
|
+
type: "boolean",
|
|
150
|
+
description: "Compare with cached baseline (default: false)"
|
|
151
|
+
},
|
|
152
|
+
output: {
|
|
153
|
+
type: "string",
|
|
154
|
+
description: "Output format: console, json, html, or all (default: console)"
|
|
155
|
+
},
|
|
156
|
+
save: {
|
|
157
|
+
type: "boolean",
|
|
158
|
+
description: "Save results as baseline (default: false)"
|
|
159
|
+
},
|
|
160
|
+
verbose: {
|
|
161
|
+
type: "boolean",
|
|
162
|
+
description: "Detailed output (default: false)"
|
|
163
|
+
},
|
|
164
|
+
cwd: {
|
|
165
|
+
type: "string",
|
|
166
|
+
description: "Working directory (default: current directory)"
|
|
167
|
+
},
|
|
168
|
+
ignore: {
|
|
169
|
+
type: "string",
|
|
170
|
+
description: "Packages to ignore for monorepo analysis (supports wildcards like @reliverse/*)"
|
|
41
171
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
172
|
+
}),
|
|
173
|
+
run: async ({ args }) => {
|
|
174
|
+
try {
|
|
175
|
+
if (typeof process.versions.bun === "undefined") {
|
|
176
|
+
logger.error("\u274C This command requires Bun runtime. Sorry.");
|
|
177
|
+
process.exit(1);
|
|
178
|
+
}
|
|
179
|
+
const validTypes = [
|
|
180
|
+
"command",
|
|
181
|
+
"bundle",
|
|
182
|
+
"file",
|
|
183
|
+
"monorepo",
|
|
184
|
+
"auto"
|
|
185
|
+
];
|
|
186
|
+
if (args.type && !validTypes.includes(args.type)) {
|
|
187
|
+
logger.error(
|
|
188
|
+
`\u274C Invalid type: ${args.type}. Must be one of: ${validTypes.join(", ")}`
|
|
189
|
+
);
|
|
190
|
+
process.exit(1);
|
|
191
|
+
}
|
|
192
|
+
const validOutputs = [
|
|
193
|
+
"console",
|
|
194
|
+
"json",
|
|
195
|
+
"html",
|
|
196
|
+
"all"
|
|
197
|
+
];
|
|
198
|
+
if (args.output && !validOutputs.includes(args.output)) {
|
|
199
|
+
logger.error(
|
|
200
|
+
`\u274C Invalid output format: ${args.output}. Must be one of: ${validOutputs.join(", ")}`
|
|
201
|
+
);
|
|
202
|
+
process.exit(1);
|
|
203
|
+
}
|
|
204
|
+
const result = await runPerfAnalysis(args);
|
|
205
|
+
if (!result.success) {
|
|
206
|
+
logger.error(`\u274C Performance analysis failed: ${result.error}`);
|
|
207
|
+
process.exit(1);
|
|
208
|
+
}
|
|
209
|
+
const outputFormats = args.output === "all" ? ["console", "json", "html"] : [args.output ?? "console"];
|
|
210
|
+
for (const format of outputFormats) {
|
|
211
|
+
switch (format) {
|
|
212
|
+
case "console": {
|
|
213
|
+
const consoleReporter = createConsoleReporter(args.verbose);
|
|
214
|
+
consoleReporter.report(result.report);
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
case "json": {
|
|
218
|
+
const jsonReporter = createJsonReporter();
|
|
219
|
+
jsonReporter.report(result.report);
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
case "html": {
|
|
223
|
+
const htmlReporter = createHtmlReporter();
|
|
224
|
+
htmlReporter.report(result.report);
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
59
227
|
}
|
|
60
228
|
}
|
|
229
|
+
logger.success("\n\u2705 Performance analysis completed successfully!");
|
|
230
|
+
} catch (error) {
|
|
231
|
+
logger.error("\n\u274C Performance analysis failed:");
|
|
232
|
+
if (error instanceof Error) {
|
|
233
|
+
logger.error(error.message);
|
|
234
|
+
} else {
|
|
235
|
+
logger.error(String(error));
|
|
236
|
+
}
|
|
237
|
+
process.exit(1);
|
|
61
238
|
}
|
|
62
|
-
logger.success("\n\u2705 Performance analysis completed successfully!");
|
|
63
|
-
} catch (error) {
|
|
64
|
-
logger.error("\n\u274C Performance analysis failed:");
|
|
65
|
-
if (error instanceof Error) {
|
|
66
|
-
logger.error(error.message);
|
|
67
|
-
} else {
|
|
68
|
-
logger.error(String(error));
|
|
69
|
-
}
|
|
70
|
-
process.exit(1);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
const perfCmdArgs = defineCmdArgs({
|
|
74
|
-
target: {
|
|
75
|
-
type: "string",
|
|
76
|
-
description: "What to measure (command name, file path, or directory)"
|
|
77
|
-
},
|
|
78
|
-
type: {
|
|
79
|
-
type: "string",
|
|
80
|
-
description: "Type of analysis: command, bundle, file, monorepo, or auto (default: auto)"
|
|
81
|
-
},
|
|
82
|
-
runs: {
|
|
83
|
-
type: "number",
|
|
84
|
-
description: "Number of benchmark iterations (default: 10)"
|
|
85
|
-
},
|
|
86
|
-
warmup: {
|
|
87
|
-
type: "number",
|
|
88
|
-
description: "Warmup runs before measurement (default: 2)"
|
|
89
|
-
},
|
|
90
|
-
concurrency: {
|
|
91
|
-
type: "number",
|
|
92
|
-
description: "For parallel benchmarks (default: 1)"
|
|
93
|
-
},
|
|
94
|
-
compare: {
|
|
95
|
-
type: "boolean",
|
|
96
|
-
description: "Compare with cached baseline (default: false)"
|
|
97
|
-
},
|
|
98
|
-
output: {
|
|
99
|
-
type: "string",
|
|
100
|
-
description: "Output format: console, json, html, or all (default: console)"
|
|
101
|
-
},
|
|
102
|
-
save: {
|
|
103
|
-
type: "boolean",
|
|
104
|
-
description: "Save results as baseline (default: false)"
|
|
105
|
-
},
|
|
106
|
-
verbose: {
|
|
107
|
-
type: "boolean",
|
|
108
|
-
description: "Detailed output (default: false)"
|
|
109
|
-
},
|
|
110
|
-
cwd: {
|
|
111
|
-
type: "string",
|
|
112
|
-
description: "Working directory (default: current directory)"
|
|
113
|
-
},
|
|
114
|
-
ignore: {
|
|
115
|
-
type: "string",
|
|
116
|
-
description: "Packages to ignore for monorepo analysis (supports wildcards like @reliverse/*)"
|
|
117
239
|
}
|
|
118
240
|
});
|
|
119
|
-
const perfCmdCfg = defineCmdCfg({
|
|
120
|
-
name: "perf",
|
|
121
|
-
description: "Comprehensive performance measurement and analysis tool. Benchmarks commands, analyzes bundles, profiles files/directories, and identifies monorepo bottlenecks.",
|
|
122
|
-
examples: [
|
|
123
|
-
"# Command Benchmarking:",
|
|
124
|
-
"dler perf build",
|
|
125
|
-
'dler perf "bun dler tsc"',
|
|
126
|
-
'dler perf "node --version"',
|
|
127
|
-
"dler perf build --runs 20 --warmup 5",
|
|
128
|
-
"dler perf build --concurrency 4 --verbose",
|
|
129
|
-
"dler perf build --compare --save",
|
|
130
|
-
"",
|
|
131
|
-
"# Bundle Analysis:",
|
|
132
|
-
"dler perf ./dist --type bundle",
|
|
133
|
-
"dler perf ./build --type bundle",
|
|
134
|
-
"dler perf ./dist --type bundle --verbose",
|
|
135
|
-
"",
|
|
136
|
-
"# File System Profiling:",
|
|
137
|
-
"dler perf ./src --type file",
|
|
138
|
-
"dler perf ./packages --type file",
|
|
139
|
-
"dler perf ./src --type file --verbose",
|
|
140
|
-
"",
|
|
141
|
-
"# Monorepo Analysis:",
|
|
142
|
-
"dler perf --type monorepo",
|
|
143
|
-
"dler perf --type monorepo --ignore '@reliverse/*'",
|
|
144
|
-
"dler perf --type monorepo --verbose",
|
|
145
|
-
"",
|
|
146
|
-
"# Auto-detection:",
|
|
147
|
-
"dler perf build # Auto-detects as command",
|
|
148
|
-
"dler perf ./dist # Auto-detects as bundle",
|
|
149
|
-
"dler perf ./src # Auto-detects as file system",
|
|
150
|
-
"dler perf # Auto-detects as monorepo",
|
|
151
|
-
"",
|
|
152
|
-
"# Output Formats:",
|
|
153
|
-
"dler perf build --output json",
|
|
154
|
-
"dler perf build --output html",
|
|
155
|
-
"dler perf build --output all",
|
|
156
|
-
"",
|
|
157
|
-
"# Baseline Comparison:",
|
|
158
|
-
"dler perf build --save # Save current as baseline",
|
|
159
|
-
"dler perf build --compare # Compare with baseline",
|
|
160
|
-
"dler perf build --compare --save # Compare and update baseline",
|
|
161
|
-
"",
|
|
162
|
-
"# Advanced Examples:",
|
|
163
|
-
"dler perf 'bun dler tsc' --runs 50 --warmup 10 --concurrency 2",
|
|
164
|
-
"dler perf ./dist --type bundle --output html --verbose",
|
|
165
|
-
"dler perf --type monorepo --ignore '@reliverse/*' --output json",
|
|
166
|
-
"dler perf build --runs 100 --compare --save --output all",
|
|
167
|
-
"",
|
|
168
|
-
"# Performance Monitoring:",
|
|
169
|
-
"dler perf build --runs 10 --save # Establish baseline",
|
|
170
|
-
"dler perf build --compare # Check for regressions",
|
|
171
|
-
"dler perf build --runs 20 --compare --save # Update baseline",
|
|
172
|
-
"",
|
|
173
|
-
"# Analysis Types:",
|
|
174
|
-
"dler perf --type command <cmd> # Benchmark command execution",
|
|
175
|
-
"dler perf --type bundle <path> # Analyze bundle size and structure",
|
|
176
|
-
"dler perf --type file <path> # Profile file system usage",
|
|
177
|
-
"dler perf --type monorepo # Analyze monorepo dependencies",
|
|
178
|
-
"dler perf --type auto <target> # Auto-detect analysis type",
|
|
179
|
-
"",
|
|
180
|
-
"# Command Examples:",
|
|
181
|
-
"dler perf 'dler build'",
|
|
182
|
-
"dler perf 'bun dler tsc --verbose'",
|
|
183
|
-
"dler perf 'node --version'",
|
|
184
|
-
"dler perf 'npm run build'",
|
|
185
|
-
"dler perf 'yarn test'",
|
|
186
|
-
"",
|
|
187
|
-
"# Bundle Analysis Examples:",
|
|
188
|
-
"dler perf ./dist --type bundle",
|
|
189
|
-
"dler perf ./build --type bundle",
|
|
190
|
-
"dler perf ./out --type bundle",
|
|
191
|
-
"dler perf ./lib --type bundle",
|
|
192
|
-
"",
|
|
193
|
-
"# File System Examples:",
|
|
194
|
-
"dler perf ./src --type file",
|
|
195
|
-
"dler perf ./packages --type file",
|
|
196
|
-
"dler perf ./apps --type file",
|
|
197
|
-
"dler perf ./examples --type file",
|
|
198
|
-
"",
|
|
199
|
-
"# Monorepo Examples:",
|
|
200
|
-
"dler perf --type monorepo",
|
|
201
|
-
"dler perf --type monorepo --cwd /path/to/monorepo",
|
|
202
|
-
"dler perf --type monorepo --ignore '@reliverse/*'",
|
|
203
|
-
"dler perf --type monorepo --ignore '@reliverse/* @company/*'",
|
|
204
|
-
"",
|
|
205
|
-
"# Output Examples:",
|
|
206
|
-
"dler perf build --output console # Console output (default)",
|
|
207
|
-
"dler perf build --output json # JSON output",
|
|
208
|
-
"dler perf build --output html # HTML report",
|
|
209
|
-
"dler perf build --output all # All formats",
|
|
210
|
-
"",
|
|
211
|
-
"# Baseline Management:",
|
|
212
|
-
"dler perf build --save # Save current run as baseline",
|
|
213
|
-
"dler perf build --compare # Compare with saved baseline",
|
|
214
|
-
"dler perf build --compare --save # Compare and update baseline",
|
|
215
|
-
"",
|
|
216
|
-
"# Verbose Output:",
|
|
217
|
-
"dler perf build --verbose # Show detailed progress",
|
|
218
|
-
"dler perf ./dist --type bundle --verbose",
|
|
219
|
-
"dler perf --type monorepo --verbose",
|
|
220
|
-
"",
|
|
221
|
-
"# Concurrency Control:",
|
|
222
|
-
"dler perf build --concurrency 1 # Sequential execution",
|
|
223
|
-
"dler perf build --concurrency 4 # Parallel execution",
|
|
224
|
-
"dler perf build --concurrency 8 # High parallelism",
|
|
225
|
-
"",
|
|
226
|
-
"# Iteration Control:",
|
|
227
|
-
"dler perf build --runs 5 # Few iterations (faster)",
|
|
228
|
-
"dler perf build --runs 50 # Many iterations (more accurate)",
|
|
229
|
-
"dler perf build --warmup 0 # No warmup",
|
|
230
|
-
"dler perf build --warmup 10 # More warmup runs",
|
|
231
|
-
"",
|
|
232
|
-
"# Working Directory:",
|
|
233
|
-
"dler perf build --cwd /path/to/project",
|
|
234
|
-
"dler perf ./dist --type bundle --cwd /path/to/project",
|
|
235
|
-
"dler perf --type monorepo --cwd /path/to/monorepo"
|
|
236
|
-
]
|
|
237
|
-
});
|
|
238
|
-
export default defineCmd(perfCmd, perfCmdArgs, perfCmdCfg);
|
package/dist/cmds/port/cmd.js
CHANGED
|
@@ -1,61 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineCmd,
|
|
3
|
-
defineCmdArgs,
|
|
4
|
-
defineCmdCfg
|
|
5
|
-
} from "@reliverse/dler-launcher";
|
|
1
|
+
import { defineArgs, defineCommand } from "@reliverse/dler-launcher";
|
|
6
2
|
import { logger } from "@reliverse/dler-logger";
|
|
7
3
|
import { killPort } from "./impl.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
export default defineCommand({
|
|
5
|
+
meta: {
|
|
6
|
+
name: "port",
|
|
7
|
+
description: "Manage processes on ports. Kill processes using a specific port or check port status.",
|
|
8
|
+
examples: [
|
|
9
|
+
"dler port --port 3000",
|
|
10
|
+
"dler port --port 3000 --action kill",
|
|
11
|
+
"dler port --port 8080 --action check",
|
|
12
|
+
"dler port --port 1420"
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
args: defineArgs({
|
|
16
|
+
port: {
|
|
17
|
+
type: "number",
|
|
18
|
+
description: "The port number to operate on (1-65535)"
|
|
19
|
+
},
|
|
20
|
+
action: {
|
|
21
|
+
type: "string",
|
|
22
|
+
description: "Action to perform: kill or check",
|
|
23
|
+
default: "kill"
|
|
13
24
|
}
|
|
14
|
-
|
|
25
|
+
}),
|
|
26
|
+
run: async ({ args }) => {
|
|
27
|
+
try {
|
|
28
|
+
if (typeof process.versions.bun === "undefined") {
|
|
29
|
+
logger.error("\u274C This command requires Bun runtime. Sorry.");
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
if (!args.port || args.port < 1 || args.port > 65535) {
|
|
33
|
+
logger.error(
|
|
34
|
+
"\u274C Invalid port number. Please provide a valid port number (1-65535)"
|
|
35
|
+
);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
const action = args.action || "kill";
|
|
39
|
+
switch (action) {
|
|
40
|
+
case "kill":
|
|
41
|
+
await killPort(args.port);
|
|
42
|
+
break;
|
|
43
|
+
case "check":
|
|
44
|
+
logger.info("Port check functionality coming soon!");
|
|
45
|
+
break;
|
|
46
|
+
default:
|
|
47
|
+
console.log("Usage: dler port --port <port> --action <action>");
|
|
48
|
+
console.log("Example: dler port --port 3000 --action kill");
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
} catch (error) {
|
|
15
52
|
logger.error(
|
|
16
|
-
|
|
53
|
+
`\u274C Port command failed: ${error instanceof Error ? error.message : String(error)}`
|
|
17
54
|
);
|
|
18
55
|
process.exit(1);
|
|
19
56
|
}
|
|
20
|
-
const action = args.action || "kill";
|
|
21
|
-
switch (action) {
|
|
22
|
-
case "kill":
|
|
23
|
-
await killPort(args.port);
|
|
24
|
-
break;
|
|
25
|
-
case "check":
|
|
26
|
-
logger.info("Port check functionality coming soon!");
|
|
27
|
-
break;
|
|
28
|
-
default:
|
|
29
|
-
console.log("Usage: dler port --port <port> --action <action>");
|
|
30
|
-
console.log("Example: dler port --port 3000 --action kill");
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
} catch (error) {
|
|
34
|
-
logger.error(
|
|
35
|
-
`\u274C Port command failed: ${error instanceof Error ? error.message : String(error)}`
|
|
36
|
-
);
|
|
37
|
-
process.exit(1);
|
|
38
57
|
}
|
|
39
|
-
};
|
|
40
|
-
const portCmdArgs = defineCmdArgs({
|
|
41
|
-
port: {
|
|
42
|
-
type: "number",
|
|
43
|
-
description: "The port number to operate on (1-65535)"
|
|
44
|
-
},
|
|
45
|
-
action: {
|
|
46
|
-
type: "string",
|
|
47
|
-
description: "Action to perform: kill or check",
|
|
48
|
-
default: "kill"
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
const portCmdCfg = defineCmdCfg({
|
|
52
|
-
name: "port",
|
|
53
|
-
description: "Manage processes on ports. Kill processes using a specific port or check port status.",
|
|
54
|
-
examples: [
|
|
55
|
-
"dler port --port 3000",
|
|
56
|
-
"dler port --port 3000 --action kill",
|
|
57
|
-
"dler port --port 8080 --action check",
|
|
58
|
-
"dler port --port 1420"
|
|
59
|
-
]
|
|
60
58
|
});
|
|
61
|
-
export default defineCmd(portCmd, portCmdArgs, portCmdCfg);
|