@reliverse/dler 1.7.85 → 1.7.86

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.
@@ -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>;
@@ -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("info", "\u2014 \u2014 \u2014 dlerPostBuild \u2014 \u2014 \u2014");
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("info", "\u2014 \u2014 \u2014 dlerPreBuild \u2014 \u2014 \u2014");
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"),
@@ -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(isDev, effectiveConfig);
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
  }
@@ -68,6 +68,13 @@ export interface DlerConfig {
68
68
  * @default false
69
69
  */
70
70
  commonVerbose: boolean;
71
+ /**
72
+ * When `true`, displays detailed build and publish logs.
73
+ * When `false`, only shows spinner with status messages during build and publish.
74
+ *
75
+ * @default true
76
+ */
77
+ displayBuildPubLogs: boolean;
71
78
  /**
72
79
  * When `true`, generates TypeScript declaration files (.d.ts) for NPM packages.
73
80
  * Essential for providing type intranspileFormation to TypeScript users.
@@ -622,6 +629,7 @@ export declare const defineConfig: (userConfig?: Partial<DlerConfig>) => {
622
629
  commonPubPause: boolean;
623
630
  commonPubRegistry: "jsr" | "npm" | "npm-jsr";
624
631
  commonVerbose: boolean;
632
+ displayBuildPubLogs: boolean;
625
633
  coreDeclarations: boolean;
626
634
  coreEntryFile: string;
627
635
  coreEntrySrcDir: string;
@@ -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",
@@ -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",
@@ -1,5 +1,5 @@
1
1
  import { endPrompt, startPrompt } from "@reliverse/rempts";
2
- const version = "1.7.85";
2
+ const version = "1.7.86";
3
3
  export async function showStartPrompt(isDev) {
4
4
  await startPrompt({
5
5
  titleColor: "inverse",
@@ -68,6 +68,13 @@ export interface DlerConfig {
68
68
  * @default false
69
69
  */
70
70
  commonVerbose: boolean;
71
+ /**
72
+ * When `true`, displays detailed build and publish logs.
73
+ * When `false`, only shows spinner with status messages during build and publish.
74
+ *
75
+ * @default true
76
+ */
77
+ displayBuildPubLogs: boolean;
71
78
  /**
72
79
  * When `true`, generates TypeScript declaration files (.d.ts) for NPM packages.
73
80
  * Essential for providing type intranspileFormation to TypeScript users.
@@ -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("info", "\u2014 \u2014 \u2014 library_buildFlow \u2014 \u2014 \u2014");
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("info", "\u2014 \u2014 \u2014 library_pubFlow \u2014 \u2014 \u2014");
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("info", "\u2014 \u2014 \u2014 regular_buildFlow \u2014 \u2014 \u2014");
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("info", "\u2014 \u2014 \u2014 regular_pubFlow \u2014 \u2014 \u2014");
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
+ }
@@ -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";
@@ -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
@@ -52,7 +52,7 @@
52
52
  "license": "MIT",
53
53
  "name": "@reliverse/dler",
54
54
  "type": "module",
55
- "version": "1.7.85",
55
+ "version": "1.7.86",
56
56
  "keywords": [
57
57
  "reliverse",
58
58
  "cli",