@reliverse/dler 1.7.12 → 1.7.13
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.js +1 -1
- package/bin/libs/sdk/sdk-impl/cfg/info.js +1 -1
- package/bin/libs/sdk/sdk-impl/pub/pub-library.js +3 -3
- package/bin/libs/sdk/sdk-impl/pub/pub-regular.js +3 -3
- package/bin/libs/sdk/sdk-impl/utils/{utils-cwd.d.ts → utils-error-cwd.d.ts} +8 -3
- package/bin/libs/sdk/sdk-impl/utils/{utils-cwd.js → utils-error-cwd.js} +33 -16
- package/bin/libs/sdk/sdk-mod.d.ts +2 -2
- package/bin/libs/sdk/sdk-mod.js +2 -2
- package/package.json +1 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-error.d.ts +0 -6
- package/bin/libs/sdk/sdk-impl/utils/utils-error.js +0 -13
package/bin/app/build/impl.js
CHANGED
|
@@ -7,7 +7,7 @@ import { processRegularFlow } from "../../libs/sdk/sdk-impl/regular-flow.js";
|
|
|
7
7
|
import { finalizeBuildPub } from "../../libs/sdk/sdk-impl/utils/finalize.js";
|
|
8
8
|
import { removeDistFolders } from "../../libs/sdk/sdk-impl/utils/utils-clean.js";
|
|
9
9
|
import { PROJECT_ROOT } from "../../libs/sdk/sdk-impl/utils/utils-consts.js";
|
|
10
|
-
import { handleDlerError } from "../../libs/sdk/sdk-impl/utils/utils-error.js";
|
|
10
|
+
import { handleDlerError } from "../../libs/sdk/sdk-impl/utils/utils-error-cwd.js";
|
|
11
11
|
import { createPerfTimer } from "../../libs/sdk/sdk-impl/utils/utils-perf.js";
|
|
12
12
|
export async function dlerBuild(isDev, config) {
|
|
13
13
|
const timer = createPerfTimer();
|
|
@@ -2,7 +2,7 @@ import { relinka } from "@reliverse/relinka";
|
|
|
2
2
|
import { execaCommand } from "execa";
|
|
3
3
|
import pAll from "p-all";
|
|
4
4
|
import { CONCURRENCY_DEFAULT } from "../utils/utils-consts.js";
|
|
5
|
-
import { withWorkingDirectory } from "../utils/utils-cwd.js";
|
|
5
|
+
import { withWorkingDirectory } from "../utils/utils-error-cwd.js";
|
|
6
6
|
import { pausePerfTimer, resumePerfTimer } from "../utils/utils-perf.js";
|
|
7
7
|
export async function library_publishLibrary(effectivePubRegistry, libName, npmOutDir, jsrOutDir, distJsrDryRun, distJsrFailOnWarn, distJsrAllowDirty, distJsrSlowTypes, isDev, timer) {
|
|
8
8
|
switch (effectivePubRegistry) {
|
|
@@ -61,7 +61,7 @@ async function library_pubToJsr(libOutDir, distJsrDryRun, distJsrFailOnWarn, dis
|
|
|
61
61
|
distJsrAllowDirty ? "--allow-dirty" : "",
|
|
62
62
|
distJsrSlowTypes ? "--allow-slow-types" : ""
|
|
63
63
|
].filter(Boolean).join(" ");
|
|
64
|
-
await execaCommand(command, { stdio: "inherit"
|
|
64
|
+
await execaCommand(command, { stdio: "inherit" });
|
|
65
65
|
relinka(
|
|
66
66
|
"success",
|
|
67
67
|
`Successfully ${distJsrDryRun ? "validated" : "published"} lib ${libName} to JSR registry`
|
|
@@ -82,7 +82,7 @@ async function library_pubToNpm(libOutDir, distJsrDryRun, _distJsrFailOnWarn, li
|
|
|
82
82
|
await withWorkingDirectory(libOutDir, async () => {
|
|
83
83
|
relinka("log", `Publishing lib ${libName} to NPM from ${libOutDir}`);
|
|
84
84
|
const command = ["bun publish", distJsrDryRun ? "--dry-run" : ""].filter(Boolean).join(" ");
|
|
85
|
-
await execaCommand(command, { stdio: "inherit"
|
|
85
|
+
await execaCommand(command, { stdio: "inherit" });
|
|
86
86
|
relinka(
|
|
87
87
|
"success",
|
|
88
88
|
`Successfully ${distJsrDryRun ? "validated" : "published"} lib ${libName} to NPM registry`
|
|
@@ -2,7 +2,7 @@ import path from "@reliverse/pathkit";
|
|
|
2
2
|
import { relinka } from "@reliverse/relinka";
|
|
3
3
|
import { execaCommand } from "execa";
|
|
4
4
|
import { PROJECT_ROOT } from "../utils/utils-consts.js";
|
|
5
|
-
import { withWorkingDirectory } from "../utils/utils-cwd.js";
|
|
5
|
+
import { withWorkingDirectory } from "../utils/utils-error-cwd.js";
|
|
6
6
|
import { pausePerfTimer, resumePerfTimer } from "../utils/utils-perf.js";
|
|
7
7
|
export async function regular_pubToJsr(distJsrDryRun, distJsrFailOnWarn, _isDev, commonPubPause, distJsrDirName, distJsrAllowDirty, distJsrSlowTypes, timer) {
|
|
8
8
|
try {
|
|
@@ -19,7 +19,7 @@ export async function regular_pubToJsr(distJsrDryRun, distJsrFailOnWarn, _isDev,
|
|
|
19
19
|
distJsrSlowTypes ? "--allow-slow-types" : ""
|
|
20
20
|
].filter(Boolean).join(" ");
|
|
21
21
|
relinka("verbose", `Running publish command: ${command}`);
|
|
22
|
-
await execaCommand(command, { stdio: "inherit"
|
|
22
|
+
await execaCommand(command, { stdio: "inherit" });
|
|
23
23
|
relinka(
|
|
24
24
|
"success",
|
|
25
25
|
`Successfully ${distJsrDryRun ? "validated" : "published"} to JSR registry`
|
|
@@ -41,7 +41,7 @@ export async function regular_pubToNpm(distJsrDryRun, _isDev, commonPubPause, di
|
|
|
41
41
|
await withWorkingDirectory(distNpmDirNameResolved, async () => {
|
|
42
42
|
const command = ["bun publish", distJsrDryRun ? "--dry-run" : ""].filter(Boolean).join(" ");
|
|
43
43
|
relinka("verbose", `Running publish command: ${command}`);
|
|
44
|
-
await execaCommand(command, { stdio: "inherit"
|
|
44
|
+
await execaCommand(command, { stdio: "inherit" });
|
|
45
45
|
relinka(
|
|
46
46
|
"success",
|
|
47
47
|
`Successfully ${distJsrDryRun ? "validated" : "published"} to NPM registry`
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Handles errors during the build process.
|
|
3
|
+
* This is the single source of error logging.
|
|
4
4
|
*/
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function handleDlerError(error: unknown): never;
|
|
6
6
|
/**
|
|
7
7
|
* Runs an async function within a given working directory,
|
|
8
8
|
* ensuring that the original directory is restored afterward.
|
|
9
9
|
*/
|
|
10
10
|
export declare function withWorkingDirectory<T>(transpileTargetDir: string, fn: () => Promise<T>): Promise<T>;
|
|
11
|
+
/**
|
|
12
|
+
* Validates that the current working directory is appropriate for a development environment.
|
|
13
|
+
* Throws an error if the current directory does not contain any of the required paths.
|
|
14
|
+
*/
|
|
15
|
+
export declare function validateDevCwd(isDev: boolean, paths: string[], cliName: string, cliOrg?: string): Promise<void>;
|
|
@@ -1,4 +1,37 @@
|
|
|
1
|
+
import { re } from "@reliverse/relico";
|
|
1
2
|
import { relinka } from "@reliverse/relinka";
|
|
3
|
+
import { deleteLastLines } from "@reliverse/rempts";
|
|
4
|
+
import { ExecaError } from "execa";
|
|
5
|
+
export function handleDlerError(error) {
|
|
6
|
+
let rootCause = "";
|
|
7
|
+
if (error instanceof ExecaError) {
|
|
8
|
+
rootCause = error.message;
|
|
9
|
+
deleteLastLines(8);
|
|
10
|
+
} else if (error instanceof Error) {
|
|
11
|
+
rootCause = error.message;
|
|
12
|
+
}
|
|
13
|
+
relinka("error", re.bold("Unexpected error happened:"));
|
|
14
|
+
if (rootCause) {
|
|
15
|
+
relinka("error", re.italic(rootCause));
|
|
16
|
+
}
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
export async function withWorkingDirectory(transpileTargetDir, fn) {
|
|
20
|
+
const originalDir = process.cwd();
|
|
21
|
+
try {
|
|
22
|
+
process.chdir(transpileTargetDir);
|
|
23
|
+
relinka("info", `Changed working directory to: ${transpileTargetDir}`);
|
|
24
|
+
const result = await fn();
|
|
25
|
+
return result;
|
|
26
|
+
} catch (error) {
|
|
27
|
+
relinka("null", "");
|
|
28
|
+
relinka("error", re.italic(transpileTargetDir), error);
|
|
29
|
+
throw error;
|
|
30
|
+
} finally {
|
|
31
|
+
process.chdir(originalDir);
|
|
32
|
+
relinka("info", `Restored working directory to: ${originalDir}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
2
35
|
export async function validateDevCwd(isDev, paths, cliName, cliOrg = "") {
|
|
3
36
|
if (!isDev) return;
|
|
4
37
|
const projectName = cliOrg ? `@${cliOrg}/${cliName}` : cliName;
|
|
@@ -15,19 +48,3 @@ export async function validateDevCwd(isDev, paths, cliName, cliOrg = "") {
|
|
|
15
48
|
);
|
|
16
49
|
}
|
|
17
50
|
}
|
|
18
|
-
export async function withWorkingDirectory(transpileTargetDir, fn) {
|
|
19
|
-
relinka("verbose", `Entering withWorkingDirectory, transpileTargetDir: ${transpileTargetDir}`);
|
|
20
|
-
const originalDir = process.cwd();
|
|
21
|
-
try {
|
|
22
|
-
process.chdir(transpileTargetDir);
|
|
23
|
-
relinka("verbose", `Changed working directory to: ${transpileTargetDir}`);
|
|
24
|
-
const result = await fn();
|
|
25
|
-
return result;
|
|
26
|
-
} catch (error) {
|
|
27
|
-
relinka("error", `Error in directory ${transpileTargetDir}:`, error);
|
|
28
|
-
throw error;
|
|
29
|
-
} finally {
|
|
30
|
-
process.chdir(originalDir);
|
|
31
|
-
relinka("verbose", `Restored working directory to: ${originalDir}`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -33,10 +33,10 @@ export { printUsage } from "./sdk-impl/utils/tools-impl";
|
|
|
33
33
|
export { getBunSourcemapOption, getUnifiedSourcemapOption, renameEntryFile, } from "./sdk-impl/utils/utils-build";
|
|
34
34
|
export { removeDistFolders } from "./sdk-impl/utils/utils-clean";
|
|
35
35
|
export { PROJECT_ROOT, CONCURRENCY_DEFAULT, tsconfigJson, cliDomainDocs, validExtensions, SHOW_VERBOSE, } from "./sdk-impl/utils/utils-consts";
|
|
36
|
-
export { validateDevCwd, withWorkingDirectory, } from "./sdk-impl/utils/utils-cwd";
|
|
36
|
+
export { validateDevCwd, withWorkingDirectory, } from "./sdk-impl/utils/utils-error-cwd";
|
|
37
37
|
export { filterDeps } from "./sdk-impl/utils/utils-deps";
|
|
38
38
|
export { determineDistName } from "./sdk-impl/utils/utils-determine";
|
|
39
|
-
export { handleDlerError } from "./sdk-impl/utils/utils-error";
|
|
39
|
+
export { handleDlerError } from "./sdk-impl/utils/utils-error-cwd";
|
|
40
40
|
export { copyRootFile, getDirectorySize, outDirBinFilesCount, deleteSpecificFiles, readFileSafe, writeFileSafe, } from "./sdk-impl/utils/utils-fs";
|
|
41
41
|
export { finalizeBuildPub } from "./sdk-impl/utils/finalize";
|
|
42
42
|
export { createJsrJSON, renameTsxFiles, } from "./sdk-impl/utils/utils-jsr-json";
|
package/bin/libs/sdk/sdk-mod.js
CHANGED
|
@@ -108,10 +108,10 @@ export {
|
|
|
108
108
|
export {
|
|
109
109
|
validateDevCwd,
|
|
110
110
|
withWorkingDirectory
|
|
111
|
-
} from "./sdk-impl/utils/utils-cwd.js";
|
|
111
|
+
} from "./sdk-impl/utils/utils-error-cwd.js";
|
|
112
112
|
export { filterDeps } from "./sdk-impl/utils/utils-deps.js";
|
|
113
113
|
export { determineDistName } from "./sdk-impl/utils/utils-determine.js";
|
|
114
|
-
export { handleDlerError } from "./sdk-impl/utils/utils-error.js";
|
|
114
|
+
export { handleDlerError } from "./sdk-impl/utils/utils-error-cwd.js";
|
|
115
115
|
export {
|
|
116
116
|
copyRootFile,
|
|
117
117
|
getDirectorySize,
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { re } from "@reliverse/relico";
|
|
2
|
-
import { relinka } from "@reliverse/relinka";
|
|
3
|
-
export function handleDlerError(error) {
|
|
4
|
-
let rootCause = "";
|
|
5
|
-
if (error instanceof Error) {
|
|
6
|
-
rootCause = error.message;
|
|
7
|
-
}
|
|
8
|
-
relinka("error", re.bold("Unexpected error happened:"));
|
|
9
|
-
if (rootCause) {
|
|
10
|
-
relinka("error", re.italic(rootCause));
|
|
11
|
-
}
|
|
12
|
-
process.exit(1);
|
|
13
|
-
}
|