@reliverse/dler 1.2.1 → 1.2.2
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/cli/args/init/cmd/index.js +3 -3
- package/bin/cli/args/init/init-mod.txt +1 -1
- package/bin/cli/args/init/libs/reinit/reint-impl/reinit-mod.txt +5 -5
- package/bin/cli/args/init/libs/reinit/reint-impl/templates/t-license.js +1 -1
- package/bin/cli/args/inject/ts-expect-error.txt +3 -3
- package/bin/cli/args/tools/index.js +1 -1
- package/bin/cli/args/tools/tools-impl.js +15 -15
- package/bin/cli.js +3 -2
- package/bin/init.js +4 -4
- package/bin/libs/sdk/sdk-impl/build/build-library.js +11 -11
- package/bin/libs/sdk/sdk-impl/build/build-regular.js +22 -12
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/auto.js +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/build.js +4 -7
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/watch.js +3 -3
- package/bin/libs/sdk/sdk-impl/library-flow.js +1 -1
- package/bin/libs/sdk/sdk-impl/pub/pub-library.js +9 -9
- package/bin/libs/sdk/sdk-impl/pub/pub-regular.js +4 -4
- package/bin/libs/sdk/sdk-impl/regular-flow.js +17 -11
- package/bin/libs/sdk/sdk-impl/utils/tools/tools-impl.js +6 -6
- package/bin/libs/sdk/sdk-impl/utils/utils-build.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-bump.js +4 -4
- package/bin/libs/sdk/sdk-impl/utils/utils-fs.js +2 -5
- package/bin/libs/sdk/sdk-impl/utils/utils-info.js +4 -4
- package/bin/libs/sdk/sdk-impl/utils/utils-jsr-json.js +3 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-paths.js +6 -6
- package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-libs.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-reg.js +8 -5
- package/bin/load.js +1 -1
- package/bin/tools.txt +1 -1
- package/package.json +4 -4
|
@@ -35,7 +35,7 @@ export default defineCommand({
|
|
|
35
35
|
fs.mkdirSync(dirPath, { recursive: true });
|
|
36
36
|
const content = generateCommandTemplate(cmdName);
|
|
37
37
|
fs.writeFileSync(filePath, content, "utf-8");
|
|
38
|
-
relinka("
|
|
38
|
+
relinka("log", `\u2705 Created new command: ${filePath}`);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
});
|
|
@@ -58,8 +58,8 @@ export default defineCommand({
|
|
|
58
58
|
},
|
|
59
59
|
},
|
|
60
60
|
async run({ args }) {
|
|
61
|
-
relinka("
|
|
62
|
-
relinka("
|
|
61
|
+
relinka("log", "Command '${cmdName}' executed.");
|
|
62
|
+
relinka("log", "Received args:", args);
|
|
63
63
|
},
|
|
64
64
|
});
|
|
65
65
|
`;
|
|
@@ -197,7 +197,7 @@ async function doInitFile(
|
|
|
197
197
|
}
|
|
198
198
|
if (maybeNewDest !== resolvedDestPath) {
|
|
199
199
|
// e.g., attach-index was chosen
|
|
200
|
-
relinka("
|
|
200
|
+
relinka("log", `attach-index or rename => ${maybeNewDest}`);
|
|
201
201
|
return await finalizeInit(
|
|
202
202
|
req,
|
|
203
203
|
initBehaviour,
|
|
@@ -268,7 +268,7 @@ async function runCopy(
|
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
relinka(
|
|
271
|
-
"
|
|
271
|
+
"log",
|
|
272
272
|
`Attempting copy:
|
|
273
273
|
- Source Dir: ${resolvedSrcDir}
|
|
274
274
|
- Source Path: ${sourcePath}
|
|
@@ -283,7 +283,7 @@ async function runCopy(
|
|
|
283
283
|
throw new Error(`Source file not found: ${sourcePath}`);
|
|
284
284
|
}
|
|
285
285
|
await fs.copy(sourcePath, resolvedDestPath, { overwrite: true });
|
|
286
|
-
relinka("
|
|
286
|
+
relinka("log", `Copied file: ${chosenVariation} -> ${resolvedDestPath}`);
|
|
287
287
|
return {
|
|
288
288
|
requested: req,
|
|
289
289
|
finalPath: resolvedDestPath,
|
|
@@ -305,7 +305,7 @@ async function runCopy(
|
|
|
305
305
|
}
|
|
306
306
|
await fs.copy(fallbackFullPath, resolvedDestPath, { overwrite: true });
|
|
307
307
|
relinka(
|
|
308
|
-
"
|
|
308
|
+
"log",
|
|
309
309
|
`Fallback copy: ${fallbackSource} -> ${resolvedDestPath}`,
|
|
310
310
|
);
|
|
311
311
|
return {
|
|
@@ -390,6 +390,6 @@ async function attachIndex(originalPath: string) {
|
|
|
390
390
|
newPath = path.join(dir, `${base}.${counter}${ext}`);
|
|
391
391
|
counter++;
|
|
392
392
|
}
|
|
393
|
-
relinka("
|
|
393
|
+
relinka("log", `Attaching index => ${newPath}`);
|
|
394
394
|
return newPath;
|
|
395
395
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const licenseTemplate = `# MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) Nazar Kornienko (blefnk), Reliverse
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -129,7 +129,7 @@ async function runTscAndParseErrors(
|
|
|
129
129
|
// In case of error, try to extract the output.
|
|
130
130
|
const combined = (error.all as string) || "";
|
|
131
131
|
if (!combined) {
|
|
132
|
-
relinka("
|
|
132
|
+
relinka("log", `TSC returned no error lines. Possibly no TS errors?`);
|
|
133
133
|
return [];
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -191,7 +191,7 @@ async function injectCommentIntoFiles(
|
|
|
191
191
|
lineNums.sort((a, b) => b - a);
|
|
192
192
|
const absPath = path.resolve(filePath);
|
|
193
193
|
relinka(
|
|
194
|
-
"
|
|
194
|
+
"log",
|
|
195
195
|
`Injecting into ${absPath} at lines: ${lineNums.join(", ")}`,
|
|
196
196
|
);
|
|
197
197
|
|
|
@@ -235,7 +235,7 @@ export async function useTsExpectError(args: {
|
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
if (usedAuto) {
|
|
238
|
-
relinka("
|
|
238
|
+
relinka("log", "Running TSC to discover error lines...");
|
|
239
239
|
const tscCommand = userConfig.tscCommand!;
|
|
240
240
|
try {
|
|
241
241
|
const discovered = await runTscAndParseErrors(tscCommand, args.tscPaths);
|
|
@@ -52,7 +52,7 @@ export default defineCommand({
|
|
|
52
52
|
}
|
|
53
53
|
if (!TOOLS.includes(args.tool)) {
|
|
54
54
|
relinka("error", `Error: Invalid tool: ${args.tool}`);
|
|
55
|
-
relinka("
|
|
55
|
+
relinka("log", `Available tools: ${TOOLS.join(", ")}`);
|
|
56
56
|
printUsage(isDev);
|
|
57
57
|
process.exit(1);
|
|
58
58
|
}
|
|
@@ -28,7 +28,7 @@ export async function useAggregator({
|
|
|
28
28
|
const exts = [".ts", ".js"];
|
|
29
29
|
if (verbose)
|
|
30
30
|
relinka(
|
|
31
|
-
"
|
|
31
|
+
"log",
|
|
32
32
|
`Scanning directory ${inputDir} for files with extensions: ${exts.join(
|
|
33
33
|
", "
|
|
34
34
|
)}`
|
|
@@ -61,7 +61,7 @@ export async function useAggregator({
|
|
|
61
61
|
const allLines = aggregatorLinesArrays.flat();
|
|
62
62
|
if (sortLines) {
|
|
63
63
|
allLines.sort();
|
|
64
|
-
if (verbose) relinka("
|
|
64
|
+
if (verbose) relinka("log", "Sorted aggregator lines alphabetically.");
|
|
65
65
|
}
|
|
66
66
|
if (outFile.startsWith(inputDir)) {
|
|
67
67
|
relinka(
|
|
@@ -83,7 +83,7 @@ ${AGGREGATOR_END}
|
|
|
83
83
|
if (overrideFile) {
|
|
84
84
|
finalText = aggregatorBlock;
|
|
85
85
|
if (verbose) {
|
|
86
|
-
relinka("
|
|
86
|
+
relinka("log", "Override mode: rewriting entire file.");
|
|
87
87
|
}
|
|
88
88
|
} else {
|
|
89
89
|
let existingContent = "";
|
|
@@ -91,12 +91,12 @@ ${AGGREGATOR_END}
|
|
|
91
91
|
existingContent = await fs.readFile(outFile, "utf8");
|
|
92
92
|
} catch {
|
|
93
93
|
if (verbose)
|
|
94
|
-
relinka("
|
|
94
|
+
relinka("log", "Aggregator file does not exist. Creating new one.");
|
|
95
95
|
}
|
|
96
96
|
if (existingContent?.includes(AGGREGATOR_START) && existingContent.includes(AGGREGATOR_END)) {
|
|
97
97
|
if (verbose) {
|
|
98
98
|
relinka(
|
|
99
|
-
"
|
|
99
|
+
"log",
|
|
100
100
|
"Existing aggregator block found. Updating auto-generated section."
|
|
101
101
|
);
|
|
102
102
|
}
|
|
@@ -109,7 +109,7 @@ ${AGGREGATOR_END}
|
|
|
109
109
|
if (existingContent) {
|
|
110
110
|
if (verbose)
|
|
111
111
|
relinka(
|
|
112
|
-
"
|
|
112
|
+
"log",
|
|
113
113
|
"No aggregator block found. Appending auto-generated section."
|
|
114
114
|
);
|
|
115
115
|
finalText = `${existingContent.trim()}
|
|
@@ -160,7 +160,7 @@ async function collectFiles(dir, exts, recursive, ignoreDirs, verbose, includeIn
|
|
|
160
160
|
if (entry.isDirectory()) {
|
|
161
161
|
if (ignoreDirs.includes(entry.name)) {
|
|
162
162
|
if (verbose) {
|
|
163
|
-
relinka("
|
|
163
|
+
relinka("log", `Skipping ignored directory: ${fullPath}`);
|
|
164
164
|
}
|
|
165
165
|
continue;
|
|
166
166
|
}
|
|
@@ -179,13 +179,13 @@ async function collectFiles(dir, exts, recursive, ignoreDirs, verbose, includeIn
|
|
|
179
179
|
} else if (entry.isFile()) {
|
|
180
180
|
if (!includeInternal && path.basename(fullPath).startsWith(internalMarker)) {
|
|
181
181
|
if (verbose) {
|
|
182
|
-
relinka("
|
|
182
|
+
relinka("log", `Skipping internal file: ${fullPath}`);
|
|
183
183
|
}
|
|
184
184
|
continue;
|
|
185
185
|
}
|
|
186
186
|
if (exts.some((ext) => entry.name.toLowerCase().endsWith(ext))) {
|
|
187
187
|
if (verbose) {
|
|
188
|
-
relinka("
|
|
188
|
+
relinka("log", `Found file: ${fullPath}`);
|
|
189
189
|
}
|
|
190
190
|
found.push(fullPath);
|
|
191
191
|
}
|
|
@@ -275,21 +275,21 @@ function guessStarImportIdentifier(filePath) {
|
|
|
275
275
|
return identifier || "file";
|
|
276
276
|
}
|
|
277
277
|
export function printUsage(isDev) {
|
|
278
|
-
relinka("
|
|
279
|
-
relinka("
|
|
280
|
-
relinka("
|
|
278
|
+
relinka("log", "====================");
|
|
279
|
+
relinka("log", "TOOLS USAGE EXAMPLES");
|
|
280
|
+
relinka("log", "====================");
|
|
281
281
|
relinka(
|
|
282
|
-
"
|
|
282
|
+
"log",
|
|
283
283
|
`${isDev ? "bun dev:agg" : "dler tools"} --tool agg --input <dir> --out <file> [options]`
|
|
284
284
|
);
|
|
285
285
|
if (isDev) {
|
|
286
286
|
relinka(
|
|
287
|
-
"
|
|
287
|
+
"log",
|
|
288
288
|
"bun dev:tools agg --input src/libs/sdk/sdk-impl --out src/libs/sdk/sdk-mod.ts --recursive --named --strip src/libs/sdk"
|
|
289
289
|
);
|
|
290
290
|
} else {
|
|
291
291
|
relinka(
|
|
292
|
-
"
|
|
292
|
+
"log",
|
|
293
293
|
"dler tools --tool agg --input src/libs --out aggregator.ts --recursive --named"
|
|
294
294
|
);
|
|
295
295
|
}
|
package/bin/cli.js
CHANGED
|
@@ -18,7 +18,7 @@ export async function dler(isDev) {
|
|
|
18
18
|
config.commonPubPause = true;
|
|
19
19
|
config.bumpDisable = true;
|
|
20
20
|
relinka(
|
|
21
|
-
"
|
|
21
|
+
"log",
|
|
22
22
|
"Development mode: Publishing paused and version bumping disabled."
|
|
23
23
|
);
|
|
24
24
|
}
|
|
@@ -67,7 +67,8 @@ export async function dler(isDev) {
|
|
|
67
67
|
config.transpileStub,
|
|
68
68
|
config.transpileWatch,
|
|
69
69
|
config.distJsrGenTsconfig,
|
|
70
|
-
config.coreDeclarations
|
|
70
|
+
config.coreDeclarations,
|
|
71
|
+
{ coreDescription: config.coreDescription }
|
|
71
72
|
);
|
|
72
73
|
await processLibraryFlow(
|
|
73
74
|
timer,
|
package/bin/init.js
CHANGED
|
@@ -13,12 +13,12 @@ export async function initDlerConfig(isDev) {
|
|
|
13
13
|
const configContent = generateConfig(isDev);
|
|
14
14
|
await fs.outputFile(configPath, configContent, "utf-8");
|
|
15
15
|
relinka("success", `Config was created at ${configPath}`);
|
|
16
|
-
relinka("
|
|
16
|
+
relinka("log", "Edit this file to customize build and publish settings");
|
|
17
17
|
if (!isDev) {
|
|
18
|
-
relinka("
|
|
19
|
-
relinka("
|
|
18
|
+
relinka("log", "Please note: commonPubPause is set to true by default");
|
|
19
|
+
relinka("log", "When you're ready, run `dler` to build and publish");
|
|
20
20
|
} else {
|
|
21
|
-
relinka("
|
|
21
|
+
relinka("log", "When you're ready, run `bun pub` to build and publish");
|
|
22
22
|
}
|
|
23
23
|
process.exit(0);
|
|
24
24
|
} catch (error) {
|
|
@@ -51,7 +51,7 @@ export async function library_buildLibrary(options) {
|
|
|
51
51
|
replacementMarker: REPLACEMENT_MARKER
|
|
52
52
|
};
|
|
53
53
|
try {
|
|
54
|
-
relinka("
|
|
54
|
+
relinka("log", `Running pre-build replacements for ${libName}...`);
|
|
55
55
|
replacedFiles = await preBuildReplacements(replacementConfig);
|
|
56
56
|
relinka("verbose", `Pre-build: ${replacedFiles.length} files modified.`);
|
|
57
57
|
await executeBuildTasks(options);
|
|
@@ -94,7 +94,7 @@ async function executeBuildTasks(options) {
|
|
|
94
94
|
`JSR build requested for ${libName} but 'options.jsr' is missing.`
|
|
95
95
|
);
|
|
96
96
|
}
|
|
97
|
-
relinka("
|
|
97
|
+
relinka("log", `Queueing JSR build for lib ${libName}...`);
|
|
98
98
|
buildTasks.push(() => library_buildJsrDist(options));
|
|
99
99
|
}
|
|
100
100
|
if (commonPubRegistry === "npm" || commonPubRegistry === "npm-jsr") {
|
|
@@ -103,7 +103,7 @@ async function executeBuildTasks(options) {
|
|
|
103
103
|
`NPM build requested for ${libName} but 'options.npm' is missing.`
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
|
-
relinka("
|
|
106
|
+
relinka("log", `Queueing NPM build for lib ${libName}...`);
|
|
107
107
|
buildTasks.push(() => library_buildNpmDist(options));
|
|
108
108
|
}
|
|
109
109
|
if (buildTasks.length === 0) {
|
|
@@ -114,11 +114,11 @@ async function executeBuildTasks(options) {
|
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
116
|
if (buildTasks.length > 1) {
|
|
117
|
-
relinka("
|
|
117
|
+
relinka("log", `Building lib ${libName} for NPM and JSR concurrently...`);
|
|
118
118
|
await pAll(buildTasks, { concurrency: CONCURRENCY_DEFAULT });
|
|
119
119
|
} else {
|
|
120
120
|
relinka(
|
|
121
|
-
"
|
|
121
|
+
"log",
|
|
122
122
|
`Building lib ${libName} for ${options.commonPubRegistry || "single target"}...`
|
|
123
123
|
);
|
|
124
124
|
const task = buildTasks[0];
|
|
@@ -137,7 +137,7 @@ async function library_buildJsrDist(options) {
|
|
|
137
137
|
const jsrOptions = options.jsr;
|
|
138
138
|
const { jsrOutDir, distJsrBuilder, distJsrOutFilesExt } = jsrOptions;
|
|
139
139
|
const targetType = "jsr";
|
|
140
|
-
relinka("
|
|
140
|
+
relinka("log", `[JSR] Initializing JSR build for ${libName}...`);
|
|
141
141
|
const libSourceDirResolved = path.resolve(PROJECT_ROOT, options.mainDir);
|
|
142
142
|
const entryFilePathResolved = path.resolve(libSourceDirResolved, libMainFile);
|
|
143
143
|
const outputDirRootResolved = path.resolve(PROJECT_ROOT, jsrOutDir);
|
|
@@ -192,7 +192,7 @@ async function library_buildNpmDist(options) {
|
|
|
192
192
|
const distJsrOutFilesExt = options.jsr?.distJsrOutFilesExt || "ts";
|
|
193
193
|
const targetType = "npm";
|
|
194
194
|
const distName = determineDistName(npmOutDir, false, libsList);
|
|
195
|
-
relinka("
|
|
195
|
+
relinka("log", `[NPM:${distName}] Initializing NPM build for ${libName}...`);
|
|
196
196
|
const coreEntrySrcDirResolved = path.resolve(PROJECT_ROOT, coreEntrySrcDir);
|
|
197
197
|
const outputDirRootResolved = path.resolve(PROJECT_ROOT, npmOutDir);
|
|
198
198
|
const outputDirBinResolved = path.resolve(
|
|
@@ -281,10 +281,10 @@ async function buildDistributionTarget(params) {
|
|
|
281
281
|
} = options;
|
|
282
282
|
const isJsr = targetType === "jsr";
|
|
283
283
|
const logPrefix = isJsr ? "[JSR]" : `[NPM:${determineDistName(path.relative(PROJECT_ROOT, outputDirRoot), false, libsList)}]`;
|
|
284
|
-
relinka("
|
|
284
|
+
relinka("log", `${logPrefix} Starting build target processing...`);
|
|
285
285
|
await ensuredir(outputDirRoot);
|
|
286
286
|
await ensuredir(outputDirBin);
|
|
287
|
-
relinka("
|
|
287
|
+
relinka("log", `${logPrefix} Using builder: ${builder}`);
|
|
288
288
|
const bundleRequest = {
|
|
289
289
|
builder,
|
|
290
290
|
entryPoint: entryFilePath,
|
|
@@ -319,7 +319,7 @@ async function buildDistributionTarget(params) {
|
|
|
319
319
|
libDirName
|
|
320
320
|
};
|
|
321
321
|
await library_performCommonBuildSteps(commonStepsParams);
|
|
322
|
-
relinka("
|
|
322
|
+
relinka("log", `${logPrefix} Completed build target processing.`);
|
|
323
323
|
}
|
|
324
324
|
async function library_bundleWithBuilder(params) {
|
|
325
325
|
const { builder, ...executorParams } = params;
|
|
@@ -777,7 +777,7 @@ async function preBuildReplacements(config) {
|
|
|
777
777
|
});
|
|
778
778
|
await fs.writeFile(filePath, updatedCode, "utf-8");
|
|
779
779
|
relinka(
|
|
780
|
-
"
|
|
780
|
+
"log",
|
|
781
781
|
`Applied pre-build replacement in ${path.relative(PROJECT_ROOT, filePath)}`
|
|
782
782
|
);
|
|
783
783
|
} else {
|
|
@@ -34,15 +34,15 @@ import {
|
|
|
34
34
|
import { regular_createPackageJSON } from "../utils/utils-pkg-json-reg.js";
|
|
35
35
|
import { createTSConfig } from "../utils/utils-tsconfig.js";
|
|
36
36
|
import { ensuredir } from "./bundlers/unified/utils.js";
|
|
37
|
-
export async function regular_buildJsrDist(isDev, isJsr, coreIsCLI, coreEntrySrcDir, distJsrDirName, distJsrBuilder, coreEntryFile, transpileTarget, transpileFormat, transpileSplitting, transpileMinify, transpileSourcemap, transpilePublicPath, unifiedBundlerOutExt, rmDepsMode, timer, transpileStub, transpileWatch, distJsrGenTsconfig, coreDeclarations) {
|
|
38
|
-
relinka("
|
|
37
|
+
export async function regular_buildJsrDist(isDev, isJsr, coreIsCLI, coreEntrySrcDir, distJsrDirName, distJsrBuilder, coreEntryFile, transpileTarget, transpileFormat, transpileSplitting, transpileMinify, transpileSourcemap, transpilePublicPath, unifiedBundlerOutExt, rmDepsMode, timer, transpileStub, transpileWatch, distJsrGenTsconfig, coreDeclarations, config) {
|
|
38
|
+
relinka("log", "Building JSR distribution...");
|
|
39
39
|
const coreEntrySrcDirResolved = path.resolve(PROJECT_ROOT, coreEntrySrcDir);
|
|
40
40
|
const coreEntryFilePath = path.join(coreEntrySrcDirResolved, coreEntryFile);
|
|
41
41
|
const distJsrDirNameResolved = path.resolve(PROJECT_ROOT, distJsrDirName);
|
|
42
42
|
const outDirBin = path.resolve(distJsrDirNameResolved, "bin");
|
|
43
43
|
await ensuredir(distJsrDirNameResolved);
|
|
44
44
|
await ensuredir(outDirBin);
|
|
45
|
-
relinka("
|
|
45
|
+
relinka("log", `Using JSR builder: ${distJsrBuilder}`);
|
|
46
46
|
await regular_bundleWithBuilder(distJsrBuilder, {
|
|
47
47
|
coreDeclarations,
|
|
48
48
|
outDir: outDirBin,
|
|
@@ -69,11 +69,18 @@ export async function regular_buildJsrDist(isDev, isJsr, coreIsCLI, coreEntrySrc
|
|
|
69
69
|
outDirBin,
|
|
70
70
|
outDirRoot: distJsrDirNameResolved,
|
|
71
71
|
rmDepsMode,
|
|
72
|
-
unifiedBundlerOutExt
|
|
72
|
+
unifiedBundlerOutExt,
|
|
73
|
+
coreDescription: config.coreDescription
|
|
73
74
|
});
|
|
74
75
|
await convertImportExtensionsJsToTs({ dirPath: outDirBin });
|
|
75
76
|
await renameTsxFiles(outDirBin);
|
|
76
|
-
await createJsrJSON(
|
|
77
|
+
await createJsrJSON(
|
|
78
|
+
distJsrDirNameResolved,
|
|
79
|
+
false,
|
|
80
|
+
void 0,
|
|
81
|
+
void 0,
|
|
82
|
+
config.coreDescription
|
|
83
|
+
);
|
|
77
84
|
if (coreIsCLI && isJsr && distJsrGenTsconfig) {
|
|
78
85
|
await createTSConfig(distJsrDirNameResolved, true);
|
|
79
86
|
}
|
|
@@ -86,15 +93,15 @@ export async function regular_buildJsrDist(isDev, isJsr, coreIsCLI, coreEntrySrc
|
|
|
86
93
|
)}))`
|
|
87
94
|
);
|
|
88
95
|
}
|
|
89
|
-
export async function regular_buildNpmDist(isDev, coreEntrySrcDir, distNpmDirName, distNpmBuilder, coreEntryFile, unifiedBundlerOutExt, rmDepsMode, coreIsCLI, transpileTarget, transpileFormat, transpileSplitting, transpileMinify, transpileSourcemap, transpilePublicPath, transpileStub, transpileWatch, timer, coreDeclarations) {
|
|
90
|
-
relinka("
|
|
96
|
+
export async function regular_buildNpmDist(isDev, coreEntrySrcDir, distNpmDirName, distNpmBuilder, coreEntryFile, unifiedBundlerOutExt, rmDepsMode, coreIsCLI, transpileTarget, transpileFormat, transpileSplitting, transpileMinify, transpileSourcemap, transpilePublicPath, transpileStub, transpileWatch, timer, coreDeclarations, config) {
|
|
97
|
+
relinka("log", "Building NPM distribution...");
|
|
91
98
|
const coreEntrySrcDirResolved = path.resolve(PROJECT_ROOT, coreEntrySrcDir);
|
|
92
99
|
const coreEntryFilePath = path.join(coreEntrySrcDirResolved, coreEntryFile);
|
|
93
100
|
const distNpmDirNameResolved = path.resolve(PROJECT_ROOT, distNpmDirName);
|
|
94
101
|
const outDirBin = path.resolve(distNpmDirNameResolved, "bin");
|
|
95
102
|
await ensuredir(distNpmDirNameResolved);
|
|
96
103
|
await ensuredir(outDirBin);
|
|
97
|
-
relinka("
|
|
104
|
+
relinka("log", `Using NPM builder: ${distNpmBuilder}`);
|
|
98
105
|
await regular_bundleWithBuilder(distNpmBuilder, {
|
|
99
106
|
coreDeclarations,
|
|
100
107
|
outDir: outDirBin,
|
|
@@ -119,7 +126,8 @@ export async function regular_buildNpmDist(isDev, coreEntrySrcDir, distNpmDirNam
|
|
|
119
126
|
outDirBin,
|
|
120
127
|
outDirRoot: distNpmDirNameResolved,
|
|
121
128
|
rmDepsMode,
|
|
122
|
-
unifiedBundlerOutExt
|
|
129
|
+
unifiedBundlerOutExt,
|
|
130
|
+
coreDescription: config.coreDescription
|
|
123
131
|
});
|
|
124
132
|
const dirSize = await getDirectorySize(distNpmDirNameResolved, isDev);
|
|
125
133
|
const filesCount = await outDirBinFilesCount(outDirBin);
|
|
@@ -197,7 +205,7 @@ async function regular_bundleUsingBun(coreEntryFile, outDirBin, transpileTarget,
|
|
|
197
205
|
}
|
|
198
206
|
}
|
|
199
207
|
async function regular_bundleUsingJsr(src, dest) {
|
|
200
|
-
relinka("
|
|
208
|
+
relinka("log", `Starting regular_bundleUsingJsr: ${src} -> ${dest}`);
|
|
201
209
|
await ensuredir(path.dirname(dest));
|
|
202
210
|
const stats = await fs.stat(src);
|
|
203
211
|
if (!stats.isDirectory()) {
|
|
@@ -340,7 +348,8 @@ async function regular_performCommonBuildSteps({
|
|
|
340
348
|
outDirBin,
|
|
341
349
|
outDirRoot,
|
|
342
350
|
rmDepsMode,
|
|
343
|
-
unifiedBundlerOutExt
|
|
351
|
+
unifiedBundlerOutExt,
|
|
352
|
+
coreDescription
|
|
344
353
|
}) {
|
|
345
354
|
await convertImportPaths({
|
|
346
355
|
aliasPrefix: "~/",
|
|
@@ -358,7 +367,8 @@ async function regular_performCommonBuildSteps({
|
|
|
358
367
|
coreIsCLI,
|
|
359
368
|
unifiedBundlerOutExt,
|
|
360
369
|
rmDepsMode,
|
|
361
|
-
[]
|
|
370
|
+
[],
|
|
371
|
+
coreDescription
|
|
362
372
|
);
|
|
363
373
|
await copyRootFile(outDirRoot, ["README.md", "LICENSE"]);
|
|
364
374
|
if (isJsr) {
|
|
@@ -23,7 +23,7 @@ export const autoPreset = definePreset(() => {
|
|
|
23
23
|
ctx.options.declaration = res.dts ? "compatible" : false;
|
|
24
24
|
}
|
|
25
25
|
relinka(
|
|
26
|
-
"
|
|
26
|
+
"log",
|
|
27
27
|
"Automatically detected entries:",
|
|
28
28
|
ctx.options.entries.map(
|
|
29
29
|
(e) => e.input.replace(`${ctx.options.rootDir}/`, "").replace(/\/$/, "/*")
|
|
@@ -202,7 +202,7 @@ async function _build(rootDir, inputConfig, buildConfig, pkg, cleanedDirs, _tran
|
|
|
202
202
|
);
|
|
203
203
|
if (process.env.DEBUG) {
|
|
204
204
|
relinka(
|
|
205
|
-
"
|
|
205
|
+
"log",
|
|
206
206
|
`Root dir: ${options.rootDir}
|
|
207
207
|
Entries:
|
|
208
208
|
${options.entries.map((entry) => ` ${dumpObject(entry)}`).join("\n ")}
|
|
@@ -218,7 +218,7 @@ ${options.entries.map((entry) => ` ${dumpObject(entry)}`).join("\n ")}
|
|
|
218
218
|
}
|
|
219
219
|
cleanedDirs.push(dir);
|
|
220
220
|
relinka(
|
|
221
|
-
"
|
|
221
|
+
"log",
|
|
222
222
|
`Cleaning dist directory: \`./${relative(process.cwd(), dir)}\``
|
|
223
223
|
);
|
|
224
224
|
await rmdir(dir);
|
|
@@ -287,7 +287,7 @@ ${entry.modules.filter((m) => m.id.includes("node_modules")).sort((a, b) => (b.b
|
|
|
287
287
|
return ` \u{1F4E6} ${rPath(m.id)}${m.bytes ? ` (${prettyBytes(m.bytes)})` : ""}`;
|
|
288
288
|
}).join("\n")}`;
|
|
289
289
|
}
|
|
290
|
-
relinka("
|
|
290
|
+
relinka("log", entry.chunk ? line : line);
|
|
291
291
|
}
|
|
292
292
|
const elapsedTime = getElapsedPerfTime(timer);
|
|
293
293
|
const transpileFormattedTime = prettyMilliseconds(elapsedTime, {
|
|
@@ -295,15 +295,12 @@ ${entry.modules.filter((m) => m.id.includes("node_modules")).sort((a, b) => (b.b
|
|
|
295
295
|
});
|
|
296
296
|
relinka(
|
|
297
297
|
"info",
|
|
298
|
-
|
|
299
|
-
prettyBytes(ctx.buildEntries.reduce((a, e) => a + (e.bytes || 0), 0)),
|
|
300
|
-
`(build time: ${transpileFormattedTime})`
|
|
298
|
+
`\u03A3 Total dist size: ${prettyBytes(ctx.buildEntries.reduce((a, e) => a + (e.bytes || 0), 0))} (build time: ${transpileFormattedTime})`
|
|
301
299
|
);
|
|
302
300
|
}
|
|
303
301
|
validateDependencies(ctx);
|
|
304
302
|
validatePackage(pkg, rootDir, ctx);
|
|
305
303
|
await ctx.hooks.callHook("build:done", ctx);
|
|
306
|
-
relinka("info", "");
|
|
307
304
|
if (ctx.warnings.size > 0) {
|
|
308
305
|
relinka(
|
|
309
306
|
"warn",
|
|
@@ -12,7 +12,7 @@ export function rollupWatch(rollupOptions) {
|
|
|
12
12
|
inputs = Object.keys(rollupOptions.input || {});
|
|
13
13
|
}
|
|
14
14
|
relinka(
|
|
15
|
-
"
|
|
15
|
+
"log",
|
|
16
16
|
`[dler] [rollup] Starting watchers for entries: ${inputs.map((input) => `./${relative(process.cwd(), input)}`).join(", ")}`
|
|
17
17
|
);
|
|
18
18
|
relinka(
|
|
@@ -20,10 +20,10 @@ export function rollupWatch(rollupOptions) {
|
|
|
20
20
|
"[dler] [rollup] Watch mode is experimental and may be unstable"
|
|
21
21
|
);
|
|
22
22
|
transpileWatcher.on("change", (id, { event }) => {
|
|
23
|
-
relinka("
|
|
23
|
+
relinka("log", `${relative(".", id)} was ${event}d`);
|
|
24
24
|
});
|
|
25
25
|
transpileWatcher.on("restart", () => {
|
|
26
|
-
relinka("
|
|
26
|
+
relinka("log", "[dler] [rollup] Rebuilding bundle");
|
|
27
27
|
});
|
|
28
28
|
transpileWatcher.on("event", (event) => {
|
|
29
29
|
if (event.code === "END") {
|
|
@@ -57,7 +57,7 @@ function extractFolderName(libName, libConfig) {
|
|
|
57
57
|
export async function libraries_buildPublish(isDev, timer, libsList, distJsrDryRun, distJsrFailOnWarn, libsDirDist, libsDirSrc, commonPubPause, commonPubRegistry, unifiedBundlerOutExt, distNpmBuilder, coreEntrySrcDir, rmDepsMode, rmDepsPatterns, transpileEsbuild, transpileTarget, transpileFormat, transpileSplitting, transpileSourcemap, transpilePublicPath, distJsrBuilder, transpileStub, transpileWatch, distJsrOutFilesExt) {
|
|
58
58
|
relinka("verbose", "Starting libraries_buildPublish");
|
|
59
59
|
if (!libsList || Object.keys(libsList).length === 0) {
|
|
60
|
-
relinka("
|
|
60
|
+
relinka("log", "No lib configs found in config, skipping libs build.");
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
const libsEntries = Object.entries(libsList);
|
|
@@ -10,14 +10,14 @@ import {
|
|
|
10
10
|
export async function library_publishLibrary(commonPubRegistry, libName, npmOutDir, jsrOutDir, distJsrDryRun, distJsrFailOnWarn, distJsrAllowDirty, distJsrSlowTypes, isDev, timer) {
|
|
11
11
|
if (isDev) {
|
|
12
12
|
relinka(
|
|
13
|
-
"
|
|
13
|
+
"log",
|
|
14
14
|
`Skipping publishing for lib ${libName} in development mode`
|
|
15
15
|
);
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
18
|
switch (commonPubRegistry) {
|
|
19
19
|
case "jsr":
|
|
20
|
-
relinka("
|
|
20
|
+
relinka("log", `Publishing lib ${libName} to JSR only...`);
|
|
21
21
|
await library_pubToJsr(
|
|
22
22
|
jsrOutDir,
|
|
23
23
|
distJsrDryRun,
|
|
@@ -30,7 +30,7 @@ export async function library_publishLibrary(commonPubRegistry, libName, npmOutD
|
|
|
30
30
|
);
|
|
31
31
|
break;
|
|
32
32
|
case "npm":
|
|
33
|
-
relinka("
|
|
33
|
+
relinka("log", `Publishing lib ${libName} to NPM only...`);
|
|
34
34
|
await library_pubToNpm(
|
|
35
35
|
npmOutDir,
|
|
36
36
|
distJsrDryRun,
|
|
@@ -41,7 +41,7 @@ export async function library_publishLibrary(commonPubRegistry, libName, npmOutD
|
|
|
41
41
|
);
|
|
42
42
|
break;
|
|
43
43
|
case "npm-jsr": {
|
|
44
|
-
relinka("
|
|
44
|
+
relinka("log", `Publishing lib ${libName} to both NPM and JSR...`);
|
|
45
45
|
const publishTasks = [
|
|
46
46
|
() => library_pubToNpm(
|
|
47
47
|
npmOutDir,
|
|
@@ -67,7 +67,7 @@ export async function library_publishLibrary(commonPubRegistry, libName, npmOutD
|
|
|
67
67
|
}
|
|
68
68
|
default:
|
|
69
69
|
relinka(
|
|
70
|
-
"
|
|
70
|
+
"log",
|
|
71
71
|
`Registry "${commonPubRegistry}" not recognized for lib ${libName}. Skipping publishing for this lib.`
|
|
72
72
|
);
|
|
73
73
|
}
|
|
@@ -75,13 +75,13 @@ export async function library_publishLibrary(commonPubRegistry, libName, npmOutD
|
|
|
75
75
|
async function library_pubToJsr(libOutDir, distJsrDryRun, distJsrFailOnWarn, distJsrAllowDirty, distJsrSlowTypes, libName, isDev, timer) {
|
|
76
76
|
relinka("verbose", `Starting library_pubToJsr for lib: ${libName}`);
|
|
77
77
|
if (isDev) {
|
|
78
|
-
relinka("
|
|
78
|
+
relinka("log", `Skipping lib ${libName} JSR publish in development mode`);
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
try {
|
|
82
82
|
if (timer) pausePerfTimer(timer);
|
|
83
83
|
await withWorkingDirectory(libOutDir, async () => {
|
|
84
|
-
relinka("
|
|
84
|
+
relinka("log", `Publishing lib ${libName} to JSR from ${libOutDir}`);
|
|
85
85
|
const command = [
|
|
86
86
|
"bun x jsr publish",
|
|
87
87
|
distJsrDryRun ? "--dry-run" : "",
|
|
@@ -107,13 +107,13 @@ async function library_pubToJsr(libOutDir, distJsrDryRun, distJsrFailOnWarn, dis
|
|
|
107
107
|
async function library_pubToNpm(libOutDir, distJsrDryRun, distJsrFailOnWarn, libName, isDev, timer) {
|
|
108
108
|
relinka("verbose", `Starting library_pubToNpm for lib: ${libName}`);
|
|
109
109
|
if (isDev) {
|
|
110
|
-
relinka("
|
|
110
|
+
relinka("log", `Skipping lib ${libName} NPM publish in development mode`);
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
113
|
try {
|
|
114
114
|
if (timer) pausePerfTimer(timer);
|
|
115
115
|
await withWorkingDirectory(libOutDir, async () => {
|
|
116
|
-
relinka("
|
|
116
|
+
relinka("log", `Publishing lib ${libName} to NPM from ${libOutDir}`);
|
|
117
117
|
const command = ["bun publish", distJsrDryRun ? "--dry-run" : ""].filter(Boolean).join(" ");
|
|
118
118
|
await execaCommand(command, { stdio: "inherit" });
|
|
119
119
|
relinka(
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
export async function regular_pubToJsr(distJsrDryRun, distJsrFailOnWarn, isDev, commonPubPause, distJsrDirName, distJsrAllowDirty, distJsrSlowTypes, timer) {
|
|
11
11
|
try {
|
|
12
12
|
if (isDev) {
|
|
13
|
-
relinka("
|
|
13
|
+
relinka("log", "Skipping JSR publish in development mode");
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
if (!commonPubPause) {
|
|
17
|
-
relinka("
|
|
17
|
+
relinka("log", "Publishing to JSR...");
|
|
18
18
|
const distJsrDirNameResolved = path.resolve(PROJECT_ROOT, distJsrDirName);
|
|
19
19
|
if (timer) pausePerfTimer(timer);
|
|
20
20
|
await withWorkingDirectory(distJsrDirNameResolved, async () => {
|
|
@@ -43,11 +43,11 @@ export async function regular_pubToJsr(distJsrDryRun, distJsrFailOnWarn, isDev,
|
|
|
43
43
|
export async function regular_pubToNpm(distJsrDryRun, isDev, commonPubPause, distNpmDirName, timer) {
|
|
44
44
|
try {
|
|
45
45
|
if (isDev) {
|
|
46
|
-
relinka("
|
|
46
|
+
relinka("log", "Skipping NPM publish in development mode");
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
if (!commonPubPause) {
|
|
50
|
-
relinka("
|
|
50
|
+
relinka("log", "Publishing to NPM...");
|
|
51
51
|
const distNpmDirNameResolved = path.resolve(PROJECT_ROOT, distNpmDirName);
|
|
52
52
|
if (timer) pausePerfTimer(timer);
|
|
53
53
|
await withWorkingDirectory(distNpmDirNameResolved, async () => {
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from "./build/build-regular.js";
|
|
7
7
|
import { regular_pubToJsr, regular_pubToNpm } from "./pub/pub-regular.js";
|
|
8
8
|
import { CONCURRENCY_DEFAULT } from "./utils/utils-consts.js";
|
|
9
|
-
export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, commonPubRegistry, coreEntrySrcDir, distNpmDirName, distNpmBuilder, coreEntryFile, distJsrDryRun, distJsrFailOnWarn, commonPubPause, distJsrDirName, distJsrBuilder, transpileTarget, transpileFormat, transpileSplitting, transpileMinify, transpileSourcemap, transpilePublicPath, distJsrAllowDirty, distJsrSlowTypes, unifiedBundlerOutExt, rmDepsMode, transpileStub, transpileWatch, distJsrGenTsconfig, coreDeclarations) {
|
|
9
|
+
export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, commonPubRegistry, coreEntrySrcDir, distNpmDirName, distNpmBuilder, coreEntryFile, distJsrDryRun, distJsrFailOnWarn, commonPubPause, distJsrDirName, distJsrBuilder, transpileTarget, transpileFormat, transpileSplitting, transpileMinify, transpileSourcemap, transpilePublicPath, distJsrAllowDirty, distJsrSlowTypes, unifiedBundlerOutExt, rmDepsMode, transpileStub, transpileWatch, distJsrGenTsconfig, coreDeclarations, config) {
|
|
10
10
|
if (libsActMode !== "main-project-only" && libsActMode !== "main-and-libs") {
|
|
11
11
|
relinka(
|
|
12
|
-
"
|
|
12
|
+
"log",
|
|
13
13
|
"Skipping main project build/publish as libsActMode is set to 'libs-only'"
|
|
14
14
|
);
|
|
15
15
|
return;
|
|
@@ -17,7 +17,7 @@ export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, c
|
|
|
17
17
|
switch (commonPubRegistry) {
|
|
18
18
|
case "jsr":
|
|
19
19
|
relinka(
|
|
20
|
-
"
|
|
20
|
+
"log",
|
|
21
21
|
"Initializing build process for main project to JSR only..."
|
|
22
22
|
);
|
|
23
23
|
await regular_buildJsrDist(
|
|
@@ -40,7 +40,8 @@ export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, c
|
|
|
40
40
|
transpileStub,
|
|
41
41
|
transpileWatch,
|
|
42
42
|
distJsrGenTsconfig,
|
|
43
|
-
coreDeclarations
|
|
43
|
+
coreDeclarations,
|
|
44
|
+
config
|
|
44
45
|
);
|
|
45
46
|
if (!isDev) {
|
|
46
47
|
await regular_pubToJsr(
|
|
@@ -57,7 +58,7 @@ export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, c
|
|
|
57
58
|
break;
|
|
58
59
|
case "npm":
|
|
59
60
|
relinka(
|
|
60
|
-
"
|
|
61
|
+
"log",
|
|
61
62
|
"Initializing build process for main project to NPM only..."
|
|
62
63
|
);
|
|
63
64
|
await regular_buildNpmDist(
|
|
@@ -78,7 +79,8 @@ export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, c
|
|
|
78
79
|
transpileStub,
|
|
79
80
|
transpileWatch,
|
|
80
81
|
timer,
|
|
81
|
-
coreDeclarations
|
|
82
|
+
coreDeclarations,
|
|
83
|
+
config
|
|
82
84
|
);
|
|
83
85
|
if (!isDev) {
|
|
84
86
|
await regular_pubToNpm(
|
|
@@ -92,7 +94,7 @@ export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, c
|
|
|
92
94
|
break;
|
|
93
95
|
case "npm-jsr": {
|
|
94
96
|
relinka(
|
|
95
|
-
"
|
|
97
|
+
"log",
|
|
96
98
|
"Initializing build process for main project to both NPM and JSR..."
|
|
97
99
|
);
|
|
98
100
|
const buildTasks = [
|
|
@@ -116,7 +118,8 @@ export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, c
|
|
|
116
118
|
transpileStub,
|
|
117
119
|
transpileWatch,
|
|
118
120
|
distJsrGenTsconfig,
|
|
119
|
-
coreDeclarations
|
|
121
|
+
coreDeclarations,
|
|
122
|
+
config
|
|
120
123
|
),
|
|
121
124
|
() => regular_buildNpmDist(
|
|
122
125
|
isDev,
|
|
@@ -136,7 +139,8 @@ export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, c
|
|
|
136
139
|
transpileStub,
|
|
137
140
|
transpileWatch,
|
|
138
141
|
timer,
|
|
139
|
-
coreDeclarations
|
|
142
|
+
coreDeclarations,
|
|
143
|
+
config
|
|
140
144
|
)
|
|
141
145
|
];
|
|
142
146
|
await pAll(buildTasks, { concurrency: CONCURRENCY_DEFAULT });
|
|
@@ -188,7 +192,8 @@ export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, c
|
|
|
188
192
|
transpileStub,
|
|
189
193
|
transpileWatch,
|
|
190
194
|
timer,
|
|
191
|
-
coreDeclarations
|
|
195
|
+
coreDeclarations,
|
|
196
|
+
config
|
|
192
197
|
),
|
|
193
198
|
() => regular_buildJsrDist(
|
|
194
199
|
isDev,
|
|
@@ -210,7 +215,8 @@ export async function processRegularFlow(timer, isDev, coreIsCLI, libsActMode, c
|
|
|
210
215
|
transpileStub,
|
|
211
216
|
transpileWatch,
|
|
212
217
|
distJsrGenTsconfig,
|
|
213
|
-
coreDeclarations
|
|
218
|
+
coreDeclarations,
|
|
219
|
+
config
|
|
214
220
|
)
|
|
215
221
|
];
|
|
216
222
|
await pAll(fallbackBuildTasks, { concurrency: CONCURRENCY_DEFAULT });
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { relinka } from "@reliverse/relinka";
|
|
2
2
|
export function printUsage(isDev) {
|
|
3
|
-
relinka("
|
|
4
|
-
relinka("
|
|
5
|
-
relinka("
|
|
3
|
+
relinka("log", "====================");
|
|
4
|
+
relinka("log", "TOOLS USAGE EXAMPLES");
|
|
5
|
+
relinka("log", "====================");
|
|
6
6
|
relinka(
|
|
7
|
-
"
|
|
7
|
+
"log",
|
|
8
8
|
`${isDev ? "bun dev:agg" : "dler tools"} --tool agg --input <dir> --out <file> [options]`
|
|
9
9
|
);
|
|
10
10
|
if (isDev) {
|
|
11
11
|
relinka(
|
|
12
|
-
"
|
|
12
|
+
"log",
|
|
13
13
|
"bun dev:tools agg --input src/libs/sdk/sdk-impl --out src/libs/sdk/sdk-mod.ts --recursive --named --strip src/libs/sdk"
|
|
14
14
|
);
|
|
15
15
|
} else {
|
|
16
16
|
relinka(
|
|
17
|
-
"
|
|
17
|
+
"log",
|
|
18
18
|
"dler tools --tool agg --input src/libs --out aggregator.ts --recursive --named"
|
|
19
19
|
);
|
|
20
20
|
}
|
|
@@ -91,10 +91,10 @@ export async function renameEntryFile(isJsr, outDirBin, originalEntryFileBasenam
|
|
|
91
91
|
}
|
|
92
92
|
if (sourceEntryPath !== targetEntryPath) {
|
|
93
93
|
await fs.rename(sourceEntryPath, targetEntryPath);
|
|
94
|
-
relinka("
|
|
94
|
+
relinka("log", `Renamed entry file to ${targetEntryPath}`);
|
|
95
95
|
} else {
|
|
96
96
|
relinka(
|
|
97
|
-
"
|
|
97
|
+
"log",
|
|
98
98
|
`Source entry file ${sourceEntryPath} already has the target name. Skipping rename.`
|
|
99
99
|
);
|
|
100
100
|
}
|
|
@@ -37,7 +37,7 @@ const TS_VERSION_REGEXES = [
|
|
|
37
37
|
export async function bumpHandler(bumpMode, bumpDisable, commonPubPause, bumpFilter) {
|
|
38
38
|
if (bumpDisable || commonPubPause) {
|
|
39
39
|
relinka(
|
|
40
|
-
"
|
|
40
|
+
"log",
|
|
41
41
|
"Skipping version bump because it is either `bumpDisable: true` or `commonPubPause: true` in your dler config."
|
|
42
42
|
);
|
|
43
43
|
return;
|
|
@@ -55,7 +55,7 @@ export async function bumpHandler(bumpMode, bumpDisable, commonPubPause, bumpFil
|
|
|
55
55
|
throw new Error(`Invalid existing version in package.json: ${oldVersion}`);
|
|
56
56
|
}
|
|
57
57
|
relinka(
|
|
58
|
-
"
|
|
58
|
+
"log",
|
|
59
59
|
`Auto-incrementing version from ${oldVersion} using "${bumpMode}"`
|
|
60
60
|
);
|
|
61
61
|
const incremented = autoIncrementVersion(oldVersion, bumpMode);
|
|
@@ -63,7 +63,7 @@ export async function bumpHandler(bumpMode, bumpDisable, commonPubPause, bumpFil
|
|
|
63
63
|
await bumpVersions(oldVersion, incremented, bumpFilter);
|
|
64
64
|
await setBumpDisabled(true, commonPubPause);
|
|
65
65
|
} else {
|
|
66
|
-
relinka("
|
|
66
|
+
relinka("log", `Version is already at ${oldVersion}, no bump needed.`);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
export async function setBumpDisabled(value, commonPubPause) {
|
|
@@ -72,7 +72,7 @@ export async function setBumpDisabled(value, commonPubPause) {
|
|
|
72
72
|
}
|
|
73
73
|
const dlerCfgPath = path.join(PROJECT_ROOT, ".config/dler.ts");
|
|
74
74
|
if (!await fs.pathExists(dlerCfgPath)) {
|
|
75
|
-
relinka("
|
|
75
|
+
relinka("log", "No .config/dler.ts found to update bumpDisable");
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
let content = await readFileSafe(dlerCfgPath, "", "bumpDisable update");
|
|
@@ -157,11 +157,8 @@ ${filesToDelete.join("\n")}`);
|
|
|
157
157
|
await pMap(snapshotDirs, async (dir) => fs.remove(dir), {
|
|
158
158
|
concurrency: CONCURRENCY_DEFAULT
|
|
159
159
|
});
|
|
160
|
-
relinka(
|
|
161
|
-
|
|
162
|
-
`Deleted snapshot directories:
|
|
163
|
-
${snapshotDirs.join("\n")}`
|
|
164
|
-
);
|
|
160
|
+
relinka("log", `Deleted snapshot directories:
|
|
161
|
+
${snapshotDirs.join("\n")}`);
|
|
165
162
|
}
|
|
166
163
|
}
|
|
167
164
|
export async function readFileSafe(filePath, isJsr, reason) {
|
|
@@ -19,22 +19,22 @@ export async function finalizeBuild(timer, commonPubPause, libsList, distNpmDirN
|
|
|
19
19
|
});
|
|
20
20
|
if (!commonPubPause) {
|
|
21
21
|
relinka(
|
|
22
|
-
"
|
|
22
|
+
"info",
|
|
23
23
|
`\u{1F389} Build and publishing completed successfully (in ${transpileFormattedTime})`
|
|
24
24
|
);
|
|
25
25
|
} else {
|
|
26
26
|
relinka(
|
|
27
|
-
"
|
|
27
|
+
"info",
|
|
28
28
|
`\u{1F389} Test build completed successfully (in ${transpileFormattedTime})`
|
|
29
29
|
);
|
|
30
30
|
if (!isDev) {
|
|
31
31
|
relinka(
|
|
32
|
-
"
|
|
32
|
+
"warn",
|
|
33
33
|
"\u{1F4DD} Publish process is currently paused in your config file"
|
|
34
34
|
);
|
|
35
35
|
} else {
|
|
36
36
|
relinka(
|
|
37
|
-
"
|
|
37
|
+
"warn",
|
|
38
38
|
"\u{1F4DD} Publish is paused, you're in dev mode (use `bun pub` to publish)"
|
|
39
39
|
);
|
|
40
40
|
}
|
|
@@ -5,7 +5,7 @@ import path from "pathe";
|
|
|
5
5
|
import { readPackageJSON } from "pkg-types";
|
|
6
6
|
import { glob } from "tinyglobby";
|
|
7
7
|
import { cliDomainDocs, CONCURRENCY_DEFAULT } from "./utils-consts.js";
|
|
8
|
-
export async function createJsrJSON(outDirRoot, isLib, libName = "unknown-lib-name", libDescription = "unknown-lib-description") {
|
|
8
|
+
export async function createJsrJSON(outDirRoot, isLib, libName = "unknown-lib-name", libDescription = "unknown-lib-description", coreDescription) {
|
|
9
9
|
relinka("verbose", `Creating jsr.json configuration (isLib: ${isLib})`);
|
|
10
10
|
const originalPkg = await readPackageJSON();
|
|
11
11
|
let { description, name } = originalPkg;
|
|
@@ -13,6 +13,8 @@ export async function createJsrJSON(outDirRoot, isLib, libName = "unknown-lib-na
|
|
|
13
13
|
if (isLib) {
|
|
14
14
|
name = libName;
|
|
15
15
|
description = libDescription;
|
|
16
|
+
} else {
|
|
17
|
+
description = coreDescription || description;
|
|
16
18
|
}
|
|
17
19
|
const pkgHomepage = cliDomainDocs;
|
|
18
20
|
const jsrConfig = {
|
|
@@ -545,11 +545,11 @@ export async function convertImportPaths(options) {
|
|
|
545
545
|
throw error;
|
|
546
546
|
}
|
|
547
547
|
relinka(
|
|
548
|
-
"
|
|
548
|
+
"log",
|
|
549
549
|
`Starting import path conversion (${fromType} -> ${toType}) in directory: ${baseDir}`
|
|
550
550
|
);
|
|
551
551
|
if (distJsrDryRun) {
|
|
552
|
-
relinka("
|
|
552
|
+
relinka("log", "Dry run mode enabled: No files will be modified.");
|
|
553
553
|
}
|
|
554
554
|
const fileProcessor = async (filePath) => {
|
|
555
555
|
return processFileContent(
|
|
@@ -585,7 +585,7 @@ export async function convertImportPaths(options) {
|
|
|
585
585
|
).length;
|
|
586
586
|
const errorResults = results.filter((r) => !r.success);
|
|
587
587
|
relinka(
|
|
588
|
-
"
|
|
588
|
+
"log",
|
|
589
589
|
`Import path conversion finished. ${successCount} files processed successfully (${changedCount} modified), ${errorResults.length} errors.`
|
|
590
590
|
);
|
|
591
591
|
for (const result of errorResults) {
|
|
@@ -618,11 +618,11 @@ export async function convertImportExtensionsJsToTs(options) {
|
|
|
618
618
|
throw error;
|
|
619
619
|
}
|
|
620
620
|
relinka(
|
|
621
|
-
"
|
|
621
|
+
"log",
|
|
622
622
|
`Starting .js -> .ts import extension conversion in directory: ${absoluteDirPath}`
|
|
623
623
|
);
|
|
624
624
|
if (distJsrDryRun) {
|
|
625
|
-
relinka("
|
|
625
|
+
relinka("log", "Dry run mode enabled: No files will be modified.");
|
|
626
626
|
}
|
|
627
627
|
const fileProcessor = async (filePath) => {
|
|
628
628
|
return processFileContent(
|
|
@@ -645,7 +645,7 @@ export async function convertImportExtensionsJsToTs(options) {
|
|
|
645
645
|
).length;
|
|
646
646
|
const errorResults = results.filter((r) => !r.success);
|
|
647
647
|
relinka(
|
|
648
|
-
"
|
|
648
|
+
"log",
|
|
649
649
|
`Extension conversion finished. ${successCount} files processed successfully (${changedCount} modified), ${errorResults.length} errors.`
|
|
650
650
|
);
|
|
651
651
|
for (const result of errorResults) {
|
|
@@ -103,7 +103,7 @@ async function library_getlibPkgKeepDeps(libName, originalDeps, outDirBin, isJsr
|
|
|
103
103
|
return result2;
|
|
104
104
|
}
|
|
105
105
|
if (libConfig.libPkgKeepDeps === true) {
|
|
106
|
-
relinka("
|
|
106
|
+
relinka("log", `Preserving all dependencies for lib ${libName}`);
|
|
107
107
|
const originalPkg = await readPackageJSON();
|
|
108
108
|
const devDeps = originalDeps === originalPkg.devDependencies;
|
|
109
109
|
const result2 = Object.entries(originalDeps).reduce(
|
|
@@ -129,7 +129,7 @@ async function library_getlibPkgKeepDeps(libName, originalDeps, outDirBin, isJsr
|
|
|
129
129
|
}
|
|
130
130
|
if (Array.isArray(libConfig.libPkgKeepDeps)) {
|
|
131
131
|
relinka(
|
|
132
|
-
"
|
|
132
|
+
"log",
|
|
133
133
|
`Including specific dependencies for lib ${libName}: ${libConfig.libPkgKeepDeps.join(", ")}`
|
|
134
134
|
);
|
|
135
135
|
const result2 = Object.entries(originalDeps).reduce(
|
|
@@ -6,12 +6,15 @@ import {
|
|
|
6
6
|
readPackageJSON
|
|
7
7
|
} from "pkg-types";
|
|
8
8
|
import { cliDomainDocs } from "./utils-consts.js";
|
|
9
|
-
export async function regular_createPackageJSON(outDirRoot, isJsr, coreIsCLI, unifiedBundlerOutExt, rmDepsMode, rmDepsPatterns) {
|
|
9
|
+
export async function regular_createPackageJSON(outDirRoot, isJsr, coreIsCLI, unifiedBundlerOutExt, rmDepsMode, rmDepsPatterns, coreDescription) {
|
|
10
10
|
relinka(
|
|
11
|
-
"
|
|
11
|
+
"log",
|
|
12
12
|
`Generating distribution package.json and tsconfig.json (isJsr=${isJsr})...`
|
|
13
13
|
);
|
|
14
|
-
const commonPkg = await regular_createCommonPackageFields(
|
|
14
|
+
const commonPkg = await regular_createCommonPackageFields(
|
|
15
|
+
coreIsCLI,
|
|
16
|
+
coreDescription
|
|
17
|
+
);
|
|
15
18
|
const originalPkg = await readPackageJSON();
|
|
16
19
|
const packageName = originalPkg.name || "";
|
|
17
20
|
const cliCommandName = packageName.startsWith("@") ? packageName.split("/").pop() || "cli" : packageName;
|
|
@@ -104,7 +107,7 @@ export async function regular_createPackageJSON(outDirRoot, isJsr, coreIsCLI, un
|
|
|
104
107
|
}
|
|
105
108
|
relinka("verbose", `Created package.json in ${outDirRoot}`);
|
|
106
109
|
}
|
|
107
|
-
async function regular_createCommonPackageFields(coreIsCLI) {
|
|
110
|
+
async function regular_createCommonPackageFields(coreIsCLI, coreDescription) {
|
|
108
111
|
relinka("verbose", "Generating common package fields");
|
|
109
112
|
const originalPkg = await readPackageJSON();
|
|
110
113
|
const { author, description, keywords, license, name, version } = originalPkg;
|
|
@@ -112,7 +115,7 @@ async function regular_createCommonPackageFields(coreIsCLI) {
|
|
|
112
115
|
const pkgHomepage = cliDomainDocs;
|
|
113
116
|
const commonPkg = {
|
|
114
117
|
dependencies: originalPkg.dependencies || {},
|
|
115
|
-
description,
|
|
118
|
+
description: coreDescription || description,
|
|
116
119
|
homepage: pkgHomepage,
|
|
117
120
|
license: license || "MIT",
|
|
118
121
|
name,
|
package/bin/load.js
CHANGED
package/bin/tools.txt
CHANGED
|
@@ -60,7 +60,7 @@ const tools = defineCommand()
|
|
|
60
60
|
}
|
|
61
61
|
if (!TOOLS.includes(args.tool as string)) {
|
|
62
62
|
relinka("error", `Error: Invalid tool: ${args.tool}`);
|
|
63
|
-
relinka("
|
|
63
|
+
relinka("log", `Available tools: ${TOOLS.join(", ")}`);
|
|
64
64
|
printUsage(isDev);
|
|
65
65
|
process.exit(1);
|
|
66
66
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@reliverse/relico": "^1.1.
|
|
4
|
-
"@reliverse/relinka": "^1.4.
|
|
3
|
+
"@reliverse/relico": "^1.1.1",
|
|
4
|
+
"@reliverse/relinka": "^1.4.2",
|
|
5
5
|
"@reliverse/rempts": "^1.6.2",
|
|
6
6
|
"@rollup/plugin-alias": "^5.1.1",
|
|
7
7
|
"@rollup/plugin-commonjs": "^28.0.3",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"name": "@reliverse/dler",
|
|
43
43
|
"type": "module",
|
|
44
|
-
"version": "1.2.
|
|
44
|
+
"version": "1.2.2",
|
|
45
45
|
"keywords": [
|
|
46
46
|
"reliverse",
|
|
47
47
|
"cli",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@types/semver": "^7.7.0",
|
|
72
72
|
"eslint": "^9.26.0",
|
|
73
73
|
"eslint-plugin-no-relative-import-paths": "^1.6.1",
|
|
74
|
-
"eslint-plugin-perfectionist": "^4.
|
|
74
|
+
"eslint-plugin-perfectionist": "^4.13.0",
|
|
75
75
|
"knip": "^5.55.1",
|
|
76
76
|
"typescript": "^5.8.3",
|
|
77
77
|
"typescript-eslint": "^8.32.1"
|