@reliverse/dler 1.7.1 → 1.7.2
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 +62 -37
- package/bin/app/build/cmd.js +1 -1
- package/bin/app/build/impl.js +1 -1
- package/bin/app/check/cmd.js +29 -9
- package/bin/app/copy/cmd.d.ts +26 -0
- package/bin/app/copy/cmd.js +143 -0
- package/bin/app/deps/cmd.js +2 -2
- package/bin/app/migrate/cmd.d.ts +12 -0
- package/bin/app/migrate/cmd.js +51 -16
- package/bin/app/migrate/codemods/{anything-to-bun.js → anything-bun.js} +9 -6
- package/bin/app/migrate/codemods/console-relinka.d.ts +3 -0
- package/bin/app/migrate/codemods/console-relinka.js +157 -0
- package/bin/app/migrate/codemods/readdir-glob.d.ts +8 -0
- package/bin/app/migrate/codemods/readdir-glob.js +144 -0
- package/bin/app/pub/cmd.js +1 -1
- package/bin/app/rempts/migrate/impl/commander.js +2 -8
- package/bin/cli.js +35 -9
- package/bin/libs/sdk/sdk-impl/{config → cfg}/info.js +1 -1
- package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/dler-config-health}/dler-config-health.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/dler-config-health}/dler-config-health.js +1 -1
- package/bin/libs/sdk/sdk-impl/rules/reliverse/file-extensions/file-extensions.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/file-extensions}/file-extensions.js +2 -2
- package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/analyzer.js +15 -1
- package/bin/libs/sdk/sdk-impl/rules/reliverse/missing-deps/deps-mod.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/{check/rules/missing-deps.js → rules/reliverse/missing-deps/deps-mod.js} +2 -2
- package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/deps-types.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/filesystem.js +2 -3
- package/bin/libs/sdk/sdk-impl/rules/reliverse/missing-deps/formatter.js +113 -0
- package/bin/libs/sdk/sdk-impl/rules/reliverse/no-index-files/no-index-files.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/rules/reliverse/no-index-files/no-index-files.js +31 -0
- package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/package-json-health}/package-json-health.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/rules/reliverse/path-extensions/path-extensions.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/path-extensions}/path-extensions.js +2 -2
- package/bin/libs/sdk/sdk-impl/rules/reliverse/self-include/self-include.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/self-include}/self-include.js +2 -2
- package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/tsconfig-health}/tsconfig-health.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/{check/check-mod.js → rules/rules-mod.js} +10 -0
- package/bin/libs/sdk/sdk-impl/{check/check-utils.d.ts → rules/rules-utils.d.ts} +1 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-libs.js +6 -4
- package/bin/libs/sdk/sdk-types.d.ts +2 -2
- package/bin/mod.d.ts +1 -1
- package/bin/mod.js +1 -1
- package/package.json +1 -3
- package/bin/app/relifso/cmd.d.ts +0 -11
- package/bin/app/relifso/cmd.js +0 -47
- package/bin/app/relinka/cmd.d.ts +0 -18
- package/bin/app/relinka/cmd.js +0 -149
- package/bin/libs/sdk/sdk-impl/check/rules/deps/formatter.js +0 -64
- package/bin/libs/sdk/sdk-impl/check/rules/file-extensions.d.ts +0 -2
- package/bin/libs/sdk/sdk-impl/check/rules/missing-deps.d.ts +0 -2
- package/bin/libs/sdk/sdk-impl/check/rules/path-extensions.d.ts +0 -2
- package/bin/libs/sdk/sdk-impl/check/rules/self-include.d.ts +0 -2
- /package/bin/app/{relifso/init → init}/cmd.d.ts +0 -0
- /package/bin/app/{relifso/init → init}/cmd.js +0 -0
- /package/bin/app/{relifso/init → init}/init-const.d.ts +0 -0
- /package/bin/app/{relifso/init → init}/init-const.js +0 -0
- /package/bin/app/{relifso/init → init}/init-impl.d.ts +0 -0
- /package/bin/app/{relifso/init → init}/init-impl.js +0 -0
- /package/bin/app/{relifso/init → init}/init-types.d.ts +0 -0
- /package/bin/app/{relifso/init → init}/init-types.js +0 -0
- /package/bin/app/{relifso/init → init}/templates/t-gitignore.d.ts +0 -0
- /package/bin/app/{relifso/init → init}/templates/t-gitignore.js +0 -0
- /package/bin/app/{relifso/init → init}/templates/t-license.d.ts +0 -0
- /package/bin/app/{relifso/init → init}/templates/t-license.js +0 -0
- /package/bin/app/{relifso/init → init}/templates/t-readme.d.ts +0 -0
- /package/bin/app/{relifso/init → init}/templates/t-readme.js +0 -0
- /package/bin/app/migrate/codemods/{anything-to-bun.d.ts → anything-bun.d.ts} +0 -0
- /package/bin/app/migrate/codemods/{fs-to-relifso.d.ts → fs-relifso.d.ts} +0 -0
- /package/bin/app/migrate/codemods/{fs-to-relifso.js → fs-relifso.js} +0 -0
- /package/bin/app/migrate/codemods/{module-resolution.d.ts → nodenext-bundler.d.ts} +0 -0
- /package/bin/app/migrate/codemods/{module-resolution.js → nodenext-bundler.js} +0 -0
- /package/bin/app/migrate/codemods/{path-to-pathkit.d.ts → path-pathkit.d.ts} +0 -0
- /package/bin/app/migrate/codemods/{path-to-pathkit.js → path-pathkit.js} +0 -0
- /package/bin/app/{relifso/rename → rename}/cmd.d.ts +0 -0
- /package/bin/app/{relifso/rename → rename}/cmd.js +0 -0
- /package/bin/libs/sdk/sdk-impl/{config → cfg}/default.d.ts +0 -0
- /package/bin/libs/sdk/sdk-impl/{config → cfg}/default.js +0 -0
- /package/bin/libs/sdk/sdk-impl/{config → cfg}/define.d.ts +0 -0
- /package/bin/libs/sdk/sdk-impl/{config → cfg}/define.js +0 -0
- /package/bin/libs/sdk/sdk-impl/{config → cfg}/info.d.ts +0 -0
- /package/bin/libs/sdk/sdk-impl/{config → cfg}/init.d.ts +0 -0
- /package/bin/libs/sdk/sdk-impl/{config → cfg}/init.js +0 -0
- /package/bin/libs/sdk/sdk-impl/{config → cfg}/load.d.ts +0 -0
- /package/bin/libs/sdk/sdk-impl/{config → cfg}/load.js +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/analyzer.d.ts +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/deps-types.js +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/filesystem.d.ts +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/formatter.d.ts +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/parser.d.ts +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/rules/deps → rules/reliverse/missing-deps}/parser.js +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/package-json-health}/package-json-health.js +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/rules → rules/reliverse/tsconfig-health}/tsconfig-health.js +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/check-consts.d.ts → rules/rules-consts.d.ts} +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/check-consts.js → rules/rules-consts.js} +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/check-mod.d.ts → rules/rules-mod.d.ts} +0 -0
- /package/bin/libs/sdk/sdk-impl/{check/check-utils.js → rules/rules-utils.js} +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
|
-
- 🔌 plugin system with
|
|
18
|
+
- 🔌 plugin system with [15 built-in plugins](#-plugins) 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
|
## 🔌 plugins
|
|
121
121
|
|
|
122
|
-
dler ships with a flexible plugin system (aka plugins) and **
|
|
122
|
+
dler ships with a flexible plugin system (aka plugins) and **15 built-in plugins** (from [reliverse addons](https://reliverse.org/addons) collection).
|
|
123
123
|
|
|
124
124
|
feel free to create your own plugins. plugins can be implemented as built-in directly in `src/app/<plugin>/impl/*` and then imported from `src/app/<plugin>/cmd.ts`; or implemented in your own library and then imported from `src/app/<plugin>/cmd.ts`.
|
|
125
125
|
|
|
@@ -127,7 +127,7 @@ if you run just `dler` — it will display a list of plugins which you can launc
|
|
|
127
127
|
|
|
128
128
|
## **available plugins**
|
|
129
129
|
|
|
130
|
-
[agg](#1-agg), [
|
|
130
|
+
[agg](#1-agg), [check](#2-check-aka-rules-of-dler), [build](#3-build), [conv](#4-conv), [deps](#5-deps), [inject](#6-inject), [libs](#7-libs), [merge](#8-merge), [migrate](#9-migrate), [pub](#10-pub), [relifso](#11-relifso), [relinka](#12-relinka), [rempts](#13-rempts), [spell](#14-spell), [split](#15-split)
|
|
131
131
|
|
|
132
132
|
### 1. `agg`
|
|
133
133
|
|
|
@@ -150,7 +150,7 @@ bun tools:agg # shortcut for:
|
|
|
150
150
|
bun src/cli.ts tools --dev --tool agg --input src/libs/sdk/sdk-impl --out src/libs/sdk/sdk-mod.ts --recursive --named --strip src/libs/sdk
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
-
###
|
|
153
|
+
### 2. `check` (aka rules of dler)
|
|
154
154
|
|
|
155
155
|
checks your project for common issues and potential improvements. This command performs several types of checks:
|
|
156
156
|
|
|
@@ -216,7 +216,7 @@ dler check --json
|
|
|
216
216
|
**pro tip:**
|
|
217
217
|
the command will prompt you only for the arguments you haven't provided. for example, if you specify `--directory` but not `--checks`, it will only prompt you to select which checks to run.
|
|
218
218
|
|
|
219
|
-
###
|
|
219
|
+
### 3. `build`
|
|
220
220
|
|
|
221
221
|
since dler is fully modular, build command is separated for its own build-in plugin as well.
|
|
222
222
|
|
|
@@ -224,11 +224,11 @@ since dler is fully modular, build command is separated for its own build-in plu
|
|
|
224
224
|
dler build ...
|
|
225
225
|
```
|
|
226
226
|
|
|
227
|
-
###
|
|
227
|
+
### 4. `conv`
|
|
228
228
|
|
|
229
229
|
not yet documented.
|
|
230
230
|
|
|
231
|
-
###
|
|
231
|
+
### 5. `deps`
|
|
232
232
|
|
|
233
233
|
finds missing dependencies in your project by scanning your code for imports and comparing them to your `package.json`. This command is particularly useful for maintaining clean dependency lists and preventing runtime errors.
|
|
234
234
|
|
|
@@ -246,6 +246,8 @@ finds missing dependencies in your project by scanning your code for imports and
|
|
|
246
246
|
- optionally includes node.js built-in modules in the report
|
|
247
247
|
- outputs results in a readable format or as json
|
|
248
248
|
- exits with error code 1 if missing dependencies are found
|
|
249
|
+
- detects packages that are only in `devDependencies` but used in production code
|
|
250
|
+
- identifies packages listed in both `dependencies` and `devDependencies`
|
|
249
251
|
|
|
250
252
|
**usage examples:**
|
|
251
253
|
|
|
@@ -276,11 +278,17 @@ dler deps --all --directory ./src --include-builtins
|
|
|
276
278
|
missing dependencies are shown only once, even if used in multiple files.
|
|
277
279
|
deep imports like `dep/some/file` or `@org/dep/some/thing` are always resolved to their root package.
|
|
278
280
|
|
|
279
|
-
|
|
281
|
+
**warning types:**
|
|
282
|
+
|
|
283
|
+
- **Missing Dependencies**: Packages that are imported but not listed in `package.json`
|
|
284
|
+
- **Dev-only Dependencies**: Packages that are only in `devDependencies` but imported in production code
|
|
285
|
+
- **Duplicate Dependencies**: Packages listed in both `dependencies` and `devDependencies`
|
|
286
|
+
|
|
287
|
+
### 6. `inject`
|
|
280
288
|
|
|
281
289
|
not yet documented.
|
|
282
290
|
|
|
283
|
-
###
|
|
291
|
+
### 7. `libs`
|
|
284
292
|
|
|
285
293
|
builds and publishes specific subdirectories of your main project as standalone packages.
|
|
286
294
|
|
|
@@ -316,20 +324,21 @@ libslist: {
|
|
|
316
324
|
|
|
317
325
|
- more magic commands coming soon...
|
|
318
326
|
|
|
319
|
-
###
|
|
327
|
+
### 8. `merge`
|
|
320
328
|
|
|
321
329
|
not yet documented.
|
|
322
330
|
|
|
323
|
-
###
|
|
331
|
+
### 9. `migrate`
|
|
324
332
|
|
|
325
333
|
helps migrate between different libraries and module resolution strategies. currently supports:
|
|
326
334
|
|
|
327
|
-
- `
|
|
328
|
-
- `
|
|
329
|
-
- `
|
|
330
|
-
- `
|
|
335
|
+
- `anything-bun`: migrate Node.js projects to Bun runtime
|
|
336
|
+
- `path-pathkit`: migrate from node:path and unjs/pathe to pathkit library
|
|
337
|
+
- `fs-relifso`: migrate from node:fs and fs-extra to relifso library
|
|
338
|
+
- `nodenext-bundler`: migrate between module resolution strategies
|
|
339
|
+
- `readdir-glob`: migrate from fs.readdir to globby for better file system operations
|
|
331
340
|
|
|
332
|
-
**path-
|
|
341
|
+
**path-pathkit features:**
|
|
333
342
|
|
|
334
343
|
- Migrates from both `pathe` and `node:path` to `@reliverse/pathkit`
|
|
335
344
|
- Handles both default and named exports
|
|
@@ -337,7 +346,7 @@ helps migrate between different libraries and module resolution strategies. curr
|
|
|
337
346
|
- Converts require statements
|
|
338
347
|
- Updates package.json dependencies
|
|
339
348
|
|
|
340
|
-
**fs-
|
|
349
|
+
**fs-relifso features:**
|
|
341
350
|
|
|
342
351
|
- Migrates from both `node:fs` and `fs-extra` to `@reliverse/relifso`
|
|
343
352
|
- Handles both default and named exports
|
|
@@ -346,7 +355,7 @@ helps migrate between different libraries and module resolution strategies. curr
|
|
|
346
355
|
- Updates package.json dependencies
|
|
347
356
|
- Preserves import structure and formatting
|
|
348
357
|
|
|
349
|
-
**anything-
|
|
358
|
+
**anything-bun features:**
|
|
350
359
|
|
|
351
360
|
- Migrates Node.js imports to use `node:` prefix
|
|
352
361
|
- Replaces npm/yarn/pnpm features with bun equivalents
|
|
@@ -362,17 +371,27 @@ helps migrate between different libraries and module resolution strategies. curr
|
|
|
362
371
|
- Generates Bun configuration files
|
|
363
372
|
- Creates Dockerfile for Bun deployment
|
|
364
373
|
|
|
365
|
-
**
|
|
374
|
+
**readdir-glob features:**
|
|
375
|
+
|
|
376
|
+
- Migrates from `fs.readdir` and `fs.readdirSync` to `globby`
|
|
377
|
+
- Handles both synchronous and asynchronous readdir operations
|
|
378
|
+
- Supports `fs.promises.readdir` migration
|
|
379
|
+
- Adds globby import if not present
|
|
380
|
+
- Updates package.json with globby dependency
|
|
381
|
+
- Preserves target directory paths
|
|
382
|
+
- Maintains async/await usage
|
|
383
|
+
|
|
384
|
+
**usage examples:**
|
|
366
385
|
|
|
367
386
|
```bash
|
|
368
387
|
# Preview changes without applying them
|
|
369
|
-
dler migrate --lib
|
|
388
|
+
dler migrate --lib readdir-glob --dryRun
|
|
370
389
|
|
|
371
390
|
# Apply changes
|
|
372
|
-
dler migrate --lib
|
|
391
|
+
dler migrate --lib readdir-glob
|
|
373
392
|
|
|
374
393
|
# Migrate specific project
|
|
375
|
-
dler migrate --lib
|
|
394
|
+
dler migrate --lib readdir-glob --project ./my-app
|
|
376
395
|
```
|
|
377
396
|
|
|
378
397
|
**module resolution targets:**
|
|
@@ -384,19 +403,19 @@ dler migrate --lib anything-to-bun --project ./my-app
|
|
|
384
403
|
|
|
385
404
|
```bash
|
|
386
405
|
# Migrate from node:path and/or pathe to pathkit
|
|
387
|
-
dler migrate --lib path-
|
|
406
|
+
dler migrate --lib path-pathkit
|
|
388
407
|
|
|
389
408
|
# Migrate from node:fs and/or fs-extra to relifso
|
|
390
|
-
dler migrate --lib fs-
|
|
409
|
+
dler migrate --lib fs-relifso
|
|
391
410
|
|
|
392
411
|
# Migrate to nodenext module resolution
|
|
393
|
-
dler migrate --lib
|
|
412
|
+
dler migrate --lib nodenext-bundler --target nodenext
|
|
394
413
|
|
|
395
414
|
# Migrate to bundler module resolution
|
|
396
|
-
dler migrate --lib
|
|
415
|
+
dler migrate --lib nodenext-bundler --target bundler
|
|
397
416
|
|
|
398
417
|
# Preview changes without applying them
|
|
399
|
-
dler migrate --lib
|
|
418
|
+
dler migrate --lib nodenext-bundler --target nodenext --dryRun
|
|
400
419
|
```
|
|
401
420
|
|
|
402
421
|
**what it does:**
|
|
@@ -410,29 +429,35 @@ dler migrate --lib module-resolution --target nodenext --dryRun
|
|
|
410
429
|
|
|
411
430
|
**next steps after migration:**
|
|
412
431
|
|
|
413
|
-
- for path-
|
|
432
|
+
- for path-pathkit:
|
|
414
433
|
1. run 'bun install' to install @reliverse/pathkit
|
|
415
434
|
2. test your application
|
|
416
435
|
3. consider using advanced pathkit features
|
|
417
436
|
|
|
418
|
-
- for fs-
|
|
437
|
+
- for fs-relifso:
|
|
419
438
|
1. run 'bun install' to install @reliverse/relifso
|
|
420
439
|
2. test your application
|
|
421
440
|
3. review any file system operations that might need manual updates
|
|
422
441
|
|
|
423
|
-
- for
|
|
442
|
+
- for nodenext-bundler:
|
|
424
443
|
1. test your application
|
|
425
444
|
2. ensure your build tools support the new module resolution
|
|
426
445
|
3. review any warnings in the migration output
|
|
427
446
|
|
|
428
|
-
- for anything-
|
|
447
|
+
- for anything-bun:
|
|
429
448
|
1. run 'bun install' to install dependencies with Bun
|
|
430
449
|
2. test your application thoroughly
|
|
431
450
|
3. review async/await usage in converted file operations
|
|
432
451
|
4. update any custom database queries to use Bun.sql syntax
|
|
433
452
|
5. review and update any custom middleware in Express apps
|
|
434
453
|
|
|
435
|
-
|
|
454
|
+
- for readdir-glob:
|
|
455
|
+
1. run 'bun install' to install globby
|
|
456
|
+
2. test your application
|
|
457
|
+
3. review any file system operations that might need manual updates
|
|
458
|
+
4. consider using globby's advanced features like pattern matching and recursive searching
|
|
459
|
+
|
|
460
|
+
### 10. `pub`
|
|
436
461
|
|
|
437
462
|
pub command is separated for its own build-in plugin as well.
|
|
438
463
|
|
|
@@ -442,13 +467,13 @@ it already calls build command by itself, so you don't need to run `dler build`
|
|
|
442
467
|
dler pub ...
|
|
443
468
|
```
|
|
444
469
|
|
|
445
|
-
###
|
|
470
|
+
### 11. `relifso`
|
|
446
471
|
|
|
447
472
|
```bash
|
|
448
473
|
dler relifso init ...
|
|
449
474
|
```
|
|
450
475
|
|
|
451
|
-
###
|
|
476
|
+
### 12. `relinka`
|
|
452
477
|
|
|
453
478
|
[@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).
|
|
454
479
|
|
|
@@ -487,7 +512,7 @@ dler relinka --input src/app.ts --from relinkaFunction --to consolaObject
|
|
|
487
512
|
- Supports conversion between any combination of formats
|
|
488
513
|
- Supports both consola method and object styles
|
|
489
514
|
|
|
490
|
-
###
|
|
515
|
+
### 13. `rempts`
|
|
491
516
|
|
|
492
517
|
@reliverse/rempts's best friend. learn more in its [docs](https://github.com/reliverse/rempts).
|
|
493
518
|
|
|
@@ -496,7 +521,7 @@ dler rempts init --cmd my-cmd-1
|
|
|
496
521
|
dler rempts init --cmds
|
|
497
522
|
```
|
|
498
523
|
|
|
499
|
-
###
|
|
524
|
+
### 14. `spell`
|
|
500
525
|
|
|
501
526
|
**available spell types:**
|
|
502
527
|
|
|
@@ -565,7 +590,7 @@ files: [] // means all files
|
|
|
565
590
|
|
|
566
591
|
p.s. [see how rse cli uses hooked=true](https://github.com/reliverse/rse/blob/main/src/postbuild.ts)
|
|
567
592
|
|
|
568
|
-
###
|
|
593
|
+
### 15. `split`
|
|
569
594
|
|
|
570
595
|
splits your code/text file into multiple files.
|
|
571
596
|
|
package/bin/app/build/cmd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
2
2
|
import { dlerBuild } from "./impl.js";
|
|
3
|
-
import { ensureDlerConfig } from "../../libs/sdk/sdk-impl/
|
|
3
|
+
import { ensureDlerConfig } from "../../libs/sdk/sdk-impl/cfg/init.js";
|
|
4
4
|
export default defineCommand({
|
|
5
5
|
meta: {
|
|
6
6
|
name: "build",
|
package/bin/app/build/impl.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "@reliverse/bleump";
|
|
6
6
|
import path from "@reliverse/pathkit";
|
|
7
7
|
import fs from "@reliverse/relifso";
|
|
8
|
-
import { loadConfig } from "../../libs/sdk/sdk-impl/
|
|
8
|
+
import { loadConfig } from "../../libs/sdk/sdk-impl/cfg/load.js";
|
|
9
9
|
import { processLibraryFlow } from "../../libs/sdk/sdk-impl/library-flow.js";
|
|
10
10
|
import { processRegularFlow } from "../../libs/sdk/sdk-impl/regular-flow.js";
|
|
11
11
|
import { finalizeBuildPub } from "../../libs/sdk/sdk-impl/utils/finalize.js";
|
package/bin/app/check/cmd.js
CHANGED
|
@@ -6,14 +6,15 @@ import {
|
|
|
6
6
|
confirmPrompt,
|
|
7
7
|
defineArgs
|
|
8
8
|
} from "@reliverse/rempts";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { checkPackageJsonHealth } from "../../libs/sdk/sdk-impl/
|
|
14
|
-
import { checkPathExtensions } from "../../libs/sdk/sdk-impl/
|
|
15
|
-
import { checkSelfInclude } from "../../libs/sdk/sdk-impl/
|
|
16
|
-
import { checkTsConfigHealth } from "../../libs/sdk/sdk-impl/
|
|
9
|
+
import { checkDlerConfigHealth } from "../../libs/sdk/sdk-impl/rules/reliverse/dler-config-health/dler-config-health.js";
|
|
10
|
+
import { checkFileExtensions } from "../../libs/sdk/sdk-impl/rules/reliverse/file-extensions/file-extensions.js";
|
|
11
|
+
import { checkMissingDependencies } from "../../libs/sdk/sdk-impl/rules/reliverse/missing-deps/deps-mod.js";
|
|
12
|
+
import { checkNoIndexFiles } from "../../libs/sdk/sdk-impl/rules/reliverse/no-index-files/no-index-files.js";
|
|
13
|
+
import { checkPackageJsonHealth } from "../../libs/sdk/sdk-impl/rules/reliverse/package-json-health/package-json-health.js";
|
|
14
|
+
import { checkPathExtensions } from "../../libs/sdk/sdk-impl/rules/reliverse/path-extensions/path-extensions.js";
|
|
15
|
+
import { checkSelfInclude } from "../../libs/sdk/sdk-impl/rules/reliverse/self-include/self-include.js";
|
|
16
|
+
import { checkTsConfigHealth } from "../../libs/sdk/sdk-impl/rules/reliverse/tsconfig-health/tsconfig-health.js";
|
|
17
|
+
import { displayCheckResults } from "../../libs/sdk/sdk-impl/rules/rules-mod.js";
|
|
17
18
|
export default defineCommand({
|
|
18
19
|
meta: {
|
|
19
20
|
name: "check",
|
|
@@ -27,7 +28,7 @@ export default defineCommand({
|
|
|
27
28
|
},
|
|
28
29
|
checks: {
|
|
29
30
|
type: "string",
|
|
30
|
-
description: "comma-separated list of checks to run (missing-deps,file-extensions,path-extensions,dler-config-health,self-include,tsconfig-health,package-json-health)"
|
|
31
|
+
description: "comma-separated list of checks to run (missing-deps,file-extensions,path-extensions,dler-config-health,self-include,tsconfig-health,package-json-health,no-index-files)"
|
|
31
32
|
},
|
|
32
33
|
strict: {
|
|
33
34
|
type: "boolean",
|
|
@@ -55,6 +56,10 @@ export default defineCommand({
|
|
|
55
56
|
"info",
|
|
56
57
|
"\u{1F504} self-include rules: no importing from main package or self-imports in libs"
|
|
57
58
|
);
|
|
59
|
+
relinka(
|
|
60
|
+
"info",
|
|
61
|
+
"\u{1F4DA} index files: avoid using index.{ts,js} files to prevent module resolution confusion"
|
|
62
|
+
);
|
|
58
63
|
let dir;
|
|
59
64
|
let checks;
|
|
60
65
|
let strict;
|
|
@@ -105,6 +110,10 @@ export default defineCommand({
|
|
|
105
110
|
{
|
|
106
111
|
label: "package.json validation",
|
|
107
112
|
value: "package-json-health"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
label: "no index files",
|
|
116
|
+
value: "no-index-files"
|
|
108
117
|
}
|
|
109
118
|
]
|
|
110
119
|
});
|
|
@@ -201,6 +210,17 @@ checking directory: ${directory}`);
|
|
|
201
210
|
process.stdout.write("\r");
|
|
202
211
|
displayCheckResults("self-includes", directory, result);
|
|
203
212
|
}
|
|
213
|
+
if (checks.includes("no-index-files")) {
|
|
214
|
+
process.stdout.write(" checking for index files...\n");
|
|
215
|
+
const result = await checkNoIndexFiles({
|
|
216
|
+
directory,
|
|
217
|
+
strict,
|
|
218
|
+
moduleResolution: "bundler",
|
|
219
|
+
onProgress
|
|
220
|
+
});
|
|
221
|
+
process.stdout.write("\r");
|
|
222
|
+
displayCheckResults("no index files", directory, result);
|
|
223
|
+
}
|
|
204
224
|
} catch (error) {
|
|
205
225
|
relinka(
|
|
206
226
|
"error",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare const _default: import("@reliverse/rempts").Command<{
|
|
2
|
+
source: {
|
|
3
|
+
type: "string";
|
|
4
|
+
description: string;
|
|
5
|
+
};
|
|
6
|
+
destination: {
|
|
7
|
+
type: "string";
|
|
8
|
+
description: string;
|
|
9
|
+
};
|
|
10
|
+
recursive: {
|
|
11
|
+
type: "boolean";
|
|
12
|
+
description: string;
|
|
13
|
+
default: true;
|
|
14
|
+
};
|
|
15
|
+
force: {
|
|
16
|
+
type: "boolean";
|
|
17
|
+
description: string;
|
|
18
|
+
default: false;
|
|
19
|
+
};
|
|
20
|
+
preserveStructure: {
|
|
21
|
+
type: "boolean";
|
|
22
|
+
description: string;
|
|
23
|
+
default: true;
|
|
24
|
+
};
|
|
25
|
+
}>;
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { relinka } from "@reliverse/relinka";
|
|
2
|
+
import { defineCommand, selectPrompt, inputPrompt } from "@reliverse/rempts";
|
|
3
|
+
import { copyFile, access, mkdir } from "node:fs/promises";
|
|
4
|
+
import { join, dirname } from "node:path";
|
|
5
|
+
import { glob } from "tinyglobby";
|
|
6
|
+
async function fileExists(path) {
|
|
7
|
+
try {
|
|
8
|
+
await access(path);
|
|
9
|
+
return true;
|
|
10
|
+
} catch {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
async function safeCopy(source, destination) {
|
|
15
|
+
if (await fileExists(destination)) {
|
|
16
|
+
throw new Error(`Destination file already exists: ${destination}`);
|
|
17
|
+
}
|
|
18
|
+
await copyFile(source, destination);
|
|
19
|
+
}
|
|
20
|
+
async function ensureDir(path) {
|
|
21
|
+
try {
|
|
22
|
+
await access(path);
|
|
23
|
+
} catch {
|
|
24
|
+
await mkdir(path, { recursive: true });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export default defineCommand({
|
|
28
|
+
meta: {
|
|
29
|
+
name: "copy",
|
|
30
|
+
version: "1.0.0",
|
|
31
|
+
description: "Copy files and directories"
|
|
32
|
+
},
|
|
33
|
+
args: {
|
|
34
|
+
source: {
|
|
35
|
+
type: "string",
|
|
36
|
+
description: "Source file or directory to copy (supports glob patterns)"
|
|
37
|
+
},
|
|
38
|
+
destination: {
|
|
39
|
+
type: "string",
|
|
40
|
+
description: "Destination path for the copy operation"
|
|
41
|
+
},
|
|
42
|
+
recursive: {
|
|
43
|
+
type: "boolean",
|
|
44
|
+
description: "Recursively process all files in subdirectories (default: true)",
|
|
45
|
+
default: true
|
|
46
|
+
},
|
|
47
|
+
force: {
|
|
48
|
+
type: "boolean",
|
|
49
|
+
description: "Overwrite existing files (default: false)",
|
|
50
|
+
default: false
|
|
51
|
+
},
|
|
52
|
+
preserveStructure: {
|
|
53
|
+
type: "boolean",
|
|
54
|
+
description: "Preserve source directory structure in destination (default: true)",
|
|
55
|
+
default: true
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
async run({ args }) {
|
|
59
|
+
const {
|
|
60
|
+
source,
|
|
61
|
+
destination,
|
|
62
|
+
recursive = true,
|
|
63
|
+
force = false,
|
|
64
|
+
preserveStructure = true
|
|
65
|
+
} = args;
|
|
66
|
+
let finalSource = source;
|
|
67
|
+
let finalDestination = destination;
|
|
68
|
+
if (!finalSource) {
|
|
69
|
+
finalSource = await inputPrompt({
|
|
70
|
+
title: "Enter source file or directory (supports glob patterns)",
|
|
71
|
+
placeholder: "e.g., putout/packages/*/lib/**/*"
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (!finalDestination) {
|
|
75
|
+
finalDestination = await inputPrompt({
|
|
76
|
+
title: "Enter destination path",
|
|
77
|
+
placeholder: "e.g., src/libs/sdk/sdk-impl/rules/putout"
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (!finalSource || !finalDestination) {
|
|
81
|
+
relinka("error", "Usage: dler copy <source> <destination>");
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
const files = await glob(finalSource, {
|
|
86
|
+
dot: true,
|
|
87
|
+
ignore: recursive ? [] : ["**/*"]
|
|
88
|
+
});
|
|
89
|
+
if (files.length === 0) {
|
|
90
|
+
relinka("error", `No files found matching pattern: ${finalSource}`);
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
if (files.length > 1) {
|
|
94
|
+
const confirm = await selectPrompt({
|
|
95
|
+
title: `Found ${files.length} files to copy. Proceed?`,
|
|
96
|
+
options: [
|
|
97
|
+
{ label: "Yes", value: "yes" },
|
|
98
|
+
{ label: "No", value: "no" }
|
|
99
|
+
]
|
|
100
|
+
});
|
|
101
|
+
if (confirm === "no") {
|
|
102
|
+
relinka("log", "Operation cancelled by user");
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
for (const file of files) {
|
|
107
|
+
let destPath;
|
|
108
|
+
if (preserveStructure) {
|
|
109
|
+
const match = file.match(/packages\/([^/]+)\/lib\/(.*)/);
|
|
110
|
+
if (match?.[1] && match?.[2]) {
|
|
111
|
+
const packageName = match[1];
|
|
112
|
+
const relativePath = match[2];
|
|
113
|
+
destPath = join(finalDestination, packageName, relativePath);
|
|
114
|
+
} else {
|
|
115
|
+
destPath = join(finalDestination, file);
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
destPath = join(finalDestination, file);
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
await ensureDir(dirname(destPath));
|
|
122
|
+
if (force) {
|
|
123
|
+
await copyFile(file, destPath);
|
|
124
|
+
} else {
|
|
125
|
+
await safeCopy(file, destPath);
|
|
126
|
+
}
|
|
127
|
+
relinka("log", `Copied '${file}' to '${destPath}'`);
|
|
128
|
+
} catch (error) {
|
|
129
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
130
|
+
relinka("error", `Error copying '${file}': ${errorMessage}`);
|
|
131
|
+
if (!force) {
|
|
132
|
+
process.exit(1);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
relinka("log", `Successfully copied ${files.length} file(s)`);
|
|
137
|
+
} catch (error) {
|
|
138
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
139
|
+
relinka("error", `Error during copy operation: ${errorMessage}`);
|
|
140
|
+
process.exit(1);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
});
|
package/bin/app/deps/cmd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "@reliverse/pathkit";
|
|
2
2
|
import { re } from "@reliverse/relico";
|
|
3
3
|
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
4
|
-
import { analyzeDependencies } from "../../libs/sdk/sdk-impl/
|
|
5
|
-
import { formatOutput } from "../../libs/sdk/sdk-impl/
|
|
4
|
+
import { analyzeDependencies } from "../../libs/sdk/sdk-impl/rules/reliverse/missing-deps/analyzer.js";
|
|
5
|
+
import { formatOutput } from "../../libs/sdk/sdk-impl/rules/reliverse/missing-deps/formatter.js";
|
|
6
6
|
export default defineCommand({
|
|
7
7
|
meta: {
|
|
8
8
|
name: "deps",
|
package/bin/app/migrate/cmd.d.ts
CHANGED
|
@@ -22,5 +22,17 @@ declare const _default: import("@reliverse/rempts").Command<{
|
|
|
22
22
|
description: string;
|
|
23
23
|
default: false;
|
|
24
24
|
};
|
|
25
|
+
consoleRelinkaInput: {
|
|
26
|
+
type: "string";
|
|
27
|
+
description: string;
|
|
28
|
+
};
|
|
29
|
+
consoleRelinkaFrom: {
|
|
30
|
+
type: "string";
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
consoleRelinkaTo: {
|
|
34
|
+
type: "string";
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
25
37
|
}>;
|
|
26
38
|
export default _default;
|