@reliverse/dler 1.7.84 → 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.
- 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/app/update/cmd.d.ts +6 -0
- package/bin/app/update/cmd.js +85 -20
- package/bin/libs/cfg/cfg-impl/cfg-dler.d.ts +8 -0
- package/bin/libs/cfg/cfg-impl/cfg-dler.js +1 -0
- package/bin/libs/sdk/sdk-impl/config/default.js +1 -0
- package/bin/libs/sdk/sdk-impl/config/info.js +1 -1
- package/bin/libs/sdk/sdk-impl/config/types.d.ts +7 -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 +1 -0
- package/bin/libs/sdk/sdk-mod.js +1 -0
- package/package.json +1 -1
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
|
}
|
package/bin/app/update/cmd.d.ts
CHANGED
|
@@ -72,6 +72,12 @@ declare const _default: import("@reliverse/rempts").Command<{
|
|
|
72
72
|
type: "boolean";
|
|
73
73
|
description: string;
|
|
74
74
|
};
|
|
75
|
+
recursive: {
|
|
76
|
+
type: "boolean";
|
|
77
|
+
description: string;
|
|
78
|
+
alias: string;
|
|
79
|
+
default: true;
|
|
80
|
+
};
|
|
75
81
|
"save-prefix": {
|
|
76
82
|
type: "string";
|
|
77
83
|
description: string;
|
package/bin/app/update/cmd.js
CHANGED
|
@@ -208,6 +208,29 @@ async function isMonorepo(cwd) {
|
|
|
208
208
|
return false;
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
+
async function findAllPackageJsons(cwd) {
|
|
212
|
+
const packageJsonFiles = await glob("**/package.json", {
|
|
213
|
+
cwd,
|
|
214
|
+
absolute: true,
|
|
215
|
+
ignore: [
|
|
216
|
+
"**/node_modules/**",
|
|
217
|
+
"**/dist/**",
|
|
218
|
+
"**/build/**",
|
|
219
|
+
"**/.git/**",
|
|
220
|
+
"**/coverage/**",
|
|
221
|
+
"**/.next/**",
|
|
222
|
+
"**/.nuxt/**",
|
|
223
|
+
"**/out/**"
|
|
224
|
+
]
|
|
225
|
+
});
|
|
226
|
+
const existingFiles = [];
|
|
227
|
+
for (const file of packageJsonFiles) {
|
|
228
|
+
if (await fs.pathExists(file)) {
|
|
229
|
+
existingFiles.push(file);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return existingFiles;
|
|
233
|
+
}
|
|
211
234
|
async function fetchVersionFromRegistry(packageName) {
|
|
212
235
|
const response = await fetch(`https://registry.npmjs.org/${packageName}/latest`);
|
|
213
236
|
if (!response.ok) {
|
|
@@ -671,7 +694,7 @@ async function handleGlobalUpdates(args) {
|
|
|
671
694
|
export default defineCommand({
|
|
672
695
|
meta: {
|
|
673
696
|
name: "update",
|
|
674
|
-
description: "Update all dependencies and catalogs to their latest available versions (
|
|
697
|
+
description: "Update all dependencies and catalogs to their latest available versions (recursively finds all package.json files by default)"
|
|
675
698
|
},
|
|
676
699
|
args: defineArgs({
|
|
677
700
|
name: {
|
|
@@ -741,11 +764,17 @@ export default defineCommand({
|
|
|
741
764
|
},
|
|
742
765
|
"all-workspaces": {
|
|
743
766
|
type: "boolean",
|
|
744
|
-
description: "Update dependencies across all workspace packages (
|
|
767
|
+
description: "Update dependencies across all workspace packages (requires --no-recursive)"
|
|
745
768
|
},
|
|
746
769
|
"root-only": {
|
|
747
770
|
type: "boolean",
|
|
748
|
-
description: "Update only the root package.json (
|
|
771
|
+
description: "Update only the root package.json (requires --no-recursive)"
|
|
772
|
+
},
|
|
773
|
+
recursive: {
|
|
774
|
+
type: "boolean",
|
|
775
|
+
description: "Recursively find and update ALL package.json files in current directory tree (default: true, use --no-recursive to disable)",
|
|
776
|
+
alias: "r",
|
|
777
|
+
default: true
|
|
749
778
|
},
|
|
750
779
|
"save-prefix": {
|
|
751
780
|
type: "string",
|
|
@@ -779,6 +808,13 @@ export default defineCommand({
|
|
|
779
808
|
relinka("error", "Cannot specify both --all-workspaces and --root-only flags");
|
|
780
809
|
return process.exit(1);
|
|
781
810
|
}
|
|
811
|
+
if (args.recursive && (args["all-workspaces"] || args["root-only"])) {
|
|
812
|
+
relinka(
|
|
813
|
+
"error",
|
|
814
|
+
"Cannot use --recursive with --all-workspaces or --root-only flags. Use --no-recursive to disable recursive mode."
|
|
815
|
+
);
|
|
816
|
+
return process.exit(1);
|
|
817
|
+
}
|
|
782
818
|
if (args.global) {
|
|
783
819
|
return await handleGlobalUpdates(args);
|
|
784
820
|
}
|
|
@@ -913,29 +949,58 @@ export default defineCommand({
|
|
|
913
949
|
args["save-prefix"]
|
|
914
950
|
);
|
|
915
951
|
let totalUpdated = rootUpdated;
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
const
|
|
920
|
-
if (
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
952
|
+
if (args.recursive) {
|
|
953
|
+
const allPackageJsons = await findAllPackageJsons(process.cwd());
|
|
954
|
+
const rootPackageJsonPath = path.resolve(process.cwd(), "package.json");
|
|
955
|
+
const otherPackageJsons = allPackageJsons.filter((p) => p !== rootPackageJsonPath);
|
|
956
|
+
if (otherPackageJsons.length > 0) {
|
|
957
|
+
relinka(
|
|
958
|
+
"info",
|
|
959
|
+
`Found ${otherPackageJsons.length} additional package.json files to update recursively`
|
|
960
|
+
);
|
|
961
|
+
const recursiveUpdated = await updateWorkspacePackages(otherPackageJsons, args, options);
|
|
962
|
+
totalUpdated += recursiveUpdated;
|
|
963
|
+
} else {
|
|
964
|
+
relinka("info", "No additional package.json files found for recursive update");
|
|
965
|
+
}
|
|
966
|
+
} else {
|
|
967
|
+
const isMonorepoProject = await isMonorepo(process.cwd());
|
|
968
|
+
const shouldUpdateWorkspaces = args["all-workspaces"] || !args["root-only"] && isMonorepoProject;
|
|
969
|
+
if (shouldUpdateWorkspaces) {
|
|
970
|
+
const workspacePkgJsons = await findWorkspacePackageJsons(process.cwd());
|
|
971
|
+
if (workspacePkgJsons.length > 0) {
|
|
972
|
+
const workspaceUpdated = await updateWorkspacePackages(
|
|
973
|
+
workspacePkgJsons,
|
|
974
|
+
args,
|
|
975
|
+
options
|
|
976
|
+
);
|
|
977
|
+
totalUpdated += workspaceUpdated;
|
|
978
|
+
} else if (args["all-workspaces"]) {
|
|
979
|
+
relinka("warn", "No workspace packages found but --all-workspaces flag was provided");
|
|
980
|
+
}
|
|
981
|
+
} else if (isMonorepoProject) {
|
|
982
|
+
relinka("info", "Skipping workspace packages due to --root-only flag");
|
|
925
983
|
}
|
|
926
|
-
} else if (await isMonorepo(process.cwd())) {
|
|
927
|
-
relinka("info", "Skipping workspace packages due to --root-only flag");
|
|
928
984
|
}
|
|
929
|
-
|
|
930
|
-
|
|
985
|
+
if (args.recursive) {
|
|
986
|
+
const allPackageJsonCount = (await findAllPackageJsons(process.cwd())).length;
|
|
931
987
|
relinka(
|
|
932
988
|
"success",
|
|
933
|
-
`Updated ${totalUpdated} dependencies across
|
|
989
|
+
`Updated ${totalUpdated} dependencies across ${allPackageJsonCount} package.json files (recursive)`
|
|
934
990
|
);
|
|
935
|
-
} else if (isMonorepoProject && !shouldUpdateWorkspaces) {
|
|
936
|
-
relinka("success", `Updated ${totalUpdated} dependencies in root package.json only`);
|
|
937
991
|
} else {
|
|
938
|
-
|
|
992
|
+
const isMonorepoProject = await isMonorepo(process.cwd());
|
|
993
|
+
const shouldUpdateWorkspaces = args["all-workspaces"] || !args["root-only"] && isMonorepoProject;
|
|
994
|
+
if (isMonorepoProject && shouldUpdateWorkspaces) {
|
|
995
|
+
relinka(
|
|
996
|
+
"success",
|
|
997
|
+
`Updated ${totalUpdated} dependencies across workspace (root + workspaces)`
|
|
998
|
+
);
|
|
999
|
+
} else if (isMonorepoProject) {
|
|
1000
|
+
relinka("success", `Updated ${totalUpdated} dependencies in root package.json only`);
|
|
1001
|
+
} else {
|
|
1002
|
+
relinka("success", `Updated ${totalUpdated} dependencies`);
|
|
1003
|
+
}
|
|
939
1004
|
}
|
|
940
1005
|
const packageManager = await detectPackageManager(process.cwd());
|
|
941
1006
|
if (!args["with-install"]) {
|
|
@@ -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;
|
|
@@ -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("
|
|
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
|
+
}
|
|
@@ -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,
|