@reliverse/dler 1.7.121 → 1.7.123
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/impl/auth/impl/init.d.ts +2 -2
- package/bin/impl/build/binary-flow.js +24 -4
- package/bin/impl/build/build-regular.js +12 -9
- package/bin/impl/build/impl.d.ts +1 -1
- package/bin/impl/build/impl.js +23 -7
- package/bin/impl/build/library-flow.js +49 -2
- package/bin/impl/build/providers/build.js +13 -13
- package/bin/impl/build/providers/mkdist/mkdist-impl/make.js +1 -1
- package/bin/impl/build/providers/mkdist/mkdist-mod.js +1 -1
- package/bin/impl/build/regular-flow.js +130 -57
- package/bin/impl/config/create.js +18 -1
- package/bin/impl/config/prepare.js +1 -7
- package/bin/impl/config/repair.d.ts +1 -2
- package/bin/impl/config/repair.js +18 -54
- package/bin/impl/init/use-template/cp-impl.js +1 -1
- package/bin/impl/init/use-template/cp-modules/cli-main-modules/cli-menu-items/showCloneProjectMenu.js +1 -1
- package/bin/impl/init/use-template/cp-modules/compose-env-file/cef-keys.d.ts +16 -25
- package/bin/impl/init/use-template/cp-modules/compose-env-file/cef-keys.js +0 -60
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/gdp-mod.js +1 -1
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-create.js +1 -1
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-deploy.js +1 -1
- package/bin/impl/merge/mod.js +71 -49
- package/bin/impl/migrate/codemods/anything-bun.js +1 -1
- package/bin/impl/providers/better-t-stack/types.d.ts +6 -6
- package/bin/impl/pub/impl.d.ts +1 -1
- package/bin/impl/pub/impl.js +31 -11
- package/bin/impl/rules/reliverse/missing-deps/formatter.js +1 -1
- package/bin/impl/schema/utils.d.ts +15 -0
- package/bin/impl/schema/utils.js +33 -0
- package/bin/impl/utils/downloading/downloadRepo.js +58 -8
- package/bin/impl/utils/finalize.d.ts +2 -2
- package/bin/impl/utils/finalize.js +10 -11
- package/bin/impl/utils/init/init-tmpl.d.ts +1 -1
- package/bin/impl/utils/init/init-tmpl.js +2 -2
- package/bin/impl/utils/projectRepository.js +2 -3
- package/bin/impl/utils/replacements/reps-keys.d.ts +14 -17
- package/bin/impl/utils/replacements/reps-keys.js +0 -17
- package/bin/impl/utils/schemaMemory.d.ts +17 -31
- package/bin/impl/utils/schemaMemory.js +0 -16
- package/bin/impl/utils/schemaTemplate.d.ts +24 -49
- package/bin/impl/utils/schemaTemplate.js +65 -84
- package/bin/impl/utils/spinner.d.ts +243 -15
- package/bin/impl/utils/spinner.js +362 -46
- package/bin/mod.d.ts +7 -7
- package/bin/mod.js +28 -16
- package/package.json +5 -6
- package/bin/impl/config/impl/typebox.d.ts +0 -8
- package/bin/impl/config/impl/typebox.js +0 -82
|
@@ -146,8 +146,8 @@ export declare const optionsSchema: z.ZodObject<{
|
|
|
146
146
|
cwd: z.ZodString;
|
|
147
147
|
config: z.ZodOptional<z.ZodString>;
|
|
148
148
|
database: z.ZodOptional<z.ZodEnum<{
|
|
149
|
-
mysql: "mysql";
|
|
150
149
|
sqlite: "sqlite";
|
|
150
|
+
mysql: "mysql";
|
|
151
151
|
mongodb: "mongodb";
|
|
152
152
|
postgres: "postgres";
|
|
153
153
|
mssql: "mssql";
|
|
@@ -165,7 +165,7 @@ export declare const optionsSchema: z.ZodObject<{
|
|
|
165
165
|
}, z.core.$strip>;
|
|
166
166
|
export declare const outroText = "\uD83E\uDD73 All Done, Happy Hacking!";
|
|
167
167
|
export declare function getLatestNpmVersion(packageName: string): Promise<string>;
|
|
168
|
-
export declare function getPackageManager(): Promise<"
|
|
168
|
+
export declare function getPackageManager(): Promise<"npm" | "yarn" | "pnpm" | "bun">;
|
|
169
169
|
export declare function getEnvFiles(cwd: string): Promise<string[]>;
|
|
170
170
|
export declare function updateEnvs({ envs, files, isCommented, }: {
|
|
171
171
|
/**
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
parseTargets,
|
|
10
10
|
validateInputFile
|
|
11
11
|
} from "./providers/bun/single-file.js";
|
|
12
|
+
import { createMultiStepSpinner } from "../utils/spinner.js";
|
|
12
13
|
function getTargetPrefix(inputFile) {
|
|
13
14
|
const filename = inputFile.split("/").pop()?.split("\\").pop() || "";
|
|
14
15
|
const nameWithoutExt = filename.replace(/\.[^/.]+$/, "");
|
|
@@ -107,20 +108,39 @@ export async function binary_buildFlow(_timer, _isDev, config) {
|
|
|
107
108
|
);
|
|
108
109
|
}
|
|
109
110
|
} else {
|
|
110
|
-
relinka("success", `\
|
|
111
|
+
relinka("success", `\u2705 Build completed! All executables available in: ${options.outdir}`);
|
|
111
112
|
}
|
|
112
113
|
} else {
|
|
113
114
|
relinka("info", "Building targets sequentially...");
|
|
115
|
+
const shouldShowSpinner = config.displayBuildPubLogs === false;
|
|
116
|
+
let sequentialSpinner = null;
|
|
117
|
+
if (shouldShowSpinner) {
|
|
118
|
+
sequentialSpinner = createMultiStepSpinner(
|
|
119
|
+
"Binary Build Process",
|
|
120
|
+
targets.map((target) => `Building ${target}`),
|
|
121
|
+
{ color: "yellow" }
|
|
122
|
+
);
|
|
123
|
+
}
|
|
114
124
|
let sequentialSuccessCount = 0;
|
|
115
125
|
let sequentialFailureCount = 0;
|
|
116
|
-
for (const target of targets) {
|
|
126
|
+
for (const [index, target] of targets.entries()) {
|
|
117
127
|
try {
|
|
118
128
|
await buildForTarget(target, inputFile, options);
|
|
119
129
|
sequentialSuccessCount++;
|
|
130
|
+
if (sequentialSpinner && index < targets.length - 1) {
|
|
131
|
+
sequentialSpinner.nextStep();
|
|
132
|
+
}
|
|
120
133
|
} catch (error) {
|
|
134
|
+
if (sequentialSpinner) {
|
|
135
|
+
sequentialSpinner.error(error, index);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
121
138
|
sequentialFailureCount++;
|
|
122
139
|
}
|
|
123
140
|
}
|
|
141
|
+
if (sequentialSpinner && sequentialSuccessCount > 0) {
|
|
142
|
+
sequentialSpinner.complete(`Built ${sequentialSuccessCount} targets successfully`);
|
|
143
|
+
}
|
|
124
144
|
if (sequentialFailureCount > 0) {
|
|
125
145
|
if (sequentialSuccessCount === 0) {
|
|
126
146
|
relinka("error", `\u274C All builds failed! No executables were generated.`);
|
|
@@ -130,8 +150,8 @@ export async function binary_buildFlow(_timer, _isDev, config) {
|
|
|
130
150
|
`\u26A0\uFE0F Build completed with ${sequentialFailureCount} failure(s). ${sequentialSuccessCount} executable(s) available in: ${options.outdir}`
|
|
131
151
|
);
|
|
132
152
|
}
|
|
133
|
-
} else {
|
|
134
|
-
relinka("success", `\
|
|
153
|
+
} else if (!sequentialSpinner) {
|
|
154
|
+
relinka("success", `\u2705 Build completed! All executables available in: ${options.outdir}`);
|
|
135
155
|
}
|
|
136
156
|
}
|
|
137
157
|
if (existsSync(options.outdir)) {
|
|
@@ -67,9 +67,9 @@ export async function regular_buildJsrDist(isDev, isJsr, coreIsCLI, coreEntrySrc
|
|
|
67
67
|
const transpileFormattedDuration = prettyMilliseconds(duration, {
|
|
68
68
|
verbose: true
|
|
69
69
|
});
|
|
70
|
-
relinka("
|
|
70
|
+
relinka("verbose", `JSR distribution built in ${transpileFormattedDuration}`);
|
|
71
71
|
} else {
|
|
72
|
-
relinka("
|
|
72
|
+
relinka("verbose", "JSR distribution built successfully");
|
|
73
73
|
}
|
|
74
74
|
} catch (error) {
|
|
75
75
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -116,9 +116,9 @@ export async function regular_buildNpmDist(isDev, coreIsCLI, coreEntrySrcDir, di
|
|
|
116
116
|
const transpileFormattedDuration = prettyMilliseconds(duration, {
|
|
117
117
|
verbose: true
|
|
118
118
|
});
|
|
119
|
-
relinka("
|
|
119
|
+
relinka("verbose", `NPM distribution built in ${transpileFormattedDuration}`);
|
|
120
120
|
} else {
|
|
121
|
-
relinka("
|
|
121
|
+
relinka("verbose", "NPM distribution built successfully");
|
|
122
122
|
}
|
|
123
123
|
} catch (error) {
|
|
124
124
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -162,7 +162,7 @@ async function regular_bundleUsingBun(coreEntryFile, outDirBin, transpileTarget,
|
|
|
162
162
|
verbose: true
|
|
163
163
|
});
|
|
164
164
|
relinka(
|
|
165
|
-
"
|
|
165
|
+
"verbose",
|
|
166
166
|
`Regular bun build completed in ${transpileFormattedDuration} with ${buildResult.outputs.length} output file(s).`
|
|
167
167
|
);
|
|
168
168
|
if (buildResult.logs && buildResult.logs.length > 0) {
|
|
@@ -189,7 +189,7 @@ async function regular_bundleUsingJsr(src, dest) {
|
|
|
189
189
|
await fs.copy(src, dest, { overwrite: true });
|
|
190
190
|
relinka("verbose", `Copied directory from ${src} to ${dest}`);
|
|
191
191
|
relinka(
|
|
192
|
-
"
|
|
192
|
+
"verbose",
|
|
193
193
|
`Completed regular bundling via 'jsr' builder`
|
|
194
194
|
// `${successCount} files processed, ${changedCount} modified`,
|
|
195
195
|
);
|
|
@@ -248,7 +248,7 @@ async function regular_bundleUsingUnified(coreIsCLI, coreEntryFile, outDirBin, b
|
|
|
248
248
|
verbose: true
|
|
249
249
|
});
|
|
250
250
|
relinka(
|
|
251
|
-
"
|
|
251
|
+
"verbose",
|
|
252
252
|
`Regular bundle completed in ${transpileFormattedDuration} using ${builder} builder`
|
|
253
253
|
);
|
|
254
254
|
} catch (error) {
|
|
@@ -321,7 +321,7 @@ async function regular_performCommonBuildSteps({
|
|
|
321
321
|
}) {
|
|
322
322
|
relinka("verbose", `Performing common build steps in ${outDirBin} (regular)`);
|
|
323
323
|
relinka(
|
|
324
|
-
"
|
|
324
|
+
"verbose",
|
|
325
325
|
`[${isJsr ? "dist-jsr" : "dist-npm"}] Performing alias path conversion in ${outDirBin}`
|
|
326
326
|
);
|
|
327
327
|
await convertImportsAliasToRelative({
|
|
@@ -330,7 +330,10 @@ async function regular_performCommonBuildSteps({
|
|
|
330
330
|
pathExtFilter: "js-ts-none"
|
|
331
331
|
});
|
|
332
332
|
if (isJsr) {
|
|
333
|
-
relinka(
|
|
333
|
+
relinka(
|
|
334
|
+
"verbose",
|
|
335
|
+
`[dist-jsr] Performing paths ext conversion in ${outDirBin} (from js to ts)`
|
|
336
|
+
);
|
|
334
337
|
await convertImportsExt({
|
|
335
338
|
targetDir: outDirBin,
|
|
336
339
|
extFrom: "js",
|
package/bin/impl/build/impl.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReliverseConfig } from "../schema/mod.js";
|
|
2
2
|
import type { PerfTimer } from "../types/mod.js";
|
|
3
3
|
/**
|
|
4
|
-
* Main entry point for the
|
|
4
|
+
* Main entry point for the rse build process.
|
|
5
5
|
* Handles building for both main project and libraries.
|
|
6
6
|
* @see `src-ts/app/pub/impl.ts` for pub main function implementation.
|
|
7
7
|
*/
|
package/bin/impl/build/impl.js
CHANGED
|
@@ -6,7 +6,7 @@ import { library_buildFlow } from "./library-flow.js";
|
|
|
6
6
|
import { regular_buildFlow } from "./regular-flow.js";
|
|
7
7
|
import { PROJECT_ROOT } from "../config/constants.js";
|
|
8
8
|
import { getConfigDler } from "../config/load.js";
|
|
9
|
-
import {
|
|
9
|
+
import { createMultiStepSpinner } from "../utils/spinner.js";
|
|
10
10
|
import { removeDistFolders } from "../utils/utils-clean.js";
|
|
11
11
|
import { handleDlerError } from "../utils/utils-error-cwd.js";
|
|
12
12
|
import { dlerPostBuild, wrapper_CopyNonBuildFiles } from "./postbuild.js";
|
|
@@ -14,13 +14,23 @@ import { dlerPreBuild } from "./prebuild.js";
|
|
|
14
14
|
export async function dlerBuild(timer, isDev, config, debugOnlyCopyNonBuildFiles, debugDontCopyNonBuildFiles, disableOwnSpinner) {
|
|
15
15
|
let effectiveConfig = config;
|
|
16
16
|
let shouldShowSpinner = false;
|
|
17
|
-
let
|
|
17
|
+
let multiStepSpinner = null;
|
|
18
18
|
try {
|
|
19
19
|
if (!effectiveConfig) {
|
|
20
20
|
effectiveConfig = await getConfigDler();
|
|
21
21
|
}
|
|
22
22
|
shouldShowSpinner = effectiveConfig.displayBuildPubLogs === false && !disableOwnSpinner;
|
|
23
|
-
|
|
23
|
+
const buildSteps = [
|
|
24
|
+
"Loading configuration",
|
|
25
|
+
"Cleaning previous build",
|
|
26
|
+
"Pre-build setup",
|
|
27
|
+
"Building main project",
|
|
28
|
+
"Building libraries",
|
|
29
|
+
"Building binaries",
|
|
30
|
+
"Post-build cleanup"
|
|
31
|
+
];
|
|
32
|
+
multiStepSpinner = shouldShowSpinner ? createMultiStepSpinner("Build Process", buildSteps, { color: "blue" }) : null;
|
|
33
|
+
if (multiStepSpinner) multiStepSpinner.nextStep();
|
|
24
34
|
if (effectiveConfig.logsFreshFile) {
|
|
25
35
|
await fs.remove(path.join(PROJECT_ROOT, effectiveConfig.logsFileName));
|
|
26
36
|
}
|
|
@@ -31,6 +41,7 @@ export async function dlerBuild(timer, isDev, config, debugOnlyCopyNonBuildFiles
|
|
|
31
41
|
effectiveConfig.libsList,
|
|
32
42
|
"dist-tmp"
|
|
33
43
|
);
|
|
44
|
+
if (multiStepSpinner) multiStepSpinner.nextStep();
|
|
34
45
|
if (debugOnlyCopyNonBuildFiles) {
|
|
35
46
|
if (debugDontCopyNonBuildFiles) {
|
|
36
47
|
relinka(
|
|
@@ -44,6 +55,7 @@ export async function dlerBuild(timer, isDev, config, debugOnlyCopyNonBuildFiles
|
|
|
44
55
|
process.exit(0);
|
|
45
56
|
}
|
|
46
57
|
await dlerPreBuild(effectiveConfig);
|
|
58
|
+
if (multiStepSpinner) multiStepSpinner.nextStep();
|
|
47
59
|
const tempDirs = {
|
|
48
60
|
npm: "dist-tmp/tmp-npm",
|
|
49
61
|
jsr: "dist-tmp/tmp-jsr",
|
|
@@ -55,19 +67,23 @@ export async function dlerBuild(timer, isDev, config, debugOnlyCopyNonBuildFiles
|
|
|
55
67
|
libsDirSrc: tempDirs.libs
|
|
56
68
|
};
|
|
57
69
|
await regular_buildFlow(timer, isDev, tempConfig);
|
|
70
|
+
if (multiStepSpinner) multiStepSpinner.nextStep();
|
|
58
71
|
await library_buildFlow(timer, isDev, tempConfig);
|
|
72
|
+
if (multiStepSpinner) multiStepSpinner.nextStep();
|
|
59
73
|
await binary_buildFlow(timer, isDev, tempConfig);
|
|
74
|
+
if (multiStepSpinner) multiStepSpinner.nextStep();
|
|
60
75
|
await dlerPostBuild(isDev, debugDontCopyNonBuildFiles);
|
|
61
76
|
if (effectiveConfig.postBuildSettings?.deleteDistTmpAfterBuild) {
|
|
62
77
|
await fs.remove(path.join(PROJECT_ROOT, "dist-tmp"));
|
|
63
78
|
}
|
|
64
|
-
if (
|
|
65
|
-
|
|
79
|
+
if (multiStepSpinner) {
|
|
80
|
+
multiStepSpinner.complete("Build completed successfully");
|
|
66
81
|
}
|
|
67
82
|
return { timer, effectiveConfig };
|
|
68
83
|
} catch (error) {
|
|
69
|
-
if (
|
|
70
|
-
|
|
84
|
+
if (multiStepSpinner) {
|
|
85
|
+
const currentStep = multiStepSpinner.getCurrentStep();
|
|
86
|
+
multiStepSpinner.error(error, currentStep);
|
|
71
87
|
}
|
|
72
88
|
handleDlerError(error);
|
|
73
89
|
}
|
|
@@ -4,6 +4,7 @@ import pAll from "p-all";
|
|
|
4
4
|
import { library_buildLibrary } from "./build-library.js";
|
|
5
5
|
import { CONCURRENCY_DEFAULT, PROJECT_ROOT } from "../config/constants.js";
|
|
6
6
|
import { library_publishLibrary } from "../pub/pub-library.js";
|
|
7
|
+
import { createSpinnerGroup } from "../utils/spinner.js";
|
|
7
8
|
import { resumePerfTimer } from "../utils/utils-perf.js";
|
|
8
9
|
export async function library_buildFlow(timer, isDev, config) {
|
|
9
10
|
relinka("verbose", "\u2014 \u2014 \u2014 library_buildFlow \u2014 \u2014 \u2014");
|
|
@@ -76,8 +77,22 @@ export async function libraries_build(isDev, timer, libsList, libsDirDist, libsD
|
|
|
76
77
|
return;
|
|
77
78
|
}
|
|
78
79
|
const libsEntries = Object.entries(libsList);
|
|
79
|
-
const
|
|
80
|
+
const shouldShowSpinner = config.displayBuildPubLogs === false;
|
|
81
|
+
let spinnerGroup = null;
|
|
82
|
+
if (shouldShowSpinner) {
|
|
83
|
+
const libraryNames = libsEntries.map(([libName]) => `Building ${libName}`);
|
|
84
|
+
spinnerGroup = createSpinnerGroup({
|
|
85
|
+
items: libraryNames,
|
|
86
|
+
concurrent: true,
|
|
87
|
+
color: "green"
|
|
88
|
+
});
|
|
89
|
+
for (const spinner of spinnerGroup.spinners) {
|
|
90
|
+
spinner.start();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const tasks = libsEntries.map(([libName, libConfig], index) => {
|
|
80
94
|
return async () => {
|
|
95
|
+
const librarySpinner = spinnerGroup?.spinners[index];
|
|
81
96
|
try {
|
|
82
97
|
if (!libConfig.libMainFile) {
|
|
83
98
|
throw new Error(`Library ${libName} is missing "libMainFile" property.`);
|
|
@@ -132,7 +147,14 @@ export async function libraries_build(isDev, timer, libsList, libsDirDist, libsD
|
|
|
132
147
|
transpileStub,
|
|
133
148
|
transpileWatch
|
|
134
149
|
});
|
|
150
|
+
if (librarySpinner) {
|
|
151
|
+
librarySpinner.succeed(`${libName} built successfully`);
|
|
152
|
+
}
|
|
135
153
|
} catch (error) {
|
|
154
|
+
if (librarySpinner) {
|
|
155
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
156
|
+
librarySpinner.fail(`${libName} build failed: ${errorMessage}`);
|
|
157
|
+
}
|
|
136
158
|
relinka(
|
|
137
159
|
"error",
|
|
138
160
|
`Failed to build library ${libName}: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -158,8 +180,23 @@ export async function libraries_publish(isDev, timer, libsList, distJsrDryRun, d
|
|
|
158
180
|
return;
|
|
159
181
|
}
|
|
160
182
|
const libsEntries = Object.entries(libsList);
|
|
161
|
-
|
|
183
|
+
let publishSpinnerGroup = null;
|
|
184
|
+
if (!commonPubPause) {
|
|
185
|
+
const libraryNames = libsEntries.filter(([, libConfig]) => !libConfig.libPubPause).map(([libName]) => `Publishing ${libName} to ${commonPubRegistry}`);
|
|
186
|
+
if (libraryNames.length > 0) {
|
|
187
|
+
publishSpinnerGroup = createSpinnerGroup({
|
|
188
|
+
items: libraryNames,
|
|
189
|
+
concurrent: true,
|
|
190
|
+
color: "magenta"
|
|
191
|
+
});
|
|
192
|
+
for (const spinner of publishSpinnerGroup.spinners) {
|
|
193
|
+
spinner.start();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
const tasks = libsEntries.map(([libName, libConfig], index) => {
|
|
162
198
|
return async () => {
|
|
199
|
+
const publishSpinner = publishSpinnerGroup?.spinners[index];
|
|
163
200
|
try {
|
|
164
201
|
const folderName = extractFolderName(libName, libConfig);
|
|
165
202
|
const libBaseDir = path.resolve(PROJECT_ROOT, libsDirDist, folderName);
|
|
@@ -179,10 +216,20 @@ export async function libraries_publish(isDev, timer, libsList, distJsrDryRun, d
|
|
|
179
216
|
isDev,
|
|
180
217
|
timer
|
|
181
218
|
);
|
|
219
|
+
if (publishSpinner) {
|
|
220
|
+
publishSpinner.succeed(`${libName} published to ${effectivePubRegistry} successfully`);
|
|
221
|
+
}
|
|
182
222
|
} else if (libConfig.libPubPause && !commonPubPause) {
|
|
183
223
|
relinka("verbose", `Publishing is paused for lib ${libName} (libPubPause: true)`);
|
|
224
|
+
if (publishSpinner) {
|
|
225
|
+
publishSpinner.info(`${libName} publish paused by configuration`);
|
|
226
|
+
}
|
|
184
227
|
}
|
|
185
228
|
} catch (error) {
|
|
229
|
+
if (publishSpinner) {
|
|
230
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
231
|
+
publishSpinner.fail(`${libName} publish failed: ${errorMessage}`);
|
|
232
|
+
}
|
|
186
233
|
relinka(
|
|
187
234
|
"error",
|
|
188
235
|
`Failed to publish library ${libName}: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -31,7 +31,7 @@ function shouldStopAtStep(stepNumber) {
|
|
|
31
31
|
}
|
|
32
32
|
export async function unifiedBuild(inputSourceDir, coreIsCLI, isLib, rootDir, inputConfig, outDir, transpileStub = false) {
|
|
33
33
|
shouldStopAtStep(1);
|
|
34
|
-
relinka("
|
|
34
|
+
relinka("verbose", "Starting unified build process...");
|
|
35
35
|
relinka("verbose", `Processing build for source directory: ${inputSourceDir}`);
|
|
36
36
|
relinka(
|
|
37
37
|
"verbose",
|
|
@@ -73,7 +73,7 @@ export async function unifiedBuild(inputSourceDir, coreIsCLI, isLib, rootDir, in
|
|
|
73
73
|
}
|
|
74
74
|
async function _build(rootDir, inputConfig, buildConfig, pkg, cleanedDirs, _transpileStubMode, _transpileWatchMode, outDir, showOutLog, isLib) {
|
|
75
75
|
const timer = createPerfTimer();
|
|
76
|
-
relinka("
|
|
76
|
+
relinka("verbose", "Resolving build configuration...");
|
|
77
77
|
const preset = await resolvePreset(
|
|
78
78
|
buildConfig.preset || pkg.dler?.preset || pkg.build?.preset || inputConfig.preset || "auto",
|
|
79
79
|
rootDir
|
|
@@ -159,7 +159,7 @@ async function _build(rootDir, inputConfig, buildConfig, pkg, cleanedDirs, _tran
|
|
|
159
159
|
relinka("verbose", `Declaration files: ${options.declaration ? "enabled" : "disabled"}`);
|
|
160
160
|
options.outDir = resolve(options.rootDir, options.outDir);
|
|
161
161
|
const jiti = createJiti(options.rootDir, { interopDefault: true });
|
|
162
|
-
relinka("
|
|
162
|
+
relinka("verbose", "Initializing build context...");
|
|
163
163
|
const ctx = {
|
|
164
164
|
buildEntries: [],
|
|
165
165
|
hooks: createHooks(),
|
|
@@ -180,7 +180,7 @@ async function _build(rootDir, inputConfig, buildConfig, pkg, cleanedDirs, _tran
|
|
|
180
180
|
ctx.hooks.addHooks(buildConfig.hooks);
|
|
181
181
|
}
|
|
182
182
|
await ctx.hooks.callHook("build:prepare", ctx);
|
|
183
|
-
relinka("
|
|
183
|
+
relinka("verbose", "Processing build entries...");
|
|
184
184
|
options.entries = options.entries.map(
|
|
185
185
|
(entry) => typeof entry === "string" ? { input: entry, isLib } : entry
|
|
186
186
|
);
|
|
@@ -225,7 +225,7 @@ ${options.entries.map((entry) => ` ${dumpObject(entry)}`).join("\n ")}
|
|
|
225
225
|
);
|
|
226
226
|
}
|
|
227
227
|
if (options.clean) {
|
|
228
|
-
relinka("
|
|
228
|
+
relinka("verbose", "Cleaning output directories...");
|
|
229
229
|
for (const dir of new Set(
|
|
230
230
|
options.entries.map((e) => e.outDir).filter((p) => !!p).sort()
|
|
231
231
|
)) {
|
|
@@ -252,10 +252,10 @@ ${options.entries.map((entry) => ` ${dumpObject(entry)}`).join("\n ")}
|
|
|
252
252
|
return false;
|
|
253
253
|
});
|
|
254
254
|
if (activeTasks.length === 0) {
|
|
255
|
-
relinka("
|
|
255
|
+
relinka("verbose", "No build tasks to execute");
|
|
256
256
|
} else {
|
|
257
257
|
if (options.parallel) {
|
|
258
|
-
relinka("
|
|
258
|
+
relinka("verbose", `Running ${activeTasks.length} build tasks in parallel...`);
|
|
259
259
|
await Promise.all(
|
|
260
260
|
activeTasks.map(async ({ task }) => {
|
|
261
261
|
await task(ctx);
|
|
@@ -263,7 +263,7 @@ ${options.entries.map((entry) => ` ${dumpObject(entry)}`).join("\n ")}
|
|
|
263
263
|
);
|
|
264
264
|
} else {
|
|
265
265
|
for (const { task, name } of activeTasks) {
|
|
266
|
-
relinka("
|
|
266
|
+
relinka("verbose", `Running ${name}...`);
|
|
267
267
|
await task(ctx);
|
|
268
268
|
}
|
|
269
269
|
}
|
|
@@ -272,8 +272,8 @@ ${options.entries.map((entry) => ` ${dumpObject(entry)}`).join("\n ")}
|
|
|
272
272
|
await ctx.hooks.callHook("build:done", ctx);
|
|
273
273
|
return;
|
|
274
274
|
}
|
|
275
|
-
relinka("
|
|
276
|
-
relinka("
|
|
275
|
+
relinka("verbose", "Finalizing build output...");
|
|
276
|
+
relinka("verbose", `Build succeeded for ${options.name}`);
|
|
277
277
|
const outFiles = await glob(["**"], { cwd: options.outDir });
|
|
278
278
|
for (const file of outFiles) {
|
|
279
279
|
let entry = ctx.buildEntries.find((e) => e.path === file);
|
|
@@ -322,9 +322,9 @@ ${entry.modules.filter((m) => m.id.includes("node_modules")).sort((a, b) => (b.b
|
|
|
322
322
|
verbose: true
|
|
323
323
|
});
|
|
324
324
|
const totalSize = ctx.buildEntries.reduce((a, e) => a + (e.bytes || 0), 0);
|
|
325
|
-
relinka("
|
|
325
|
+
relinka("verbose", `Build complete! ${prettyBytes(totalSize)} in ${transpileFormattedTime}`);
|
|
326
326
|
relinka(
|
|
327
|
-
"
|
|
327
|
+
"verbose",
|
|
328
328
|
`\u03A3 Total dist size: ${prettyBytes(totalSize)} (build time: ${transpileFormattedTime})`
|
|
329
329
|
);
|
|
330
330
|
}
|
|
@@ -346,6 +346,6 @@ ${[...ctx.warnings].map((msg) => `- ${msg}`).join("\n")}`
|
|
|
346
346
|
process.exit(1);
|
|
347
347
|
}
|
|
348
348
|
shouldStopAtStep(15);
|
|
349
|
-
relinka("
|
|
349
|
+
relinka("verbose", `Build complete (with ${ctx.warnings.size} warnings)`);
|
|
350
350
|
}
|
|
351
351
|
}
|
|
@@ -180,7 +180,7 @@ export async function mkdist(options = {}) {
|
|
|
180
180
|
relinka("error", `... and ${errors.length - 5} more errors`);
|
|
181
181
|
}
|
|
182
182
|
} else {
|
|
183
|
-
relinka("
|
|
183
|
+
relinka("verbose", "Build completed successfully!");
|
|
184
184
|
}
|
|
185
185
|
return {
|
|
186
186
|
result: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { relinka } from "@reliverse/relinka";
|
|
2
2
|
import pAll from "p-all";
|
|
3
3
|
import { CONCURRENCY_DEFAULT } from "../config/constants.js";
|
|
4
|
+
import { createSpinnerGroup } from "../utils/spinner.js";
|
|
4
5
|
import { regular_pubToJsr, regular_pubToNpm } from "../pub/pub-regular.js";
|
|
5
6
|
import { regular_buildJsrDist, regular_buildNpmDist } from "./build-regular.js";
|
|
6
7
|
export async function regular_buildFlow(timer, isDev, config) {
|
|
@@ -58,47 +59,83 @@ export async function regular_buildFlow(timer, isDev, config) {
|
|
|
58
59
|
break;
|
|
59
60
|
case "npm-jsr": {
|
|
60
61
|
relinka("verbose", "Initializing build process for main project to both NPM and JSR...");
|
|
62
|
+
const shouldShowSpinner = config.displayBuildPubLogs === false;
|
|
63
|
+
let buildSpinnerGroup = null;
|
|
64
|
+
if (shouldShowSpinner) {
|
|
65
|
+
buildSpinnerGroup = createSpinnerGroup({
|
|
66
|
+
items: ["Building for NPM", "Building for JSR"],
|
|
67
|
+
concurrent: true,
|
|
68
|
+
color: "cyan"
|
|
69
|
+
});
|
|
70
|
+
for (const spinner of buildSpinnerGroup.spinners) {
|
|
71
|
+
spinner.start();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
61
74
|
const buildTasks = [
|
|
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
|
-
|
|
75
|
+
async () => {
|
|
76
|
+
try {
|
|
77
|
+
await regular_buildJsrDist(
|
|
78
|
+
isDev,
|
|
79
|
+
true,
|
|
80
|
+
config.coreIsCLI,
|
|
81
|
+
config.coreEntrySrcDir,
|
|
82
|
+
config.distJsrDirName,
|
|
83
|
+
config.distJsrBuilder,
|
|
84
|
+
config.coreEntryFile,
|
|
85
|
+
config.transpileTarget,
|
|
86
|
+
config.transpileFormat,
|
|
87
|
+
config.transpileMinify,
|
|
88
|
+
config.transpileSourcemap,
|
|
89
|
+
config.transpilePublicPath,
|
|
90
|
+
config.distNpmOutFilesExt,
|
|
91
|
+
config,
|
|
92
|
+
timer,
|
|
93
|
+
config.transpileStub,
|
|
94
|
+
config.transpileWatch,
|
|
95
|
+
config.distJsrGenTsconfig,
|
|
96
|
+
config.coreDeclarations
|
|
97
|
+
);
|
|
98
|
+
if (buildSpinnerGroup?.spinners[1]) {
|
|
99
|
+
buildSpinnerGroup.spinners[1].succeed("JSR build completed");
|
|
100
|
+
}
|
|
101
|
+
} catch (error) {
|
|
102
|
+
if (buildSpinnerGroup?.spinners[1]) {
|
|
103
|
+
buildSpinnerGroup.spinners[1].fail("JSR build failed");
|
|
104
|
+
}
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
async () => {
|
|
109
|
+
try {
|
|
110
|
+
await regular_buildNpmDist(
|
|
111
|
+
isDev,
|
|
112
|
+
config.coreIsCLI,
|
|
113
|
+
config.coreEntrySrcDir,
|
|
114
|
+
config.distNpmDirName,
|
|
115
|
+
config.distNpmBuilder,
|
|
116
|
+
config.coreEntryFile,
|
|
117
|
+
config.distNpmOutFilesExt,
|
|
118
|
+
config,
|
|
119
|
+
config.transpileTarget,
|
|
120
|
+
config.transpileFormat,
|
|
121
|
+
config.transpileMinify,
|
|
122
|
+
config.transpileSourcemap,
|
|
123
|
+
config.transpilePublicPath,
|
|
124
|
+
config.transpileStub,
|
|
125
|
+
config.transpileWatch,
|
|
126
|
+
timer,
|
|
127
|
+
config.coreDeclarations
|
|
128
|
+
);
|
|
129
|
+
if (buildSpinnerGroup?.spinners[0]) {
|
|
130
|
+
buildSpinnerGroup.spinners[0].succeed("NPM build completed");
|
|
131
|
+
}
|
|
132
|
+
} catch (error) {
|
|
133
|
+
if (buildSpinnerGroup?.spinners[0]) {
|
|
134
|
+
buildSpinnerGroup.spinners[0].fail("NPM build failed");
|
|
135
|
+
}
|
|
136
|
+
throw error;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
102
139
|
];
|
|
103
140
|
await pAll(buildTasks, { concurrency: CONCURRENCY_DEFAULT });
|
|
104
141
|
break;
|
|
@@ -140,24 +177,60 @@ export async function regular_pubFlow(timer, isDev, config) {
|
|
|
140
177
|
break;
|
|
141
178
|
case "npm-jsr": {
|
|
142
179
|
relinka("verbose", "Publishing main project to both NPM and JSR...");
|
|
180
|
+
const shouldShowSpinner = config.displayBuildPubLogs === false;
|
|
181
|
+
let pubSpinnerGroup = null;
|
|
182
|
+
if (shouldShowSpinner) {
|
|
183
|
+
pubSpinnerGroup = createSpinnerGroup({
|
|
184
|
+
items: ["Publishing to NPM", "Publishing to JSR"],
|
|
185
|
+
concurrent: true,
|
|
186
|
+
color: "magenta"
|
|
187
|
+
});
|
|
188
|
+
for (const spinner of pubSpinnerGroup.spinners) {
|
|
189
|
+
spinner.start();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
143
192
|
const publishTasks = [
|
|
144
|
-
() =>
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
193
|
+
async () => {
|
|
194
|
+
try {
|
|
195
|
+
await regular_pubToJsr(
|
|
196
|
+
config.distJsrDryRun,
|
|
197
|
+
config.distJsrFailOnWarn,
|
|
198
|
+
isDev,
|
|
199
|
+
config.commonPubPause,
|
|
200
|
+
config.distJsrDirName,
|
|
201
|
+
config.distJsrAllowDirty,
|
|
202
|
+
config.distJsrSlowTypes,
|
|
203
|
+
timer
|
|
204
|
+
);
|
|
205
|
+
if (pubSpinnerGroup?.spinners[1]) {
|
|
206
|
+
pubSpinnerGroup.spinners[1].succeed("JSR publish completed");
|
|
207
|
+
}
|
|
208
|
+
} catch (error) {
|
|
209
|
+
if (pubSpinnerGroup?.spinners[1]) {
|
|
210
|
+
pubSpinnerGroup.spinners[1].fail("JSR publish failed");
|
|
211
|
+
}
|
|
212
|
+
throw error;
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
async () => {
|
|
216
|
+
try {
|
|
217
|
+
await regular_pubToNpm(
|
|
218
|
+
config.distJsrDryRun,
|
|
219
|
+
isDev,
|
|
220
|
+
config.commonPubPause,
|
|
221
|
+
config.distNpmDirName,
|
|
222
|
+
timer
|
|
223
|
+
);
|
|
224
|
+
if (pubSpinnerGroup?.spinners[0]) {
|
|
225
|
+
pubSpinnerGroup.spinners[0].succeed("NPM publish completed");
|
|
226
|
+
}
|
|
227
|
+
} catch (error) {
|
|
228
|
+
if (pubSpinnerGroup?.spinners[0]) {
|
|
229
|
+
pubSpinnerGroup.spinners[0].fail("NPM publish failed");
|
|
230
|
+
}
|
|
231
|
+
throw error;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
161
234
|
];
|
|
162
235
|
await pAll(publishTasks, { concurrency: CONCURRENCY_DEFAULT });
|
|
163
236
|
break;
|