relizy 0.2.5-beta.12 → 0.2.5-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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 { U as isInCI, V as getCIName, b as bump, c as changelog, d as publish, a as providerRelease, r as release } from './shared/relizy.PGChVRhn.mjs';
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.qmU37FU2.mjs';
9
9
  import 'changelogen';
10
10
  import 'fast-glob';
11
11
  import '@inquirer/prompts';
@@ -98,7 +98,7 @@ program.command("changelog").description("Generate changelogs for all packages")
98
98
  process.exit(1);
99
99
  }
100
100
  });
101
- program.command("publish").description("Publish packages to registry").option("--registry <url>", "Custom registry URL").option("--tag <tag>", "Publish with specific tag (default: latest for stable, next for prerelease)").option("--access <type>", "Package access level (public or restricted)").option("--otp <code>", "One-time password for 2FA").option("--build-cmd <cmd>", 'Command to build packages before publish (e.g. "pnpm build")').action(async (options) => {
101
+ program.command("publish").description("Publish packages to registry").option("--registry <url>", "Custom registry URL").option("--tag <tag>", "Publish with specific tag (default: latest for stable, next for prerelease)").option("--access <type>", "Package access level (public or restricted)").option("--otp <code>", "One-time password for 2FA").option("--build-cmd <cmd>", 'Command to build packages before publish (e.g. "pnpm build")').option("--publish-token <token>", 'NPM token (e.g. "123456") - only supported for pnpm and npm').action(async (options) => {
102
102
  try {
103
103
  await publish({
104
104
  registry: options.registry,
@@ -106,6 +106,7 @@ program.command("publish").description("Publish packages to registry").option("-
106
106
  access: options.access,
107
107
  otp: options.otp,
108
108
  buildCmd: options.buildCmd,
109
+ token: options.publishToken,
109
110
  dryRun: program.opts().dryRun,
110
111
  logLevel: program.opts().logLevel,
111
112
  configName: program.opts().config
@@ -130,7 +131,7 @@ program.command("provider-release").description("Publish release to git provider
130
131
  process.exit(1);
131
132
  }
132
133
  });
133
- program.command("release").description("Complete release workflow (bump + changelog + commit + tag + push to remote + publish release)").option("--major", "Bump major version").option("--minor", "Bump minor version").option("--patch", "Bump patch version").option("--prerelease", "Bump prerelease version").option("--premajor", "Bump premajor version").option("--preminor", "Bump preminor version").option("--prepatch", "Bump prepatch version").option("--preid <id>", "Prerelease identifier (alpha, beta, rc, etc.)").option("--suffix <suffix>", "Custom suffix for prerelease versions - replace the last .X with .suffix (e.g. 1.0.0-beta.0 -> 1.0.0-beta.suffix)").option("--from <ref>", "Start commit reference").option("--to <ref>", "End commit reference").option("--no-push", "Skip push changes and tags to remote").option("--no-provider-release", "Skip release creation (GitHub/GitLab)").option("--no-publish", "Skip npm publish").option("--registry <url>", "Custom npm registry URL").option("--tag <tag>", "Publish with specific tag (default: latest for stable, next for prerelease)").option("--access <type>", "Package access level (public or restricted)").option("--otp <code>", "One-time password for 2FA").option("--no-verify", "Skip git hooks during commit").option("--format-cmd <cmd>", 'Command to format CHANGELOG files after generation (e.g. "pnpm lint")').option("--build-cmd <cmd>", 'Command to build packages before publish (e.g. "pnpm build")').option("--no-root-changelog", "Skip generation of root changelog file").option("--token <token>", "Git token (github or gitlab)").option("--force", "Bump even if there are no commits").option("--no-clean", "Skip check if the working directory is clean").option("--no-commit", "Skip commit and tag").option("--no-git-tag", "Skip tag creation").option("--no-changelog", "Skip changelog generation files").option("--provider <provider>", "Git provider (github or gitlab)").option("--yes", "Skip confirmation prompt about bumping packages").action(async (options) => {
134
+ program.command("release").description("Complete release workflow (bump + changelog + commit + tag + push to remote + publish release)").option("--major", "Bump major version").option("--minor", "Bump minor version").option("--patch", "Bump patch version").option("--prerelease", "Bump prerelease version").option("--premajor", "Bump premajor version").option("--preminor", "Bump preminor version").option("--prepatch", "Bump prepatch version").option("--preid <id>", "Prerelease identifier (alpha, beta, rc, etc.)").option("--suffix <suffix>", "Custom suffix for prerelease versions - replace the last .X with .suffix (e.g. 1.0.0-beta.0 -> 1.0.0-beta.suffix)").option("--from <ref>", "Start commit reference").option("--to <ref>", "End commit reference").option("--no-push", "Skip push changes and tags to remote").option("--no-provider-release", "Skip release creation (GitHub/GitLab)").option("--no-publish", "Skip npm publish").option("--registry <url>", "Custom npm registry URL").option("--tag <tag>", "Publish with specific tag (default: latest for stable, next for prerelease)").option("--access <type>", "Package access level (public or restricted)").option("--otp <code>", "One-time password for 2FA").option("--no-verify", "Skip git hooks during commit").option("--format-cmd <cmd>", 'Command to format CHANGELOG files after generation (e.g. "pnpm lint")').option("--build-cmd <cmd>", 'Command to build packages before publish (e.g. "pnpm build")').option("--no-root-changelog", "Skip generation of root changelog file").option("--token <token>", "Git token (github or gitlab)").option("--force", "Bump even if there are no commits").option("--no-clean", "Skip check if the working directory is clean").option("--no-commit", "Skip commit and tag").option("--no-git-tag", "Skip tag creation").option("--no-changelog", "Skip changelog generation files").option("--provider <provider>", "Git provider (github or gitlab)").option("--yes", "Skip confirmation prompt about bumping packages").option("--publish-token <token>", 'NPM token (e.g. "123456") - only supported for pnpm and npm').action(async (options) => {
134
135
  try {
135
136
  await release({
136
137
  type: getReleaseType(options),
@@ -155,6 +156,7 @@ program.command("release").description("Complete release workflow (bump + change
155
156
  buildCmd: options.buildCmd,
156
157
  rootChangelog: hasCliFlag("--no-root-changelog") ? false : void 0,
157
158
  token: options.token,
159
+ publishToken: options.publishToken,
158
160
  logLevel: program.opts().logLevel,
159
161
  force: options.force,
160
162
  yes: options.yes,
package/dist/index.d.mts CHANGED
@@ -43,6 +43,7 @@ declare function getDefaultConfig(): {
43
43
  publish: {
44
44
  private: boolean;
45
45
  args: never[];
46
+ safetyCheck: boolean;
46
47
  };
47
48
  tokens: {
48
49
  gitlab: string | undefined;
@@ -162,6 +163,11 @@ declare function detectPackageManager(cwd?: string): PackageManager;
162
163
  declare function determinePublishTag(version: string, configTag?: string): string;
163
164
  declare function getPackagesToPublishInSelectiveMode(sortedPackages: PackageBase[], rootVersion: string | undefined): PackageBase[];
164
165
  declare function getPackagesToPublishInIndependentMode(sortedPackages: PackageBase[], config: ResolvedRelizyConfig): Promise<PackageBase[]>;
166
+ declare function getAuthCommand({ packageManager, config, otp, }: {
167
+ packageManager: PackageManager;
168
+ config: ResolvedRelizyConfig;
169
+ otp?: string;
170
+ }): string;
165
171
  declare function publishPackage({ pkg, config, packageManager, dryRun, }: {
166
172
  pkg: PackageBase;
167
173
  config: ResolvedRelizyConfig;
@@ -285,7 +291,8 @@ declare function determineReleaseType({ currentVersion, commits, releaseType, pr
285
291
  force: boolean;
286
292
  }): ReleaseType | undefined;
287
293
  declare function writeVersion(pkgPath: string, newVersion: string, dryRun?: boolean): void;
288
- declare function getPackageNewVersion({ currentVersion, releaseType, preid, suffix, }: {
294
+ declare function getPackageNewVersion({ name, currentVersion, releaseType, preid, suffix, }: {
295
+ name: string;
289
296
  currentVersion: string;
290
297
  releaseType: ReleaseType;
291
298
  preid: string | undefined;
@@ -630,6 +637,11 @@ interface ProviderReleaseOptions {
630
637
  suffix?: string;
631
638
  }
632
639
  type PublishConfig = ChangelogConfig$1['publish'] & {
640
+ /**
641
+ * Package manager (e.g. `pnpm` or `npm`)
642
+ * @values `pnpm`, `npm`, `yarn`, `bun`
643
+ */
644
+ packageManager?: PackageManager;
633
645
  /**
634
646
  * NPM registry URL (e.g. `https://registry.npmjs.org/`)
635
647
  */
@@ -654,6 +666,15 @@ type PublishConfig = ChangelogConfig$1['publish'] & {
654
666
  * Command to build your packages before publishing (e.g. `pnpm build`)
655
667
  */
656
668
  buildCmd?: string;
669
+ /**
670
+ * NPM token (e.g. `123456`) - only supported for pnpm and npm
671
+ */
672
+ token?: string;
673
+ /**
674
+ * Skip safety check
675
+ * @default false
676
+ */
677
+ safetyCheck?: boolean;
657
678
  };
658
679
  interface PublishOptions extends PublishConfig {
659
680
  /**
@@ -771,6 +792,10 @@ interface ReleaseOptions extends ReleaseConfig, BumpConfig, ChangelogConfig, Pub
771
792
  * @default true
772
793
  */
773
794
  safetyCheck?: boolean;
795
+ /**
796
+ * NPM token (e.g. "123456")
797
+ */
798
+ publishToken?: string;
774
799
  }
775
800
  interface TemplatesConfig {
776
801
  /**
@@ -902,11 +927,14 @@ declare function providerRelease(options?: Partial<ProviderReleaseOptions>): Pro
902
927
  postedReleases: PostedRelease[];
903
928
  }>;
904
929
 
930
+ declare function publishSafetyCheck({ config }: {
931
+ config: ResolvedRelizyConfig;
932
+ }): Promise<void>;
905
933
  declare function publish(options?: Partial<PublishOptions>): Promise<{
906
934
  publishedPackages: PackageBase[];
907
935
  } | undefined>;
908
936
 
909
937
  declare function release(options?: Partial<ReleaseOptions>): Promise<void>;
910
938
 
911
- export { bump, changelog, checkGitStatusIfDirty, confirmBump, createCommitAndTags, createGitlabRelease, defineConfig, detectGitProvider, detectPackageManager, determinePublishTag, determineReleaseType, determineSemverChange, executeBuildCmd, executeFormatCmd, executeHook, expandPackagesToBumpWithDependents, extractVersionFromPackageTag, fetchGitTags, generateChangelog, 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, pushCommitAndTags, readPackageJson, readPackages, release, resolveTags, topologicalSort, updateLernaVersion, writeChangelogToFile, writeVersion };
939
+ 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 };
912
940
  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 };
package/dist/index.d.ts CHANGED
@@ -43,6 +43,7 @@ declare function getDefaultConfig(): {
43
43
  publish: {
44
44
  private: boolean;
45
45
  args: never[];
46
+ safetyCheck: boolean;
46
47
  };
47
48
  tokens: {
48
49
  gitlab: string | undefined;
@@ -162,6 +163,11 @@ declare function detectPackageManager(cwd?: string): PackageManager;
162
163
  declare function determinePublishTag(version: string, configTag?: string): string;
163
164
  declare function getPackagesToPublishInSelectiveMode(sortedPackages: PackageBase[], rootVersion: string | undefined): PackageBase[];
164
165
  declare function getPackagesToPublishInIndependentMode(sortedPackages: PackageBase[], config: ResolvedRelizyConfig): Promise<PackageBase[]>;
166
+ declare function getAuthCommand({ packageManager, config, otp, }: {
167
+ packageManager: PackageManager;
168
+ config: ResolvedRelizyConfig;
169
+ otp?: string;
170
+ }): string;
165
171
  declare function publishPackage({ pkg, config, packageManager, dryRun, }: {
166
172
  pkg: PackageBase;
167
173
  config: ResolvedRelizyConfig;
@@ -285,7 +291,8 @@ declare function determineReleaseType({ currentVersion, commits, releaseType, pr
285
291
  force: boolean;
286
292
  }): ReleaseType | undefined;
287
293
  declare function writeVersion(pkgPath: string, newVersion: string, dryRun?: boolean): void;
288
- declare function getPackageNewVersion({ currentVersion, releaseType, preid, suffix, }: {
294
+ declare function getPackageNewVersion({ name, currentVersion, releaseType, preid, suffix, }: {
295
+ name: string;
289
296
  currentVersion: string;
290
297
  releaseType: ReleaseType;
291
298
  preid: string | undefined;
@@ -630,6 +637,11 @@ interface ProviderReleaseOptions {
630
637
  suffix?: string;
631
638
  }
632
639
  type PublishConfig = ChangelogConfig$1['publish'] & {
640
+ /**
641
+ * Package manager (e.g. `pnpm` or `npm`)
642
+ * @values `pnpm`, `npm`, `yarn`, `bun`
643
+ */
644
+ packageManager?: PackageManager;
633
645
  /**
634
646
  * NPM registry URL (e.g. `https://registry.npmjs.org/`)
635
647
  */
@@ -654,6 +666,15 @@ type PublishConfig = ChangelogConfig$1['publish'] & {
654
666
  * Command to build your packages before publishing (e.g. `pnpm build`)
655
667
  */
656
668
  buildCmd?: string;
669
+ /**
670
+ * NPM token (e.g. `123456`) - only supported for pnpm and npm
671
+ */
672
+ token?: string;
673
+ /**
674
+ * Skip safety check
675
+ * @default false
676
+ */
677
+ safetyCheck?: boolean;
657
678
  };
658
679
  interface PublishOptions extends PublishConfig {
659
680
  /**
@@ -771,6 +792,10 @@ interface ReleaseOptions extends ReleaseConfig, BumpConfig, ChangelogConfig, Pub
771
792
  * @default true
772
793
  */
773
794
  safetyCheck?: boolean;
795
+ /**
796
+ * NPM token (e.g. "123456")
797
+ */
798
+ publishToken?: string;
774
799
  }
775
800
  interface TemplatesConfig {
776
801
  /**
@@ -902,11 +927,14 @@ declare function providerRelease(options?: Partial<ProviderReleaseOptions>): Pro
902
927
  postedReleases: PostedRelease[];
903
928
  }>;
904
929
 
930
+ declare function publishSafetyCheck({ config }: {
931
+ config: ResolvedRelizyConfig;
932
+ }): Promise<void>;
905
933
  declare function publish(options?: Partial<PublishOptions>): Promise<{
906
934
  publishedPackages: PackageBase[];
907
935
  } | undefined>;
908
936
 
909
937
  declare function release(options?: Partial<ReleaseOptions>): Promise<void>;
910
938
 
911
- export { bump, changelog, checkGitStatusIfDirty, confirmBump, createCommitAndTags, createGitlabRelease, defineConfig, detectGitProvider, detectPackageManager, determinePublishTag, determineReleaseType, determineSemverChange, executeBuildCmd, executeFormatCmd, executeHook, expandPackagesToBumpWithDependents, extractVersionFromPackageTag, fetchGitTags, generateChangelog, 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, pushCommitAndTags, readPackageJson, readPackages, release, resolveTags, topologicalSort, updateLernaVersion, writeChangelogToFile, writeVersion };
939
+ 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 };
912
940
  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 };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { b as bump, c as changelog, m as checkGitStatusIfDirty, ac as confirmBump, s as createCommitAndTags, A as createGitlabRelease, f as defineConfig, o as detectGitProvider, C as detectPackageManager, D as determinePublishTag, a0 as determineReleaseType, $ as determineSemverChange, X as executeBuildCmd, W as executeFormatCmd, T as executeHook, j as expandPackagesToBumpWithDependents, a4 as extractVersionFromPackageTag, n as fetchGitTags, g as generateChangelog, ad as getBumpedIndependentPackages, ab as getBumpedPackageIndependently, V as getCIName, x as getCurrentGitBranch, y as getCurrentGitRef, e as getDefaultConfig, i as getDependentsOf, v as getFirstCommit, k as getGitStatus, N as getIndependentTag, R as getLastPackageTag, Q as getLastRepoTag, O as getLastStableTag, P as getLastTag, L as getPackageCommits, h as getPackageDependencies, a2 as getPackageNewVersion, K as getPackages, Z as getPackagesOrBumpedPackages, F as getPackagesToPublishInIndependentMode, E as getPackagesToPublishInSelectiveMode, a9 as getPreid, I as getRootPackage, z as github, B as gitlab, M as hasLernaJson, Y as isBumpedPackage, aa as isChangedPreid, a8 as isGraduating, _ as isGraduatingToStableBetweenVersion, U as isInCI, a5 as isPrerelease, a7 as isPrereleaseReleaseType, a6 as isStableReleaseType, l as loadRelizyConfig, q as parseGitRemoteUrl, a as providerRelease, p as providerReleaseSafetyCheck, d as publish, G as publishPackage, u as pushCommitAndTags, H as readPackageJson, J as readPackages, r as release, S as resolveTags, t as topologicalSort, a3 as updateLernaVersion, w as writeChangelogToFile, a1 as writeVersion } from './shared/relizy.PGChVRhn.mjs';
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.qmU37FU2.mjs';
2
2
  import '@maz-ui/node';
3
3
  import 'node:fs';
4
4
  import 'node:path';
@@ -187,6 +187,7 @@ async function getRootPackage({
187
187
  process.exit(0);
188
188
  }
189
189
  newVersion = getPackageNewVersion({
190
+ name: packageJson.name,
190
191
  currentVersion: packageJson.version,
191
192
  releaseType,
192
193
  preid: config.bump.preid,
@@ -365,6 +366,7 @@ async function getPackages({
365
366
  force
366
367
  });
367
368
  const newVersion = releaseType ? getPackageNewVersion({
369
+ name: pkg.name,
368
370
  currentVersion: pkg.version,
369
371
  releaseType,
370
372
  preid: config.bump.preid,
@@ -1110,7 +1112,8 @@ function getDefaultConfig() {
1110
1112
  },
1111
1113
  publish: {
1112
1114
  private: false,
1113
- args: []
1115
+ args: [],
1116
+ safetyCheck: false
1114
1117
  },
1115
1118
  tokens: {
1116
1119
  gitlab: process$1.env.RELIZY_GITLAB_TOKEN || process$1.env.GITLAB_TOKEN || process$1.env.GITLAB_API_TOKEN || process$1.env.CI_JOB_TOKEN,
@@ -1773,6 +1776,7 @@ function writeVersion(pkgPath, newVersion, dryRun = false) {
1773
1776
  }
1774
1777
  }
1775
1778
  function getPackageNewVersion({
1779
+ name,
1776
1780
  currentVersion,
1777
1781
  releaseType,
1778
1782
  preid,
@@ -1780,7 +1784,7 @@ function getPackageNewVersion({
1780
1784
  }) {
1781
1785
  let newVersion = semver.inc(currentVersion, releaseType, preid);
1782
1786
  if (!newVersion) {
1783
- throw new Error(`Unable to bump version "${currentVersion}" with release type "${releaseType}"
1787
+ throw new Error(`Unable to bump "${name}" version "${currentVersion}" with release type "${releaseType}"
1784
1788
 
1785
1789
  You should use an explicit release type (use flag: --major, --minor, --patch, --premajor, --preminor, --prepatch, --prerelease)`);
1786
1790
  }
@@ -1789,13 +1793,13 @@ You should use an explicit release type (use flag: --major, --minor, --patch, --
1789
1793
  }
1790
1794
  const isValidVersion = semver.gt(newVersion, currentVersion);
1791
1795
  if (!isValidVersion) {
1792
- throw new Error(`Unable to bump version "${currentVersion}" to "${newVersion}", new version is not greater than current version`);
1796
+ throw new Error(`Unable to bump "${name}" version "${currentVersion}" to "${newVersion}", new version is not greater than current version`);
1793
1797
  }
1794
1798
  if (isGraduating(currentVersion, releaseType)) {
1795
- logger.info(`Graduating from prerelease ${currentVersion} to stable ${newVersion}`);
1799
+ logger.info(`Graduating "${name}" from prerelease ${currentVersion} to stable ${newVersion}`);
1796
1800
  }
1797
1801
  if (isChangedPreid(currentVersion, preid)) {
1798
- logger.debug(`Graduating from ${getPreid(currentVersion)} to ${preid}`);
1802
+ logger.debug(`Graduating "${name}" from ${getPreid(currentVersion)} to ${preid}`);
1799
1803
  }
1800
1804
  return newVersion;
1801
1805
  }
@@ -2342,30 +2346,47 @@ function getCommandArgs({
2342
2346
  packageManager,
2343
2347
  tag,
2344
2348
  config,
2345
- otp
2349
+ otp,
2350
+ type
2346
2351
  }) {
2347
- const args = ["publish", "--tag", tag];
2348
- if (packageManager === "pnpm") {
2349
- args.push("--no-git-checks");
2350
- } else if (packageManager === "yarn") {
2351
- args.push("--non-interactive");
2352
- if (isYarnBerry())
2353
- args.push("--no-git-checks");
2354
- } else if (packageManager === "npm") {
2355
- args.push("--yes");
2356
- }
2352
+ const args = type === "publish" ? ["publish", "--tag", tag] : ["whoami"];
2357
2353
  const registry = config.publish.registry;
2358
2354
  if (registry) {
2359
2355
  args.push("--registry", registry);
2360
2356
  }
2361
- const access = config.publish.access;
2362
- if (access) {
2363
- args.push("--access", access);
2357
+ const isPnpmOrNpm = packageManager === "pnpm" || packageManager === "npm";
2358
+ const publishToken = config.publish.token;
2359
+ if (publishToken) {
2360
+ if (!registry) {
2361
+ logger.warn("Publish token provided but no registry specified");
2362
+ } else if (!isPnpmOrNpm) {
2363
+ logger.warn("Publish token only supported for pnpm and npm");
2364
+ } else {
2365
+ const registryUrl = new URL(registry);
2366
+ const authTokenKey = `--//${registryUrl.host}${registryUrl.pathname}:_authToken=${publishToken}`;
2367
+ args.push(authTokenKey);
2368
+ }
2364
2369
  }
2365
2370
  const finalOtp = otp ?? sessionOtp ?? config.publish.otp;
2366
2371
  if (finalOtp) {
2367
2372
  args.push("--otp", finalOtp);
2368
2373
  }
2374
+ if (type === "auth") {
2375
+ return args;
2376
+ }
2377
+ const access = config.publish.access;
2378
+ if (access) {
2379
+ args.push("--access", access);
2380
+ }
2381
+ if (packageManager === "pnpm") {
2382
+ args.push("--no-git-checks");
2383
+ } else if (packageManager === "yarn") {
2384
+ args.push("--non-interactive");
2385
+ if (isYarnBerry())
2386
+ args.push("--no-git-checks");
2387
+ } else if (packageManager === "npm") {
2388
+ args.push("--yes");
2389
+ }
2369
2390
  return args;
2370
2391
  }
2371
2392
  function isOtpError(error) {
@@ -2428,6 +2449,36 @@ async function executePublishCommand({
2428
2449
  }
2429
2450
  logger.info(`Published ${packageNameAndVersion}`);
2430
2451
  }
2452
+ function getAuthCommand({
2453
+ packageManager,
2454
+ config,
2455
+ otp
2456
+ }) {
2457
+ const args = getCommandArgs({
2458
+ packageManager,
2459
+ tag: void 0,
2460
+ config,
2461
+ otp,
2462
+ type: "auth"
2463
+ });
2464
+ return `${packageManager} ${args.join(" ")}`;
2465
+ }
2466
+ function getPublishCommand({
2467
+ packageManager,
2468
+ tag,
2469
+ config,
2470
+ otp
2471
+ }) {
2472
+ const args = getCommandArgs({
2473
+ packageManager,
2474
+ tag,
2475
+ config,
2476
+ otp,
2477
+ type: "publish"
2478
+ });
2479
+ const baseCommand = packageManager === "yarn" && isYarnBerry() ? "yarn npm" : packageManager;
2480
+ return `${baseCommand} ${args.join(" ")}`;
2481
+ }
2431
2482
  async function publishPackage({
2432
2483
  pkg,
2433
2484
  config,
@@ -2436,19 +2487,17 @@ async function publishPackage({
2436
2487
  }) {
2437
2488
  const tag = determinePublishTag(pkg.newVersion || pkg.version, config.publish.tag);
2438
2489
  const packageNameAndVersion = getIndependentTag({ name: pkg.name, version: pkg.newVersion || pkg.version });
2439
- const baseCommand = packageManager === "yarn" && isYarnBerry() ? "yarn npm" : packageManager;
2440
2490
  logger.debug(`Building publish command for ${pkg.name}`);
2441
2491
  let dynamicOtp;
2442
2492
  const maxAttempts = 2;
2443
2493
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
2444
2494
  try {
2445
- const args = getCommandArgs({
2495
+ const command = getPublishCommand({
2446
2496
  packageManager,
2447
2497
  tag,
2448
2498
  config,
2449
2499
  otp: dynamicOtp
2450
2500
  });
2451
- const command = `${baseCommand} ${args.join(" ")}`;
2452
2501
  logger.debug(`Publishing ${packageNameAndVersion} with tag '${tag}' with command: ${command}`);
2453
2502
  process.chdir(pkg.path);
2454
2503
  await executePublishCommand({
@@ -2972,11 +3021,11 @@ function providerReleaseSafetyCheck({ config, provider }) {
2972
3021
  } else if (internalProvider === "gitlab") {
2973
3022
  token = config.tokens?.gitlab || config.repo?.token;
2974
3023
  } else {
2975
- logger.error(`Unsupported Git provider: ${internalProvider || "unknown"}`);
3024
+ logger.error(`[provider-release-safety-check] Unsupported Git provider: ${internalProvider || "unknown"}`);
2976
3025
  process.exit(1);
2977
3026
  }
2978
3027
  if (!token) {
2979
- logger.error(`No token provided for ${internalProvider || "unknown"} - The release will not be published - Please refer to the documentation: https://louismazel.github.io/relizy/guide/installation#environment-setup`);
3028
+ logger.error(`[provider-release-safety-check] No token provided for ${internalProvider || "unknown"} - The release will not be published - Please refer to the documentation: https://louismazel.github.io/relizy/guide/installation#environment-setup`);
2980
3029
  process.exit(1);
2981
3030
  }
2982
3031
  }
@@ -3043,6 +3092,40 @@ async function providerRelease(options = {}) {
3043
3092
  }
3044
3093
  }
3045
3094
 
3095
+ async function publishSafetyCheck({ config }) {
3096
+ logger.debug("[publish-safety-check] Running publish safety check");
3097
+ if (!config.safetyCheck || !config.release.publish || !config.publish.safetyCheck) {
3098
+ logger.debug("[publish-safety-check] Safety check disabled or publish disabled");
3099
+ return;
3100
+ }
3101
+ const packageManager = config.publish.packageManager || detectPackageManager(config.cwd);
3102
+ if (!packageManager) {
3103
+ logger.error("[publish-safety-check] Unable to detect package manager");
3104
+ process.exit(1);
3105
+ }
3106
+ const isPnpmOrNpm = packageManager === "pnpm" || packageManager === "npm";
3107
+ if (isPnpmOrNpm) {
3108
+ const authCommand = getAuthCommand({
3109
+ packageManager,
3110
+ config,
3111
+ otp: config.publish.otp
3112
+ });
3113
+ try {
3114
+ logger.debug("[publish-safety-check] Authenticating to package registry...");
3115
+ await execPromise(authCommand, {
3116
+ cwd: config.cwd,
3117
+ noStderr: true,
3118
+ noStdout: true,
3119
+ logLevel: config.logLevel,
3120
+ noSuccess: true
3121
+ });
3122
+ logger.info("[publish-safety-check] Successfully authenticated to package registry");
3123
+ } catch (error) {
3124
+ logger.error("[publish-safety-check] Failed to authenticate to package registry:", error);
3125
+ process.exit(1);
3126
+ }
3127
+ }
3128
+ }
3046
3129
  async function publish(options = {}) {
3047
3130
  const config = await loadRelizyConfig({
3048
3131
  configName: options.configName,
@@ -3053,14 +3136,16 @@ async function publish(options = {}) {
3053
3136
  otp: options.otp,
3054
3137
  registry: options.registry,
3055
3138
  tag: options.tag,
3056
- buildCmd: options.buildCmd
3139
+ buildCmd: options.buildCmd,
3140
+ token: options.token
3057
3141
  },
3058
- logLevel: options.logLevel
3142
+ logLevel: options.logLevel,
3143
+ safetyCheck: options.safetyCheck
3059
3144
  }
3060
3145
  });
3061
3146
  const dryRun = options.dryRun ?? false;
3062
3147
  logger.debug(`Dry run: ${dryRun}`);
3063
- const packageManager = detectPackageManager(process.cwd());
3148
+ const packageManager = config.publish.packageManager || detectPackageManager(config.cwd);
3064
3149
  logger.debug(`Package manager: ${packageManager}`);
3065
3150
  logger.info(`Version mode: ${config.monorepo?.versionMode || "standalone"}`);
3066
3151
  if (config.publish.registry) {
@@ -3071,6 +3156,7 @@ async function publish(options = {}) {
3071
3156
  }
3072
3157
  try {
3073
3158
  await executeHook("before:publish", config, dryRun);
3159
+ await publishSafetyCheck({ config });
3074
3160
  const rootPackage = readPackageJson(config.cwd);
3075
3161
  if (!rootPackage) {
3076
3162
  throw new Error("Failed to read root package.json");
@@ -3162,7 +3248,8 @@ function getReleaseConfig(options = {}) {
3162
3248
  otp: options.otp,
3163
3249
  registry: options.registry,
3164
3250
  tag: options.tag,
3165
- buildCmd: options.buildCmd
3251
+ buildCmd: options.buildCmd,
3252
+ token: options.publishToken
3166
3253
  },
3167
3254
  release: {
3168
3255
  commit: options.commit,
@@ -3178,7 +3265,7 @@ function getReleaseConfig(options = {}) {
3178
3265
  }
3179
3266
  });
3180
3267
  }
3181
- function releaseSafetyCheck({
3268
+ async function releaseSafetyCheck({
3182
3269
  config,
3183
3270
  provider
3184
3271
  }) {
@@ -3186,6 +3273,7 @@ function releaseSafetyCheck({
3186
3273
  return;
3187
3274
  }
3188
3275
  providerReleaseSafetyCheck({ config, provider });
3276
+ await publishSafetyCheck({ config });
3189
3277
  }
3190
3278
  async function release(options = {}) {
3191
3279
  const dryRun = options.dryRun ?? false;
@@ -3195,7 +3283,7 @@ async function release(options = {}) {
3195
3283
  const config = await getReleaseConfig(options);
3196
3284
  logger.debug(`Version mode: ${config.monorepo?.versionMode || "standalone"}`);
3197
3285
  logger.debug(`Push: ${config.release.push}, Publish: ${config.release.publish}, Provider Release: ${config.release.providerRelease}`);
3198
- releaseSafetyCheck({ config, provider: options.provider });
3286
+ await releaseSafetyCheck({ config, provider: options.provider });
3199
3287
  try {
3200
3288
  await executeHook("before:release", config, dryRun);
3201
3289
  logger.box("Step 1/6: Bump versions");
@@ -3326,4 +3414,4 @@ Git provider: ${provider}`);
3326
3414
  }
3327
3415
  }
3328
3416
 
3329
- export { determineSemverChange as $, createGitlabRelease as A, gitlab as B, detectPackageManager as C, determinePublishTag as D, getPackagesToPublishInSelectiveMode as E, getPackagesToPublishInIndependentMode as F, publishPackage as G, readPackageJson as H, getRootPackage as I, readPackages as J, getPackages as K, getPackageCommits as L, hasLernaJson as M, getIndependentTag as N, getLastStableTag as O, getLastTag as P, getLastRepoTag as Q, getLastPackageTag as R, resolveTags as S, executeHook as T, isInCI as U, getCIName as V, executeFormatCmd as W, executeBuildCmd as X, isBumpedPackage as Y, getPackagesOrBumpedPackages as Z, isGraduatingToStableBetweenVersion as _, providerRelease as a, determineReleaseType as a0, writeVersion as a1, getPackageNewVersion as a2, updateLernaVersion as a3, extractVersionFromPackageTag as a4, isPrerelease as a5, isStableReleaseType as a6, isPrereleaseReleaseType as a7, isGraduating as a8, getPreid as a9, isChangedPreid as aa, getBumpedPackageIndependently as ab, confirmBump as ac, getBumpedIndependentPackages as ad, bump as b, changelog as c, publish as d, getDefaultConfig as e, defineConfig as f, generateChangelog as g, getPackageDependencies as h, getDependentsOf as i, expandPackagesToBumpWithDependents as j, getGitStatus as k, loadRelizyConfig as l, checkGitStatusIfDirty as m, fetchGitTags as n, detectGitProvider as o, providerReleaseSafetyCheck as p, parseGitRemoteUrl as q, release as r, createCommitAndTags as s, topologicalSort as t, pushCommitAndTags as u, getFirstCommit as v, writeChangelogToFile as w, getCurrentGitBranch as x, getCurrentGitRef as y, github as z };
3417
+ 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 };
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "relizy",
3
3
  "type": "module",
4
- "version": "0.2.5-beta.12",
4
+ "version": "0.2.5-beta.13",
5
+ "packageManager": "pnpm@10.22.0",
5
6
  "description": "Changelogen adapter for monorepo management with unified and independent versioning",
6
7
  "author": "Louis Mazel <me@loicmazuel.com>",
7
8
  "license": "MIT",
@@ -54,6 +55,21 @@
54
55
  "engines": {
55
56
  "node": ">=20.0.0"
56
57
  },
58
+ "scripts": {
59
+ "preinstall": "npx only-allow pnpm",
60
+ "prepare": "npx husky",
61
+ "build": "unbuild",
62
+ "dev": "unbuild --stub",
63
+ "relizy": "node bin/relizy.mjs",
64
+ "rly": "node bin/relizy.mjs",
65
+ "typecheck": "tsc --noEmit --skipLibCheck",
66
+ "lint": "cross-env NODE_ENV=production eslint .",
67
+ "lint:fix": "pnpm lint --fix",
68
+ "test:unit": "vitest run",
69
+ "test:unit:watch": "vitest watch",
70
+ "test:unit:coverage": "vitest run --coverage",
71
+ "pre-commit": "lint-staged"
72
+ },
57
73
  "dependencies": {
58
74
  "@inquirer/prompts": "^8.0.1",
59
75
  "@maz-ui/node": "4.3.2-beta.1",
@@ -90,19 +106,5 @@
90
106
  "*.{js,jsx,ts,tsx,mjs,mts,cjs,md,yml,json}": [
91
107
  "eslint --fix"
92
108
  ]
93
- },
94
- "scripts": {
95
- "preinstall": "npx only-allow pnpm",
96
- "build": "unbuild",
97
- "dev": "unbuild --stub",
98
- "relizy": "node bin/relizy.mjs",
99
- "rly": "node bin/relizy.mjs",
100
- "typecheck": "tsc --noEmit --skipLibCheck",
101
- "lint": "cross-env NODE_ENV=production eslint .",
102
- "lint:fix": "pnpm lint --fix",
103
- "test:unit": "vitest run",
104
- "test:unit:watch": "vitest watch",
105
- "test:unit:coverage": "vitest run --coverage",
106
- "pre-commit": "lint-staged"
107
109
  }
108
- }
110
+ }