@reliverse/dler 2.0.5 → 2.0.7
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 +1 -15
- package/dist/cmds/publish/cmd.js +2 -4
- package/package.json +16 -12
- package/src/cli.ts +0 -8
- package/src/cmds/build/cmd.ts +0 -582
- package/src/cmds/clean/cmd.ts +0 -166
- package/src/cmds/clean/impl.ts +0 -900
- package/src/cmds/clean/presets.ts +0 -158
- package/src/cmds/clean/types.ts +0 -71
- package/src/cmds/init/cmd.ts +0 -68
- package/src/cmds/init/impl/config.ts +0 -105
- package/src/cmds/init/impl/generators.ts +0 -220
- package/src/cmds/init/impl/prompts.ts +0 -137
- package/src/cmds/init/impl/types.ts +0 -25
- package/src/cmds/init/impl/utils.ts +0 -17
- package/src/cmds/init/impl/validators.ts +0 -55
- package/src/cmds/integrate/cmd.ts +0 -82
- package/src/cmds/integrate/impl.ts +0 -204
- package/src/cmds/integrate/integrations/base.ts +0 -69
- package/src/cmds/integrate/integrations/nextjs.ts +0 -227
- package/src/cmds/integrate/integrations/registry.ts +0 -45
- package/src/cmds/integrate/integrations/ultracite.ts +0 -53
- package/src/cmds/integrate/types.ts +0 -48
- package/src/cmds/integrate/utils/biome.ts +0 -173
- package/src/cmds/integrate/utils/context.ts +0 -148
- package/src/cmds/integrate/utils/temp.ts +0 -47
- package/src/cmds/perf/analysis/bundle.ts +0 -311
- package/src/cmds/perf/analysis/filesystem.ts +0 -324
- package/src/cmds/perf/analysis/monorepo.ts +0 -439
- package/src/cmds/perf/benchmarks/command.ts +0 -230
- package/src/cmds/perf/benchmarks/memory.ts +0 -249
- package/src/cmds/perf/benchmarks/runner.ts +0 -220
- package/src/cmds/perf/cmd.ts +0 -285
- package/src/cmds/perf/impl.ts +0 -411
- package/src/cmds/perf/reporters/console.ts +0 -331
- package/src/cmds/perf/reporters/html.ts +0 -984
- package/src/cmds/perf/reporters/json.ts +0 -42
- package/src/cmds/perf/types.ts +0 -220
- package/src/cmds/perf/utils/cache.ts +0 -234
- package/src/cmds/perf/utils/formatter.ts +0 -190
- package/src/cmds/perf/utils/stats.ts +0 -153
- package/src/cmds/publish/cmd.ts +0 -215
- package/src/cmds/shell/cmd.ts +0 -61
- package/src/cmds/tsc/cache.ts +0 -237
- package/src/cmds/tsc/cmd.ts +0 -139
- package/src/cmds/tsc/impl.ts +0 -855
- package/src/cmds/tsc/types.ts +0 -66
- package/tsconfig.json +0 -9
package/dist/cmds/build/cmd.js
CHANGED
|
@@ -378,11 +378,7 @@ const buildCmdArgs = defineCmdArgs({
|
|
|
378
378
|
type: "number",
|
|
379
379
|
description: "Maximum directory levels to search up for dler.ts config (default: 3)"
|
|
380
380
|
},
|
|
381
|
-
// Package
|
|
382
|
-
prepareForPublish: {
|
|
383
|
-
type: "boolean",
|
|
384
|
-
description: "Transform package.json for publishing (exports, bin, private fields)"
|
|
385
|
-
},
|
|
381
|
+
// Package kind and bin definitions
|
|
386
382
|
kind: {
|
|
387
383
|
type: "string",
|
|
388
384
|
description: "Package kind: library, cli, browser-app, or native-app"
|
|
@@ -530,16 +526,6 @@ const buildCmdCfg = defineCmdCfg({
|
|
|
530
526
|
"# Config Discovery Examples:",
|
|
531
527
|
"dler build --maxConfigDepth 5",
|
|
532
528
|
"",
|
|
533
|
-
"# Package Preparation for Publishing:",
|
|
534
|
-
"dler build --prepareForPublish",
|
|
535
|
-
"dler build --prepareForPublish --kind library",
|
|
536
|
-
"dler build --prepareForPublish --kind cli --bin 'my-cli=dist/cli.js'",
|
|
537
|
-
"dler build --prepareForPublish --kind cli --bin 'dler=dist/cli.js,login=dist/foo/bar/login.js'",
|
|
538
|
-
"dler build --production --prepareForPublish --kind library",
|
|
539
|
-
"",
|
|
540
|
-
"# Note: Use --prepareForPublish to transform package.json for publishing",
|
|
541
|
-
"# This updates exports field, adds bin field for CLI packages, and sets private: false",
|
|
542
|
-
"",
|
|
543
529
|
"# TSConfig Validation Examples:",
|
|
544
530
|
"dler build --validateTsconfig",
|
|
545
531
|
"dler build --strictTsconfig",
|
package/dist/cmds/publish/cmd.js
CHANGED
|
@@ -177,11 +177,9 @@ const publishCmdCfg = defineCmdCfg({
|
|
|
177
177
|
"# }",
|
|
178
178
|
"# }",
|
|
179
179
|
"",
|
|
180
|
-
"# Note: Make sure to run 'dler build
|
|
180
|
+
"# Note: Make sure to run 'dler build' first to:",
|
|
181
181
|
"# - Generate dist folders and declaration files",
|
|
182
|
-
"# - Transform package.json
|
|
183
|
-
"# - Add bin field for CLI packages",
|
|
184
|
-
"# - Set private: false and publishConfig",
|
|
182
|
+
"# - Transform package.json (adds files field, transforms exports, adds bin for CLI)",
|
|
185
183
|
"# The publish command will then handle version bumping and registry publishing",
|
|
186
184
|
"# CLI flags override dler.ts configuration settings"
|
|
187
185
|
]
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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.7",
|
|
6
6
|
"private": false,
|
|
7
7
|
"type": "module",
|
|
8
8
|
"bin": {
|
|
@@ -14,16 +14,16 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"c12": "^3.3.0",
|
|
16
16
|
"clipboardy": "^5.0.0",
|
|
17
|
-
"@reliverse/dler-publish": "2.0.
|
|
18
|
-
"@reliverse/dler-bump": "2.0.
|
|
19
|
-
"@reliverse/dler-build": "2.0.
|
|
20
|
-
"@reliverse/dler-logger": "2.0.
|
|
21
|
-
"@reliverse/dler-matcher": "2.0.
|
|
22
|
-
"@reliverse/dler-launcher": "2.0.
|
|
23
|
-
"@reliverse/dler-prompt": "2.0.
|
|
24
|
-
"@reliverse/dler-helpers": "2.0.
|
|
25
|
-
"@reliverse/dler-pkg-tsc": "2.0.
|
|
26
|
-
"@reliverse/dler-mapper": "2.0.
|
|
17
|
+
"@reliverse/dler-publish": "2.0.8",
|
|
18
|
+
"@reliverse/dler-bump": "2.0.8",
|
|
19
|
+
"@reliverse/dler-build": "2.0.8",
|
|
20
|
+
"@reliverse/dler-logger": "2.0.8",
|
|
21
|
+
"@reliverse/dler-matcher": "2.0.8",
|
|
22
|
+
"@reliverse/dler-launcher": "2.0.8",
|
|
23
|
+
"@reliverse/dler-prompt": "2.0.8",
|
|
24
|
+
"@reliverse/dler-helpers": "2.0.8",
|
|
25
|
+
"@reliverse/dler-pkg-tsc": "2.0.8",
|
|
26
|
+
"@reliverse/dler-mapper": "2.0.8"
|
|
27
27
|
},
|
|
28
28
|
"keywords": [
|
|
29
29
|
"dler",
|
|
@@ -31,5 +31,9 @@
|
|
|
31
31
|
],
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
|
-
}
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist",
|
|
37
|
+
"package.json"
|
|
38
|
+
]
|
|
35
39
|
}
|
package/src/cli.ts
DELETED
package/src/cmds/build/cmd.ts
DELETED
|
@@ -1,582 +0,0 @@
|
|
|
1
|
-
// apps/dler/src/cmds/build/cmd.ts
|
|
2
|
-
|
|
3
|
-
import type { BuildOptions } from "@reliverse/dler-build";
|
|
4
|
-
import { applyPresets, runBuildOnAllPackages, validateAndExit } from "@reliverse/dler-build";
|
|
5
|
-
import {
|
|
6
|
-
defineCmd,
|
|
7
|
-
defineCmdArgs,
|
|
8
|
-
defineCmdCfg,
|
|
9
|
-
} from "@reliverse/dler-launcher";
|
|
10
|
-
import { logger } from "@reliverse/dler-logger";
|
|
11
|
-
import { replaceExportsInPackages } from "@reliverse/dler-helpers";
|
|
12
|
-
|
|
13
|
-
const buildCmd = async (args: any): Promise<void> => {
|
|
14
|
-
try {
|
|
15
|
-
// Check if running in Bun
|
|
16
|
-
if (typeof process.versions.bun === "undefined") {
|
|
17
|
-
logger.error("❌ This command requires Bun runtime. Sorry.");
|
|
18
|
-
process.exit(1);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Apply presets and validate options
|
|
22
|
-
const buildOptions = applyPresets(args as any as BuildOptions);
|
|
23
|
-
validateAndExit(buildOptions);
|
|
24
|
-
|
|
25
|
-
const results = await runBuildOnAllPackages(args.ignore, args.cwd, {
|
|
26
|
-
...buildOptions,
|
|
27
|
-
allowPrivateBuild: args.allowPrivateBuild,
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
if (results.hasErrors) {
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Replace exports if enabled (default: true, unless explicitly false)
|
|
35
|
-
const shouldReplaceExports = args.replaceExports !== false;
|
|
36
|
-
if (shouldReplaceExports && !buildOptions.watch) {
|
|
37
|
-
if (args.verbose) {
|
|
38
|
-
logger.info("\n📝 Replacing exports from ./src/*.ts to ./dist/*.js after build...");
|
|
39
|
-
}
|
|
40
|
-
await replaceExportsInPackages({
|
|
41
|
-
direction: "ts-to-js",
|
|
42
|
-
cwd: args.cwd,
|
|
43
|
-
ignorePackages: args.replaceExportsIgnorePackages,
|
|
44
|
-
verbose: args.verbose,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
logger.success("\n✅ All packages built successfully!");
|
|
49
|
-
} catch (error) {
|
|
50
|
-
logger.error("\n❌ Build failed:");
|
|
51
|
-
|
|
52
|
-
if (error instanceof Error) {
|
|
53
|
-
logger.error(error.message);
|
|
54
|
-
} else {
|
|
55
|
-
logger.error(String(error));
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const buildCmdArgs = defineCmdArgs({
|
|
63
|
-
ignore: {
|
|
64
|
-
type: "string",
|
|
65
|
-
description: "Package(s) to ignore (supports wildcards like @reliverse/*)",
|
|
66
|
-
},
|
|
67
|
-
cwd: {
|
|
68
|
-
type: "string",
|
|
69
|
-
description: "Working directory (monorepo root)",
|
|
70
|
-
},
|
|
71
|
-
concurrency: {
|
|
72
|
-
type: "number",
|
|
73
|
-
description: "Number of packages to build concurrently (default: 5)",
|
|
74
|
-
},
|
|
75
|
-
stopOnError: {
|
|
76
|
-
type: "boolean",
|
|
77
|
-
description:
|
|
78
|
-
"Stop on first error instead of collecting all errors (default: false)",
|
|
79
|
-
},
|
|
80
|
-
verbose: {
|
|
81
|
-
type: "boolean",
|
|
82
|
-
description: "Verbose mode (default: false)",
|
|
83
|
-
},
|
|
84
|
-
watch: {
|
|
85
|
-
type: "boolean",
|
|
86
|
-
description: "Watch mode for hot rebuild (default: false)",
|
|
87
|
-
},
|
|
88
|
-
bundler: {
|
|
89
|
-
type: "string",
|
|
90
|
-
description: "Bundler to use: bun (fast, bundles deps) or mkdist (preserves structure, default for libraries)",
|
|
91
|
-
},
|
|
92
|
-
target: {
|
|
93
|
-
type: "string",
|
|
94
|
-
description: "Build target: browser, bun, or node (default: bun)",
|
|
95
|
-
},
|
|
96
|
-
format: {
|
|
97
|
-
type: "string",
|
|
98
|
-
description: "Output format: esm, cjs, or iife (default: esm)",
|
|
99
|
-
},
|
|
100
|
-
minify: {
|
|
101
|
-
type: "boolean",
|
|
102
|
-
description: "Enable all minification options (default: false)",
|
|
103
|
-
},
|
|
104
|
-
minifyWhitespace: {
|
|
105
|
-
type: "boolean",
|
|
106
|
-
description: "Minify whitespace (default: false)",
|
|
107
|
-
},
|
|
108
|
-
minifySyntax: {
|
|
109
|
-
type: "boolean",
|
|
110
|
-
description: "Minify syntax and inline constants (default: false)",
|
|
111
|
-
},
|
|
112
|
-
minifyIdentifiers: {
|
|
113
|
-
type: "boolean",
|
|
114
|
-
description: "Minify variable and function identifiers (default: false)",
|
|
115
|
-
},
|
|
116
|
-
sourcemap: {
|
|
117
|
-
type: "string",
|
|
118
|
-
description: "Sourcemap option: none, linked, inline, or external (default: none)",
|
|
119
|
-
},
|
|
120
|
-
splitting: {
|
|
121
|
-
type: "boolean",
|
|
122
|
-
description: "Enable code splitting (default: true)",
|
|
123
|
-
},
|
|
124
|
-
external: {
|
|
125
|
-
type: "string",
|
|
126
|
-
description: "External packages to exclude from bundle (supports wildcards)",
|
|
127
|
-
},
|
|
128
|
-
bytecode: {
|
|
129
|
-
type: "boolean",
|
|
130
|
-
description: "Generate bytecode for faster cold starts (requires format: cjs, target: bun)",
|
|
131
|
-
},
|
|
132
|
-
drop: {
|
|
133
|
-
type: "string",
|
|
134
|
-
description: "Drop function calls (e.g., 'console.log', 'debugger')",
|
|
135
|
-
},
|
|
136
|
-
packages: {
|
|
137
|
-
type: "string",
|
|
138
|
-
description: "How to handle dependencies: bundle or external (default: bundle)",
|
|
139
|
-
},
|
|
140
|
-
publicPath: {
|
|
141
|
-
type: "string",
|
|
142
|
-
description: "Prefix for import paths in bundled code",
|
|
143
|
-
},
|
|
144
|
-
root: {
|
|
145
|
-
type: "string",
|
|
146
|
-
description: "Project root for resolving relative paths",
|
|
147
|
-
},
|
|
148
|
-
define: {
|
|
149
|
-
type: "string",
|
|
150
|
-
description: "Define global constants (JSON format, e.g., '{\"__VERSION__\":\"1.0.0\"}')",
|
|
151
|
-
},
|
|
152
|
-
naming: {
|
|
153
|
-
type: "string",
|
|
154
|
-
description: "Customize output file naming (JSON format)",
|
|
155
|
-
},
|
|
156
|
-
env: {
|
|
157
|
-
type: "string",
|
|
158
|
-
description: "Environment variable handling: inline, disable, or prefix like PUBLIC_*",
|
|
159
|
-
},
|
|
160
|
-
banner: {
|
|
161
|
-
type: "string",
|
|
162
|
-
description: "Add banner to bundled code (e.g., 'use client')",
|
|
163
|
-
},
|
|
164
|
-
footer: {
|
|
165
|
-
type: "string",
|
|
166
|
-
description: "Add footer to bundled code",
|
|
167
|
-
},
|
|
168
|
-
conditions: {
|
|
169
|
-
type: "string",
|
|
170
|
-
description: "Package.json exports conditions for import resolution",
|
|
171
|
-
},
|
|
172
|
-
loader: {
|
|
173
|
-
type: "string",
|
|
174
|
-
description: "Custom loaders for file extensions (JSON format)",
|
|
175
|
-
},
|
|
176
|
-
ignoreDCEAnnotations: {
|
|
177
|
-
type: "boolean",
|
|
178
|
-
description: "Ignore dead code elimination annotations",
|
|
179
|
-
},
|
|
180
|
-
emitDCEAnnotations: {
|
|
181
|
-
type: "boolean",
|
|
182
|
-
description: "Force emit dead code elimination annotations",
|
|
183
|
-
},
|
|
184
|
-
throw: {
|
|
185
|
-
type: "boolean",
|
|
186
|
-
description: "Throw on build errors instead of returning success: false",
|
|
187
|
-
},
|
|
188
|
-
production: {
|
|
189
|
-
type: "boolean",
|
|
190
|
-
description: "Enable production mode (minify=true, sourcemap=none, env=inline)",
|
|
191
|
-
},
|
|
192
|
-
dev: {
|
|
193
|
-
type: "boolean",
|
|
194
|
-
description: "Enable development mode (minify=false, sourcemap=inline, watch=true)",
|
|
195
|
-
},
|
|
196
|
-
compile: {
|
|
197
|
-
type: "boolean",
|
|
198
|
-
description: "Generate standalone Bun executable",
|
|
199
|
-
},
|
|
200
|
-
cache: {
|
|
201
|
-
type: "boolean",
|
|
202
|
-
description: "Enable build caching (default: true)",
|
|
203
|
-
},
|
|
204
|
-
noCache: {
|
|
205
|
-
type: "boolean",
|
|
206
|
-
description: "Disable build caching",
|
|
207
|
-
},
|
|
208
|
-
entryNaming: {
|
|
209
|
-
type: "string",
|
|
210
|
-
description: "Entry point naming pattern (e.g., '[dir]/[name].[ext]')",
|
|
211
|
-
},
|
|
212
|
-
chunkNaming: {
|
|
213
|
-
type: "string",
|
|
214
|
-
description: "Chunk naming pattern (e.g., '[name]-[hash].[ext]')",
|
|
215
|
-
},
|
|
216
|
-
assetNaming: {
|
|
217
|
-
type: "string",
|
|
218
|
-
description: "Asset naming pattern (e.g., '[name]-[hash].[ext]')",
|
|
219
|
-
},
|
|
220
|
-
// Frontend-specific options
|
|
221
|
-
html: {
|
|
222
|
-
type: "boolean",
|
|
223
|
-
description: "Enable HTML entry point processing (auto-detected for frontend apps)",
|
|
224
|
-
},
|
|
225
|
-
cssChunking: {
|
|
226
|
-
type: "boolean",
|
|
227
|
-
description: "Chunk CSS to reduce duplication (default: true for frontend apps)",
|
|
228
|
-
},
|
|
229
|
-
devServer: {
|
|
230
|
-
type: "boolean",
|
|
231
|
-
description: "Start dev server with HMR (requires --watch)",
|
|
232
|
-
},
|
|
233
|
-
port: {
|
|
234
|
-
type: "number",
|
|
235
|
-
description: "Dev server port (default: 3000)",
|
|
236
|
-
},
|
|
237
|
-
open: {
|
|
238
|
-
type: "boolean",
|
|
239
|
-
description: "Open browser on dev server start",
|
|
240
|
-
},
|
|
241
|
-
publicAssets: {
|
|
242
|
-
type: "string",
|
|
243
|
-
description: "Public assets directory (default: public)",
|
|
244
|
-
},
|
|
245
|
-
jsxRuntime: {
|
|
246
|
-
type: "string",
|
|
247
|
-
description: "JSX runtime: automatic or classic (default: automatic)",
|
|
248
|
-
},
|
|
249
|
-
jsxImportSource: {
|
|
250
|
-
type: "string",
|
|
251
|
-
description: "JSX import source (e.g., 'react' for classic runtime)",
|
|
252
|
-
},
|
|
253
|
-
keepNames: {
|
|
254
|
-
type: "boolean",
|
|
255
|
-
description: "Preserve original function and class names when minifying",
|
|
256
|
-
},
|
|
257
|
-
debug: {
|
|
258
|
-
type: "boolean",
|
|
259
|
-
description: "Enable debug mode with verbose internal logging",
|
|
260
|
-
},
|
|
261
|
-
experimental: {
|
|
262
|
-
type: "string",
|
|
263
|
-
description: "Enable experimental features (comma-separated list)",
|
|
264
|
-
},
|
|
265
|
-
// New Bun bundler features
|
|
266
|
-
noBundle: {
|
|
267
|
-
type: "boolean",
|
|
268
|
-
description: "Transpile only — do not bundle",
|
|
269
|
-
},
|
|
270
|
-
reactFastRefresh: {
|
|
271
|
-
type: "boolean",
|
|
272
|
-
description: "Enable React Fast Refresh transform (for development testing)",
|
|
273
|
-
},
|
|
274
|
-
noClearScreen: {
|
|
275
|
-
type: "boolean",
|
|
276
|
-
description: "Don't clear the terminal when rebuilding with --watch",
|
|
277
|
-
},
|
|
278
|
-
// Windows executable options
|
|
279
|
-
windowsHideConsole: {
|
|
280
|
-
type: "boolean",
|
|
281
|
-
description: "Prevent a console window from opening when running a compiled Windows executable",
|
|
282
|
-
},
|
|
283
|
-
windowsIcon: {
|
|
284
|
-
type: "string",
|
|
285
|
-
description: "Set an icon for the Windows executable",
|
|
286
|
-
},
|
|
287
|
-
windowsTitle: {
|
|
288
|
-
type: "string",
|
|
289
|
-
description: "Set the Windows executable product name",
|
|
290
|
-
},
|
|
291
|
-
windowsPublisher: {
|
|
292
|
-
type: "string",
|
|
293
|
-
description: "Set the Windows executable company name",
|
|
294
|
-
},
|
|
295
|
-
windowsVersion: {
|
|
296
|
-
type: "string",
|
|
297
|
-
description: "Set the Windows executable version (e.g. 1.2.3.4)",
|
|
298
|
-
},
|
|
299
|
-
windowsDescription: {
|
|
300
|
-
type: "string",
|
|
301
|
-
description: "Set the Windows executable description",
|
|
302
|
-
},
|
|
303
|
-
windowsCopyright: {
|
|
304
|
-
type: "string",
|
|
305
|
-
description: "Set the Windows executable copyright notice",
|
|
306
|
-
},
|
|
307
|
-
// Experimental features
|
|
308
|
-
app: {
|
|
309
|
-
type: "boolean",
|
|
310
|
-
description: "(EXPERIMENTAL) Build a web app for production using Bun Bake",
|
|
311
|
-
},
|
|
312
|
-
serverComponents: {
|
|
313
|
-
type: "boolean",
|
|
314
|
-
description: "(EXPERIMENTAL) Enable React Server Components",
|
|
315
|
-
},
|
|
316
|
-
debugDumpServerFiles: {
|
|
317
|
-
type: "boolean",
|
|
318
|
-
description: "When --app is set, dump all server files to disk even for static builds",
|
|
319
|
-
},
|
|
320
|
-
debugNoMinify: {
|
|
321
|
-
type: "boolean",
|
|
322
|
-
description: "When --app is set, disable all minification",
|
|
323
|
-
},
|
|
324
|
-
// Enhanced features
|
|
325
|
-
macros: {
|
|
326
|
-
type: "boolean",
|
|
327
|
-
description: "Enable Bun macros support for compile-time code generation",
|
|
328
|
-
},
|
|
329
|
-
sideEffects: {
|
|
330
|
-
type: "string",
|
|
331
|
-
description: "Configure sideEffects for tree-shaking (boolean or JSON array)",
|
|
332
|
-
},
|
|
333
|
-
bundleAnalyzer: {
|
|
334
|
-
type: "boolean",
|
|
335
|
-
description: "Generate bundle analysis report",
|
|
336
|
-
},
|
|
337
|
-
typeCheck: {
|
|
338
|
-
type: "boolean",
|
|
339
|
-
description: "Run TypeScript type checking during build",
|
|
340
|
-
},
|
|
341
|
-
generateTypes: {
|
|
342
|
-
type: "boolean",
|
|
343
|
-
description: "Generate TypeScript declaration files (.d.ts)",
|
|
344
|
-
},
|
|
345
|
-
bundleSizeLimit: {
|
|
346
|
-
type: "number",
|
|
347
|
-
description: "Set maximum bundle size limit in bytes",
|
|
348
|
-
},
|
|
349
|
-
performanceBudget: {
|
|
350
|
-
type: "string",
|
|
351
|
-
description: "Set performance budget (JSON format)",
|
|
352
|
-
},
|
|
353
|
-
// Asset optimization
|
|
354
|
-
imageOptimization: {
|
|
355
|
-
type: "boolean",
|
|
356
|
-
description: "Enable image optimization (WebP conversion, compression)",
|
|
357
|
-
},
|
|
358
|
-
fontOptimization: {
|
|
359
|
-
type: "boolean",
|
|
360
|
-
description: "Enable font optimization (subsetting, compression)",
|
|
361
|
-
},
|
|
362
|
-
cssOptimization: {
|
|
363
|
-
type: "boolean",
|
|
364
|
-
description: "Enable CSS optimization (purge, minify, autoprefixer)",
|
|
365
|
-
},
|
|
366
|
-
// Modern loaders
|
|
367
|
-
svgAsReact: {
|
|
368
|
-
type: "boolean",
|
|
369
|
-
description: "Transform SVG files into React components",
|
|
370
|
-
},
|
|
371
|
-
cssModules: {
|
|
372
|
-
type: "boolean",
|
|
373
|
-
description: "Enable CSS Modules support",
|
|
374
|
-
},
|
|
375
|
-
workerSupport: {
|
|
376
|
-
type: "boolean",
|
|
377
|
-
description: "Enable Web Worker support",
|
|
378
|
-
},
|
|
379
|
-
// Plugin system
|
|
380
|
-
plugins: {
|
|
381
|
-
type: "string",
|
|
382
|
-
description: "Load custom plugins (comma-separated list)",
|
|
383
|
-
},
|
|
384
|
-
// Performance monitoring
|
|
385
|
-
performanceMonitoring: {
|
|
386
|
-
type: "boolean",
|
|
387
|
-
description: "Enable performance monitoring and reporting",
|
|
388
|
-
},
|
|
389
|
-
bundleAnalysis: {
|
|
390
|
-
type: "boolean",
|
|
391
|
-
description: "Generate detailed bundle analysis",
|
|
392
|
-
},
|
|
393
|
-
maxConfigDepth: {
|
|
394
|
-
type: "number",
|
|
395
|
-
description: "Maximum directory levels to search up for dler.ts config (default: 3)",
|
|
396
|
-
},
|
|
397
|
-
// Package preparation for publishing
|
|
398
|
-
prepareForPublish: {
|
|
399
|
-
type: "boolean",
|
|
400
|
-
description: "Transform package.json for publishing (exports, bin, private fields)",
|
|
401
|
-
},
|
|
402
|
-
kind: {
|
|
403
|
-
type: "string",
|
|
404
|
-
description: "Package kind: library, cli, browser-app, or native-app",
|
|
405
|
-
},
|
|
406
|
-
bin: {
|
|
407
|
-
type: "string",
|
|
408
|
-
description: "Binary definitions for CLI packages (e.g., 'dler=dist/cli.js,login=dist/foo/bar/login.js')",
|
|
409
|
-
},
|
|
410
|
-
// TSConfig validation
|
|
411
|
-
strictTsconfig: {
|
|
412
|
-
type: "boolean",
|
|
413
|
-
description: "Make TSConfig validation errors fatal (default: false)",
|
|
414
|
-
},
|
|
415
|
-
validateTsconfig: {
|
|
416
|
-
type: "boolean",
|
|
417
|
-
description: "Validate tsconfig.json files for common issues (default: true)",
|
|
418
|
-
},
|
|
419
|
-
dtsProvider: {
|
|
420
|
-
type: "string",
|
|
421
|
-
description: "Provider for generating .d.ts files: dts-bundle-generator (default), api-extractor, typescript, or mkdist",
|
|
422
|
-
},
|
|
423
|
-
replaceExports: {
|
|
424
|
-
type: "boolean",
|
|
425
|
-
description: "Replace exports from ./src/*.ts to ./dist/*.js after build completes (default: true)",
|
|
426
|
-
},
|
|
427
|
-
replaceExportsIgnorePackages: {
|
|
428
|
-
type: "string",
|
|
429
|
-
description: "Packages to ignore when replacing exports (supports glob patterns like @reliverse/*)",
|
|
430
|
-
},
|
|
431
|
-
allowPrivateBuild: {
|
|
432
|
-
type: "string",
|
|
433
|
-
description: "Allow building private packages (supports wildcards like @reliverse/* to build all packages starting with @reliverse/)",
|
|
434
|
-
},
|
|
435
|
-
});
|
|
436
|
-
|
|
437
|
-
const buildCmdCfg = defineCmdCfg({
|
|
438
|
-
name: "build",
|
|
439
|
-
description: "Build all workspace packages using configurable bundler (mkdist for libraries, bun for apps) with dler.ts configuration. Auto-detects frontend apps and libraries. Supports presets: --production, --dev, --library, --react, --node, --monorepo.",
|
|
440
|
-
examples: [
|
|
441
|
-
"dler build",
|
|
442
|
-
'dler build --ignore "@reliverse/*"',
|
|
443
|
-
'dler build --ignore "@reliverse/dler-colors" --ignore "@reliverse/dler-v1"',
|
|
444
|
-
'dler build --ignore "@reliverse/dler-colors @reliverse/dler-v1"',
|
|
445
|
-
"dler build --cwd /path/to/monorepo",
|
|
446
|
-
"dler build --cwd /path/to/monorepo --ignore @reliverse/*",
|
|
447
|
-
"dler build --concurrency 8",
|
|
448
|
-
"dler build --concurrency 2 --stopOnError",
|
|
449
|
-
"dler build --ignore @reliverse/* --concurrency 6 --stopOnError",
|
|
450
|
-
"dler build --verbose",
|
|
451
|
-
"dler build --verbose --ignore @reliverse/*",
|
|
452
|
-
"dler build --verbose --concurrency 2 --stopOnError",
|
|
453
|
-
"dler build --watch",
|
|
454
|
-
"dler build --watch --verbose",
|
|
455
|
-
"dler build --target node --format cjs",
|
|
456
|
-
"dler build --minify --sourcemap linked",
|
|
457
|
-
"dler build --target browser --format esm --splitting false",
|
|
458
|
-
"dler build --external react --external react-dom",
|
|
459
|
-
"dler build --watch --target browser --minify --sourcemap inline",
|
|
460
|
-
"dler build --production",
|
|
461
|
-
"dler build --dev",
|
|
462
|
-
"dler build --bytecode --format cjs --target bun",
|
|
463
|
-
"dler build --minifyWhitespace --minifySyntax --minifyIdentifiers",
|
|
464
|
-
"dler build --drop console.log --drop debugger",
|
|
465
|
-
"dler build --env PUBLIC_* --define '{\"__VERSION__\":\"1.0.0\"}'",
|
|
466
|
-
"dler build --banner 'use client' --footer '// built with dler'",
|
|
467
|
-
"dler build --entryNaming '[dir]/[name].[ext]' --chunkNaming '[name]-[hash].[ext]'",
|
|
468
|
-
"dler build --compile --production",
|
|
469
|
-
"dler build --noCache --verbose",
|
|
470
|
-
"dler build --packages external --external 'react*'",
|
|
471
|
-
"dler build --publicPath /assets/ --root ./src",
|
|
472
|
-
"",
|
|
473
|
-
"# Standalone Executable Examples:",
|
|
474
|
-
"dler build --compile --production --target bun",
|
|
475
|
-
"dler build --compile --target node --format cjs --minify",
|
|
476
|
-
"dler build --compile --bytecode --format cjs --target bun",
|
|
477
|
-
"dler build --compile --windowsIcon app.ico --windowsTitle 'My App'",
|
|
478
|
-
"dler build --compile --production --env inline --drop console.log",
|
|
479
|
-
"",
|
|
480
|
-
"# Note: --compile generates executables alongside bundles",
|
|
481
|
-
"# For Bun executables, use --target bun --format cjs --bytecode for best performance",
|
|
482
|
-
"# For Node executables, use --target node --format cjs",
|
|
483
|
-
"",
|
|
484
|
-
"# Preset Examples:",
|
|
485
|
-
"dler build --production # Optimized for production",
|
|
486
|
-
"dler build --dev # Development mode with watch",
|
|
487
|
-
"dler build --library # Library build (external deps)",
|
|
488
|
-
"dler build --react # React app with JSX support",
|
|
489
|
-
"dler build --node # Node.js server build",
|
|
490
|
-
"dler build --monorepo # Monorepo optimized build",
|
|
491
|
-
"",
|
|
492
|
-
"# Bundler Examples:",
|
|
493
|
-
"dler build --bundler mkdist # Use mkdist bundler (default for libraries)",
|
|
494
|
-
"dler build --bundler bun # Use Bun bundler (default for apps)",
|
|
495
|
-
"dler build --bundler mkdist --kind library",
|
|
496
|
-
"dler build --bundler bun --kind library",
|
|
497
|
-
"",
|
|
498
|
-
"# Note: mkdist preserves file structure and is ideal for libraries",
|
|
499
|
-
"# bun bundles dependencies and is ideal for applications",
|
|
500
|
-
"",
|
|
501
|
-
"# New Bun bundler features:",
|
|
502
|
-
"dler build --noBundle --target node",
|
|
503
|
-
"dler build --reactFastRefresh --watch",
|
|
504
|
-
"dler build --noClearScreen --watch",
|
|
505
|
-
"dler build --windowsHideConsole --windowsIcon app.ico --compile",
|
|
506
|
-
"dler build --app --serverComponents",
|
|
507
|
-
"dler build --debugDumpServerFiles --debugNoMinify",
|
|
508
|
-
"",
|
|
509
|
-
"# Enhanced Features:",
|
|
510
|
-
"dler build --bundleAnalyzer --performanceMonitoring",
|
|
511
|
-
"dler build --generateTypes --typeCheck",
|
|
512
|
-
"dler build --macros --sideEffects false",
|
|
513
|
-
"dler build --bundleSizeLimit 1048576 --performanceBudget '{\"maxBundleSize\":1048576}'",
|
|
514
|
-
"dler build --imageOptimization --fontOptimization --cssOptimization",
|
|
515
|
-
"dler build --svgAsReact --cssModules --workerSupport",
|
|
516
|
-
"dler build --plugins 'react-refresh,typescript-declarations,bundle-analyzer'",
|
|
517
|
-
"",
|
|
518
|
-
"# Frontend App Examples:",
|
|
519
|
-
"dler build --devServer --watch --open --reactFastRefresh",
|
|
520
|
-
"dler build --production --html --cssChunking --bundleAnalyzer",
|
|
521
|
-
"dler build --target browser --format esm --html --cssChunking --svgAsReact",
|
|
522
|
-
"dler build --devServer --port 8080 --open --cssModules",
|
|
523
|
-
"dler build --html --publicAssets static --cssChunking --imageOptimization",
|
|
524
|
-
"",
|
|
525
|
-
"# Full-stack App Examples:",
|
|
526
|
-
"dler build --target browser --format esm --html --assets public --workerSupport",
|
|
527
|
-
"dler build --devServer --watch --target browser --html --performanceMonitoring",
|
|
528
|
-
"",
|
|
529
|
-
"# Library Examples:",
|
|
530
|
-
"dler build --library --generateTypes --typeCheck",
|
|
531
|
-
"dler build --target bun --format esm --generateTypes --bundleAnalyzer",
|
|
532
|
-
"dler build --target node --format cjs --generateTypes --sideEffects false",
|
|
533
|
-
"",
|
|
534
|
-
"# Configuration Examples:",
|
|
535
|
-
"# Create dler.ts in your monorepo root:",
|
|
536
|
-
"# export default {",
|
|
537
|
-
"# build: {",
|
|
538
|
-
"# global: { target: 'bun', format: 'esm' },",
|
|
539
|
-
"# packages: { 'my-package': { minify: true, generateTypes: true } },",
|
|
540
|
-
"# patterns: [{ pattern: 'apps/*', config: { target: 'browser', html: true, bundleAnalyzer: true } }]",
|
|
541
|
-
"# }",
|
|
542
|
-
"# }",
|
|
543
|
-
"",
|
|
544
|
-
"# Note: Configuration is only supported via dler.ts",
|
|
545
|
-
"# package.json build fields are not supported",
|
|
546
|
-
"",
|
|
547
|
-
"# Config Discovery Examples:",
|
|
548
|
-
"dler build --maxConfigDepth 5",
|
|
549
|
-
"",
|
|
550
|
-
"# Package Preparation for Publishing:",
|
|
551
|
-
"dler build --prepareForPublish",
|
|
552
|
-
"dler build --prepareForPublish --kind library",
|
|
553
|
-
"dler build --prepareForPublish --kind cli --bin 'my-cli=dist/cli.js'",
|
|
554
|
-
"dler build --prepareForPublish --kind cli --bin 'dler=dist/cli.js,login=dist/foo/bar/login.js'",
|
|
555
|
-
"dler build --production --prepareForPublish --kind library",
|
|
556
|
-
"",
|
|
557
|
-
"# Note: Use --prepareForPublish to transform package.json for publishing",
|
|
558
|
-
"# This updates exports field, adds bin field for CLI packages, and sets private: false",
|
|
559
|
-
"",
|
|
560
|
-
"# TSConfig Validation Examples:",
|
|
561
|
-
"dler build --validateTsconfig",
|
|
562
|
-
"dler build --strictTsconfig",
|
|
563
|
-
"dler build --validateTsconfig --verbose",
|
|
564
|
-
"dler build --noValidateTsconfig",
|
|
565
|
-
"",
|
|
566
|
-
"# Note: --validateTsconfig checks tsconfig.json for common issues",
|
|
567
|
-
"# Use --strictTsconfig to make validation errors fatal",
|
|
568
|
-
"",
|
|
569
|
-
"# DTS Provider Examples:",
|
|
570
|
-
"dler build --dtsProvider dts-bundle-generator",
|
|
571
|
-
"dler build --dtsProvider api-extractor",
|
|
572
|
-
"dler build --dtsProvider typescript",
|
|
573
|
-
"dler build --dtsProvider mkdist",
|
|
574
|
-
"dler build --generateTypes --dtsProvider dts-bundle-generator",
|
|
575
|
-
"",
|
|
576
|
-
"# Note: dts-bundle-generator is the default provider for better bundling",
|
|
577
|
-
"# mkdist provider offers VFS-based processing with automatic relative import resolution",
|
|
578
|
-
"# Use --dtsProvider to override the default provider",
|
|
579
|
-
],
|
|
580
|
-
});
|
|
581
|
-
|
|
582
|
-
export default defineCmd(buildCmd, buildCmdArgs, buildCmdCfg);
|