-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathreltypes.ts
More file actions
1490 lines (1490 loc) · 46 KB
/
reltypes.ts
File metadata and controls
1490 lines (1490 loc) · 46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// reliverse.ts types version 2025-08-26 (this file is generated, don't edit it)
export interface ReliverseConfig {
$schema?: string;
projectName?: UnknownLiteral | (string & {});
projectAuthor?: UnknownLiteral | (string & {});
projectDescription?: string;
version?: string;
projectLicense?: string;
projectRepository?: string;
projectDomain?: string;
projectGitService?: ProjectGitService;
projectDeployService?: ProjectDeployService;
projectPackageManager?: ProjectPackageManager;
projectState?: ProjectState;
projectCategory?: ProjectCategory;
projectSubcategory?: ProjectSubcategory;
projectFramework?: ProjectFramework;
projectTemplate?: ProjectTemplate;
projectTemplateDate?: string;
features?: {
i18n?: boolean;
analytics?: boolean;
themeMode?: ThemeMode;
authentication?: boolean;
api?: boolean;
database?: boolean;
testing?: boolean;
docker?: boolean;
ci?: boolean;
commands?: string[];
webview?: string[];
language?: string[];
themes?: string[];
};
preferredLibraries?: {
stateManagement?: PreferredStateManagement;
formManagement?: PreferredForm;
styling?: PreferredStyling;
uiComponents?: PreferredUI;
testing?: PreferredTesting;
authentication?: PreferredAuth;
databaseLibrary?: PreferredDBLib;
databaseProvider?: PreferredDBProvider;
api?: PreferredAPI;
linting?: PreferredLint;
formatting?: PreferredFormat;
payment?: PreferredPayment;
analytics?: PreferredAnalytics;
monitoring?: PreferredMonitoring;
logging?: PreferredLogging;
forms?: PreferredForms;
notifications?: PreferredNotifications;
search?: PreferredSearch;
uploads?: PreferredUploads;
validation?: PreferredValidation;
documentation?: PreferredDocs;
icons?: PreferredIcons;
mail?: PreferredMail;
cache?: PreferredCache;
storage?: PreferredStorage;
cdn?: PreferredCDN;
cms?: PreferredCMS;
i18n?: PreferredI18n;
seo?: PreferredSEO;
motion?: PreferredMotion;
charts?: PreferredCharts;
dates?: PreferredDates;
markdown?: PreferredMarkdown;
security?: PreferredSecurity;
routing?: PreferredRouting;
};
codeStyle?: {
lineWidth?: number;
indentSize?: number;
indentStyle?: "space" | "tab";
quoteMark?: "single" | "double";
semicolons?: boolean;
trailingCommas?: "none" | "es5" | "all";
bracketSpacing?: boolean;
arrowParens?: "always" | "avoid";
tabWidth?: number;
jsToTs?: boolean;
dontRemoveComments?: boolean;
shouldAddComments?: boolean;
typeOrInterface?: "type" | "interface" | "mixed";
importOrRequire?: "import" | "require" | "mixed";
cjsToEsm?: boolean;
modernize?: {
replaceFs?: boolean;
replacePath?: boolean;
replaceHttp?: boolean;
replaceProcess?: boolean;
replaceConsole?: boolean;
replaceEvents?: boolean;
};
importSymbol?: string;
};
monorepo?: {
type?: "none" | "turborepo" | "nx" | "pnpm" | "bun";
packages?: string[];
sharedPackages?: string[];
};
ignoreDependencies?: string[];
customRules?: Record<string, unknown>;
multipleRepoCloneMode?: boolean;
customUserFocusedRepos?: string[];
customDevsFocusedRepos?: string[];
hideRepoSuggestions?: boolean;
customReposOnNewProject?: boolean;
envComposerOpenBrowser?: boolean;
repoBranch?: string;
repoPrivacy?: RepoPrivacy;
projectArchitecture?: ProjectArchitecture;
projectRuntime?: ProjectRuntime;
skipPromptsUseAutoBehavior?: boolean;
deployBehavior?: "prompt" | "autoYes" | "autoNo";
depsBehavior?: "prompt" | "autoYes" | "autoNo";
gitBehavior?: "prompt" | "autoYes" | "autoNo";
i18nBehavior?: "prompt" | "autoYes" | "autoNo";
scriptsBehavior?: "prompt" | "autoYes" | "autoNo";
existingRepoBehavior?: "prompt" | "autoYes" | "autoYesSkipCommit" | "autoNo";
relinterConfirm?: RelinterConfirm;
// ==========================================================================
// Bump configuration
// ==========================================================================
/**
* When `true`, disables version bumping.
* Useful when retrying a failed publish with an already bumped version.
*
* @default false
*/
bumpDisable: boolean;
/**
* Controls which files will have their version numbers updated during version bumping.
*
* Accepts:
* - Standard file types like "package.json"
* - Relative paths like "src/constants.ts"
* - [Globbing patterns](https://github.com/mrmlnc/fast-glob#pattern-syntax)
*
* When empty, falls back to only updating "package.json".
* Respects: .gitignore patterns, hidden files, .git & node_modules.
*
* @default ["package.json", "reliverse.ts"]
*/
bumpFilter: string[];
/**
* Specifies how the version number should be incremented:
* - `patch`: Increments the patch version for backwards-compatible bug fixes (1.2.3 → 1.2.4)
* - `minor`: Increments the minor version for new backwards-compatible features (1.2.3 → 1.3.0)
* - `major`: Increments the major version for breaking changes (1.2.3 → 2.0.0)
* - `auto`: Automatically determine the appropriate bump type
* - `manual`: Set a specific version (requires bumpSet to be set)
*
* Please note: `dler` infers the version from the `package.json` file.
*
* @default "patch"
*/
bumpMode: BumpMode;
/**
* Custom version to set when bumpMode is "manual".
* Must be a valid semver version (e.g., "1.2.3").
*
* @default ""
*/
bumpSet: string;
// ==========================================================================
// Common configuration
// ==========================================================================
/**
* When `true`, stops after building and retains distribution folders.
* Useful for development or inspecting the build output.
*
* @default true
*/
commonPubPause: boolean;
/**
* Specifies which package registries to publish to:
* - `npm`: Publish only to the NPM commonPubRegistry.
* - `jsr`: Publish only to the JSR commonPubRegistry.
* - `npm-jsr`: Publish to both NPM and JSR registries.
*
* @default "npm"
*/
commonPubRegistry: "jsr" | "npm" | "npm-jsr";
/**
* When `true`, enables detailed logs during the build and publish process.
* Useful for debugging or understanding the build flow.
*
* @default false
*/
commonVerbose: boolean;
/**
* When `true`, displays detailed build and publish logs.
* When `false`, only shows spinner with status messages during build and publish.
*
* @default true
*/
displayBuildPubLogs: boolean;
// ==========================================================================
// Core configuration
// ==========================================================================
/**
* When `true`, generates TypeScript declaration files (.d.ts) for NPM packages.
* Essential for providing type intranspileFormation to TypeScript users.
*
* To reduce bundle size you can set this to `false` if your main project
* is planned to be used only as a global CLI tool (e.g. `bunx dler`).
*
* @default true
*/
coreDeclarations: boolean;
/**
* Path to the project's main entry file.
* Used as the entry point for the NPM package.
*
* @default "mod.ts"
*/
coreEntryFile: string;
/**
* Base directory containing the source entry files.
* All paths are resolved relative to this directory.
* Set to `"."` if entry files are in the project root.
*
* @default "src"
*/
coreEntrySrcDir: string;
/**
* Directory where built files will be placed within the distribution directory.
* For example, if set to "bin", CLI scripts will be placed in "dist-npm/bin" or "dist-jsr/bin".
*
* @default "bin"
*/
coreBuildOutDir: string;
/**
* Configuration for CLI functionality:
* - enabled: When `true`, indicates that the package has CLI capabilities
* - scripts: Map of CLI script names to their entry file paths
* The key will be used as the command name in package.json's bin field
* The value should be the path to the executable script (e.g. "cli.ts")
*
* **The source scripts should be in your "coreEntrySrcDir" directory (by default "src")**
*
* @example
* {
* enabled: true,
* scripts: {
* "mycli": "cli.ts",
* "othercmd": "other-cmd.ts"
* }
* }
*
* @default { enabled: false, scripts: {} }
*/
coreIsCLI: {
enabled: boolean;
scripts: Record<string, string>;
};
/**
* Optional description that overrides the description from package.json.
* When provided, this description will be used in the dist's package.json.
* If not provided, the description from the original package.json will be used.
*
* @default `package.json`'s "description"
*/
coreDescription: string;
// ==========================================================================
// JSR-only config
// ==========================================================================
/**
* When `true`, allows JSR publishing even with uncommitted changes.
* Use with caution, as it may lead to inconsistent published versions.
*
* It is `true` by default to make it easier for new `dler` users to publish their projects.
*
* @default true
*/
distJsrAllowDirty: boolean;
/**
* The bundler to use for creating JSR-compatible packages.
* JSR's native bundler is recommended for best compatibility.
*
* @default "jsr"
*/
distJsrBuilder: BundlerName;
/**
* Directory where JSR build artifacts are generated.
* This directory will contain the package ready for JSR publishing.
*
* @default "dist-jsr"
*/
distJsrDirName: string;
/**
* When `true`, simulates the publishing process without actually publishing.
* Useful for testing the build and publish pipeline without side effects.
*
* @default false
*/
distJsrDryRun: boolean;
/**
* When `true`, fails the build if warnings are detected.
* Use with caution, as it may lead to inconsistent published versions.
*
* @default false
*/
distJsrFailOnWarn: boolean;
/**
* When `true`, generates a `jsconfig.json` file for JSR's dist.
*
* @default false
*/
distJsrGenTsconfig: boolean;
/**
* The file extension for output files in JSR packages.
*
* @default "ts"
*/
distJsrOutFilesExt: NpmOutExt;
/**
* When `true`, enables JSR to process complex types, which may impact performance.
* Enable this only if you cannot simplify or explicitly define exported types.
*
* JSR requires exported functions, classes, variables, and type aliases to have
* explicitly written or easily inferred types. Otherwise, it may be unable to
* generate documentation, type declarations for npm compatibility, or efficient
* type checking for consumers.
*
* If "slow types" are present, type checking performance may degrade, and some
* features may not work as expected.
*
* It is `true` by default to make it easier for new `dler` users to publish their projects.
*
* @see https://jsr.io/docs/about-slow-types
* @default true
*/
distJsrSlowTypes: boolean;
// ==========================================================================
// NPM-only config
// ==========================================================================
/**
* The bundler to use for creating NPM-compatible packages.
*
* @default "mkdist"
*/
distNpmBuilder: BundlerName;
/**
* Directory where NPM build artifacts are generated.
* This directory will contain the package ready for NPM publishing.
*
* @default "dist-npm"
*/
distNpmDirName: string;
/**
* Specifies the file extension for output files in NPM packages.
* Determines the extension of compiled files in the NPM distribution.
* We strongly recommend using `"js"` with the `"esm"` transpileFormat.
*
* @default "js"
*/
distNpmOutFilesExt: NpmOutExt;
// ==========================================================================
// Binary Build Configuration
// ==========================================================================
/**
* When `true`, enables binary build functionality to create standalone executables.
*
* @default false
*/
binaryBuildEnabled: boolean;
/**
* Input TypeScript file to bundle for binary builds.
* If not specified, will use the coreEntryFile from the coreEntrySrcDir.
*
* @default undefined (uses coreEntryFile)
*/
binaryBuildInputFile?: string;
/**
* Comma-separated list of targets to build for binary builds.
* Use 'all' for all targets, 'list' to show available targets.
* Target format is {prefix}-{platform}-{arch} where prefix is extracted from input filename.
* Platforms: linux, windows, darwin (macOS)
* Architectures: x64, arm64
* Examples: dler-linux-x64, dler-windows-arm64, dler-darwin-x64
*
* @default "all"
*/
binaryBuildTargets: string;
/**
* Output directory for built binary executables.
*
* @default "dist"
*/
binaryBuildOutDir: string;
/**
* When `true`, minifies the binary output.
*
* @default true
*/
binaryBuildMinify: boolean;
/**
* When `true`, generates source maps for binary builds.
*
* @default true
*/
binaryBuildSourcemap: boolean;
/**
* When `true`, enables bytecode compilation for faster startup (Bun v1.1.30+).
*
* @default false
*/
binaryBuildBytecode: boolean;
/**
* When `true`, cleans output directory before building binaries.
*
* @default true
*/
binaryBuildClean: boolean;
/**
* Path to Windows .ico file for executable icon.
*
* @default undefined
*/
binaryBuildWindowsIcon?: string;
/**
* When `true`, hides console window on Windows.
*
* @default false
*/
binaryBuildWindowsHideConsole: boolean;
/**
* Asset naming pattern for binary builds.
*
* @default "[name]-[hash].[ext]"
*/
binaryBuildAssetNaming: string;
/**
* When `true`, builds binary targets in parallel.
*
* @default true
*/
binaryBuildParallel: boolean;
/**
* External dependencies to exclude from binary bundle.
*
* @default ["c12", "terminal-kit"]
*/
binaryBuildExternal: string[];
/**
* When `true`, creates a bundled script instead of standalone executable.
* Useful for debugging terminal issues.
*
* @default false
*/
binaryBuildNoCompile: boolean;
// ==========================================================================
// Libraries Dler Plugin
// ==========================================================================
/**
* !! EXPERIMENTAL !!
* Controls which parts of the project are built and published:
* - `main-project-only`: Builds/publishes only the main package.
* - `main-and-libs`: Builds/publishes both the main package and libraries.
* - `libs-only`: Builds/publishes only the libraries.
*
* @default "main-project-only"
*/
libsActMode: "libs-only" | "main-and-libs" | "main-project-only";
/**
* The directory where built libraries are stored before publishing.
*
* @default "dist-libs"
*/
libsDirDist: string;
/**
* The directory containing library source files.
*
* @default "src/libs"
*/
libsDirSrc: string;
/**
* !! EXPERIMENTAL !!
* Configuration for building and publishing multiple libraries.
* Each key represents a package name, and its value contains the configuration.
*
* @example
* {
* "@myorg/ml1": { main: "my-lib-1/mod.ts" },
* "@myorg/ml2": { main: "my-lib-2/ml2-mod.ts" },
* "@myorg/ml3": { main: "src/libs/my-lib-3/index.js" }
* }
*/
libsList: Record<string, LibConfig>;
// ==========================================================================
// Logger setup
// ==========================================================================
/**
* The name of the log file. dler uses `@reliverse/relinka` for logging.
*
* @default ".logs/relinka.log"
*/
logsFileName: string;
/**
* When `true`, cleans up the log file from previous runs.
*
* @default false
*/
logsFreshFile: boolean;
// ==========================================================================
// Dependency filtering
// ==========================================================================
/**
* Configuration for dependency removal/injection patterns.
* Controls which dependencies are excluded from (or injected into) the final package.
*
* Pattern types:
* - Regular patterns: Exclude deps that match the pattern
* - Negation patterns (starting with !): Don't exclude deps that match the pattern
* - Add patterns (starting with +): Inject deps into specific dists even if original package.json doesn't have them
*
* Structure (dist-specific patterns are merged with global):
* - `global`: Patterns that are always applied to all builds
* - `dist-npm`: NPM-specific patterns
* - `dist-jsr`: JSR-specific patterns
* - `dist-libs`: Library-specific patterns
* Each library can have separate NPM and JSR patterns
*
* @example
* {
* global: ["@types", "eslint"],
* "dist-npm": ["npm-specific"],
* "dist-jsr": ["+bun"], // Explicitly include 'bun' in JSR builds
* "dist-libs": {
* "@myorg/lib1": {
* npm: ["lib1-npm-specific"],
* jsr: ["+bun"] // Explicitly include 'bun' in this lib's JSR build
* }
* }
* }
*/
filterDepsPatterns: {
global: string[];
"dist-npm": string[];
"dist-jsr": string[];
"dist-libs": Record<
string,
{
npm: string[];
jsr: string[];
}
>;
};
// ==========================================================================
// Code quality tools
// ==========================================================================
/**
* List of tools to run before the build process starts.
* Available options: "tsc", "eslint", "biome", "knip", "dler-check"
* Each tool will only run if it's installed in the system.
*
* @default []
*/
runBeforeBuild: ("tsc" | "eslint" | "biome" | "knip" | "dler-check")[];
/**
* List of tools to run after the build process completes.
* Available options: "dler-check"
* Each tool will only run if it's installed in the system.
*
* @default []
*/
runAfterBuild: "dler-check"[];
// ==========================================================================
// Build hooks
// ==========================================================================
/**
* Array of functions to be executed before the build process starts.
* These hooks will be called in sequence before any build steps.
*
* If you are a dler plugin developer, tell your users to
* call your plugin's `beforeBuild`-related function here.
*
* @example
* hooksBeforeBuild: [
* async () => {
* // Custom pre-build logic
* await someAsyncOperation();
*
* // dler-plugin-my-plugin-name
* await myPluginName_beforeBuild();
* }
* ]
*
* @default []
*/
hooksBeforeBuild: (() => Promise<void>)[];
/**
* Array of functions to be executed after the build process completes.
* These hooks will be called in sequence after all build steps.
*
* If you are a dler plugin developer, tell your users to
* call your plugin's `afterBuild`-related function here.
*
* @example
* hooksAfterBuild: [
* async () => {
* // Custom post-build logic
* await someAsyncOperation();
*
* // dler-plugin-my-plugin-name
* await myPluginName_afterBuild();
* }
* ]
*
* @default []
*/
hooksAfterBuild: (() => Promise<void>)[];
/**
* When `true`, cleans up the temporary directories after the build process completes.
*
* @default true
*/
postBuildSettings: {
deleteDistTmpAfterBuild: boolean;
};
// ==========================================================================
// Build setup
// ==========================================================================
/**
* When `true`, fails the build if warnings are detected.
* Use with caution, as it may lead to inconsistent published versions.
*
* @default false
*/
transpileFailOnWarn: boolean;
/**
* The transpileTarget runtime environment for the built package.
*
* @default "es2023"
*/
transpileEsbuild: Esbuild;
/**
* Output module transpileFormat for built files:
* - `esm`: ECMAScript modules (import/export)
* - `cjs`: CommonJS modules (require/exports)
* - `iife`: Immediately Invoked Function Expression (for browsers)
*
* @default "esm"
*/
transpileFormat: transpileFormat;
/**
* When `true`, minifies the output to reduce bundle size.
* Recommended for production builds but may increase build time.
*
* @default true
*/
transpileMinify: boolean;
/**
* The base URL for loading assets in the built package.
* Important for packages that include assets like images or fonts.
*
* @default "/"
*/
transpilePublicPath: string;
/**
* Controls source map generation for debugging (experimental):
* - `true/false`: Enable/disable source maps.
* - `"inline"`: Include source maps within output files.
* - `"none"`: Do not generate source maps.
* - `"linked"`: Generate separate source map files with links.
* - `"external"`: Generate separate source map files.
*
* @default false
*/
transpileSourcemap: Sourcemap;
/**
* When `true`, enables code transpileSplitting for improved load-time performance.
* Useful for large applications but may not be needed for small projects.
*
* @default false
*/
transpileSplitting: boolean;
/**
* Stub the package for JIT compilation.
*
* @default false
*/
transpileStub: boolean;
/**
* Defines the transpileTarget runtime environment:
* - `node`: Optimized for Node.js.
* - `bun`: Optimized for Bun.
* - `browser`: Optimized for web browsers.
*
* @default "node"
*/
transpileTarget: TranspileTarget;
/**
* Watch the src dir and rebuild on change (experimental).
*
* @default false
*/
transpileWatch: boolean;
/**
* Specifies what resources to send to npm and jsr registries.
* coreBuildOutDir (e.g. "bin") dir is automatically included.
* The following is also included if publishArtifacts is {}:
* - global: ["package.json", "README.md", "LICENSE"]
* - dist-jsr,dist-libs/jsr: ["jsr.json"]
*
* Structure:
* - `global`: Files to include in all distributions
* - `dist-jsr`: Files specific to JSR distribution
* - `dist-npm`: Files specific to NPM distribution
* - `dist-libs`: Library-specific files for each distribution type
*
* Useful for including additional files like configuration or documentation.
* Pro tip: set jsr.jsonc to generate jsr.jsonc instead of jsr.json config.
*
* @default
* {
* global: ["bin", "package.json", "README.md", "LICENSE"],
* "dist-jsr": ["jsr.json"],
* "dist-npm": [],
* "dist-libs": {
* "@myorg/lib1": {
* jsr: ["jsr.json"],
* npm: []
* }
* }
* }
*/
publishArtifacts?: {
global: string[];
"dist-jsr": string[];
"dist-npm": string[];
"dist-libs": Record<
string,
{
jsr: string[];
npm: string[];
}
>;
};
// Files with these extensions will be built
// Any other files will be copied as-is to dist
/**
* File extensions that should be copied to temporary build directories during pre-build.
* These files will be processed by the bundlers.
* All other files will be copied as-is to final dist directories during post-build.
* @default ["ts", "js"]
*/
buildPreExtensions: string[];
// If you need to exclude some ts/js files from being built,
// you can store them in the dirs with buildTemplatesDir name
/**
* Directory name for templates that should be excluded from pre-build processing.
* Files in this directory will be copied as-is during post-build.
* @default "templates"
*/
buildTemplatesDir: string;
// ==========================================================================
// Relinka Logger Configuration
// ==========================================================================
/**
* Integrated relinka logger configuration.
* @see https://github.com/reliverse/relinka
*
* @default See DEFAULT_RELINKA_CONFIG in defaults
*/
relinka: {
/**
* Configuration options for the Relinka logger.
* All properties are optional to allow for partial configuration.
* Defaults will be applied during initialization.
*/
/**
* Enables verbose (aka debug) mode for detailed logging.
*
* `true` here works only for end-users of CLIs/libs when theirs developers
* has been awaited for user's config via `@reliverse/relinka`'s `await relinkaConfig;`
*/
verbose?: boolean;
/**
* Configuration for directory-related settings.
* - `maxLogFiles`: The maximum number of log files to keep before cleanup.
*/
dirs?: RelinkaDirsConfig;
/**
* Disables color output in the console.
*/
disableColors?: boolean;
/**
* Configuration for log file output.
*/
logFile?: {
/**
* Path to the log file.
*/
outputPath?: string;
/**
* How to handle date in the filename.
* - `disable`: No date prefix/suffix
* - `append-before`: Add date before the filename (e.g., "2024-01-15-log.txt")
* - `append-after`: Add date after the filename (e.g., "log-2024-01-15.txt")
*/
nameWithDate?: "disable" | "append-before" | "append-after";
/**
* If true, clears the log file when relinkaConfig is executed with supportFreshLogFile: true.
* This is useful for starting with a clean log file on each run.
*/
freshLogFile?: boolean;
};
/**
* If true, logs will be saved to a file.
*/
saveLogsToFile?: boolean;
/**
* Configuration for timestamp in log messages.
*/
timestamp?: {
/**
* If true, timestamps will be added to log messages.
*/
enabled: boolean;
/**
* The format for timestamps. Default is YYYY-MM-DD HH:mm:ss.SSS
*/
format?: string;
};
/**
* Allows to customize the log levels.
*/
levels?: LogLevelsConfig;
/**
* Controls how often the log cleanup runs (in milliseconds)
* Default: 10000 (10 seconds)
*/
cleanupInterval?: number;
/**
* Maximum size of the log write buffer before flushing to disk (in bytes)
* Default: 4096 (4KB)
*/
bufferSize?: number;
/**
* Maximum time to hold logs in buffer before flushing to disk (in milliseconds)
* Default: 5000 (5 seconds)
*/
maxBufferAge?: number;
};
// ==========================================================================
// Remdn Configuration
// ==========================================================================
/**
* Configuration for the remdn command which generates directory comparison documentation.
* Controls how files are compared and documented across different distribution directories.
*/
remdn?: {
/**
* Title for the generated documentation.
* @default "Directory Comparison"
*/
title?: string;
/**
* Output path for the generated HTML file.
* @default "docs/files.html"
*/
output?: string;
/**
* Configuration for directories to compare.
* Each key represents a directory path, and its value contains directory-specific settings.
*/
dirs?: Record<string, Record<string, never>>;
/**
* Extension mapping for file comparison.
* Maps source file extensions to their corresponding extensions in different distribution directories.
* Format: [<main>, <dist-npm/bin | dist-libs's * npm/bin>, <dist-jsr | dist-libs's * jsr/bin>]
*/
"ext-map"?: Record<string, string[]>;
};
}
/** Configuration for directory-related settings. */
export interface RelinkaDirsConfig {
maxLogFiles?: number;
}
/** Log level types used by the logger. */
export type LogLevel =
| "error"
| "fatal"
| "info"
| "success"
| "verbose"
| "warn"
| "log"
| "internal"
| "null"
| "step"
| "box"
| "message";
/** Configuration for a single log level. */
export interface LogLevelConfig {
/**
* Symbol to display for this log level.
* @see https://symbl.cc
*/
symbol: string;
/**
* Fallback symbol to use if Unicode is not supported.
*/
fallbackSymbol: string;
/**
* Color to use for this log level.
*/
color: string;
/**
* Number of spaces after the symbol/fallback
*/
spacing?: number;
}
/** Configuration for all log levels. */
export type LogLevelsConfig = Partial<Record<LogLevel, LogLevelConfig>>;
export type BumpMode = "patch" | "minor" | "major" | "auto" | "manual";
/**
* Supported bundler names for building packages:
* - bun: Bun's built-in bundler for fast builds
* - copy: A simple file copy without bundling
* - jsr: Similar to copy but optimized for the JSR commonPubRegistry
* - mkdist: A lightweight bundler focused on TypeScript/ESM
* - rollup: A traditional bundler with an extensive plugin ecosystem
* - untyped: Types and markdown generation from a config object
*/
export type BundlerName = "bun" | "copy" | "jsr" | "mkdist" | "rollup" | "untyped";
export type NpmOutExt = "cjs" | "cts" | "js" | "mjs" | "mts" | "ts";
/**
* Configuration for a library to be built and published as a separate package.
* Used when publishing multiple packages from a single repository.
*/
export interface LibConfig {
/**
* When `true`, generates TypeScript declaration files (.d.ts) for NPM packages.
*/
libDeclarations: boolean;
/**
* An optional description of the library, included in the dist's package.json.
* Provides users with an overview of the library's purpose.
*
* @example "Utility functions for data manipulation"
* @example "Core configuration module for the framework"
*
* @default `package.json`'s "description"
*/
libDescription: string;
/**
* The directory where the library's dist files are stored.
*
* @default name is derived from the library's name after slash
*/
libDirName: string;
/**
* The path to the library's main entry file.
* This file serves as the primary entry point for imports.
* The path should be relative to the project root.
* The full path to the library's main file is derived by joining `libsDirDist` with `main`.
*
* @example "my-lib-1/mod.ts"
* @example "my-lib-2/ml2-mod.ts"
* @example "src/libs/my-lib-3/index.js"
*/
libMainFile: string;
/**
* Dependencies to include in the dist's package.json.
* The final output may vary based on `filterDepsPatterns`.
* Defines how dependencies are handled during publishing:
* - `string[]`: Includes only the specified dependencies.
* - `true`: Includes all dependencies from the main package.json.
* - `false` or `undefined`: Automatically determines dependencies based on imports.
*
* @example ["@reliverse/pathkit", "@reliverse/relifso"] - Only will include these specific dependencies.
* @example true - Include all `dependencies` from the main package.json.
*/
libPkgKeepDeps: boolean | string[];
/**
* When `true`, minifies the output to reduce bundle size.
* Recommended for production builds but may increase build time.
*
* @default true
*/
libTranspileMinify: boolean;
/**
* When true, pauses publishing for this specific library (overridden by commonPubPause).
* If true, this library will be built but not published, even if other libs are published.
*
* @default false
*/
libPubPause?: boolean;
/**
* The registry to publish the library to.
*
* @default "npm"
*/
libPubRegistry?: "jsr" | "npm" | "npm-jsr";
/**