@reliverse/dler 1.7.16 → 1.7.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/README.md +134 -206
  2. package/bin/app/agg/run.js +2 -8
  3. package/bin/app/build/cmd.js +4 -4
  4. package/bin/app/build/impl.d.ts +2 -6
  5. package/bin/app/build/impl.js +2 -46
  6. package/bin/app/conv/cmd.d.ts +8 -33
  7. package/bin/app/conv/cmd.js +185 -163
  8. package/bin/app/copy/cmd.js +1 -1
  9. package/bin/app/init/init-impl.js +3 -3
  10. package/bin/app/init/init-types.d.ts +8 -8
  11. package/bin/app/merge/cmd.d.ts +10 -24
  12. package/bin/app/merge/cmd.js +47 -464
  13. package/bin/app/migrate/codemods/anything-bun.js +1 -1
  14. package/bin/app/migrate/codemods/fs-relifso.d.ts +2 -2
  15. package/bin/app/migrate/codemods/fs-relifso.js +1 -1
  16. package/bin/app/migrate/codemods/nodenext-bundler.d.ts +2 -2
  17. package/bin/app/migrate/codemods/nodenext-bundler.js +1 -1
  18. package/bin/app/migrate/codemods/path-pathkit.d.ts +2 -2
  19. package/bin/app/migrate/codemods/path-pathkit.js +1 -1
  20. package/bin/app/migrate/codemods/readdir-glob.d.ts +2 -2
  21. package/bin/app/migrate/codemods/readdir-glob.js +1 -1
  22. package/bin/app/mkdist/cmd.js +4 -2
  23. package/bin/app/pack/cmd.d.ts +44 -0
  24. package/bin/app/pack/cmd.js +313 -0
  25. package/bin/app/pub/cmd.js +4 -4
  26. package/bin/app/pub/impl.d.ts +7 -0
  27. package/bin/app/pub/impl.js +97 -0
  28. package/bin/app/rename/cmd.js +1 -1
  29. package/bin/app/spell/cmd.d.ts +14 -5
  30. package/bin/app/spell/cmd.js +33 -33
  31. package/bin/app/spell/old.js +0 -0
  32. package/bin/app/{mock → unpack}/cmd.d.ts +10 -14
  33. package/bin/app/unpack/cmd.js +200 -0
  34. package/bin/cli.js +2 -2
  35. package/bin/libs/cfg/cfg-mod.d.ts +69 -0
  36. package/bin/libs/cfg/cfg-mod.js +61 -0
  37. package/bin/libs/cfg/rse/rse-impl/rse-biome.d.ts +2 -0
  38. package/bin/libs/cfg/rse/rse-impl/rse-biome.js +34 -0
  39. package/bin/libs/cfg/rse/rse-impl/rse-consts.d.ts +35 -0
  40. package/bin/libs/cfg/rse/rse-impl/rse-consts.js +37 -0
  41. package/bin/libs/cfg/rse/rse-impl/rse-content.d.ts +14 -0
  42. package/bin/libs/cfg/rse/rse-impl/rse-content.js +15 -0
  43. package/bin/libs/cfg/rse/rse-impl/rse-core.d.ts +14 -0
  44. package/bin/libs/cfg/rse/rse-impl/rse-core.js +63 -0
  45. package/bin/libs/cfg/rse/rse-impl/rse-create.d.ts +36 -0
  46. package/bin/libs/cfg/rse/rse-impl/rse-create.js +254 -0
  47. package/bin/libs/cfg/rse/rse-impl/rse-def-utils.d.ts +6 -0
  48. package/bin/libs/cfg/rse/rse-impl/rse-def-utils.js +225 -0
  49. package/bin/libs/cfg/rse/rse-impl/rse-default.d.ts +3 -0
  50. package/bin/libs/cfg/rse/rse-impl/rse-default.js +155 -0
  51. package/bin/libs/cfg/rse/rse-impl/rse-define.d.ts +125 -0
  52. package/bin/libs/cfg/rse/rse-impl/rse-define.js +4 -0
  53. package/bin/libs/cfg/rse/rse-impl/rse-detect.d.ts +23 -0
  54. package/bin/libs/cfg/rse/rse-impl/rse-detect.js +347 -0
  55. package/bin/libs/cfg/rse/rse-impl/rse-gen-cfg.d.ts +3 -0
  56. package/bin/libs/cfg/rse/rse-impl/rse-gen-cfg.js +186 -0
  57. package/bin/libs/cfg/rse/rse-impl/rse-inject.d.ts +1 -0
  58. package/bin/libs/cfg/rse/rse-impl/rse-inject.js +57 -0
  59. package/bin/libs/cfg/rse/rse-impl/rse-migrate.d.ts +5 -0
  60. package/bin/libs/cfg/rse/rse-impl/rse-migrate.js +56 -0
  61. package/bin/libs/cfg/rse/rse-impl/rse-path.d.ts +11 -0
  62. package/bin/libs/cfg/rse/rse-impl/rse-path.js +33 -0
  63. package/bin/libs/cfg/rse/rse-impl/rse-prompts.d.ts +5 -0
  64. package/bin/libs/cfg/rse/rse-impl/rse-prompts.js +12 -0
  65. package/bin/libs/cfg/rse/rse-impl/rse-read.d.ts +11 -0
  66. package/bin/libs/cfg/rse/rse-impl/rse-read.js +84 -0
  67. package/bin/libs/cfg/rse/rse-impl/rse-repair.d.ts +16 -0
  68. package/bin/libs/cfg/rse/rse-impl/rse-repair.js +137 -0
  69. package/bin/libs/cfg/rse/rse-impl/rse-schema.d.ts +130 -0
  70. package/bin/libs/cfg/rse/rse-impl/rse-schema.js +444 -0
  71. package/bin/libs/cfg/rse/rse-impl/rse-types.d.ts +75 -0
  72. package/bin/libs/cfg/rse/rse-impl/rse-types.js +0 -0
  73. package/bin/libs/cfg/rse/rse-impl/rse-unstable.d.ts +11 -0
  74. package/bin/libs/cfg/rse/rse-impl/rse-unstable.js +41 -0
  75. package/bin/libs/cfg/rse/rse-impl/rse-update.d.ts +10 -0
  76. package/bin/libs/cfg/rse/rse-impl/rse-update.js +152 -0
  77. package/bin/libs/cfg/rse/rse-impl/rse-utils.d.ts +17 -0
  78. package/bin/libs/cfg/rse/rse-impl/rse-utils.js +86 -0
  79. package/bin/libs/cfg/rse/rse-mod.d.ts +20 -0
  80. package/bin/libs/cfg/rse/rse-mod.js +20 -0
  81. package/bin/libs/cfg/types.d.ts +533 -0
  82. package/bin/libs/cfg/types.js +0 -0
  83. package/bin/libs/sdk/sdk-impl/build/build-library.d.ts +5 -5
  84. package/bin/libs/sdk/sdk-impl/build/build-library.js +1 -174
  85. package/bin/libs/sdk/sdk-impl/build/build-regular.d.ts +2 -1
  86. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/build.js +287 -240
  87. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loaders/vue.d.ts +4 -4
  88. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/make.d.ts +8 -5
  89. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/make.js +199 -119
  90. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/utils/spinner.d.ts +99 -0
  91. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/utils/spinner.js +206 -0
  92. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-mod.js +92 -46
  93. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/raw.d.ts +2 -2
  94. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/utils.d.ts +2 -2
  95. package/bin/libs/sdk/sdk-impl/config/default.d.ts +6 -0
  96. package/bin/libs/sdk/sdk-impl/{cfg → config}/default.js +8 -18
  97. package/bin/libs/sdk/sdk-impl/{cfg → config}/info.js +1 -1
  98. package/bin/libs/sdk/sdk-impl/{cfg → config}/init.js +53 -43
  99. package/bin/libs/sdk/sdk-impl/{cfg → config}/load.d.ts +2 -2
  100. package/bin/libs/sdk/sdk-impl/{cfg → config}/load.js +6 -6
  101. package/bin/libs/sdk/sdk-impl/config/types.d.ts +533 -0
  102. package/bin/libs/sdk/sdk-impl/config/types.js +0 -0
  103. package/bin/libs/sdk/sdk-impl/library-flow.d.ts +2 -1
  104. package/bin/libs/sdk/sdk-impl/regular-flow.d.ts +2 -1
  105. package/bin/libs/sdk/sdk-impl/rules/reliverse/dler-config-health/dler-config-health.js +2 -2
  106. package/bin/libs/sdk/sdk-impl/rules/reliverse/missing-deps/deps-types.d.ts +6 -6
  107. package/bin/libs/sdk/sdk-impl/rules/reliverse/missing-deps/filesystem.js +1 -1
  108. package/bin/libs/sdk/sdk-impl/rules/reliverse/no-index-files/no-index-files.js +1 -1
  109. package/bin/libs/sdk/sdk-impl/rules/reliverse/self-include/self-include.js +2 -2
  110. package/bin/libs/sdk/sdk-impl/spell/applyMagicSpells.d.ts +38 -0
  111. package/bin/libs/sdk/sdk-impl/spell/applyMagicSpells.js +474 -0
  112. package/bin/libs/sdk/sdk-impl/spell/spells.d.ts +31 -0
  113. package/bin/libs/sdk/sdk-impl/spell/spells.js +85 -0
  114. package/bin/libs/sdk/sdk-impl/utils/binary.js +1 -1
  115. package/bin/libs/sdk/sdk-impl/utils/comments.d.ts +6 -0
  116. package/bin/libs/sdk/sdk-impl/utils/comments.js +41 -0
  117. package/bin/libs/sdk/sdk-impl/utils/finalize.d.ts +2 -1
  118. package/bin/libs/sdk/sdk-impl/utils/finalize.js +1 -0
  119. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-constants.d.ts +6 -0
  120. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-constants.js +7 -0
  121. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-file-utils.d.ts +5 -0
  122. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-file-utils.js +40 -0
  123. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-types.d.ts +24 -0
  124. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-types.js +0 -0
  125. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pub-json-utils.d.ts +17 -0
  126. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pub-json-utils.js +46 -0
  127. package/bin/libs/sdk/sdk-impl/utils/replacements.d.ts +0 -0
  128. package/bin/libs/sdk/sdk-impl/utils/replacements.js +0 -0
  129. package/bin/libs/sdk/sdk-impl/utils/resolve-cross-libs.d.ts +3 -0
  130. package/bin/libs/sdk/sdk-impl/utils/resolve-cross-libs.js +194 -0
  131. package/bin/libs/sdk/sdk-impl/utils/utils-build.d.ts +1 -2
  132. package/bin/libs/sdk/sdk-impl/utils/utils-clean.d.ts +1 -1
  133. package/bin/libs/sdk/sdk-impl/utils/utils-deps.d.ts +1 -1
  134. package/bin/libs/sdk/sdk-impl/utils/utils-determine.d.ts +1 -1
  135. package/bin/libs/sdk/sdk-impl/utils/utils-error-cwd.d.ts +4 -0
  136. package/bin/libs/sdk/sdk-impl/utils/utils-error-cwd.js +1 -0
  137. package/bin/libs/sdk/sdk-impl/utils/utils-jsr-json.d.ts +1 -1
  138. package/bin/libs/sdk/sdk-impl/utils/utils-package-json-libraries.d.ts +1 -1
  139. package/bin/libs/sdk/sdk-impl/utils/utils-package-json-regular.d.ts +1 -1
  140. package/bin/libs/sdk/sdk-impl/utils/utils-security.d.ts +1 -3
  141. package/bin/libs/sdk/sdk-impl/utils/utils-security.js +11 -10
  142. package/bin/libs/sdk/sdk-mod.d.ts +1 -6
  143. package/bin/libs/sdk/sdk-mod.js +0 -31
  144. package/bin/libs/sdk/sdk-types.d.ts +39 -582
  145. package/bin/mod.d.ts +1 -1
  146. package/bin/mod.js +1 -1
  147. package/package.json +11 -4
  148. package/bin/app/mock/cmd.js +0 -284
  149. package/bin/app/mock/mock.d.ts +0 -11
  150. package/bin/app/mock/mock.js +0 -97
  151. package/bin/libs/sdk/sdk-impl/cfg/default.d.ts +0 -5
  152. package/bin/libs/sdk/sdk-impl/cfg/define.d.ts +0 -2
  153. package/bin/libs/sdk/sdk-impl/cfg/define.js +0 -4
  154. package/bin/libs/sdk/sdk-impl/spell/spell-executors.d.ts +0 -10
  155. package/bin/libs/sdk/sdk-impl/spell/spell-executors.js +0 -307
  156. package/bin/libs/sdk/sdk-impl/spell/spell-filesystem.d.ts +0 -7
  157. package/bin/libs/sdk/sdk-impl/spell/spell-filesystem.js +0 -74
  158. package/bin/libs/sdk/sdk-impl/spell/spell-mod.d.ts +0 -4
  159. package/bin/libs/sdk/sdk-impl/spell/spell-mod.js +0 -87
  160. package/bin/libs/sdk/sdk-impl/spell/spell-parser.d.ts +0 -4
  161. package/bin/libs/sdk/sdk-impl/spell/spell-parser.js +0 -58
  162. package/bin/libs/sdk/sdk-impl/spell/spell-types.d.ts +0 -60
  163. /package/bin/{libs/sdk/sdk-impl/spell/spell-types.js → app/spell/old.d.ts} +0 -0
  164. /package/bin/libs/sdk/sdk-impl/{cfg → config}/info.d.ts +0 -0
  165. /package/bin/libs/sdk/sdk-impl/{cfg → config}/init.d.ts +0 -0
package/README.md CHANGED
@@ -15,7 +15,7 @@
15
15
  - 🎯 optimized for speed and modern workflows
16
16
  - ✨ packed with powerful features under the hood
17
17
  - 🛠️ converts typescript aliases to relative paths
18
- - 🔌 16 built-in helper [dler commands](#-commands) included
18
+ - 🔌 18 built-in helper [dler commands](#-commands) included
19
19
  - 📝 highly configurable flow via a configuration file
20
20
  - 🔜 `libraries` plugin —> dler monorepo implementation
21
21
  - 🧼 cleans up your internal logs from the build dist
@@ -119,7 +119,7 @@ bun dev # bun src/cli.ts --dev
119
119
 
120
120
  ## 🔌 commands
121
121
 
122
- dler ships with a flexible command system (prev. plugins) and **16 built-in commands** (from [reliverse addons](https://reliverse.org/addons) collection).
122
+ dler ships with a flexible command system (prev. plugins) and **18 built-in commands** (from [reliverse addons](https://reliverse.org/addons) collection).
123
123
 
124
124
  feel free to create your own commands. commands can be implemented as built-in directly in `src/app/<command>/impl/*` and then imported from `src/app/<command>/cmd.ts`; or implemented in your own library and then imported from `src/app/<command>/cmd.ts`.
125
125
 
@@ -127,7 +127,7 @@ if you run just `dler` — it will display a list of commands which you can laun
127
127
 
128
128
  ## **available commands**
129
129
 
130
- [agg](#1-agg) [build](#2-build) [check](#3-check) [conv](#4-conv) [copy](#5-copy) [init](#6-init) [inject](#7-inject) [libs](#8-libs) [merge](#9-merge) [mock](#10-mock) [migrate](#11-migrate) [pub](#12-pub) [rempts](#13-rempts) [rename](#14-rename) [spell](#15-spell) [split](#16-split)
130
+ [agg](#1-agg) [build](#2-build) [check](#3-check) [conv](#4-conv) [copy](#6-copy) [init](#7-init) [inject](#8-inject) [libs](#9-libs) [merge](#10-merge) [migrate](#11-migrate) [pub](#12-pub) [rempts](#13-rempts) [rename](#14-rename) [spell](#15-spell) [split](#16-split) [pack](#17-pack) [unpack](#18-unpack)
131
131
 
132
132
  ### 1. `agg`
133
133
 
@@ -284,7 +284,7 @@ deep imports like `dep/some/file` or `@org/dep/some/thing` are always resolved t
284
284
  - **Dev-only Dependencies**: Packages that are only in `devDependencies` but imported in production code
285
285
  - **Duplicate Dependencies**: Packages listed in both `dependencies` and `devDependencies`
286
286
 
287
- ### 5. `copy`
287
+ ### 6. `copy`
288
288
 
289
289
  ```bash
290
290
  # simple example:
@@ -294,15 +294,15 @@ bun dler copy --s "src/**/*.ts" --d "dist"
294
294
  bun dler copy --s ".temp/packages/*/lib/**/*" --d "src/libs/sdk/sdk-impl/rules/external"
295
295
  ```
296
296
 
297
- ### 6. `init`
297
+ ### 7. `init`
298
298
 
299
299
  not yet documented.
300
300
 
301
- ### 7. `inject`
301
+ ### 8. `inject`
302
302
 
303
303
  not yet documented.
304
304
 
305
- ### 8. `libs`
305
+ ### 9. `libs`
306
306
 
307
307
  builds and publishes specific subdirectories of your main project as standalone packages.
308
308
 
@@ -338,7 +338,7 @@ libslist: {
338
338
 
339
339
  - more magic commands coming soon...
340
340
 
341
- ### 9. `merge`
341
+ ### 10. `merge`
342
342
 
343
343
  merges multiple files into a single file. The command is built for both CI and interactive use, with support for glob patterns and advanced options.
344
344
 
@@ -349,14 +349,12 @@ merges multiple files into a single file. The command is built for both CI and i
349
349
  - supports both glob patterns and simple paths
350
350
  - preserves directory structure when merging to a directory
351
351
  - generates source maps for merged output
352
- - creates and updates templates for mock project structures
353
352
  - handles file deduplication
354
353
  - supports custom separators and comment styles
355
354
  - provides interactive mode with prompts
356
355
  - includes backup functionality
357
356
  - validates file permissions and sizes
358
357
  - enforces output path conflict detection
359
- - supports template generation with TypeScript type definitions
360
358
  - handles both single file and directory output modes
361
359
  - implements interactive prompts via `@reliverse/rempts`
362
360
  - provides reporting with logging via `@reliverse/relinka`
@@ -369,18 +367,6 @@ bun dler merge --s "src/**/*.ts" --d "dist/merged.ts"
369
367
 
370
368
  # advanced example:
371
369
  bun dler merge --s ".temp1/packages/*/lib/**/*" --d ".temp2/merged.ts" --sort "mtime" --header "// Header" --footer "// Footer" --dedupe
372
-
373
- # generate mock template:
374
- bun dler merge --s "src/templates" --d "templates/my-template.ts" --as-template
375
-
376
- # update mock template:
377
- bun dler merge --s "src/templates" --d "templates/my-template.ts" --as-template --update-template REACT_DLER_TEMPLATE
378
-
379
- # generate multiple templates based on directory structure:
380
- bun dler merge --s "src/templates" --d "templates" --as-template --template-multi --depth 2
381
-
382
- # create separate files for each template with an aggregator:
383
- bun dler merge --s "src/templates" --d "templates/index.ts" --as-template --template-per-file
384
370
  ```
385
371
 
386
372
  **arguments:**
@@ -408,15 +394,8 @@ bun dler merge --s "src/templates" --d "templates/index.ts" --as-template --temp
408
394
  - `--footer`: Footer text to add at the end of merged output
409
395
  - `--select-files`: Prompt for file selection before merging
410
396
  - `--interactive`: Enable interactive mode with prompts
411
- - `--as-template`: Generate a TypeScript file with template structure
412
- - `--custom-template-name`: Custom template name when using --as-template
413
- - `--template-multi`: Create multiple templates based on directory structure (default: true)
414
397
  - `--depth`: Depth level to start processing from (default: 0)
415
- - `--template-per-file`: Create separate files for each template with an aggregator (default: false)
416
- - `--whitelabel`: Custom prefix to use instead of 'DLER' in template generation (default: "DLER")
417
398
  - `--sourcemap`: Generate source map for the merged output
418
- - `--update-template`: Update specific template in existing mock template file
419
- - `--dev`: Generate template for development
420
399
 
421
400
  **implementation details:**
422
401
 
@@ -425,182 +404,10 @@ bun dler merge --s "src/templates" --d "templates/index.ts" --as-template --temp
425
404
  - implements concurrent file operations with `p-map`
426
405
  - provides file type detection and appropriate comment styles
427
406
  - includes safety checks for file sizes and permissions
428
- - supports template generation with TypeScript type definitions
429
407
  - handles both single file and directory output modes
430
408
  - implements interactive prompts via `@reliverse/rempts`
431
409
  - provides reporting with logging via `@reliverse/relinka`
432
410
 
433
- ### 10. `mock`
434
-
435
- bootstraps file structure based on the specified mock template. The command is designed to create project structures from predefined or custom templates, with built-in safety checks and cleanup capabilities.
436
-
437
- **key features:**
438
-
439
- - creates project structures from predefined templates (basic, api, react)
440
- - supports custom template files
441
- - handles path conflicts with force option
442
- - provides cleanup functionality
443
- - includes dry run mode for previewing changes
444
- - validates file types and content
445
- - enforces rate limiting for file operations
446
- - supports custom whitelabel prefixes
447
- - preserves directory structure
448
- - handles both text and binary files
449
-
450
- **usage examples:**
451
-
452
- ```bash
453
- # use default react template:
454
- bun dler mock --template react
455
-
456
- # use custom template file:
457
- bun dler mock --template-file templates/my-template.ts
458
-
459
- # preview changes without applying:
460
- bun dler mock --template react --dry-run
461
-
462
- # clean up existing mock structure:
463
- bun dler mock --template react --cleanup
464
- ```
465
-
466
- **integration with merge command:**
467
- The mock command works seamlessly with the merge command to create and update templates:
468
-
469
- 1. **create template from existing files:**
470
-
471
- ```bash
472
- # create a template from your project structure
473
- bun dler merge --s "src/templates" --d "templates/my-template.ts" --as-template
474
- ```
475
-
476
- 2. **use the template with mock:**
477
-
478
- ```bash
479
- # use the generated template
480
- bun dler mock --template-file templates/my-template.ts
481
- ```
482
-
483
- 3. **update existing template:**
484
-
485
- ```bash
486
- # update a specific template in the file
487
- bun dler merge --s "src/templates" --d "templates/my-template.ts" --update-template REACT_DLER_TEMPLATE
488
- ```
489
-
490
- **implementation details:**
491
-
492
- - uses `jiti` for dynamic template file loading
493
- - implements template validation and type checking
494
- - provides detailed error handling and reporting
495
- - supports multiple template constants in a single file
496
- - handles file system operations safely with permissions checks
497
- - includes cleanup of empty directories
498
- - provides verbose logging option
499
- - enforces output path conflict detection
500
-
501
- **programmatic usage:**
502
- Both merge and mock commands can be used programmatically through the `@reliverse/dler-sdk` package:
503
-
504
- ```typescript
505
- import { merge, mock } from "@reliverse/dler-sdk";
506
-
507
- // Merge files programmatically
508
- await merge({
509
- source: ["src/**/*.ts"],
510
- destination: "dist/merged.ts",
511
- options: {
512
- sort: "mtime",
513
- header: "// Header",
514
- footer: "// Footer",
515
- dedupe: true,
516
- sourcemap: true
517
- }
518
- });
519
-
520
- // Create mock structure programmatically
521
- await mock({
522
- template: "react",
523
- options: {
524
- templateFile: "templates/my-template.ts",
525
- cleanup: false,
526
- dryRun: false,
527
- verbose: true,
528
- whitelabel: "MYAPP",
529
- force: true
530
- }
531
- });
532
-
533
- // Create and use custom template
534
- const template = await merge({
535
- source: ["src/templates"],
536
- destination: "templates/my-template.ts",
537
- options: {
538
- asTemplate: true,
539
- whitelabel: "MYAPP"
540
- }
541
- });
542
-
543
- await mock({
544
- template: "custom",
545
- options: {
546
- templateFile: "templates/my-template.ts"
547
- }
548
- });
549
- ```
550
-
551
- **sdk types:**
552
-
553
- ```typescript
554
- // Merge command options
555
- interface MergeOptions {
556
- source: string[];
557
- destination?: string;
558
- options?: {
559
- ignore?: string[];
560
- format?: string;
561
- stdout?: boolean;
562
- noPath?: boolean;
563
- pathAbove?: boolean;
564
- separator?: string;
565
- comment?: string;
566
- forceComment?: boolean;
567
- batch?: boolean;
568
- recursive?: boolean;
569
- preserveStructure?: boolean;
570
- increment?: boolean;
571
- concurrency?: number;
572
- sort?: "name" | "path" | "mtime" | "none";
573
- dryRun?: boolean;
574
- backup?: boolean;
575
- dedupe?: boolean;
576
- header?: string;
577
- footer?: string;
578
- selectFiles?: boolean;
579
- interactive?: boolean;
580
- asTemplate?: boolean;
581
- ctn?: string;
582
- whitelabel?: string;
583
- sourcemap?: boolean;
584
- updateTemplate?: string;
585
- dev?: boolean;
586
- };
587
- }
588
-
589
- // Mock command options
590
- interface MockOptions {
591
- template: string;
592
- options?: {
593
- templateFile?: string;
594
- templateConsts?: string;
595
- cleanup?: boolean;
596
- dryRun?: boolean;
597
- verbose?: boolean;
598
- whitelabel?: string;
599
- force?: boolean;
600
- };
601
- }
602
- ```
603
-
604
411
  ### 11. `migrate`
605
412
 
606
413
  helps migrate between different libraries and module resolution strategies. currently supports:
@@ -700,7 +507,7 @@ dler migrate --lib nodenext-bundler --target nodenext --dryRun
700
507
  - handles both relative and alias imports
701
508
  - supports both .ts and .tsx files
702
509
 
703
- #### `console-relinka`
510
+ **`console-relinka`**:
704
511
 
705
512
  [@reliverse/relinka](https://github.com/reliverse/relinka)'s best friend. Converts between different logging formats (console, consola method/object, and relinka's function/method/object styles).
706
513
 
@@ -722,7 +529,7 @@ dler relinka --input src/app.ts --from relinkaMethod --to relinkaObject
722
529
  dler relinka --input src/app.ts --from relinkaFunction --to consolaObject
723
530
  ```
724
531
 
725
- **Supported formats:**
532
+ **Supported formats**:
726
533
 
727
534
  - `console`: Standard console logging (`console.log(message, ...args)`)
728
535
  - `consolaMethod`: Consola method style (`consola.log(message, ...args)`)
@@ -731,7 +538,7 @@ dler relinka --input src/app.ts --from relinkaFunction --to consolaObject
731
538
  - `relinkaMethod`: Relinka method style (`relinka.level(message, ...args)`)
732
539
  - `relinkaObject`: Relinka object style (`relinka({ level, message, title?, args? })`)
733
540
 
734
- **Special features:**
541
+ **Special features**:
735
542
 
736
543
  - Preserves additional arguments in all formats
737
544
  - Handles special box format with title and message
@@ -739,7 +546,7 @@ dler relinka --input src/app.ts --from relinkaFunction --to consolaObject
739
546
  - Supports conversion between any combination of formats
740
547
  - Supports both consola method and object styles
741
548
 
742
- #### next steps after migration
549
+ **next steps after migration**:
743
550
 
744
551
  - for path-pathkit:
745
552
  1. run 'bun install' to install @reliverse/pathkit
@@ -796,6 +603,8 @@ bun dler rename ...
796
603
 
797
604
  ### 15. `spell`
798
605
 
606
+ > Contributors: Please check the [docs/cmds/SPELLS.md](./docs/cmds/SPELLS.md) file for more technical details.
607
+
799
608
  **available spell types:**
800
609
 
801
610
  - `replace-line` — injects contents from one file into another
@@ -871,7 +680,118 @@ splits your code/text file into multiple files.
871
680
  bun dler split ...
872
681
  ```
873
682
 
874
- ## api (for advanced users)
683
+ ### 17. `pack`
684
+
685
+ packs a directory of templates into TypeScript modules. This command is useful for creating reusable template packages that can be distributed and used by other projects.
686
+
687
+ **key features:**
688
+
689
+ - Converts directory structure into TypeScript modules
690
+ - Handles binary files with automatic hashing and storage
691
+ - Preserves JSON comments and formatting
692
+ - Supports custom whitelabeling
693
+ - Generates type-safe template definitions
694
+ - Creates an aggregator module for easy imports
695
+ - Tracks file metadata (update time and content hash)
696
+ - Supports selective file updates
697
+ - Handles file conflicts gracefully
698
+ - Preserves JSON type information for package.json and tsconfig.json
699
+
700
+ **usage examples:**
701
+
702
+ ```bash
703
+ # Basic usage
704
+ dler pack --dir ./templates --output ./dist-templates
705
+
706
+ # With custom whitelabel
707
+ dler pack --dir ./templates --output ./dist-templates --whitelabel MYAPP
708
+
709
+ # Update specific files only
710
+ dler pack --dir ./templates --output ./dist-templates --files "src/index.ts,src/config.ts"
711
+
712
+ # Force overwrite existing files
713
+ dler pack --dir ./templates --output ./dist-templates --force
714
+
715
+ # Update mode (default: true)
716
+ dler pack --dir ./templates --output ./dist-templates --update
717
+ ```
718
+
719
+ **arguments:**
720
+
721
+ - `--dir`: Directory containing templates to process (required)
722
+ - `--output`: Output directory for generated modules (default: "my-templates")
723
+ - `--whitelabel`: Custom prefix to use instead of 'DLER' (default: "DLER")
724
+ - `--cdn`: Remote CDN for binary assets upload (not yet implemented)
725
+ - `--force`: Force overwrite existing files (default: false)
726
+ - `--update`: Update existing templates and add new ones (default: true)
727
+ - `--files`: Comma-separated list of specific files to update
728
+ - `--lastUpdate`: Override lastUpdate timestamp
729
+
730
+ **output structure:**
731
+
732
+ ```bash
733
+ output/
734
+ ├── impl/
735
+ │ ├── binaries/ # binary files stored with hash-based names (dler reads/writes this dir when --cdn is not used)
736
+ │ │ └── [hashed-files]
737
+ │ ├── template1.ts
738
+ │ └── template2.ts
739
+ ├── types.ts
740
+ └── mod.ts
741
+ ```
742
+
743
+ ### 18. `unpack`
744
+
745
+ creates file structure from packed templates. This command is the counterpart to `pack` and is used to extract and restore template files from a packed template package.
746
+
747
+ **key features:**
748
+
749
+ - Restores complete directory structure from packed templates
750
+ - Handles binary files with automatic lookup
751
+ - Preserves JSON comments and formatting
752
+ - Supports custom output locations
753
+ - Maintains file permissions and structure
754
+ - Validates template integrity
755
+ - Supports cleanup of existing template files
756
+ - Provides dry-run mode for previewing changes
757
+ - Handles empty directory cleanup
758
+
759
+ **usage examples:**
760
+
761
+ ```bash
762
+ # Basic usage
763
+ dler unpack ./dist-templates --output ./my-project
764
+
765
+ # With custom output directory
766
+ dler unpack ./dist-templates --output ./custom-location
767
+
768
+ # Preview changes without applying
769
+ dler unpack ./dist-templates --output ./my-project --dry-run
770
+
771
+ # Clean up existing template files before unpacking
772
+ dler unpack ./dist-templates --output ./my-project --cleanup
773
+ ```
774
+
775
+ **arguments:**
776
+
777
+ - `templatesDir`: Directory containing mod.ts (required)
778
+ - `--output`: Where to write files (default: "unpacked")
779
+ - `--cdn`: Remote CDN base for binary assets download (not yet implemented)
780
+ - `--cleanup`: Clean up template files before unpacking (default: false)
781
+ - `--dry-run`: Preview changes without applying them (default: false)
782
+
783
+ **implementation details:**
784
+
785
+ - Uses `jiti` for dynamic template file loading
786
+ - Implements template validation and type checking
787
+ - Provides detailed error handling and reporting
788
+ - Handles file system operations safely
789
+ - Preserves JSON comments and formatting
790
+ - Supports binary file restoration
791
+ - Cleans up empty directories after unpacking
792
+ - Validates template structure before unpacking
793
+
794
+ ## api (for advanced usage)
875
795
 
876
796
  the sdk lets you build custom dler cli plugins or even extend your own cli tools.
877
797
 
@@ -898,6 +818,14 @@ special thanks to the project that inspired `@reliverse/dler`:
898
818
 
899
819
  - [unjs/unbuild](https://github.com/unjs/unbuild#readme)
900
820
 
821
+ ## contributors
822
+
823
+ ### scripts
824
+
825
+ - `libs:pack`: Creates two templates, `cfg` and `sdk`, based on dist-libs directory structure (using **dler pack** command).
826
+ - `libs:unpack`: Creates a project structure using all templates from the `cfg` and `sdk` templates (using **dler unpack** command).
827
+ - `libs:example`: Since `libs:unpack`'s serves as a dist-libs mock, then `libs:example` helps easily test dler's features like `resolveAllCrossLibs()`.
828
+
901
829
  ## support
902
830
 
903
831
  - if dler saves you time and effort, please consider supporting its development: [github sponsors](https://github.com/sponsors/blefnk);
@@ -1,14 +1,8 @@
1
1
  import { selectPrompt, runCmd, confirmPrompt, inputPrompt } from "@reliverse/rempts";
2
- import { existsSync } from "node:fs";
3
- import { resolve } from "node:path";
4
2
  import { getAggCmd } from "../cmds.js";
5
- async function loadConfig() {
6
- const configPath = resolve(".config/dler.ts");
7
- if (!existsSync(configPath)) return null;
8
- return (await import(configPath)).default;
9
- }
3
+ import { getConfigDler } from "../../libs/sdk/sdk-impl/config/load.js";
10
4
  export async function promptAggCommand() {
11
- const config = await loadConfig();
5
+ const config = await getConfigDler();
12
6
  let selectedLibName = null;
13
7
  if (config?.libsList && Object.keys(config.libsList).length > 0) {
14
8
  const libs = Object.entries(config.libsList).map(([name, lib]) => ({
@@ -1,7 +1,7 @@
1
1
  import { defineArgs, defineCommand } from "@reliverse/rempts";
2
- import { dlerPub } from "./impl.js";
3
- import { ensureDlerConfig } from "../../libs/sdk/sdk-impl/cfg/init.js";
4
- import { loadConfig } from "../../libs/sdk/sdk-impl/cfg/load.js";
2
+ import { dlerPub } from "../pub/impl.js";
3
+ import { ensureDlerConfig } from "../../libs/sdk/sdk-impl/config/init.js";
4
+ import { getConfigDler } from "../../libs/sdk/sdk-impl/config/load.js";
5
5
  import { removeDistFolders } from "../../libs/sdk/sdk-mod.js";
6
6
  export default defineCommand({
7
7
  meta: {
@@ -16,7 +16,7 @@ export default defineCommand({
16
16
  }),
17
17
  async run({ args }) {
18
18
  await ensureDlerConfig(args.dev);
19
- const config = await loadConfig();
19
+ const config = await getConfigDler();
20
20
  await removeDistFolders(
21
21
  config.distNpmDirName,
22
22
  config.distJsrDirName,
@@ -1,11 +1,7 @@
1
- import type { DlerConfig } from "../../libs/sdk/sdk-types.js";
1
+ import type { DlerConfig } from "../../libs/sdk/sdk-impl/config/types.js";
2
2
  /**
3
3
  * Main entry point for the dler build and publish process.
4
4
  * Handles building and publishing for both main project and libraries.
5
+ * @see `src/app/pub/impl.ts` for pub main function implementation.
5
6
  */
6
7
  export declare function dlerBuild(isDev: boolean, config?: DlerConfig): Promise<void>;
7
- /**
8
- * Main entry point for the dler build and publish process.
9
- * Handles building and publishing for both main project and libraries.
10
- */
11
- export declare function dlerPub(isDev: boolean, config?: DlerConfig): Promise<void>;
@@ -1,7 +1,7 @@
1
1
  import { bumpHandler, isBumpDisabled, setBumpDisabledValueTo } from "@reliverse/bleump";
2
2
  import path from "@reliverse/pathkit";
3
3
  import fs from "@reliverse/relifso";
4
- import { loadConfig } from "../../libs/sdk/sdk-impl/cfg/load.js";
4
+ import { getConfigDler } from "../../libs/sdk/sdk-impl/config/load.js";
5
5
  import { processLibraryFlow } from "../../libs/sdk/sdk-impl/library-flow.js";
6
6
  import { processRegularFlow } from "../../libs/sdk/sdk-impl/regular-flow.js";
7
7
  import { finalizeBuildPub } from "../../libs/sdk/sdk-impl/utils/finalize.js";
@@ -14,7 +14,7 @@ export async function dlerBuild(isDev, config) {
14
14
  let effectiveConfig = config;
15
15
  try {
16
16
  if (!effectiveConfig) {
17
- effectiveConfig = await loadConfig();
17
+ effectiveConfig = await getConfigDler();
18
18
  }
19
19
  if (effectiveConfig.logsFreshFile) {
20
20
  await fs.remove(path.join(PROJECT_ROOT, effectiveConfig.logsFileName));
@@ -53,47 +53,3 @@ export async function dlerBuild(isDev, config) {
53
53
  handleDlerError(error);
54
54
  }
55
55
  }
56
- export async function dlerPub(isDev, config) {
57
- const timer = createPerfTimer();
58
- let effectiveConfig = config;
59
- try {
60
- if (!effectiveConfig) {
61
- effectiveConfig = await loadConfig();
62
- }
63
- if (effectiveConfig.logsFreshFile) {
64
- await fs.remove(path.join(PROJECT_ROOT, effectiveConfig.logsFileName));
65
- }
66
- await removeDistFolders(
67
- effectiveConfig.distNpmDirName,
68
- effectiveConfig.distJsrDirName,
69
- effectiveConfig.libsDirDist,
70
- effectiveConfig.libsList
71
- );
72
- const bumpIsDisabled = await isBumpDisabled();
73
- if (!bumpIsDisabled && !effectiveConfig.commonPubPause) {
74
- try {
75
- await bumpHandler(
76
- effectiveConfig.bumpMode,
77
- false,
78
- effectiveConfig.bumpFilter,
79
- effectiveConfig.bumpSet
80
- );
81
- await setBumpDisabledValueTo(true);
82
- } catch {
83
- throw new Error("[.config/dler.ts] Failed to set bumpDisable to true");
84
- }
85
- }
86
- await processRegularFlow(timer, isDev, effectiveConfig);
87
- await processLibraryFlow(timer, isDev, effectiveConfig);
88
- await finalizeBuildPub(
89
- timer,
90
- effectiveConfig.commonPubPause,
91
- effectiveConfig.libsList,
92
- effectiveConfig.distNpmDirName,
93
- effectiveConfig.distJsrDirName,
94
- effectiveConfig.libsDirDist
95
- );
96
- } catch (error) {
97
- handleDlerError(error);
98
- }
99
- }
@@ -1,33 +1,8 @@
1
- declare const _default: import("@reliverse/rempts").Command<{
2
- type: {
3
- type: "string";
4
- required: true;
5
- description: string;
6
- };
7
- input: {
8
- type: "string";
9
- required: true;
10
- description: string;
11
- };
12
- output: {
13
- type: "string";
14
- description: string;
15
- };
16
- pattern: {
17
- type: "string";
18
- description: string;
19
- };
20
- replacement: {
21
- type: "string";
22
- description: string;
23
- };
24
- line: {
25
- type: "number";
26
- description: string;
27
- };
28
- transform: {
29
- type: "string";
30
- description: string;
31
- };
32
- }>;
33
- export default _default;
1
+ /**
2
+ * Recursively inlines (or rewrites) aliased import / re-export statements for all libraries.
3
+ *
4
+ * @param alias Prefix used in module specifiers (default: "~")
5
+ * @param subFolders Ordered sub-folder candidates to look for when chasing other libs
6
+ * @returns Absolute paths of files that were modified
7
+ */
8
+ export declare function resolveCrossLibs(alias?: string, subFolders?: ("npm" | "jsr")[]): Promise<string[]>;