@reliverse/dler 1.7.85 → 1.7.87
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 +1 -1
- package/bin/app/build/impl.d.ts +1 -1
- package/bin/app/build/impl.js +12 -1
- package/bin/app/build/postbuild.js +1 -1
- package/bin/app/build/prebuild.js +1 -1
- package/bin/app/pub/impl.js +22 -1
- package/bin/libs/cfg/cfg-impl/cfg-dler.d.ts +124 -0
- package/bin/libs/cfg/cfg-impl/cfg-dler.js +77 -1
- package/bin/libs/sdk/sdk-impl/config/default.js +77 -1
- package/bin/libs/sdk/sdk-impl/config/info.js +1 -1
- package/bin/libs/sdk/sdk-impl/config/types.d.ts +122 -0
- package/bin/libs/sdk/sdk-impl/library-flow.js +2 -2
- package/bin/libs/sdk/sdk-impl/regular-flow.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/spinner.d.ts +17 -0
- package/bin/libs/sdk/sdk-impl/utils/spinner.js +53 -0
- package/bin/libs/sdk/sdk-mod.d.ts +2 -1
- package/bin/libs/sdk/sdk-mod.js +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[sponsor](https://github.com/sponsors/blefnk) — [discord](https://discord.gg/pb8ukbwpsj) — [github](https://github.com/reliverse/dler) — [npm](https://npmjs.com/@reliverse/dler)
|
|
4
4
|
|
|
5
|
-
> @reliverse/dler (formerly relidler; `/ˈdiː.lər/`, dealer) is a unified package manager for typescript/javascript projects.
|
|
5
|
+
> @reliverse/dler (formerly relidler; `/ˈdiː.lər/`, dealer) is both a unified package manager for typescript/javascript projects and a flexible framework for creating, building, and publishing js/ts libraries to npm and jsr.
|
|
6
6
|
>
|
|
7
7
|
> dler is your package manager’s best friend — it extends bun, deno (🔜), pnpm, yarn, and npm with powerful and modern features.
|
|
8
8
|
>
|
package/bin/app/build/impl.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { DlerConfig } from "../../libs/sdk/sdk-impl/config/types.js";
|
|
|
4
4
|
* Handles building for both main project and libraries.
|
|
5
5
|
* @see `src/app/pub/impl.ts` for pub main function implementation.
|
|
6
6
|
*/
|
|
7
|
-
export declare function dlerBuild(isDev: boolean, config?: DlerConfig, debugOnlyCopyNonBuildFiles?: boolean, debugDontCopyNonBuildFiles?: boolean): Promise<{
|
|
7
|
+
export declare function dlerBuild(isDev: boolean, config?: DlerConfig, debugOnlyCopyNonBuildFiles?: boolean, debugDontCopyNonBuildFiles?: boolean, disableOwnSpinner?: boolean): Promise<{
|
|
8
8
|
timer: any;
|
|
9
9
|
effectiveConfig: any;
|
|
10
10
|
} | undefined>;
|
package/bin/app/build/impl.js
CHANGED
|
@@ -4,19 +4,24 @@ import { relinka } from "@reliverse/relinka";
|
|
|
4
4
|
import { getConfigDler } from "../../libs/sdk/sdk-impl/config/load.js";
|
|
5
5
|
import { library_buildFlow } from "../../libs/sdk/sdk-impl/library-flow.js";
|
|
6
6
|
import { regular_buildFlow } from "../../libs/sdk/sdk-impl/regular-flow.js";
|
|
7
|
+
import { createSpinner } from "../../libs/sdk/sdk-impl/utils/spinner.js";
|
|
7
8
|
import { removeDistFolders } from "../../libs/sdk/sdk-impl/utils/utils-clean.js";
|
|
8
9
|
import { PROJECT_ROOT } from "../../libs/sdk/sdk-impl/utils/utils-consts.js";
|
|
9
10
|
import { handleDlerError } from "../../libs/sdk/sdk-impl/utils/utils-error-cwd.js";
|
|
10
11
|
import { createPerfTimer } from "../../libs/sdk/sdk-impl/utils/utils-perf.js";
|
|
11
12
|
import { dlerPostBuild, wrapper_CopyNonBuildFiles } from "./postbuild.js";
|
|
12
13
|
import { dlerPreBuild } from "./prebuild.js";
|
|
13
|
-
export async function dlerBuild(isDev, config, debugOnlyCopyNonBuildFiles, debugDontCopyNonBuildFiles) {
|
|
14
|
+
export async function dlerBuild(isDev, config, debugOnlyCopyNonBuildFiles, debugDontCopyNonBuildFiles, disableOwnSpinner) {
|
|
14
15
|
const timer = createPerfTimer();
|
|
15
16
|
let effectiveConfig = config;
|
|
17
|
+
let shouldShowSpinner = false;
|
|
18
|
+
let spinner = null;
|
|
16
19
|
try {
|
|
17
20
|
if (!effectiveConfig) {
|
|
18
21
|
effectiveConfig = await getConfigDler();
|
|
19
22
|
}
|
|
23
|
+
shouldShowSpinner = effectiveConfig.displayBuildPubLogs === false && !disableOwnSpinner;
|
|
24
|
+
spinner = shouldShowSpinner ? createSpinner("Building...").start() : null;
|
|
20
25
|
if (effectiveConfig.logsFreshFile) {
|
|
21
26
|
await fs.remove(path.join(PROJECT_ROOT, effectiveConfig.logsFileName));
|
|
22
27
|
}
|
|
@@ -56,8 +61,14 @@ export async function dlerBuild(isDev, config, debugOnlyCopyNonBuildFiles, debug
|
|
|
56
61
|
if (effectiveConfig.postBuildSettings?.deleteDistTmpAfterBuild) {
|
|
57
62
|
await fs.remove(path.join(PROJECT_ROOT, "dist-tmp"));
|
|
58
63
|
}
|
|
64
|
+
if (shouldShowSpinner && spinner) {
|
|
65
|
+
spinner.succeed("Build completed successfully!");
|
|
66
|
+
}
|
|
59
67
|
return { timer, effectiveConfig };
|
|
60
68
|
} catch (error) {
|
|
69
|
+
if (shouldShowSpinner && spinner) {
|
|
70
|
+
spinner.fail("Build failed!");
|
|
71
|
+
}
|
|
61
72
|
handleDlerError(error);
|
|
62
73
|
}
|
|
63
74
|
}
|
|
@@ -11,7 +11,7 @@ import { PROJECT_ROOT } from "../../libs/sdk/sdk-impl/utils/utils-consts.js";
|
|
|
11
11
|
import { directoryExists, executeDlerHooks } from "./ppb-utils.js";
|
|
12
12
|
const ALIAS_TO_REPLACE = "~";
|
|
13
13
|
export async function dlerPostBuild(isDev, debugDontCopyNonBuildFiles) {
|
|
14
|
-
relinka("
|
|
14
|
+
relinka("verbose", "\u2014 \u2014 \u2014 dlerPostBuild \u2014 \u2014 \u2014");
|
|
15
15
|
const config = await getConfigDler();
|
|
16
16
|
await resolveAllCrossLibs(
|
|
17
17
|
"package",
|
|
@@ -56,7 +56,7 @@ async function copyFilesToTempDir(srcDir, tempDir, extensions, excludeDir) {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
export async function dlerPreBuild(config) {
|
|
59
|
-
relinka("
|
|
59
|
+
relinka("verbose", "\u2014 \u2014 \u2014 dlerPreBuild \u2014 \u2014 \u2014");
|
|
60
60
|
await executeDlerHooks(config?.hooksBeforeBuild ?? [], "pre-build");
|
|
61
61
|
const tempDirs = {
|
|
62
62
|
npm: path.join(PROJECT_ROOT, "dist-tmp", "tmp-npm"),
|
package/bin/app/pub/impl.js
CHANGED
|
@@ -4,13 +4,18 @@ import { getConfigDler } from "../../libs/sdk/sdk-impl/config/load.js";
|
|
|
4
4
|
import { library_pubFlow } from "../../libs/sdk/sdk-impl/library-flow.js";
|
|
5
5
|
import { regular_pubFlow } from "../../libs/sdk/sdk-impl/regular-flow.js";
|
|
6
6
|
import { finalizeBuild, finalizePub } from "../../libs/sdk/sdk-impl/utils/finalize.js";
|
|
7
|
+
import { createSpinner } from "../../libs/sdk/sdk-impl/utils/spinner.js";
|
|
7
8
|
import { handleDlerError } from "../../libs/sdk/sdk-impl/utils/utils-error-cwd.js";
|
|
8
9
|
export async function dlerPub(isDev, config) {
|
|
9
10
|
let effectiveConfig = config;
|
|
11
|
+
let shouldShowSpinner = false;
|
|
12
|
+
let spinner = null;
|
|
10
13
|
try {
|
|
11
14
|
if (!effectiveConfig) {
|
|
12
15
|
effectiveConfig = await getConfigDler();
|
|
13
16
|
}
|
|
17
|
+
shouldShowSpinner = effectiveConfig.displayBuildPubLogs === false;
|
|
18
|
+
spinner = shouldShowSpinner ? createSpinner("Building and publishing...").start() : null;
|
|
14
19
|
const bumpIsDisabled = await isBumpDisabled();
|
|
15
20
|
if (!bumpIsDisabled && !effectiveConfig.commonPubPause) {
|
|
16
21
|
try {
|
|
@@ -25,9 +30,19 @@ export async function dlerPub(isDev, config) {
|
|
|
25
30
|
throw new Error("[.config/dler.ts] Failed to set bumpDisable to true");
|
|
26
31
|
}
|
|
27
32
|
}
|
|
28
|
-
const { timer, effectiveConfig: buildConfig } = await dlerBuild(
|
|
33
|
+
const { timer, effectiveConfig: buildConfig } = await dlerBuild(
|
|
34
|
+
isDev,
|
|
35
|
+
effectiveConfig,
|
|
36
|
+
void 0,
|
|
37
|
+
void 0,
|
|
38
|
+
shouldShowSpinner
|
|
39
|
+
// disable build's spinner if pub is showing one
|
|
40
|
+
);
|
|
29
41
|
if (effectiveConfig.commonPubPause) {
|
|
30
42
|
await finalizeBuild(timer, effectiveConfig.commonPubPause, "pub");
|
|
43
|
+
if (shouldShowSpinner && spinner) {
|
|
44
|
+
spinner.succeed("Build completed successfully!");
|
|
45
|
+
}
|
|
31
46
|
} else {
|
|
32
47
|
await regular_pubFlow(timer, isDev, buildConfig);
|
|
33
48
|
await library_pubFlow(timer, isDev, buildConfig);
|
|
@@ -38,8 +53,14 @@ export async function dlerPub(isDev, config) {
|
|
|
38
53
|
buildConfig.distJsrDirName,
|
|
39
54
|
buildConfig.libsDirDist
|
|
40
55
|
);
|
|
56
|
+
if (shouldShowSpinner && spinner) {
|
|
57
|
+
spinner.succeed("Build and publish completed successfully!");
|
|
58
|
+
}
|
|
41
59
|
}
|
|
42
60
|
} catch (error) {
|
|
61
|
+
if (shouldShowSpinner && spinner) {
|
|
62
|
+
spinner.fail("Build and publish failed!");
|
|
63
|
+
}
|
|
43
64
|
handleDlerError(error);
|
|
44
65
|
}
|
|
45
66
|
}
|
|
@@ -1,3 +1,111 @@
|
|
|
1
|
+
/** Configuration for directory-related settings. */
|
|
2
|
+
export interface RelinkaDirsConfig {
|
|
3
|
+
maxLogFiles?: number;
|
|
4
|
+
}
|
|
5
|
+
/** Log level types used by the logger. */
|
|
6
|
+
export type LogLevel = "error" | "fatal" | "info" | "success" | "verbose" | "warn" | "log" | "internal" | "null" | "step" | "box" | "message";
|
|
7
|
+
/** Configuration for a single log level. */
|
|
8
|
+
export interface LogLevelConfig {
|
|
9
|
+
/**
|
|
10
|
+
* Symbol to display for this log level.
|
|
11
|
+
* @see https://symbl.cc
|
|
12
|
+
*/
|
|
13
|
+
symbol: string;
|
|
14
|
+
/**
|
|
15
|
+
* Fallback symbol to use if Unicode is not supported.
|
|
16
|
+
*/
|
|
17
|
+
fallbackSymbol: string;
|
|
18
|
+
/**
|
|
19
|
+
* Color to use for this log level.
|
|
20
|
+
*/
|
|
21
|
+
color: string;
|
|
22
|
+
/**
|
|
23
|
+
* Number of spaces after the symbol/fallback
|
|
24
|
+
*/
|
|
25
|
+
spacing?: number;
|
|
26
|
+
}
|
|
27
|
+
/** Configuration for all log levels. */
|
|
28
|
+
export type LogLevelsConfig = Partial<Record<LogLevel, LogLevelConfig>>;
|
|
29
|
+
/**
|
|
30
|
+
* Configuration options for the Relinka logger.
|
|
31
|
+
* All properties are optional to allow for partial configuration.
|
|
32
|
+
* Defaults will be applied during initialization.
|
|
33
|
+
*/
|
|
34
|
+
export interface RelinkaConfig {
|
|
35
|
+
/**
|
|
36
|
+
* Enables verbose (aka debug) mode for detailed logging.
|
|
37
|
+
*
|
|
38
|
+
* `true` here works only for end-users of CLIs/libs when theirs developers
|
|
39
|
+
* has been awaited for user's config via `@reliverse/relinka`'s `await relinkaConfig;`
|
|
40
|
+
*/
|
|
41
|
+
verbose?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Configuration for directory-related settings.
|
|
44
|
+
* - `maxLogFiles`: The maximum number of log files to keep before cleanup.
|
|
45
|
+
*/
|
|
46
|
+
dirs?: RelinkaDirsConfig;
|
|
47
|
+
/**
|
|
48
|
+
* Disables color output in the console.
|
|
49
|
+
*/
|
|
50
|
+
disableColors?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Configuration for log file output.
|
|
53
|
+
*/
|
|
54
|
+
logFile?: {
|
|
55
|
+
/**
|
|
56
|
+
* Path to the log file.
|
|
57
|
+
*/
|
|
58
|
+
outputPath?: string;
|
|
59
|
+
/**
|
|
60
|
+
* How to handle date in the filename.
|
|
61
|
+
* - `disable`: No date prefix/suffix
|
|
62
|
+
* - `append-before`: Add date before the filename (e.g., "2024-01-15-log.txt")
|
|
63
|
+
* - `append-after`: Add date after the filename (e.g., "log-2024-01-15.txt")
|
|
64
|
+
*/
|
|
65
|
+
nameWithDate?: "disable" | "append-before" | "append-after";
|
|
66
|
+
/**
|
|
67
|
+
* If true, clears the log file when relinkaConfig is executed with supportFreshLogFile: true.
|
|
68
|
+
* This is useful for starting with a clean log file on each run.
|
|
69
|
+
*/
|
|
70
|
+
freshLogFile?: boolean;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* If true, logs will be saved to a file.
|
|
74
|
+
*/
|
|
75
|
+
saveLogsToFile?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Configuration for timestamp in log messages.
|
|
78
|
+
*/
|
|
79
|
+
timestamp?: {
|
|
80
|
+
/**
|
|
81
|
+
* If true, timestamps will be added to log messages.
|
|
82
|
+
*/
|
|
83
|
+
enabled: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* The format for timestamps. Default is YYYY-MM-DD HH:mm:ss.SSS
|
|
86
|
+
*/
|
|
87
|
+
format?: string;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Allows to customize the log levels.
|
|
91
|
+
*/
|
|
92
|
+
levels?: LogLevelsConfig;
|
|
93
|
+
/**
|
|
94
|
+
* Controls how often the log cleanup runs (in milliseconds)
|
|
95
|
+
* Default: 10000 (10 seconds)
|
|
96
|
+
*/
|
|
97
|
+
cleanupInterval?: number;
|
|
98
|
+
/**
|
|
99
|
+
* Maximum size of the log write buffer before flushing to disk (in bytes)
|
|
100
|
+
* Default: 4096 (4KB)
|
|
101
|
+
*/
|
|
102
|
+
bufferSize?: number;
|
|
103
|
+
/**
|
|
104
|
+
* Maximum time to hold logs in buffer before flushing to disk (in milliseconds)
|
|
105
|
+
* Default: 5000 (5 seconds)
|
|
106
|
+
*/
|
|
107
|
+
maxBufferAge?: number;
|
|
108
|
+
}
|
|
1
109
|
/**
|
|
2
110
|
* Defines the configuration for building and publishing packages. This includes: versioning,
|
|
3
111
|
* build settings, publishing options, libraries-dler-plugin built-in plugin, and more.
|
|
@@ -68,6 +176,13 @@ export interface DlerConfig {
|
|
|
68
176
|
* @default false
|
|
69
177
|
*/
|
|
70
178
|
commonVerbose: boolean;
|
|
179
|
+
/**
|
|
180
|
+
* When `true`, displays detailed build and publish logs.
|
|
181
|
+
* When `false`, only shows spinner with status messages during build and publish.
|
|
182
|
+
*
|
|
183
|
+
* @default true
|
|
184
|
+
*/
|
|
185
|
+
displayBuildPubLogs: boolean;
|
|
71
186
|
/**
|
|
72
187
|
* When `true`, generates TypeScript declaration files (.d.ts) for NPM packages.
|
|
73
188
|
* Essential for providing type intranspileFormation to TypeScript users.
|
|
@@ -497,6 +612,13 @@ export interface DlerConfig {
|
|
|
497
612
|
* @default "templates"
|
|
498
613
|
*/
|
|
499
614
|
buildTemplatesDir: string;
|
|
615
|
+
/**
|
|
616
|
+
* Integrated relinka logger configuration.
|
|
617
|
+
* @see https://github.com/reliverse/relinka
|
|
618
|
+
*
|
|
619
|
+
* @default See DEFAULT_RELINKA_CONFIG in defaults
|
|
620
|
+
*/
|
|
621
|
+
relinka: RelinkaConfig;
|
|
500
622
|
}
|
|
501
623
|
export type BumpMode = "patch" | "minor" | "major" | "auto" | "manual";
|
|
502
624
|
/**
|
|
@@ -622,6 +744,7 @@ export declare const defineConfig: (userConfig?: Partial<DlerConfig>) => {
|
|
|
622
744
|
commonPubPause: boolean;
|
|
623
745
|
commonPubRegistry: "jsr" | "npm" | "npm-jsr";
|
|
624
746
|
commonVerbose: boolean;
|
|
747
|
+
displayBuildPubLogs: boolean;
|
|
625
748
|
coreDeclarations: boolean;
|
|
626
749
|
coreEntryFile: string;
|
|
627
750
|
coreEntrySrcDir: string;
|
|
@@ -685,4 +808,5 @@ export declare const defineConfig: (userConfig?: Partial<DlerConfig>) => {
|
|
|
685
808
|
};
|
|
686
809
|
buildPreExtensions: string[];
|
|
687
810
|
buildTemplatesDir: string;
|
|
811
|
+
relinka: RelinkaConfig;
|
|
688
812
|
};
|
|
@@ -6,6 +6,7 @@ export const DEFAULT_CONFIG_DLER = {
|
|
|
6
6
|
commonPubPause: true,
|
|
7
7
|
commonPubRegistry: "npm",
|
|
8
8
|
commonVerbose: false,
|
|
9
|
+
displayBuildPubLogs: true,
|
|
9
10
|
coreDeclarations: true,
|
|
10
11
|
coreDescription: "",
|
|
11
12
|
coreEntryFile: "mod.ts",
|
|
@@ -78,7 +79,82 @@ export const DEFAULT_CONFIG_DLER = {
|
|
|
78
79
|
buildPreExtensions: ["ts", "js"],
|
|
79
80
|
// If you need to exclude some ts/js files from being built,
|
|
80
81
|
// you can store them in the dirs with buildTemplatesDir name
|
|
81
|
-
buildTemplatesDir: "templates"
|
|
82
|
+
buildTemplatesDir: "templates",
|
|
83
|
+
// Integrated relinka logger configuration
|
|
84
|
+
relinka: {
|
|
85
|
+
verbose: false,
|
|
86
|
+
dirs: {
|
|
87
|
+
maxLogFiles: 5
|
|
88
|
+
},
|
|
89
|
+
disableColors: false,
|
|
90
|
+
logFile: {
|
|
91
|
+
outputPath: "logs.log",
|
|
92
|
+
nameWithDate: "disable",
|
|
93
|
+
freshLogFile: true
|
|
94
|
+
},
|
|
95
|
+
saveLogsToFile: true,
|
|
96
|
+
timestamp: {
|
|
97
|
+
enabled: false,
|
|
98
|
+
format: "HH:mm:ss"
|
|
99
|
+
},
|
|
100
|
+
cleanupInterval: 1e4,
|
|
101
|
+
// 10 seconds
|
|
102
|
+
bufferSize: 4096,
|
|
103
|
+
// 4KB
|
|
104
|
+
maxBufferAge: 5e3,
|
|
105
|
+
// 5 seconds
|
|
106
|
+
levels: {
|
|
107
|
+
success: {
|
|
108
|
+
symbol: "\u2713",
|
|
109
|
+
fallbackSymbol: "[OK]",
|
|
110
|
+
color: "greenBright",
|
|
111
|
+
spacing: 3
|
|
112
|
+
},
|
|
113
|
+
info: {
|
|
114
|
+
symbol: "i",
|
|
115
|
+
fallbackSymbol: "[i]",
|
|
116
|
+
color: "cyanBright",
|
|
117
|
+
spacing: 3
|
|
118
|
+
},
|
|
119
|
+
error: {
|
|
120
|
+
symbol: "\u2716",
|
|
121
|
+
fallbackSymbol: "[ERR]",
|
|
122
|
+
color: "redBright",
|
|
123
|
+
spacing: 3
|
|
124
|
+
},
|
|
125
|
+
warn: {
|
|
126
|
+
symbol: "\u26A0",
|
|
127
|
+
fallbackSymbol: "[WARN]",
|
|
128
|
+
color: "yellowBright",
|
|
129
|
+
spacing: 3
|
|
130
|
+
},
|
|
131
|
+
fatal: {
|
|
132
|
+
symbol: "\u203C",
|
|
133
|
+
fallbackSymbol: "[FATAL]",
|
|
134
|
+
color: "redBright",
|
|
135
|
+
spacing: 3
|
|
136
|
+
},
|
|
137
|
+
verbose: {
|
|
138
|
+
symbol: "\u2727",
|
|
139
|
+
fallbackSymbol: "[VERBOSE]",
|
|
140
|
+
color: "gray",
|
|
141
|
+
spacing: 3
|
|
142
|
+
},
|
|
143
|
+
internal: {
|
|
144
|
+
symbol: "\u2699",
|
|
145
|
+
fallbackSymbol: "[INTERNAL]",
|
|
146
|
+
color: "magentaBright",
|
|
147
|
+
spacing: 3
|
|
148
|
+
},
|
|
149
|
+
log: { symbol: "\u2502", fallbackSymbol: "|", color: "dim", spacing: 3 },
|
|
150
|
+
message: {
|
|
151
|
+
symbol: "\u{1F7A0}",
|
|
152
|
+
fallbackSymbol: "[MSG]",
|
|
153
|
+
color: "cyan",
|
|
154
|
+
spacing: 3
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
82
158
|
};
|
|
83
159
|
export const defineConfig = (userConfig = {}) => {
|
|
84
160
|
return { ...DEFAULT_CONFIG_DLER, ...userConfig };
|
|
@@ -6,6 +6,7 @@ export const DEFAULT_CONFIG_DLER = {
|
|
|
6
6
|
commonPubPause: true,
|
|
7
7
|
commonPubRegistry: "npm",
|
|
8
8
|
commonVerbose: false,
|
|
9
|
+
displayBuildPubLogs: true,
|
|
9
10
|
coreDeclarations: true,
|
|
10
11
|
coreDescription: "",
|
|
11
12
|
coreEntryFile: "mod.ts",
|
|
@@ -76,7 +77,82 @@ export const DEFAULT_CONFIG_DLER = {
|
|
|
76
77
|
buildPreExtensions: ["ts", "js"],
|
|
77
78
|
// If you need to exclude some ts/js files from being built,
|
|
78
79
|
// you can store them in the dirs with buildTemplatesDir name
|
|
79
|
-
buildTemplatesDir: "templates"
|
|
80
|
+
buildTemplatesDir: "templates",
|
|
81
|
+
// Integrated relinka logger configuration
|
|
82
|
+
relinka: {
|
|
83
|
+
verbose: false,
|
|
84
|
+
dirs: {
|
|
85
|
+
maxLogFiles: 5
|
|
86
|
+
},
|
|
87
|
+
disableColors: false,
|
|
88
|
+
logFile: {
|
|
89
|
+
outputPath: "logs.log",
|
|
90
|
+
nameWithDate: "disable",
|
|
91
|
+
freshLogFile: true
|
|
92
|
+
},
|
|
93
|
+
saveLogsToFile: true,
|
|
94
|
+
timestamp: {
|
|
95
|
+
enabled: false,
|
|
96
|
+
format: "HH:mm:ss"
|
|
97
|
+
},
|
|
98
|
+
cleanupInterval: 1e4,
|
|
99
|
+
// 10 seconds
|
|
100
|
+
bufferSize: 4096,
|
|
101
|
+
// 4KB
|
|
102
|
+
maxBufferAge: 5e3,
|
|
103
|
+
// 5 seconds
|
|
104
|
+
levels: {
|
|
105
|
+
success: {
|
|
106
|
+
symbol: "\u2713",
|
|
107
|
+
fallbackSymbol: "[OK]",
|
|
108
|
+
color: "greenBright",
|
|
109
|
+
spacing: 3
|
|
110
|
+
},
|
|
111
|
+
info: {
|
|
112
|
+
symbol: "i",
|
|
113
|
+
fallbackSymbol: "[i]",
|
|
114
|
+
color: "cyanBright",
|
|
115
|
+
spacing: 3
|
|
116
|
+
},
|
|
117
|
+
error: {
|
|
118
|
+
symbol: "\u2716",
|
|
119
|
+
fallbackSymbol: "[ERR]",
|
|
120
|
+
color: "redBright",
|
|
121
|
+
spacing: 3
|
|
122
|
+
},
|
|
123
|
+
warn: {
|
|
124
|
+
symbol: "\u26A0",
|
|
125
|
+
fallbackSymbol: "[WARN]",
|
|
126
|
+
color: "yellowBright",
|
|
127
|
+
spacing: 3
|
|
128
|
+
},
|
|
129
|
+
fatal: {
|
|
130
|
+
symbol: "\u203C",
|
|
131
|
+
fallbackSymbol: "[FATAL]",
|
|
132
|
+
color: "redBright",
|
|
133
|
+
spacing: 3
|
|
134
|
+
},
|
|
135
|
+
verbose: {
|
|
136
|
+
symbol: "\u2727",
|
|
137
|
+
fallbackSymbol: "[VERBOSE]",
|
|
138
|
+
color: "gray",
|
|
139
|
+
spacing: 3
|
|
140
|
+
},
|
|
141
|
+
internal: {
|
|
142
|
+
symbol: "\u2699",
|
|
143
|
+
fallbackSymbol: "[INTERNAL]",
|
|
144
|
+
color: "magentaBright",
|
|
145
|
+
spacing: 3
|
|
146
|
+
},
|
|
147
|
+
log: { symbol: "\u2502", fallbackSymbol: "|", color: "dim", spacing: 3 },
|
|
148
|
+
message: {
|
|
149
|
+
symbol: "\u{1F7A0}",
|
|
150
|
+
fallbackSymbol: "[MSG]",
|
|
151
|
+
color: "cyan",
|
|
152
|
+
spacing: 3
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
80
156
|
};
|
|
81
157
|
export const defineConfig = (userConfig = {}) => {
|
|
82
158
|
return { ...DEFAULT_CONFIG_DLER, ...userConfig };
|
|
@@ -1,3 +1,111 @@
|
|
|
1
|
+
/** Configuration for directory-related settings. */
|
|
2
|
+
export interface RelinkaDirsConfig {
|
|
3
|
+
maxLogFiles?: number;
|
|
4
|
+
}
|
|
5
|
+
/** Log level types used by the logger. */
|
|
6
|
+
export type LogLevel = "error" | "fatal" | "info" | "success" | "verbose" | "warn" | "log" | "internal" | "null" | "step" | "box" | "message";
|
|
7
|
+
/** Configuration for a single log level. */
|
|
8
|
+
export interface LogLevelConfig {
|
|
9
|
+
/**
|
|
10
|
+
* Symbol to display for this log level.
|
|
11
|
+
* @see https://symbl.cc
|
|
12
|
+
*/
|
|
13
|
+
symbol: string;
|
|
14
|
+
/**
|
|
15
|
+
* Fallback symbol to use if Unicode is not supported.
|
|
16
|
+
*/
|
|
17
|
+
fallbackSymbol: string;
|
|
18
|
+
/**
|
|
19
|
+
* Color to use for this log level.
|
|
20
|
+
*/
|
|
21
|
+
color: string;
|
|
22
|
+
/**
|
|
23
|
+
* Number of spaces after the symbol/fallback
|
|
24
|
+
*/
|
|
25
|
+
spacing?: number;
|
|
26
|
+
}
|
|
27
|
+
/** Configuration for all log levels. */
|
|
28
|
+
export type LogLevelsConfig = Partial<Record<LogLevel, LogLevelConfig>>;
|
|
29
|
+
/**
|
|
30
|
+
* Configuration options for the Relinka logger.
|
|
31
|
+
* All properties are optional to allow for partial configuration.
|
|
32
|
+
* Defaults will be applied during initialization.
|
|
33
|
+
*/
|
|
34
|
+
export interface RelinkaConfig {
|
|
35
|
+
/**
|
|
36
|
+
* Enables verbose (aka debug) mode for detailed logging.
|
|
37
|
+
*
|
|
38
|
+
* `true` here works only for end-users of CLIs/libs when theirs developers
|
|
39
|
+
* has been awaited for user's config via `@reliverse/relinka`'s `await relinkaConfig;`
|
|
40
|
+
*/
|
|
41
|
+
verbose?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Configuration for directory-related settings.
|
|
44
|
+
* - `maxLogFiles`: The maximum number of log files to keep before cleanup.
|
|
45
|
+
*/
|
|
46
|
+
dirs?: RelinkaDirsConfig;
|
|
47
|
+
/**
|
|
48
|
+
* Disables color output in the console.
|
|
49
|
+
*/
|
|
50
|
+
disableColors?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Configuration for log file output.
|
|
53
|
+
*/
|
|
54
|
+
logFile?: {
|
|
55
|
+
/**
|
|
56
|
+
* Path to the log file.
|
|
57
|
+
*/
|
|
58
|
+
outputPath?: string;
|
|
59
|
+
/**
|
|
60
|
+
* How to handle date in the filename.
|
|
61
|
+
* - `disable`: No date prefix/suffix
|
|
62
|
+
* - `append-before`: Add date before the filename (e.g., "2024-01-15-log.txt")
|
|
63
|
+
* - `append-after`: Add date after the filename (e.g., "log-2024-01-15.txt")
|
|
64
|
+
*/
|
|
65
|
+
nameWithDate?: "disable" | "append-before" | "append-after";
|
|
66
|
+
/**
|
|
67
|
+
* If true, clears the log file when relinkaConfig is executed with supportFreshLogFile: true.
|
|
68
|
+
* This is useful for starting with a clean log file on each run.
|
|
69
|
+
*/
|
|
70
|
+
freshLogFile?: boolean;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* If true, logs will be saved to a file.
|
|
74
|
+
*/
|
|
75
|
+
saveLogsToFile?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Configuration for timestamp in log messages.
|
|
78
|
+
*/
|
|
79
|
+
timestamp?: {
|
|
80
|
+
/**
|
|
81
|
+
* If true, timestamps will be added to log messages.
|
|
82
|
+
*/
|
|
83
|
+
enabled: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* The format for timestamps. Default is YYYY-MM-DD HH:mm:ss.SSS
|
|
86
|
+
*/
|
|
87
|
+
format?: string;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Allows to customize the log levels.
|
|
91
|
+
*/
|
|
92
|
+
levels?: LogLevelsConfig;
|
|
93
|
+
/**
|
|
94
|
+
* Controls how often the log cleanup runs (in milliseconds)
|
|
95
|
+
* Default: 10000 (10 seconds)
|
|
96
|
+
*/
|
|
97
|
+
cleanupInterval?: number;
|
|
98
|
+
/**
|
|
99
|
+
* Maximum size of the log write buffer before flushing to disk (in bytes)
|
|
100
|
+
* Default: 4096 (4KB)
|
|
101
|
+
*/
|
|
102
|
+
bufferSize?: number;
|
|
103
|
+
/**
|
|
104
|
+
* Maximum time to hold logs in buffer before flushing to disk (in milliseconds)
|
|
105
|
+
* Default: 5000 (5 seconds)
|
|
106
|
+
*/
|
|
107
|
+
maxBufferAge?: number;
|
|
108
|
+
}
|
|
1
109
|
/**
|
|
2
110
|
* Defines the configuration for building and publishing packages. This includes: versioning,
|
|
3
111
|
* build settings, publishing options, libraries-dler-plugin built-in plugin, and more.
|
|
@@ -68,6 +176,13 @@ export interface DlerConfig {
|
|
|
68
176
|
* @default false
|
|
69
177
|
*/
|
|
70
178
|
commonVerbose: boolean;
|
|
179
|
+
/**
|
|
180
|
+
* When `true`, displays detailed build and publish logs.
|
|
181
|
+
* When `false`, only shows spinner with status messages during build and publish.
|
|
182
|
+
*
|
|
183
|
+
* @default true
|
|
184
|
+
*/
|
|
185
|
+
displayBuildPubLogs: boolean;
|
|
71
186
|
/**
|
|
72
187
|
* When `true`, generates TypeScript declaration files (.d.ts) for NPM packages.
|
|
73
188
|
* Essential for providing type intranspileFormation to TypeScript users.
|
|
@@ -497,6 +612,13 @@ export interface DlerConfig {
|
|
|
497
612
|
* @default "templates"
|
|
498
613
|
*/
|
|
499
614
|
buildTemplatesDir: string;
|
|
615
|
+
/**
|
|
616
|
+
* Integrated relinka logger configuration.
|
|
617
|
+
* @see https://github.com/reliverse/relinka
|
|
618
|
+
*
|
|
619
|
+
* @default See DEFAULT_RELINKA_CONFIG in defaults
|
|
620
|
+
*/
|
|
621
|
+
relinka: RelinkaConfig;
|
|
500
622
|
}
|
|
501
623
|
export type BumpMode = "patch" | "minor" | "major" | "auto" | "manual";
|
|
502
624
|
/**
|
|
@@ -6,7 +6,7 @@ import { library_publishLibrary } from "./pub/pub-library.js";
|
|
|
6
6
|
import { CONCURRENCY_DEFAULT, PROJECT_ROOT } from "./utils/utils-consts.js";
|
|
7
7
|
import { resumePerfTimer } from "./utils/utils-perf.js";
|
|
8
8
|
export async function library_buildFlow(timer, isDev, config) {
|
|
9
|
-
relinka("
|
|
9
|
+
relinka("verbose", "\u2014 \u2014 \u2014 library_buildFlow \u2014 \u2014 \u2014");
|
|
10
10
|
if (config.libsActMode !== "libs-only" && config.libsActMode !== "main-and-libs") {
|
|
11
11
|
relinka("verbose", "Skipping libs build as libsActMode is set to 'main-project-only'");
|
|
12
12
|
return;
|
|
@@ -36,7 +36,7 @@ export async function library_buildFlow(timer, isDev, config) {
|
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
38
|
export async function library_pubFlow(timer, isDev, config) {
|
|
39
|
-
relinka("
|
|
39
|
+
relinka("verbose", "\u2014 \u2014 \u2014 library_pubFlow \u2014 \u2014 \u2014");
|
|
40
40
|
if (config.libsActMode !== "libs-only" && config.libsActMode !== "main-and-libs") {
|
|
41
41
|
relinka("verbose", "Skipping libs publish as libsActMode is set to 'main-project-only'");
|
|
42
42
|
return;
|
|
@@ -4,7 +4,7 @@ import { regular_buildJsrDist, regular_buildNpmDist } from "./build/build-regula
|
|
|
4
4
|
import { regular_pubToJsr, regular_pubToNpm } from "./pub/pub-regular.js";
|
|
5
5
|
import { CONCURRENCY_DEFAULT } from "./utils/utils-consts.js";
|
|
6
6
|
export async function regular_buildFlow(timer, isDev, config) {
|
|
7
|
-
relinka("
|
|
7
|
+
relinka("verbose", "\u2014 \u2014 \u2014 regular_buildFlow \u2014 \u2014 \u2014");
|
|
8
8
|
if (config.libsActMode === "libs-only") {
|
|
9
9
|
relinka("log", "Skipping main project build as libsActMode is set to 'libs-only'");
|
|
10
10
|
return;
|
|
@@ -113,7 +113,7 @@ export async function regular_buildFlow(timer, isDev, config) {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
export async function regular_pubFlow(timer, isDev, config) {
|
|
116
|
-
relinka("
|
|
116
|
+
relinka("verbose", "\u2014 \u2014 \u2014 regular_pubFlow \u2014 \u2014 \u2014");
|
|
117
117
|
if (config.libsActMode === "libs-only") {
|
|
118
118
|
relinka("log", "Skipping main project publish as libsActMode is set to 'libs-only'");
|
|
119
119
|
return;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple console spinner utility for showing progress when displayBuildPubLogs is false
|
|
3
|
+
*/
|
|
4
|
+
export declare class SimpleSpinner {
|
|
5
|
+
private interval?;
|
|
6
|
+
private message;
|
|
7
|
+
private frames;
|
|
8
|
+
private currentFrame;
|
|
9
|
+
private isSpinning;
|
|
10
|
+
constructor(message: string);
|
|
11
|
+
start(): this;
|
|
12
|
+
stop(finalMessage?: string): this;
|
|
13
|
+
updateMessage(message: string): this;
|
|
14
|
+
succeed(message?: string): this;
|
|
15
|
+
fail(message?: string): this;
|
|
16
|
+
}
|
|
17
|
+
export declare function createSpinner(message: string): SimpleSpinner;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export class SimpleSpinner {
|
|
2
|
+
interval;
|
|
3
|
+
message;
|
|
4
|
+
frames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
5
|
+
currentFrame = 0;
|
|
6
|
+
isSpinning = false;
|
|
7
|
+
constructor(message) {
|
|
8
|
+
this.message = message;
|
|
9
|
+
}
|
|
10
|
+
start() {
|
|
11
|
+
if (this.isSpinning || !process.stdout.isTTY) {
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
this.isSpinning = true;
|
|
15
|
+
process.stdout.write("\x1B[?25l");
|
|
16
|
+
this.interval = setInterval(() => {
|
|
17
|
+
const frame = this.frames[this.currentFrame];
|
|
18
|
+
process.stdout.write(`\r${frame} ${this.message}`);
|
|
19
|
+
this.currentFrame = (this.currentFrame + 1) % this.frames.length;
|
|
20
|
+
}, 80);
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
stop(finalMessage) {
|
|
24
|
+
if (!this.isSpinning) {
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
if (this.interval) {
|
|
28
|
+
clearInterval(this.interval);
|
|
29
|
+
this.interval = void 0;
|
|
30
|
+
}
|
|
31
|
+
this.isSpinning = false;
|
|
32
|
+
process.stdout.write("\r\x1B[K");
|
|
33
|
+
process.stdout.write("\x1B[?25h");
|
|
34
|
+
if (finalMessage) {
|
|
35
|
+
process.stdout.write(`${finalMessage}
|
|
36
|
+
`);
|
|
37
|
+
}
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
updateMessage(message) {
|
|
41
|
+
this.message = message;
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
succeed(message) {
|
|
45
|
+
return this.stop(message ? `\u2705 ${message}` : `\u2705 ${this.message}`);
|
|
46
|
+
}
|
|
47
|
+
fail(message) {
|
|
48
|
+
return this.stop(message ? `\u274C ${message}` : `\u274C ${this.message}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export function createSpinner(message) {
|
|
52
|
+
return new SimpleSpinner(message);
|
|
53
|
+
}
|
|
@@ -42,7 +42,7 @@ export { DEFAULT_CONFIG_DLER, defineConfig } from "./sdk-impl/config/default.js"
|
|
|
42
42
|
export { showStartPrompt, showEndPrompt } from "./sdk-impl/config/info.js";
|
|
43
43
|
export { getConfigDler, getConfigBunfig } from "./sdk-impl/config/load.js";
|
|
44
44
|
export { ensureDlerConfig, prepareDlerEnvironment } from "./sdk-impl/config/prepare.js";
|
|
45
|
-
export type { DlerConfig, BumpMode, BundlerName, NpmOutExt, LibConfig, Esbuild, transpileFormat, Sourcemap, transpileTarget, } from "./sdk-impl/config/types.js";
|
|
45
|
+
export type { DlerConfig, BumpMode, BundlerName, NpmOutExt, LibConfig, Esbuild, transpileFormat, Sourcemap, transpileTarget, RelinkaConfig, LogLevel, LogLevelConfig, LogLevelsConfig, RelinkaDirsConfig, } from "./sdk-impl/config/types.js";
|
|
46
46
|
export { IGNORE_PATTERNS } from "./sdk-impl/constants.js";
|
|
47
47
|
export { library_buildFlow, library_pubFlow, libraries_build, libraries_publish, } from "./sdk-impl/library-flow.js";
|
|
48
48
|
export type { ApplyMagicSpellsOptions, ApplyMagicSpellsResult, FileWithSpells, } from "./sdk-impl/magic/magic-apply.js";
|
|
@@ -96,6 +96,7 @@ export type { ExecParseResult } from "./sdk-impl/utils/exec/exec-types.js";
|
|
|
96
96
|
export { _parse } from "./sdk-impl/utils/exec/exec-types.js";
|
|
97
97
|
export { detectFileType, detectBufferType, detectStreamType, isBinary, getMimeType, } from "./sdk-impl/utils/file-type.js";
|
|
98
98
|
export { finalizeBuild, finalizePub } from "./sdk-impl/utils/finalize.js";
|
|
99
|
+
export { createSpinner, SimpleSpinner } from "./sdk-impl/utils/spinner.js";
|
|
99
100
|
export { safeRename, prepareCLIFiles } from "./sdk-impl/utils/fs-rename.js";
|
|
100
101
|
export { FILE_TYPES, INIT_BEHAVIOURS, DEST_FILE_EXISTS_BEHAVIOURS, CONTENT_CREATE_MODES, } from "./sdk-impl/utils/init/init-const.js";
|
|
101
102
|
export { createFileFromScratch, initFile, initFiles, escapeMarkdownCodeBlocks, } from "./sdk-impl/utils/init/init-impl.js";
|
package/bin/libs/sdk/sdk-mod.js
CHANGED
|
@@ -197,6 +197,7 @@ export {
|
|
|
197
197
|
getMimeType
|
|
198
198
|
} from "./sdk-impl/utils/file-type.js";
|
|
199
199
|
export { finalizeBuild, finalizePub } from "./sdk-impl/utils/finalize.js";
|
|
200
|
+
export { createSpinner, SimpleSpinner } from "./sdk-impl/utils/spinner.js";
|
|
200
201
|
export { safeRename, prepareCLIFiles } from "./sdk-impl/utils/fs-rename.js";
|
|
201
202
|
export {
|
|
202
203
|
FILE_TYPES,
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"@reliverse/reglob": "^1.0.0",
|
|
6
6
|
"@reliverse/relico": "^1.2.0",
|
|
7
7
|
"@reliverse/relifso": "^1.4.5",
|
|
8
|
-
"@reliverse/relinka": "^1.5.
|
|
8
|
+
"@reliverse/relinka": "^1.5.4",
|
|
9
9
|
"@reliverse/rempts": "^1.7.44",
|
|
10
10
|
"@rollup/plugin-alias": "^5.1.1",
|
|
11
11
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"license": "MIT",
|
|
53
53
|
"name": "@reliverse/dler",
|
|
54
54
|
"type": "module",
|
|
55
|
-
"version": "1.7.
|
|
55
|
+
"version": "1.7.87",
|
|
56
56
|
"keywords": [
|
|
57
57
|
"reliverse",
|
|
58
58
|
"cli",
|