relizy 0.2.7 → 0.3.0

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/dist/cli.mjs CHANGED
@@ -5,7 +5,7 @@ import process from 'node:process';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import { printBanner, logger } from '@maz-ui/node';
7
7
  import { Command } from 'commander';
8
- import { W as isInCI, X as getCIName, b as bump, c as changelog, e as publish, a as providerRelease, r as release } from './shared/relizy.6FWq4lmP.mjs';
8
+ import { Y as isInCI, Z as getCIName, b as bump, c as changelog, e as publish, a as providerRelease, r as release } from './shared/relizy.B4guss__.mjs';
9
9
  import 'changelogen';
10
10
  import 'fast-glob';
11
11
  import '@inquirer/prompts';
package/dist/index.d.mts CHANGED
@@ -37,22 +37,25 @@ declare function getDefaultConfig(): {
37
37
  emptyChangelogContent: string;
38
38
  };
39
39
  excludeAuthors: never[];
40
- noAuthors: boolean;
40
+ noAuthors: false;
41
41
  bump: Required<Omit<BumpConfig, "preid">>;
42
42
  changelog: Required<ChangelogConfig>;
43
43
  publish: {
44
- private: boolean;
44
+ private: false;
45
45
  args: never[];
46
- safetyCheck: boolean;
46
+ token: string | undefined;
47
+ registry: string;
48
+ safetyCheck: false;
47
49
  };
48
50
  tokens: {
51
+ registry: string | undefined;
49
52
  gitlab: string | undefined;
50
53
  github: string | undefined;
51
54
  };
52
55
  scopeMap: {};
53
56
  release: Required<ReleaseConfig>;
54
57
  logLevel: LogLevel;
55
- safetyCheck: boolean;
58
+ safetyCheck: true;
56
59
  };
57
60
  declare function loadRelizyConfig(options?: {
58
61
  baseConfig?: ResolvedRelizyConfig;
@@ -100,7 +103,7 @@ declare function expandPackagesToBumpWithDependents({ allPackages, packagesWithC
100
103
  */
101
104
  declare function topologicalSort(packages: PackageBase[]): PackageBase[];
102
105
 
103
- declare function getGitStatus(cwd?: string): string;
106
+ declare function getGitStatus(cwd?: string, trim?: boolean): string;
104
107
  declare function checkGitStatusIfDirty(): void;
105
108
  declare function fetchGitTags(cwd?: string): Promise<void>;
106
109
  declare function detectGitProvider(cwd?: string): GitProvider | null;
@@ -108,6 +111,13 @@ declare function parseGitRemoteUrl(remoteUrl: string): {
108
111
  owner: string;
109
112
  repo: string;
110
113
  } | null;
114
+ /**
115
+ * Get files modified in git status that are relevant for release
116
+ * Returns only package.json, CHANGELOG.md, and lerna.json files
117
+ */
118
+ declare function getModifiedReleaseFilePatterns({ config }: {
119
+ config: ResolvedRelizyConfig;
120
+ }): string[];
111
121
  declare function createCommitAndTags({ config, noVerify, bumpedPackages, newVersion, dryRun, logLevel, }: {
112
122
  config: ResolvedRelizyConfig;
113
123
  noVerify: boolean;
@@ -122,6 +132,13 @@ declare function pushCommitAndTags({ config, dryRun, logLevel, cwd }: {
122
132
  logLevel?: LogLevel;
123
133
  cwd: string;
124
134
  }): Promise<void>;
135
+ /**
136
+ * Rollback modified files to their last committed state
137
+ * Used when publish fails before commit/tag/push operations
138
+ */
139
+ declare function rollbackModifiedFiles({ config, }: {
140
+ config: ResolvedRelizyConfig;
141
+ }): Promise<void>;
125
142
  declare function getFirstCommit(cwd: string): string;
126
143
  declare function getCurrentGitBranch(cwd: string): string;
127
144
  declare function getCurrentGitRef(cwd: string): string;
@@ -223,12 +240,14 @@ declare function getLastTag({ logLevel, cwd }: {
223
240
  }): Promise<string>;
224
241
  declare function getLastRepoTag(options?: {
225
242
  onlyStable?: boolean;
243
+ currentVersion?: string;
226
244
  logLevel?: LogLevel;
227
245
  cwd?: string;
228
246
  }): Promise<string | null>;
229
- declare function getLastPackageTag({ packageName, onlyStable, logLevel, cwd, }: {
247
+ declare function getLastPackageTag({ packageName, onlyStable, currentVersion, logLevel, cwd, }: {
230
248
  packageName: string;
231
249
  onlyStable?: boolean;
250
+ currentVersion?: string;
232
251
  logLevel?: LogLevel;
233
252
  cwd?: string;
234
253
  }): Promise<string | null>;
@@ -334,6 +353,48 @@ declare function getBumpedIndependentPackages({ packages, dryRun, }: {
334
353
  packages: PackageBase[];
335
354
  dryRun: boolean;
336
355
  }): PackageBase[];
356
+ /**
357
+ * Determines if prerelease tags should be filtered out when searching for tags.
358
+ * Returns true when the current version is stable AND we're not graduating to stable.
359
+ *
360
+ * This prevents beta/prerelease tags from being used as the base for stable version bumps.
361
+ *
362
+ * @example
363
+ * shouldFilterPrereleaseTags('4.1.1', false) // true - stable version, not graduating
364
+ * shouldFilterPrereleaseTags('4.1.1-beta.0', true) // false - graduating to stable
365
+ * shouldFilterPrereleaseTags('4.1.1-beta.0', false) // false - prerelease version
366
+ */
367
+ declare function shouldFilterPrereleaseTags(currentVersion: string, graduating: boolean): boolean;
368
+ /**
369
+ * Extracts a semantic version from a git tag.
370
+ * Supports multiple tag formats:
371
+ * - v1.2.3 → 1.2.3
372
+ * - 1.2.3 → 1.2.3
373
+ * - package-name@1.2.3 → 1.2.3
374
+ * - v1.2.3-beta.0 → 1.2.3-beta.0
375
+ *
376
+ * @param tag - The git tag to extract version from
377
+ * @param packageName - Optional package name for independent mode tags (e.g., "pkg-name@1.2.3")
378
+ * @returns The extracted version string or null if invalid
379
+ */
380
+ declare function extractVersionFromTag(tag: string, packageName?: string): string | null;
381
+ /**
382
+ * Checks if a tag's version is compatible with the current version.
383
+ * A tag is compatible if its major version is less than or equal to the current major version.
384
+ *
385
+ * This prevents accidentally using tags from future major versions (e.g., v5.0.0-beta.0)
386
+ * when bumping a current stable version (e.g., 4.1.1 → 4.1.2).
387
+ *
388
+ * @param tagVersion - The semantic version extracted from the tag
389
+ * @param currentVersion - The current package version
390
+ * @returns true if the tag version's major is <= current major version
391
+ *
392
+ * @example
393
+ * isTagVersionCompatibleWithCurrent('4.1.1', '4.1.0') // true - same major
394
+ * isTagVersionCompatibleWithCurrent('5.0.0-beta.0', '4.1.1') // false - newer major
395
+ * isTagVersionCompatibleWithCurrent('3.9.9', '4.1.1') // true - older major
396
+ */
397
+ declare function isTagVersionCompatibleWithCurrent(tagVersion: string, currentVersion: string): boolean;
337
398
 
338
399
  type VersionMode = 'unified' | 'independent' | 'selective';
339
400
  type GitProvider = 'github' | 'gitlab';
@@ -835,6 +896,15 @@ interface RepoConfig {
835
896
  }
836
897
  type HookType = 'before' | 'success' | 'error';
837
898
  type HookStep = 'bump' | 'changelog' | 'commit-and-tag' | 'provider-release' | 'publish' | 'push' | 'release';
899
+ /**
900
+ * Tokens configuration
901
+ * @default {}
902
+ */
903
+ interface TokensConfig {
904
+ registry?: string;
905
+ gitlab?: string;
906
+ github?: string;
907
+ }
838
908
  /**
839
909
  * Hooks configuration
840
910
  * Useful to run custom scripts before, after a step or on error
@@ -851,7 +921,7 @@ type HookConfig = {
851
921
  * Relizy configuration
852
922
  * @see https://louismazel.github.io/relizy/config/overview
853
923
  */
854
- interface RelizyConfig extends Partial<Omit<ChangelogConfig$1, 'output' | 'templates' | 'publish' | 'types'>> {
924
+ interface RelizyConfig extends Partial<Omit<ChangelogConfig$1, 'output' | 'templates' | 'publish' | 'types' | 'tokens'>> {
855
925
  types?: Record<string, {
856
926
  title: string;
857
927
  semver?: SemverBumpType;
@@ -897,6 +967,10 @@ interface RelizyConfig extends Partial<Omit<ChangelogConfig$1, 'output' | 'templ
897
967
  * Release config
898
968
  */
899
969
  release?: ReleaseConfig;
970
+ /**
971
+ * Tokens config
972
+ */
973
+ tokens?: TokensConfig;
900
974
  /**
901
975
  * Hooks config
902
976
  */
@@ -935,5 +1009,5 @@ declare function publish(options?: Partial<PublishOptions>): Promise<{
935
1009
 
936
1010
  declare function release(options?: Partial<ReleaseOptions>): Promise<void>;
937
1011
 
938
- export { bump, changelog, checkGitStatusIfDirty, confirmBump, createCommitAndTags, createGitlabRelease, defineConfig, detectGitProvider, detectPackageManager, determinePublishTag, determineReleaseType, determineSemverChange, executeBuildCmd, executeFormatCmd, executeHook, expandPackagesToBumpWithDependents, extractVersionFromPackageTag, fetchGitTags, generateChangelog, getAuthCommand, getBumpedIndependentPackages, getBumpedPackageIndependently, getCIName, getCurrentGitBranch, getCurrentGitRef, getDefaultConfig, getDependentsOf, getFirstCommit, getGitStatus, getIndependentTag, getLastPackageTag, getLastRepoTag, getLastStableTag, getLastTag, getPackageCommits, getPackageDependencies, getPackageNewVersion, getPackages, getPackagesOrBumpedPackages, getPackagesToPublishInIndependentMode, getPackagesToPublishInSelectiveMode, getPreid, getRootPackage, github, gitlab, hasLernaJson, isBumpedPackage, isChangedPreid, isGraduating, isGraduatingToStableBetweenVersion, isInCI, isPrerelease, isPrereleaseReleaseType, isStableReleaseType, loadRelizyConfig, parseGitRemoteUrl, providerRelease, providerReleaseSafetyCheck, publish, publishPackage, publishSafetyCheck, pushCommitAndTags, readPackageJson, readPackages, release, resolveTags, topologicalSort, updateLernaVersion, writeChangelogToFile, writeVersion };
939
- export type { BumpConfig, BumpOptions, BumpResult, BumpResultFalsy, BumpResultTruthy, ChangelogConfig, ChangelogOptions, ConfigType, GitProvider, GitlabRelease, GitlabReleaseResponse, HookConfig, HookStep, HookType, MonorepoConfig, PackageBase, PackageManager, PostedRelease, ProviderReleaseOptions, PublishConfig, PublishOptions, PublishResponse, ReadPackage, ReleaseConfig, ReleaseOptions, RelizyConfig, RepoConfig, ResolvedConfig, ResolvedRelizyConfig, ResolvedTags, RootPackage, Step, TemplatesConfig, VersionMode };
1012
+ export { bump, changelog, checkGitStatusIfDirty, confirmBump, createCommitAndTags, createGitlabRelease, defineConfig, detectGitProvider, detectPackageManager, determinePublishTag, determineReleaseType, determineSemverChange, executeBuildCmd, executeFormatCmd, executeHook, expandPackagesToBumpWithDependents, extractVersionFromPackageTag, extractVersionFromTag, fetchGitTags, generateChangelog, getAuthCommand, getBumpedIndependentPackages, getBumpedPackageIndependently, getCIName, getCurrentGitBranch, getCurrentGitRef, getDefaultConfig, getDependentsOf, getFirstCommit, getGitStatus, getIndependentTag, getLastPackageTag, getLastRepoTag, getLastStableTag, getLastTag, getModifiedReleaseFilePatterns, getPackageCommits, getPackageDependencies, getPackageNewVersion, getPackages, getPackagesOrBumpedPackages, getPackagesToPublishInIndependentMode, getPackagesToPublishInSelectiveMode, getPreid, getRootPackage, github, gitlab, hasLernaJson, isBumpedPackage, isChangedPreid, isGraduating, isGraduatingToStableBetweenVersion, isInCI, isPrerelease, isPrereleaseReleaseType, isStableReleaseType, isTagVersionCompatibleWithCurrent, loadRelizyConfig, parseGitRemoteUrl, providerRelease, providerReleaseSafetyCheck, publish, publishPackage, publishSafetyCheck, pushCommitAndTags, readPackageJson, readPackages, release, resolveTags, rollbackModifiedFiles, shouldFilterPrereleaseTags, topologicalSort, updateLernaVersion, writeChangelogToFile, writeVersion };
1013
+ export type { BumpConfig, BumpOptions, BumpResult, BumpResultFalsy, BumpResultTruthy, ChangelogConfig, ChangelogOptions, ConfigType, GitProvider, GitlabRelease, GitlabReleaseResponse, HookConfig, HookStep, HookType, MonorepoConfig, PackageBase, PackageManager, PostedRelease, ProviderReleaseOptions, PublishConfig, PublishOptions, PublishResponse, ReadPackage, ReleaseConfig, ReleaseOptions, RelizyConfig, RepoConfig, ResolvedConfig, ResolvedRelizyConfig, ResolvedTags, RootPackage, Step, TemplatesConfig, TokensConfig, VersionMode };
package/dist/index.d.ts CHANGED
@@ -37,22 +37,25 @@ declare function getDefaultConfig(): {
37
37
  emptyChangelogContent: string;
38
38
  };
39
39
  excludeAuthors: never[];
40
- noAuthors: boolean;
40
+ noAuthors: false;
41
41
  bump: Required<Omit<BumpConfig, "preid">>;
42
42
  changelog: Required<ChangelogConfig>;
43
43
  publish: {
44
- private: boolean;
44
+ private: false;
45
45
  args: never[];
46
- safetyCheck: boolean;
46
+ token: string | undefined;
47
+ registry: string;
48
+ safetyCheck: false;
47
49
  };
48
50
  tokens: {
51
+ registry: string | undefined;
49
52
  gitlab: string | undefined;
50
53
  github: string | undefined;
51
54
  };
52
55
  scopeMap: {};
53
56
  release: Required<ReleaseConfig>;
54
57
  logLevel: LogLevel;
55
- safetyCheck: boolean;
58
+ safetyCheck: true;
56
59
  };
57
60
  declare function loadRelizyConfig(options?: {
58
61
  baseConfig?: ResolvedRelizyConfig;
@@ -100,7 +103,7 @@ declare function expandPackagesToBumpWithDependents({ allPackages, packagesWithC
100
103
  */
101
104
  declare function topologicalSort(packages: PackageBase[]): PackageBase[];
102
105
 
103
- declare function getGitStatus(cwd?: string): string;
106
+ declare function getGitStatus(cwd?: string, trim?: boolean): string;
104
107
  declare function checkGitStatusIfDirty(): void;
105
108
  declare function fetchGitTags(cwd?: string): Promise<void>;
106
109
  declare function detectGitProvider(cwd?: string): GitProvider | null;
@@ -108,6 +111,13 @@ declare function parseGitRemoteUrl(remoteUrl: string): {
108
111
  owner: string;
109
112
  repo: string;
110
113
  } | null;
114
+ /**
115
+ * Get files modified in git status that are relevant for release
116
+ * Returns only package.json, CHANGELOG.md, and lerna.json files
117
+ */
118
+ declare function getModifiedReleaseFilePatterns({ config }: {
119
+ config: ResolvedRelizyConfig;
120
+ }): string[];
111
121
  declare function createCommitAndTags({ config, noVerify, bumpedPackages, newVersion, dryRun, logLevel, }: {
112
122
  config: ResolvedRelizyConfig;
113
123
  noVerify: boolean;
@@ -122,6 +132,13 @@ declare function pushCommitAndTags({ config, dryRun, logLevel, cwd }: {
122
132
  logLevel?: LogLevel;
123
133
  cwd: string;
124
134
  }): Promise<void>;
135
+ /**
136
+ * Rollback modified files to their last committed state
137
+ * Used when publish fails before commit/tag/push operations
138
+ */
139
+ declare function rollbackModifiedFiles({ config, }: {
140
+ config: ResolvedRelizyConfig;
141
+ }): Promise<void>;
125
142
  declare function getFirstCommit(cwd: string): string;
126
143
  declare function getCurrentGitBranch(cwd: string): string;
127
144
  declare function getCurrentGitRef(cwd: string): string;
@@ -223,12 +240,14 @@ declare function getLastTag({ logLevel, cwd }: {
223
240
  }): Promise<string>;
224
241
  declare function getLastRepoTag(options?: {
225
242
  onlyStable?: boolean;
243
+ currentVersion?: string;
226
244
  logLevel?: LogLevel;
227
245
  cwd?: string;
228
246
  }): Promise<string | null>;
229
- declare function getLastPackageTag({ packageName, onlyStable, logLevel, cwd, }: {
247
+ declare function getLastPackageTag({ packageName, onlyStable, currentVersion, logLevel, cwd, }: {
230
248
  packageName: string;
231
249
  onlyStable?: boolean;
250
+ currentVersion?: string;
232
251
  logLevel?: LogLevel;
233
252
  cwd?: string;
234
253
  }): Promise<string | null>;
@@ -334,6 +353,48 @@ declare function getBumpedIndependentPackages({ packages, dryRun, }: {
334
353
  packages: PackageBase[];
335
354
  dryRun: boolean;
336
355
  }): PackageBase[];
356
+ /**
357
+ * Determines if prerelease tags should be filtered out when searching for tags.
358
+ * Returns true when the current version is stable AND we're not graduating to stable.
359
+ *
360
+ * This prevents beta/prerelease tags from being used as the base for stable version bumps.
361
+ *
362
+ * @example
363
+ * shouldFilterPrereleaseTags('4.1.1', false) // true - stable version, not graduating
364
+ * shouldFilterPrereleaseTags('4.1.1-beta.0', true) // false - graduating to stable
365
+ * shouldFilterPrereleaseTags('4.1.1-beta.0', false) // false - prerelease version
366
+ */
367
+ declare function shouldFilterPrereleaseTags(currentVersion: string, graduating: boolean): boolean;
368
+ /**
369
+ * Extracts a semantic version from a git tag.
370
+ * Supports multiple tag formats:
371
+ * - v1.2.3 → 1.2.3
372
+ * - 1.2.3 → 1.2.3
373
+ * - package-name@1.2.3 → 1.2.3
374
+ * - v1.2.3-beta.0 → 1.2.3-beta.0
375
+ *
376
+ * @param tag - The git tag to extract version from
377
+ * @param packageName - Optional package name for independent mode tags (e.g., "pkg-name@1.2.3")
378
+ * @returns The extracted version string or null if invalid
379
+ */
380
+ declare function extractVersionFromTag(tag: string, packageName?: string): string | null;
381
+ /**
382
+ * Checks if a tag's version is compatible with the current version.
383
+ * A tag is compatible if its major version is less than or equal to the current major version.
384
+ *
385
+ * This prevents accidentally using tags from future major versions (e.g., v5.0.0-beta.0)
386
+ * when bumping a current stable version (e.g., 4.1.1 → 4.1.2).
387
+ *
388
+ * @param tagVersion - The semantic version extracted from the tag
389
+ * @param currentVersion - The current package version
390
+ * @returns true if the tag version's major is <= current major version
391
+ *
392
+ * @example
393
+ * isTagVersionCompatibleWithCurrent('4.1.1', '4.1.0') // true - same major
394
+ * isTagVersionCompatibleWithCurrent('5.0.0-beta.0', '4.1.1') // false - newer major
395
+ * isTagVersionCompatibleWithCurrent('3.9.9', '4.1.1') // true - older major
396
+ */
397
+ declare function isTagVersionCompatibleWithCurrent(tagVersion: string, currentVersion: string): boolean;
337
398
 
338
399
  type VersionMode = 'unified' | 'independent' | 'selective';
339
400
  type GitProvider = 'github' | 'gitlab';
@@ -835,6 +896,15 @@ interface RepoConfig {
835
896
  }
836
897
  type HookType = 'before' | 'success' | 'error';
837
898
  type HookStep = 'bump' | 'changelog' | 'commit-and-tag' | 'provider-release' | 'publish' | 'push' | 'release';
899
+ /**
900
+ * Tokens configuration
901
+ * @default {}
902
+ */
903
+ interface TokensConfig {
904
+ registry?: string;
905
+ gitlab?: string;
906
+ github?: string;
907
+ }
838
908
  /**
839
909
  * Hooks configuration
840
910
  * Useful to run custom scripts before, after a step or on error
@@ -851,7 +921,7 @@ type HookConfig = {
851
921
  * Relizy configuration
852
922
  * @see https://louismazel.github.io/relizy/config/overview
853
923
  */
854
- interface RelizyConfig extends Partial<Omit<ChangelogConfig$1, 'output' | 'templates' | 'publish' | 'types'>> {
924
+ interface RelizyConfig extends Partial<Omit<ChangelogConfig$1, 'output' | 'templates' | 'publish' | 'types' | 'tokens'>> {
855
925
  types?: Record<string, {
856
926
  title: string;
857
927
  semver?: SemverBumpType;
@@ -897,6 +967,10 @@ interface RelizyConfig extends Partial<Omit<ChangelogConfig$1, 'output' | 'templ
897
967
  * Release config
898
968
  */
899
969
  release?: ReleaseConfig;
970
+ /**
971
+ * Tokens config
972
+ */
973
+ tokens?: TokensConfig;
900
974
  /**
901
975
  * Hooks config
902
976
  */
@@ -935,5 +1009,5 @@ declare function publish(options?: Partial<PublishOptions>): Promise<{
935
1009
 
936
1010
  declare function release(options?: Partial<ReleaseOptions>): Promise<void>;
937
1011
 
938
- export { bump, changelog, checkGitStatusIfDirty, confirmBump, createCommitAndTags, createGitlabRelease, defineConfig, detectGitProvider, detectPackageManager, determinePublishTag, determineReleaseType, determineSemverChange, executeBuildCmd, executeFormatCmd, executeHook, expandPackagesToBumpWithDependents, extractVersionFromPackageTag, fetchGitTags, generateChangelog, getAuthCommand, getBumpedIndependentPackages, getBumpedPackageIndependently, getCIName, getCurrentGitBranch, getCurrentGitRef, getDefaultConfig, getDependentsOf, getFirstCommit, getGitStatus, getIndependentTag, getLastPackageTag, getLastRepoTag, getLastStableTag, getLastTag, getPackageCommits, getPackageDependencies, getPackageNewVersion, getPackages, getPackagesOrBumpedPackages, getPackagesToPublishInIndependentMode, getPackagesToPublishInSelectiveMode, getPreid, getRootPackage, github, gitlab, hasLernaJson, isBumpedPackage, isChangedPreid, isGraduating, isGraduatingToStableBetweenVersion, isInCI, isPrerelease, isPrereleaseReleaseType, isStableReleaseType, loadRelizyConfig, parseGitRemoteUrl, providerRelease, providerReleaseSafetyCheck, publish, publishPackage, publishSafetyCheck, pushCommitAndTags, readPackageJson, readPackages, release, resolveTags, topologicalSort, updateLernaVersion, writeChangelogToFile, writeVersion };
939
- export type { BumpConfig, BumpOptions, BumpResult, BumpResultFalsy, BumpResultTruthy, ChangelogConfig, ChangelogOptions, ConfigType, GitProvider, GitlabRelease, GitlabReleaseResponse, HookConfig, HookStep, HookType, MonorepoConfig, PackageBase, PackageManager, PostedRelease, ProviderReleaseOptions, PublishConfig, PublishOptions, PublishResponse, ReadPackage, ReleaseConfig, ReleaseOptions, RelizyConfig, RepoConfig, ResolvedConfig, ResolvedRelizyConfig, ResolvedTags, RootPackage, Step, TemplatesConfig, VersionMode };
1012
+ export { bump, changelog, checkGitStatusIfDirty, confirmBump, createCommitAndTags, createGitlabRelease, defineConfig, detectGitProvider, detectPackageManager, determinePublishTag, determineReleaseType, determineSemverChange, executeBuildCmd, executeFormatCmd, executeHook, expandPackagesToBumpWithDependents, extractVersionFromPackageTag, extractVersionFromTag, fetchGitTags, generateChangelog, getAuthCommand, getBumpedIndependentPackages, getBumpedPackageIndependently, getCIName, getCurrentGitBranch, getCurrentGitRef, getDefaultConfig, getDependentsOf, getFirstCommit, getGitStatus, getIndependentTag, getLastPackageTag, getLastRepoTag, getLastStableTag, getLastTag, getModifiedReleaseFilePatterns, getPackageCommits, getPackageDependencies, getPackageNewVersion, getPackages, getPackagesOrBumpedPackages, getPackagesToPublishInIndependentMode, getPackagesToPublishInSelectiveMode, getPreid, getRootPackage, github, gitlab, hasLernaJson, isBumpedPackage, isChangedPreid, isGraduating, isGraduatingToStableBetweenVersion, isInCI, isPrerelease, isPrereleaseReleaseType, isStableReleaseType, isTagVersionCompatibleWithCurrent, loadRelizyConfig, parseGitRemoteUrl, providerRelease, providerReleaseSafetyCheck, publish, publishPackage, publishSafetyCheck, pushCommitAndTags, readPackageJson, readPackages, release, resolveTags, rollbackModifiedFiles, shouldFilterPrereleaseTags, topologicalSort, updateLernaVersion, writeChangelogToFile, writeVersion };
1013
+ export type { BumpConfig, BumpOptions, BumpResult, BumpResultFalsy, BumpResultTruthy, ChangelogConfig, ChangelogOptions, ConfigType, GitProvider, GitlabRelease, GitlabReleaseResponse, HookConfig, HookStep, HookType, MonorepoConfig, PackageBase, PackageManager, PostedRelease, ProviderReleaseOptions, PublishConfig, PublishOptions, PublishResponse, ReadPackage, ReleaseConfig, ReleaseOptions, RelizyConfig, RepoConfig, ResolvedConfig, ResolvedRelizyConfig, ResolvedTags, RootPackage, Step, TemplatesConfig, TokensConfig, VersionMode };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { b as bump, c as changelog, n as checkGitStatusIfDirty, ae as confirmBump, u as createCommitAndTags, B as createGitlabRelease, h as defineConfig, q as detectGitProvider, D as detectPackageManager, E as determinePublishTag, a2 as determineReleaseType, a1 as determineSemverChange, Z as executeBuildCmd, Y as executeFormatCmd, V as executeHook, k as expandPackagesToBumpWithDependents, a6 as extractVersionFromPackageTag, o as fetchGitTags, g as generateChangelog, H as getAuthCommand, af as getBumpedIndependentPackages, ad as getBumpedPackageIndependently, X as getCIName, y as getCurrentGitBranch, z as getCurrentGitRef, f as getDefaultConfig, j as getDependentsOf, x as getFirstCommit, m as getGitStatus, P as getIndependentTag, T as getLastPackageTag, S as getLastRepoTag, Q as getLastStableTag, R as getLastTag, N as getPackageCommits, i as getPackageDependencies, a4 as getPackageNewVersion, M as getPackages, $ as getPackagesOrBumpedPackages, G as getPackagesToPublishInIndependentMode, F as getPackagesToPublishInSelectiveMode, ab as getPreid, K as getRootPackage, A as github, C as gitlab, O as hasLernaJson, _ as isBumpedPackage, ac as isChangedPreid, aa as isGraduating, a0 as isGraduatingToStableBetweenVersion, W as isInCI, a7 as isPrerelease, a9 as isPrereleaseReleaseType, a8 as isStableReleaseType, l as loadRelizyConfig, s as parseGitRemoteUrl, a as providerRelease, p as providerReleaseSafetyCheck, e as publish, I as publishPackage, d as publishSafetyCheck, v as pushCommitAndTags, J as readPackageJson, L as readPackages, r as release, U as resolveTags, t as topologicalSort, a5 as updateLernaVersion, w as writeChangelogToFile, a3 as writeVersion } from './shared/relizy.6FWq4lmP.mjs';
1
+ export { b as bump, c as changelog, n as checkGitStatusIfDirty, ag as confirmBump, v as createCommitAndTags, D as createGitlabRelease, h as defineConfig, q as detectGitProvider, F as detectPackageManager, G as determinePublishTag, a4 as determineReleaseType, a3 as determineSemverChange, $ as executeBuildCmd, _ as executeFormatCmd, X as executeHook, k as expandPackagesToBumpWithDependents, a8 as extractVersionFromPackageTag, aj as extractVersionFromTag, o as fetchGitTags, g as generateChangelog, J as getAuthCommand, ah as getBumpedIndependentPackages, af as getBumpedPackageIndependently, Z as getCIName, A as getCurrentGitBranch, B as getCurrentGitRef, f as getDefaultConfig, j as getDependentsOf, z as getFirstCommit, m as getGitStatus, R as getIndependentTag, V as getLastPackageTag, U as getLastRepoTag, S as getLastStableTag, T as getLastTag, u as getModifiedReleaseFilePatterns, P as getPackageCommits, i as getPackageDependencies, a6 as getPackageNewVersion, O as getPackages, a1 as getPackagesOrBumpedPackages, I as getPackagesToPublishInIndependentMode, H as getPackagesToPublishInSelectiveMode, ad as getPreid, M as getRootPackage, C as github, E as gitlab, Q as hasLernaJson, a0 as isBumpedPackage, ae as isChangedPreid, ac as isGraduating, a2 as isGraduatingToStableBetweenVersion, Y as isInCI, a9 as isPrerelease, ab as isPrereleaseReleaseType, aa as isStableReleaseType, ak as isTagVersionCompatibleWithCurrent, l as loadRelizyConfig, s as parseGitRemoteUrl, a as providerRelease, p as providerReleaseSafetyCheck, e as publish, K as publishPackage, d as publishSafetyCheck, x as pushCommitAndTags, L as readPackageJson, N as readPackages, r as release, W as resolveTags, y as rollbackModifiedFiles, ai as shouldFilterPrereleaseTags, t as topologicalSort, a7 as updateLernaVersion, w as writeChangelogToFile, a5 as writeVersion } from './shared/relizy.B4guss__.mjs';
2
2
  import '@maz-ui/node';
3
3
  import 'node:fs';
4
4
  import 'node:path';
@@ -216,7 +216,7 @@ function readPackages({
216
216
  const patternsSet = new Set(patterns);
217
217
  if (!patterns)
218
218
  patternsSet.add(".");
219
- logger.debug(`Read package.json files from patterns: ${patternsSet.values()}`);
219
+ logger.debug(`Read package.json files from patterns: ${[...patternsSet].join(", ")}`);
220
220
  for (const pattern of patternsSet) {
221
221
  try {
222
222
  const matches = fastGlob.sync(pattern, {
@@ -445,14 +445,13 @@ async function getPackageCommits({
445
445
  if (!isAllowedCommit({ commit, type, changelog })) {
446
446
  return false;
447
447
  }
448
- const isTracked = isCommitOfTrackedPackages({ commit, config });
449
- if ((pkg.path === changelogConfig.cwd || pkg.name === rootPackage.name) && isTracked) {
448
+ const isTrackedPackage = isCommitOfTrackedPackages({ commit, config });
449
+ if ((pkg.path === changelogConfig.cwd || pkg.name === rootPackage.name) && isTrackedPackage) {
450
450
  return true;
451
451
  }
452
452
  const packageRelativePath = relative(changelogConfig.cwd, pkg.path);
453
- const scopeMatches = commit.scope === pkg.name;
454
453
  const bodyContainsPath = commit.body.includes(packageRelativePath);
455
- return (scopeMatches || bodyContainsPath) && isTracked;
454
+ return bodyContainsPath && isTrackedPackage;
456
455
  });
457
456
  logger.debug(`Found ${commits.length} commit(s) for ${pkg.name} from ${from} to ${to}`);
458
457
  if (commits.length > 0) {
@@ -617,11 +616,14 @@ async function getPackagesOrBumpedPackages({
617
616
  });
618
617
  }
619
618
 
620
- function getGitStatus(cwd) {
621
- return execSync("git status --porcelain", {
619
+ function getGitStatus(cwd, trim = true) {
620
+ const status = execSync("git status --porcelain", {
622
621
  cwd,
623
622
  encoding: "utf8"
624
- }).trim();
623
+ });
624
+ if (trim)
625
+ return status.trim();
626
+ return status;
625
627
  }
626
628
  function checkGitStatusIfDirty() {
627
629
  logger.debug("Checking git status");
@@ -685,6 +687,27 @@ function parseGitRemoteUrl(remoteUrl) {
685
687
  }
686
688
  return null;
687
689
  }
690
+ function getModifiedReleaseFilePatterns({ config }) {
691
+ const gitStatusRaw = getGitStatus(config.cwd, false);
692
+ if (!gitStatusRaw) {
693
+ logger.debug("No modified files in git status");
694
+ return [];
695
+ }
696
+ const modifiedFiles = gitStatusRaw.split("\n").filter((line) => line.length > 0).map((line) => {
697
+ if (line.length < 4)
698
+ return null;
699
+ const filename = line.substring(3).trim();
700
+ return filename || null;
701
+ }).filter((file) => file !== null);
702
+ const releaseFiles = modifiedFiles.filter((file) => {
703
+ const isPackageJson = file === "package.json" || file.endsWith("/package.json");
704
+ const isChangelog = file === "CHANGELOG.md" || file.endsWith("/CHANGELOG.md");
705
+ const isLerna = file === "lerna.json";
706
+ return isPackageJson || isChangelog || isLerna;
707
+ });
708
+ logger.debug(`Found ${releaseFiles.length} modified release files:`, releaseFiles.join(", "));
709
+ return releaseFiles;
710
+ }
688
711
  async function createCommitAndTags({
689
712
  config,
690
713
  noVerify,
@@ -696,13 +719,7 @@ async function createCommitAndTags({
696
719
  const internalConfig = config || await loadRelizyConfig();
697
720
  try {
698
721
  await executeHook("before:commit-and-tag", internalConfig, dryRun ?? false);
699
- const filePatternsToAdd = [
700
- "package.json",
701
- "lerna.json",
702
- "CHANGELOG.md",
703
- "**/CHANGELOG.md",
704
- "**/package.json"
705
- ];
722
+ const filePatternsToAdd = getModifiedReleaseFilePatterns({ config: internalConfig });
706
723
  logger.start("Start commit and tag");
707
724
  logger.debug("Adding files to git staging area...");
708
725
  for (const pattern of filePatternsToAdd) {
@@ -821,6 +838,47 @@ async function pushCommitAndTags({ config, dryRun, logLevel, cwd }) {
821
838
  }
822
839
  logger.success("Pushing changes and tags completed!");
823
840
  }
841
+ async function rollbackModifiedFiles({
842
+ config
843
+ }) {
844
+ const modifiedFiles = getModifiedReleaseFilePatterns({ config });
845
+ if (modifiedFiles.length === 0) {
846
+ logger.debug("No modified files to rollback");
847
+ return;
848
+ }
849
+ logger.debug(`Rolling back ${modifiedFiles.length} modified file(s)...`);
850
+ logger.debug(`Files to rollback: ${modifiedFiles.join(", ")}`);
851
+ try {
852
+ const fileList = modifiedFiles.join(" ");
853
+ logger.debug(`Restoring specific files from HEAD: ${fileList}`);
854
+ await execPromise(`git checkout HEAD -- ${fileList}`, {
855
+ cwd: config.cwd,
856
+ logLevel: config.logLevel,
857
+ noStderr: true
858
+ });
859
+ logger.debug("Checking for untracked release files to remove...");
860
+ for (const file of modifiedFiles) {
861
+ const filePath = join(config.cwd, file);
862
+ if (existsSync(filePath)) {
863
+ try {
864
+ execSync(`git ls-files --error-unmatch "${file}"`, {
865
+ cwd: config.cwd,
866
+ encoding: "utf8",
867
+ stdio: "pipe"
868
+ });
869
+ } catch {
870
+ logger.debug(`Removing untracked file: ${file}`);
871
+ execSync(`rm "${filePath}"`, { cwd: config.cwd });
872
+ }
873
+ }
874
+ }
875
+ logger.success(`Successfully rolled back ${modifiedFiles.length} release file(s)`);
876
+ } catch (error) {
877
+ logger.error("Failed to rollback modified files automatically");
878
+ logger.warn(`Please manually restore these files: ${modifiedFiles.join(", ")}`);
879
+ throw error;
880
+ }
881
+ }
824
882
  function getFirstCommit(cwd) {
825
883
  const result = execSync(
826
884
  "git rev-list --max-parents=0 HEAD",
@@ -1131,9 +1189,12 @@ function getDefaultConfig() {
1131
1189
  publish: {
1132
1190
  private: false,
1133
1191
  args: [],
1192
+ token: process$1.env.RELIZY_NPM_TOKEN || process$1.env.NPM_TOKEN || process$1.env.NODE_AUTH_TOKEN,
1193
+ registry: "https://registry.npmjs.org/",
1134
1194
  safetyCheck: false
1135
1195
  },
1136
1196
  tokens: {
1197
+ registry: process$1.env.RELIZY_NPM_TOKEN || process$1.env.NPM_TOKEN || process$1.env.NODE_AUTH_TOKEN,
1137
1198
  gitlab: process$1.env.RELIZY_GITLAB_TOKEN || process$1.env.GITLAB_TOKEN || process$1.env.GITLAB_API_TOKEN || process$1.env.CI_JOB_TOKEN,
1138
1199
  github: process$1.env.RELIZY_GITHUB_TOKEN || process$1.env.GITHUB_TOKEN || process$1.env.GH_TOKEN
1139
1200
  },
@@ -2095,6 +2156,40 @@ function getBumpedIndependentPackages({
2095
2156
  }
2096
2157
  return bumpedPackages;
2097
2158
  }
2159
+ function shouldFilterPrereleaseTags(currentVersion, graduating) {
2160
+ return !isPrerelease(currentVersion) && !graduating;
2161
+ }
2162
+ function extractVersionFromTag(tag, packageName) {
2163
+ if (!tag) {
2164
+ return null;
2165
+ }
2166
+ if (packageName) {
2167
+ const prefix = `${packageName}@`;
2168
+ if (tag.startsWith(prefix)) {
2169
+ return tag.slice(prefix.length);
2170
+ }
2171
+ }
2172
+ const atIndex = tag.lastIndexOf("@");
2173
+ if (atIndex !== -1) {
2174
+ return tag.slice(atIndex + 1);
2175
+ }
2176
+ if (tag.startsWith("v") && /^v\d/.test(tag)) {
2177
+ return tag.slice(1);
2178
+ }
2179
+ if (/^\d+\.\d+\.\d+/.test(tag)) {
2180
+ return tag;
2181
+ }
2182
+ return null;
2183
+ }
2184
+ function isTagVersionCompatibleWithCurrent(tagVersion, currentVersion) {
2185
+ try {
2186
+ const tagMajor = semver.major(tagVersion);
2187
+ const currentMajor = semver.major(currentVersion);
2188
+ return tagMajor <= currentMajor;
2189
+ } catch {
2190
+ return false;
2191
+ }
2192
+ }
2098
2193
 
2099
2194
  function getIndependentTag({ version, name }) {
2100
2195
  return `${name}@${version}`;
@@ -2126,18 +2221,131 @@ async function getLastTag({ logLevel, cwd }) {
2126
2221
  logger.debug("Last tag:", lastTag || "No tags found");
2127
2222
  return lastTag;
2128
2223
  }
2224
+ async function getAllRecentRepoTags(options) {
2225
+ const limit = options?.limit;
2226
+ try {
2227
+ const { stdout } = await execPromise(
2228
+ `git tag --sort=-creatordate | head -n ${limit}`,
2229
+ {
2230
+ logLevel: options?.logLevel,
2231
+ noStderr: true,
2232
+ noStdout: true,
2233
+ noSuccess: true,
2234
+ cwd: options?.cwd
2235
+ }
2236
+ );
2237
+ const tags = stdout.trim().split("\n").filter((tag) => tag.length > 0);
2238
+ logger.debug(`Retrieved ${tags.length} recent repo tags`);
2239
+ return tags;
2240
+ } catch {
2241
+ return [];
2242
+ }
2243
+ }
2244
+ async function getAllRecentPackageTags({
2245
+ packageName,
2246
+ limit = 50,
2247
+ logLevel,
2248
+ cwd
2249
+ }) {
2250
+ try {
2251
+ const escapedPackageName = packageName.replace(/[@/]/g, "\\$&");
2252
+ const { stdout } = await execPromise(
2253
+ `git tag --sort=-creatordate | grep -E '^${escapedPackageName}@' | head -n ${limit}`,
2254
+ {
2255
+ logLevel,
2256
+ noStderr: true,
2257
+ noStdout: true,
2258
+ noSuccess: true,
2259
+ cwd
2260
+ }
2261
+ );
2262
+ const tags = stdout.trim().split("\n").filter((tag) => tag.length > 0);
2263
+ logger.debug(`Retrieved ${tags.length} recent tags for package ${packageName}`);
2264
+ return tags;
2265
+ } catch {
2266
+ return [];
2267
+ }
2268
+ }
2269
+ function filterCompatibleTags({
2270
+ tags,
2271
+ currentVersion,
2272
+ onlyStable,
2273
+ packageName
2274
+ }) {
2275
+ const filtered = tags.filter((tag) => {
2276
+ const tagVersion = extractVersionFromTag(tag, packageName);
2277
+ if (!tagVersion) {
2278
+ logger.debug(`Skipping tag ${tag}: cannot extract version`);
2279
+ return false;
2280
+ }
2281
+ if (onlyStable && isPrerelease(tagVersion)) {
2282
+ logger.debug(`Skipping tag ${tag}: prerelease version ${tagVersion} (onlyStable=${onlyStable})`);
2283
+ return false;
2284
+ }
2285
+ if (!isTagVersionCompatibleWithCurrent(tagVersion, currentVersion)) {
2286
+ logger.debug(`Skipping tag ${tag}: version ${tagVersion} has higher major than current ${currentVersion}`);
2287
+ return false;
2288
+ }
2289
+ logger.debug(`Tag ${tag} with version ${tagVersion} is compatible`);
2290
+ return true;
2291
+ });
2292
+ logger.debug(`Filtered ${tags.length} tags down to ${filtered.length} compatible tags`);
2293
+ return filtered;
2294
+ }
2129
2295
  function getLastRepoTag(options) {
2296
+ if (options?.currentVersion) {
2297
+ return getLastRepoTagWithFiltering({
2298
+ currentVersion: options.currentVersion,
2299
+ onlyStable: options.onlyStable ?? false,
2300
+ logLevel: options.logLevel,
2301
+ cwd: options.cwd
2302
+ });
2303
+ }
2130
2304
  if (options?.onlyStable) {
2131
2305
  return getLastStableTag({ logLevel: options?.logLevel, cwd: options?.cwd });
2132
2306
  }
2133
2307
  return getLastTag({ logLevel: options?.logLevel, cwd: options?.cwd });
2134
2308
  }
2309
+ async function getLastRepoTagWithFiltering({
2310
+ currentVersion,
2311
+ onlyStable,
2312
+ logLevel,
2313
+ cwd
2314
+ }) {
2315
+ const recentTags = await getAllRecentRepoTags({ limit: 50, logLevel, cwd });
2316
+ if (recentTags.length === 0) {
2317
+ logger.debug("No tags found in repository");
2318
+ return null;
2319
+ }
2320
+ const compatibleTags = filterCompatibleTags({
2321
+ tags: recentTags,
2322
+ currentVersion,
2323
+ onlyStable
2324
+ });
2325
+ if (compatibleTags.length === 0) {
2326
+ logger.debug("No compatible tags found");
2327
+ return null;
2328
+ }
2329
+ const lastTag = compatibleTags[0];
2330
+ logger.debug(`Last compatible repo tag: ${lastTag}`);
2331
+ return lastTag;
2332
+ }
2135
2333
  async function getLastPackageTag({
2136
2334
  packageName,
2137
2335
  onlyStable,
2336
+ currentVersion,
2138
2337
  logLevel,
2139
2338
  cwd
2140
2339
  }) {
2340
+ if (currentVersion) {
2341
+ return getLastPackageTagWithFiltering({
2342
+ packageName,
2343
+ currentVersion,
2344
+ onlyStable: onlyStable ?? false,
2345
+ logLevel,
2346
+ cwd
2347
+ });
2348
+ }
2141
2349
  try {
2142
2350
  const escapedPackageName = packageName.replace(/[@/]/g, "\\$&");
2143
2351
  let grepPattern;
@@ -2162,16 +2370,52 @@ async function getLastPackageTag({
2162
2370
  return null;
2163
2371
  }
2164
2372
  }
2373
+ async function getLastPackageTagWithFiltering({
2374
+ packageName,
2375
+ currentVersion,
2376
+ onlyStable,
2377
+ logLevel,
2378
+ cwd
2379
+ }) {
2380
+ const recentTags = await getAllRecentPackageTags({
2381
+ packageName,
2382
+ limit: 50,
2383
+ logLevel,
2384
+ cwd
2385
+ });
2386
+ if (recentTags.length === 0) {
2387
+ logger.debug(`No tags found for package ${packageName}`);
2388
+ return null;
2389
+ }
2390
+ const compatibleTags = filterCompatibleTags({
2391
+ tags: recentTags,
2392
+ currentVersion,
2393
+ onlyStable,
2394
+ packageName
2395
+ });
2396
+ if (compatibleTags.length === 0) {
2397
+ logger.debug(`No compatible tags found for package ${packageName}`);
2398
+ return null;
2399
+ }
2400
+ const lastTag = compatibleTags[0];
2401
+ logger.debug(`Last compatible package tag for ${packageName}: ${lastTag}`);
2402
+ return lastTag;
2403
+ }
2165
2404
  async function resolveFromTagIndependent({
2166
2405
  cwd,
2167
2406
  packageName,
2407
+ currentVersion,
2168
2408
  graduating,
2169
2409
  logLevel
2170
2410
  }) {
2411
+ const filterPrereleases = shouldFilterPrereleaseTags(currentVersion, graduating);
2412
+ const onlyStable = graduating || filterPrereleases;
2171
2413
  const lastPackageTag = await getLastPackageTag({
2172
2414
  packageName,
2173
- onlyStable: graduating,
2174
- logLevel
2415
+ currentVersion,
2416
+ onlyStable,
2417
+ logLevel,
2418
+ cwd
2175
2419
  });
2176
2420
  if (!lastPackageTag) {
2177
2421
  return getFirstCommit(cwd);
@@ -2180,10 +2424,18 @@ async function resolveFromTagIndependent({
2180
2424
  }
2181
2425
  async function resolveFromTagUnified({
2182
2426
  config,
2427
+ currentVersion,
2183
2428
  graduating,
2184
2429
  logLevel
2185
2430
  }) {
2186
- const from = await getLastRepoTag({ onlyStable: graduating, logLevel }) || getFirstCommit(config.cwd);
2431
+ const filterPrereleases = shouldFilterPrereleaseTags(currentVersion, graduating);
2432
+ const onlyStable = graduating || filterPrereleases;
2433
+ const from = await getLastRepoTag({
2434
+ currentVersion,
2435
+ onlyStable,
2436
+ logLevel,
2437
+ cwd: config.cwd
2438
+ }) || getFirstCommit(config.cwd);
2187
2439
  return from;
2188
2440
  }
2189
2441
  async function resolveFromTag({
@@ -2191,6 +2443,7 @@ async function resolveFromTag({
2191
2443
  versionMode,
2192
2444
  step,
2193
2445
  packageName,
2446
+ currentVersion,
2194
2447
  graduating,
2195
2448
  logLevel
2196
2449
  }) {
@@ -2202,12 +2455,14 @@ async function resolveFromTag({
2202
2455
  from = await resolveFromTagIndependent({
2203
2456
  cwd: config.cwd,
2204
2457
  packageName,
2458
+ currentVersion,
2205
2459
  graduating,
2206
2460
  logLevel
2207
2461
  });
2208
2462
  } else {
2209
2463
  from = await resolveFromTagUnified({
2210
2464
  config,
2465
+ currentVersion,
2211
2466
  graduating,
2212
2467
  logLevel
2213
2468
  });
@@ -2256,6 +2511,7 @@ async function resolveTags({
2256
2511
  versionMode,
2257
2512
  step,
2258
2513
  packageName: pkg.name,
2514
+ currentVersion: pkg.version,
2259
2515
  graduating,
2260
2516
  logLevel
2261
2517
  });
@@ -2375,7 +2631,7 @@ function getCommandArgs({
2375
2631
  args.push("--registry", registry);
2376
2632
  }
2377
2633
  const isPnpmOrNpm = packageManager === "pnpm" || packageManager === "npm";
2378
- const publishToken = config.publish.token;
2634
+ const publishToken = config.publish.token || config.tokens.registry;
2379
2635
  if (publishToken) {
2380
2636
  if (!registry) {
2381
2637
  logger.warn("Publish token provided but no registry specified");
@@ -2416,7 +2672,18 @@ function isOtpError(error) {
2416
2672
  if (typeof error !== "object" || error === null)
2417
2673
  return false;
2418
2674
  const errorMessage = "message" in error && typeof error.message === "string" ? error.message.toLowerCase() : "";
2419
- return errorMessage.includes("otp") || errorMessage.includes("one-time password") || errorMessage.includes("eotp");
2675
+ const fullErrorString = String(error).toLowerCase();
2676
+ const searchText = `${errorMessage} ${fullErrorString}`;
2677
+ const otpPatterns = [
2678
+ "otp",
2679
+ "one-time password",
2680
+ "eotp",
2681
+ "two-factor authentication",
2682
+ "2fa",
2683
+ "two factor"
2684
+ ];
2685
+ const isOtp = otpPatterns.some((pattern) => searchText.includes(pattern));
2686
+ return isOtp;
2420
2687
  }
2421
2688
  function promptOtpWithTimeout(timeout = 9e4) {
2422
2689
  return new Promise((resolve, reject) => {
@@ -2445,7 +2712,7 @@ async function handleOtpError() {
2445
2712
  logger.debug("OTP received, retrying publish...");
2446
2713
  return otp;
2447
2714
  } catch (promptError) {
2448
- logger.error("Failed to get OTP:", promptError);
2715
+ logger.error("Failed to get OTP");
2449
2716
  throw promptError;
2450
2717
  }
2451
2718
  }
@@ -2468,6 +2735,7 @@ async function executePublishCommand({
2468
2735
  noStderr: true,
2469
2736
  noStdout: true,
2470
2737
  noSuccess: true,
2738
+ noError: true,
2471
2739
  logLevel: config.logLevel,
2472
2740
  cwd: pkg.path
2473
2741
  });
@@ -3223,7 +3491,7 @@ async function publish(options = {}) {
3223
3491
  config,
3224
3492
  dryRun
3225
3493
  });
3226
- for (const pkg of sortedPackages) {
3494
+ for await (const pkg of sortedPackages) {
3227
3495
  if (publishedPackages.some((p) => p.name === pkg.name)) {
3228
3496
  logger.debug(`Publishing ${getIndependentTag({ name: pkg.name, version: pkg.newVersion || pkg.version })}...`);
3229
3497
  await publishPackage({
@@ -3348,7 +3616,31 @@ async function release(options = {}) {
3348
3616
  } else {
3349
3617
  logger.info("Skipping changelog generation (--no-changelog)");
3350
3618
  }
3351
- logger.box("Step 3/6: Commit changes and create tag");
3619
+ logger.box("Step 3/6: Publish packages to registry");
3620
+ let publishResponse;
3621
+ if (config.release.publish) {
3622
+ try {
3623
+ publishResponse = await publish({
3624
+ registry: config.publish.registry,
3625
+ tag: config.publish.tag,
3626
+ access: config.publish.access,
3627
+ otp: config.publish.otp,
3628
+ bumpResult,
3629
+ dryRun,
3630
+ config,
3631
+ configName: options.configName,
3632
+ suffix: options.suffix,
3633
+ force
3634
+ });
3635
+ } catch (error) {
3636
+ logger.error("Publish failed, rolling back modified files...");
3637
+ await rollbackModifiedFiles({ config });
3638
+ throw error;
3639
+ }
3640
+ } else {
3641
+ logger.info("Skipping publish (--no-publish)");
3642
+ }
3643
+ logger.box("Step 4/6: Commit changes and create tag");
3352
3644
  let createdTags = [];
3353
3645
  if (config.release.commit) {
3354
3646
  createdTags = await createCommitAndTags({
@@ -3362,7 +3654,7 @@ async function release(options = {}) {
3362
3654
  } else {
3363
3655
  logger.info("Skipping commit and tag (--no-commit)");
3364
3656
  }
3365
- logger.box("Step 4/6: Push changes and tags");
3657
+ logger.box("Step 5/6: Push changes and tags");
3366
3658
  if (config.release.push && config.release.commit) {
3367
3659
  await executeHook("before:push", config, dryRun);
3368
3660
  try {
@@ -3380,24 +3672,6 @@ async function release(options = {}) {
3380
3672
  } else {
3381
3673
  logger.info("Skipping push (--no-push or --no-commit)");
3382
3674
  }
3383
- logger.box("Step 5/6: Publish packages to registry");
3384
- let publishResponse;
3385
- if (config.release.publish) {
3386
- publishResponse = await publish({
3387
- registry: config.publish.registry,
3388
- tag: config.publish.tag,
3389
- access: config.publish.access,
3390
- otp: config.publish.otp,
3391
- bumpResult,
3392
- dryRun,
3393
- config,
3394
- configName: options.configName,
3395
- suffix: options.suffix,
3396
- force
3397
- });
3398
- } else {
3399
- logger.info("Skipping publish (--no-publish)");
3400
- }
3401
3675
  let provider = config.repo?.provider;
3402
3676
  let postedReleases = [];
3403
3677
  logger.box("Step 6/6: Publish Git release");
@@ -3443,4 +3717,4 @@ Git provider: ${provider}`);
3443
3717
  }
3444
3718
  }
3445
3719
 
3446
- export { getPackagesOrBumpedPackages as $, github as A, createGitlabRelease as B, gitlab as C, detectPackageManager as D, determinePublishTag as E, getPackagesToPublishInSelectiveMode as F, getPackagesToPublishInIndependentMode as G, getAuthCommand as H, publishPackage as I, readPackageJson as J, getRootPackage as K, readPackages as L, getPackages as M, getPackageCommits as N, hasLernaJson as O, getIndependentTag as P, getLastStableTag as Q, getLastTag as R, getLastRepoTag as S, getLastPackageTag as T, resolveTags as U, executeHook as V, isInCI as W, getCIName as X, executeFormatCmd as Y, executeBuildCmd as Z, isBumpedPackage as _, providerRelease as a, isGraduatingToStableBetweenVersion as a0, determineSemverChange as a1, determineReleaseType as a2, writeVersion as a3, getPackageNewVersion as a4, updateLernaVersion as a5, extractVersionFromPackageTag as a6, isPrerelease as a7, isStableReleaseType as a8, isPrereleaseReleaseType as a9, isGraduating as aa, getPreid as ab, isChangedPreid as ac, getBumpedPackageIndependently as ad, confirmBump as ae, getBumpedIndependentPackages as af, bump as b, changelog as c, publishSafetyCheck as d, publish as e, getDefaultConfig as f, generateChangelog as g, defineConfig as h, getPackageDependencies as i, getDependentsOf as j, expandPackagesToBumpWithDependents as k, loadRelizyConfig as l, getGitStatus as m, checkGitStatusIfDirty as n, fetchGitTags as o, providerReleaseSafetyCheck as p, detectGitProvider as q, release as r, parseGitRemoteUrl as s, topologicalSort as t, createCommitAndTags as u, pushCommitAndTags as v, writeChangelogToFile as w, getFirstCommit as x, getCurrentGitBranch as y, getCurrentGitRef as z };
3720
+ export { executeBuildCmd as $, getCurrentGitBranch as A, getCurrentGitRef as B, github as C, createGitlabRelease as D, gitlab as E, detectPackageManager as F, determinePublishTag as G, getPackagesToPublishInSelectiveMode as H, getPackagesToPublishInIndependentMode as I, getAuthCommand as J, publishPackage as K, readPackageJson as L, getRootPackage as M, readPackages as N, getPackages as O, getPackageCommits as P, hasLernaJson as Q, getIndependentTag as R, getLastStableTag as S, getLastTag as T, getLastRepoTag as U, getLastPackageTag as V, resolveTags as W, executeHook as X, isInCI as Y, getCIName as Z, executeFormatCmd as _, providerRelease as a, isBumpedPackage as a0, getPackagesOrBumpedPackages as a1, isGraduatingToStableBetweenVersion as a2, determineSemverChange as a3, determineReleaseType as a4, writeVersion as a5, getPackageNewVersion as a6, updateLernaVersion as a7, extractVersionFromPackageTag as a8, isPrerelease as a9, isStableReleaseType as aa, isPrereleaseReleaseType as ab, isGraduating as ac, getPreid as ad, isChangedPreid as ae, getBumpedPackageIndependently as af, confirmBump as ag, getBumpedIndependentPackages as ah, shouldFilterPrereleaseTags as ai, extractVersionFromTag as aj, isTagVersionCompatibleWithCurrent as ak, bump as b, changelog as c, publishSafetyCheck as d, publish as e, getDefaultConfig as f, generateChangelog as g, defineConfig as h, getPackageDependencies as i, getDependentsOf as j, expandPackagesToBumpWithDependents as k, loadRelizyConfig as l, getGitStatus as m, checkGitStatusIfDirty as n, fetchGitTags as o, providerReleaseSafetyCheck as p, detectGitProvider as q, release as r, parseGitRemoteUrl as s, topologicalSort as t, getModifiedReleaseFilePatterns as u, createCommitAndTags as v, writeChangelogToFile as w, pushCommitAndTags as x, rollbackModifiedFiles as y, getFirstCommit as z };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "relizy",
3
3
  "type": "module",
4
- "version": "0.2.7",
4
+ "version": "0.3.0",
5
5
  "description": "Changelogen adapter for monorepo management with unified and independent versioning",
6
6
  "author": "Louis Mazel <me@loicmazuel.com>",
7
7
  "license": "MIT",
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "dependencies": {
58
58
  "@inquirer/prompts": "^8.1.0",
59
- "@maz-ui/node": "4.3.2",
59
+ "@maz-ui/node": "4.3.4-beta.0",
60
60
  "@maz-ui/utils": "^4.3.0",
61
61
  "c12": "^3.3.3",
62
62
  "changelogen": "^0.6.2",