@reliverse/dler 1.4.1 → 1.4.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/impl.js CHANGED
@@ -27,7 +27,6 @@ export async function dlerBuild(isDev) {
27
27
  await bumpHandler(
28
28
  config.bumpMode,
29
29
  config.bumpDisable,
30
- pausePublishing,
31
30
  config.bumpFilter,
32
31
  config.bumpSet
33
32
  );
@@ -124,7 +123,6 @@ export async function dlerPub(isDev) {
124
123
  await bumpHandler(
125
124
  config.bumpMode,
126
125
  config.bumpDisable,
127
- config.commonPubPause,
128
126
  config.bumpFilter,
129
127
  config.bumpSet
130
128
  );
@@ -1,6 +1,6 @@
1
1
  import { isAbsolute, resolve } from "@reliverse/pathkit";
2
+ import { resolveAlias } from "@reliverse/pathkit";
2
3
  import { parseNodeModulePath } from "mlly";
3
- import { resolveAlias } from "pathe/utils";
4
4
  import {
5
5
  arrayIncludes,
6
6
  getpkg,
@@ -79,11 +79,11 @@ export declare function handleInteractiveSession(config: SessionConfig, projectV
79
79
  mismatchedFiles: FileAnalysis[];
80
80
  fileAnalysis: FileAnalysis[];
81
81
  }>;
82
- /**
83
- * Handles version bumping using @reliverse/bleump
84
- */
85
- export declare function bumpHandler(bumpMode: BumpMode, bumpDisable: boolean, commonPubPause: boolean, bumpFilter: string[], bumpSet?: string): Promise<void>;
86
82
  /**
87
83
  * Updates the "bumpDisable" flag in the build configuration file.
88
84
  */
89
85
  export declare function setBumpDisabled(value: boolean, commonPubPause: boolean): Promise<void>;
86
+ /**
87
+ * Handles version bumping using @reliverse/bleump
88
+ */
89
+ export declare function bumpHandler(bumpMode: BumpMode, bumpDisable: boolean, bumpFilter: string[], bumpSet?: string): Promise<void>;
@@ -359,50 +359,58 @@ async function fileExists(filePath) {
359
359
  return false;
360
360
  }
361
361
  }
362
- export async function bumpHandler(bumpMode, bumpDisable, commonPubPause, bumpFilter, bumpSet) {
363
- if (bumpDisable || commonPubPause) {
364
- relinka("info", "Version bumping is disabled or paused");
365
- return;
366
- }
367
- try {
368
- const files = bumpFilter.length > 0 ? bumpFilter : ["package.json"];
369
- await bumpVersionWithAnalysis(bumpMode, files, {
370
- dryRun: false,
371
- verbose: true,
372
- customVersion: bumpMode === "manual" ? bumpSet : void 0
373
- });
374
- relinka("success", "Version bump completed successfully");
375
- } catch (error) {
376
- relinka("error", "Failed to bump version", error);
377
- throw error;
378
- }
379
- }
380
- export async function setBumpDisabled(value, commonPubPause) {
381
- if (commonPubPause && value) {
382
- return;
383
- }
384
- const dlerCfgTs = join(PROJECT_ROOT, ".config/dler.ts");
385
- const dlerCfgJs = join(PROJECT_ROOT, ".config/dler.js");
386
- const dlerCfgPath = await fileExists(dlerCfgTs) ? dlerCfgTs : dlerCfgJs;
362
+ async function updateDlerConfig(key, value) {
363
+ const dlerCfgPath = join(PROJECT_ROOT, ".config/dler.ts");
387
364
  if (!await fileExists(dlerCfgPath)) {
388
365
  relinka(
389
366
  "warn",
390
- "No .config/dler.ts or .config/dler.js found to update bumpDisable. This is not an error, but the bumpDisable flag will not be updated."
367
+ `No .config/dler.ts found to update ${key}. This is not an error, but the ${key} flag will not be updated.`
391
368
  );
392
369
  return;
393
370
  }
394
371
  try {
395
- let content = await readFile(dlerCfgPath, "utf-8");
396
- content = content.replace(
397
- /bumpDisable\s*:\s*(true|false)/,
398
- `bumpDisable: ${value}`
372
+ const content = await readFile(dlerCfgPath, "utf-8");
373
+ const formattedValue = Array.isArray(value) ? `[${value.map((v) => `"${v}"`).join(", ")}]` : typeof value === "string" ? `"${value}"` : value;
374
+ const pattern = new RegExp(`${key}\\s*[:=]\\s*([^,}\\]]+)`);
375
+ const updatedContent = content.replace(
376
+ pattern,
377
+ `${key}: ${formattedValue}`
378
+ );
379
+ await writeFile(dlerCfgPath, updatedContent, "utf-8");
380
+ relinka(
381
+ "info",
382
+ `Successfully updated ${key} to ${formattedValue} in .config/dler.ts`
399
383
  );
400
- await writeFile(dlerCfgPath, content, "utf-8");
401
384
  } catch (error) {
402
385
  relinka(
403
386
  "warn",
404
- `Failed to update bumpDisable in ${dlerCfgPath}. This is not an error, but the bumpDisable flag will not be updated.`,
387
+ `Failed to update ${key} in ${dlerCfgPath}. This is not an error, but the ${key} flag will not be updated.`,
405
388
  error
406
389
  );
407
390
  }
408
391
  }
392
+ export async function setBumpDisabled(value, commonPubPause) {
393
+ if (commonPubPause && !value) {
394
+ return;
395
+ }
396
+ await getConfigFromDler();
397
+ await updateDlerConfig("bumpDisable", value);
398
+ }
399
+ export async function bumpHandler(bumpMode, bumpDisable, bumpFilter, bumpSet) {
400
+ if (bumpDisable) {
401
+ relinka("info", "Version bumping is paused");
402
+ return;
403
+ }
404
+ try {
405
+ const files = bumpFilter.length > 0 ? bumpFilter : ["package.json"];
406
+ await bumpVersionWithAnalysis(bumpMode, files, {
407
+ dryRun: false,
408
+ verbose: true,
409
+ customVersion: bumpMode === "manual" ? bumpSet : void 0
410
+ });
411
+ relinka("success", "Version bump completed successfully");
412
+ } catch (error) {
413
+ relinka("error", "Failed to bump version", error);
414
+ throw error;
415
+ }
416
+ }
@@ -30,7 +30,6 @@ export type { SpellType, SpellParams, Spell, SpellExecutionOptions, FileOperatio
30
30
  export { useAggregator } from "./sdk-impl/utils/tools/tools-agg.js";
31
31
  export { printUsage } from "./sdk-impl/utils/tools/tools-impl.js";
32
32
  export { getBunSourcemapOption, getUnifiedSourcemapOption, renameEntryFile, } from "./sdk-impl/utils/utils-build.js";
33
- export { bumpHandler, setBumpDisabled } from "./sdk-impl/utils/utils-bump.js";
34
33
  export { removeDistFolders } from "./sdk-impl/utils/utils-clean.js";
35
34
  export { PROJECT_ROOT, CONCURRENCY_DEFAULT, tsconfigJson, cliDomainDocs, validExtensions, SHOW_VERBOSE, } from "./sdk-impl/utils/utils-consts.js";
36
35
  export { validateDevCwd, withWorkingDirectory, } from "./sdk-impl/utils/utils-cwd.js";
@@ -95,7 +95,6 @@ export {
95
95
  getUnifiedSourcemapOption,
96
96
  renameEntryFile
97
97
  } from "./sdk-impl/utils/utils-build.js";
98
- export { bumpHandler, setBumpDisabled } from "./sdk-impl/utils/utils-bump.js";
99
98
  export { removeDistFolders } from "./sdk-impl/utils/utils-clean.js";
100
99
  export {
101
100
  PROJECT_ROOT,
package/package.json CHANGED
@@ -43,7 +43,7 @@
43
43
  "license": "MIT",
44
44
  "name": "@reliverse/dler",
45
45
  "type": "module",
46
- "version": "1.4.1",
46
+ "version": "1.4.2",
47
47
  "keywords": [
48
48
  "reliverse",
49
49
  "cli",