relizy 0.2.5-beta.1 → 0.2.5-beta.11
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 +3 -2
- package/dist/index.d.mts +17 -18
- package/dist/index.d.ts +17 -18
- package/dist/index.mjs +2 -2
- package/dist/shared/{relizy.DYn3rUjq.mjs → relizy.DLoE22sp.mjs} +146 -79
- package/package.json +6 -6
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.
|
|
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.DLoE22sp.mjs';
|
|
9
9
|
import 'node:child_process';
|
|
10
10
|
import '@maz-ui/utils';
|
|
11
11
|
import 'c12';
|
|
@@ -130,7 +130,7 @@ program.command("provider-release").description("Publish release to git provider
|
|
|
130
130
|
process.exit(1);
|
|
131
131
|
}
|
|
132
132
|
});
|
|
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-changelog", "Skip changelog generation files").option("--provider <provider>", "Git provider (github or gitlab)").option("--yes", "Skip confirmation prompt about bumping packages").action(async (options) => {
|
|
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
134
|
try {
|
|
135
135
|
await release({
|
|
136
136
|
type: getReleaseType(options),
|
|
@@ -143,6 +143,7 @@ program.command("release").description("Complete release workflow (bump + change
|
|
|
143
143
|
push: hasCliFlag("--no-push") || hasCliFlag("--no-commit") ? false : void 0,
|
|
144
144
|
publish: hasCliFlag("--no-publish") ? false : void 0,
|
|
145
145
|
providerRelease: hasCliFlag("--no-provider-release") ? false : void 0,
|
|
146
|
+
gitTag: hasCliFlag("--no-git-tag") ? false : void 0,
|
|
146
147
|
noVerify: hasCliFlag("--no-verify") ? true : void 0,
|
|
147
148
|
clean: hasCliFlag("--no-clean") ? false : void 0,
|
|
148
149
|
registry: options.registry,
|
package/dist/index.d.mts
CHANGED
|
@@ -115,7 +115,8 @@ declare function createCommitAndTags({ config, noVerify, bumpedPackages, newVers
|
|
|
115
115
|
dryRun?: boolean;
|
|
116
116
|
logLevel: LogLevel;
|
|
117
117
|
}): Promise<string[]>;
|
|
118
|
-
declare function pushCommitAndTags({ dryRun, logLevel, cwd }: {
|
|
118
|
+
declare function pushCommitAndTags({ config, dryRun, logLevel, cwd }: {
|
|
119
|
+
config: ResolvedRelizyConfig;
|
|
119
120
|
dryRun: boolean;
|
|
120
121
|
logLevel?: LogLevel;
|
|
121
122
|
cwd: string;
|
|
@@ -168,7 +169,12 @@ declare function publishPackage({ pkg, config, packageManager, dryRun, }: {
|
|
|
168
169
|
dryRun: boolean;
|
|
169
170
|
}): Promise<void>;
|
|
170
171
|
|
|
171
|
-
declare function readPackageJson(packagePath: string): ReadPackage;
|
|
172
|
+
declare function readPackageJson(packagePath: string): ReadPackage | undefined;
|
|
173
|
+
interface RootPackage extends ReadPackage {
|
|
174
|
+
fromTag: string;
|
|
175
|
+
commits: GitCommit[];
|
|
176
|
+
newVersion?: string;
|
|
177
|
+
}
|
|
172
178
|
declare function getRootPackage({ config, force, from, to, suffix, changelog, }: {
|
|
173
179
|
config: ResolvedRelizyConfig;
|
|
174
180
|
force: boolean;
|
|
@@ -176,15 +182,7 @@ declare function getRootPackage({ config, force, from, to, suffix, changelog, }:
|
|
|
176
182
|
to: string;
|
|
177
183
|
suffix: string | undefined;
|
|
178
184
|
changelog: boolean;
|
|
179
|
-
}): Promise<
|
|
180
|
-
path: string;
|
|
181
|
-
fromTag: string;
|
|
182
|
-
commits: GitCommit[];
|
|
183
|
-
newVersion: string;
|
|
184
|
-
name: string;
|
|
185
|
-
version: string;
|
|
186
|
-
private: boolean;
|
|
187
|
-
}>;
|
|
185
|
+
}): Promise<RootPackage>;
|
|
188
186
|
declare function readPackages({ cwd, patterns, ignorePackageNames, }: {
|
|
189
187
|
cwd: string;
|
|
190
188
|
patterns?: string[];
|
|
@@ -312,11 +310,7 @@ declare function getBumpedPackageIndependently({ pkg, dryRun, }: {
|
|
|
312
310
|
declare function confirmBump({ versionMode, config, packages, force, currentVersion, newVersion, dryRun, }: {
|
|
313
311
|
versionMode: VersionMode;
|
|
314
312
|
config: ResolvedRelizyConfig;
|
|
315
|
-
packages:
|
|
316
|
-
name: string;
|
|
317
|
-
version: string;
|
|
318
|
-
newVersion?: string;
|
|
319
|
-
}[];
|
|
313
|
+
packages: PackageBase[];
|
|
320
314
|
force: boolean;
|
|
321
315
|
currentVersion?: string;
|
|
322
316
|
newVersion?: string;
|
|
@@ -399,7 +393,7 @@ interface BumpResultTruthy {
|
|
|
399
393
|
/**
|
|
400
394
|
* Root package
|
|
401
395
|
*/
|
|
402
|
-
rootPackage?:
|
|
396
|
+
rootPackage?: RootPackage;
|
|
403
397
|
/**
|
|
404
398
|
* Bumped packages
|
|
405
399
|
*/
|
|
@@ -723,6 +717,11 @@ interface ReleaseConfig {
|
|
|
723
717
|
* @default false
|
|
724
718
|
*/
|
|
725
719
|
clean?: boolean;
|
|
720
|
+
/**
|
|
721
|
+
* Create tag
|
|
722
|
+
* @default true
|
|
723
|
+
*/
|
|
724
|
+
gitTag?: boolean;
|
|
726
725
|
}
|
|
727
726
|
interface ReleaseOptions extends ReleaseConfig, BumpConfig, ChangelogConfig, PublishConfig {
|
|
728
727
|
/**
|
|
@@ -903,4 +902,4 @@ declare function publish(options?: Partial<PublishOptions>): Promise<{
|
|
|
903
902
|
declare function release(options?: Partial<ReleaseOptions>): Promise<void>;
|
|
904
903
|
|
|
905
904
|
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, getPackagesToPublishInIndependentMode, getPackagesToPublishInSelectiveMode, getPreid, getRootPackage, github, gitlab, hasLernaJson, isBumpedPackage, isChangedPreid, isGraduating, isInCI, isPrerelease, isPrereleaseReleaseType, isStableReleaseType, loadRelizyConfig, parseGitRemoteUrl, providerRelease, providerReleaseSafetyCheck, publish, publishPackage, pushCommitAndTags, readPackageJson, readPackages, release, resolveTags, topologicalSort, updateLernaVersion, writeChangelogToFile, writeVersion };
|
|
906
|
-
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, Step, TemplatesConfig, VersionMode };
|
|
905
|
+
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
|
@@ -115,7 +115,8 @@ declare function createCommitAndTags({ config, noVerify, bumpedPackages, newVers
|
|
|
115
115
|
dryRun?: boolean;
|
|
116
116
|
logLevel: LogLevel;
|
|
117
117
|
}): Promise<string[]>;
|
|
118
|
-
declare function pushCommitAndTags({ dryRun, logLevel, cwd }: {
|
|
118
|
+
declare function pushCommitAndTags({ config, dryRun, logLevel, cwd }: {
|
|
119
|
+
config: ResolvedRelizyConfig;
|
|
119
120
|
dryRun: boolean;
|
|
120
121
|
logLevel?: LogLevel;
|
|
121
122
|
cwd: string;
|
|
@@ -168,7 +169,12 @@ declare function publishPackage({ pkg, config, packageManager, dryRun, }: {
|
|
|
168
169
|
dryRun: boolean;
|
|
169
170
|
}): Promise<void>;
|
|
170
171
|
|
|
171
|
-
declare function readPackageJson(packagePath: string): ReadPackage;
|
|
172
|
+
declare function readPackageJson(packagePath: string): ReadPackage | undefined;
|
|
173
|
+
interface RootPackage extends ReadPackage {
|
|
174
|
+
fromTag: string;
|
|
175
|
+
commits: GitCommit[];
|
|
176
|
+
newVersion?: string;
|
|
177
|
+
}
|
|
172
178
|
declare function getRootPackage({ config, force, from, to, suffix, changelog, }: {
|
|
173
179
|
config: ResolvedRelizyConfig;
|
|
174
180
|
force: boolean;
|
|
@@ -176,15 +182,7 @@ declare function getRootPackage({ config, force, from, to, suffix, changelog, }:
|
|
|
176
182
|
to: string;
|
|
177
183
|
suffix: string | undefined;
|
|
178
184
|
changelog: boolean;
|
|
179
|
-
}): Promise<
|
|
180
|
-
path: string;
|
|
181
|
-
fromTag: string;
|
|
182
|
-
commits: GitCommit[];
|
|
183
|
-
newVersion: string;
|
|
184
|
-
name: string;
|
|
185
|
-
version: string;
|
|
186
|
-
private: boolean;
|
|
187
|
-
}>;
|
|
185
|
+
}): Promise<RootPackage>;
|
|
188
186
|
declare function readPackages({ cwd, patterns, ignorePackageNames, }: {
|
|
189
187
|
cwd: string;
|
|
190
188
|
patterns?: string[];
|
|
@@ -312,11 +310,7 @@ declare function getBumpedPackageIndependently({ pkg, dryRun, }: {
|
|
|
312
310
|
declare function confirmBump({ versionMode, config, packages, force, currentVersion, newVersion, dryRun, }: {
|
|
313
311
|
versionMode: VersionMode;
|
|
314
312
|
config: ResolvedRelizyConfig;
|
|
315
|
-
packages:
|
|
316
|
-
name: string;
|
|
317
|
-
version: string;
|
|
318
|
-
newVersion?: string;
|
|
319
|
-
}[];
|
|
313
|
+
packages: PackageBase[];
|
|
320
314
|
force: boolean;
|
|
321
315
|
currentVersion?: string;
|
|
322
316
|
newVersion?: string;
|
|
@@ -399,7 +393,7 @@ interface BumpResultTruthy {
|
|
|
399
393
|
/**
|
|
400
394
|
* Root package
|
|
401
395
|
*/
|
|
402
|
-
rootPackage?:
|
|
396
|
+
rootPackage?: RootPackage;
|
|
403
397
|
/**
|
|
404
398
|
* Bumped packages
|
|
405
399
|
*/
|
|
@@ -723,6 +717,11 @@ interface ReleaseConfig {
|
|
|
723
717
|
* @default false
|
|
724
718
|
*/
|
|
725
719
|
clean?: boolean;
|
|
720
|
+
/**
|
|
721
|
+
* Create tag
|
|
722
|
+
* @default true
|
|
723
|
+
*/
|
|
724
|
+
gitTag?: boolean;
|
|
726
725
|
}
|
|
727
726
|
interface ReleaseOptions extends ReleaseConfig, BumpConfig, ChangelogConfig, PublishConfig {
|
|
728
727
|
/**
|
|
@@ -903,4 +902,4 @@ declare function publish(options?: Partial<PublishOptions>): Promise<{
|
|
|
903
902
|
declare function release(options?: Partial<ReleaseOptions>): Promise<void>;
|
|
904
903
|
|
|
905
904
|
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, getPackagesToPublishInIndependentMode, getPackagesToPublishInSelectiveMode, getPreid, getRootPackage, github, gitlab, hasLernaJson, isBumpedPackage, isChangedPreid, isGraduating, isInCI, isPrerelease, isPrereleaseReleaseType, isStableReleaseType, loadRelizyConfig, parseGitRemoteUrl, providerRelease, providerReleaseSafetyCheck, publish, publishPackage, pushCommitAndTags, readPackageJson, readPackages, release, resolveTags, topologicalSort, updateLernaVersion, writeChangelogToFile, writeVersion };
|
|
906
|
-
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, Step, TemplatesConfig, VersionMode };
|
|
905
|
+
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,9 +1,9 @@
|
|
|
1
|
-
export { b as bump, c as changelog, m as checkGitStatusIfDirty, aa as confirmBump, s as createCommitAndTags, A as createGitlabRelease, f as defineConfig, o as detectGitProvider, C as detectPackageManager, D as determinePublishTag, _ as determineReleaseType, Z as determineSemverChange, X as executeBuildCmd, W as executeFormatCmd, T as executeHook, j as expandPackagesToBumpWithDependents, a2 as extractVersionFromPackageTag, n as fetchGitTags, g as generateChangelog, ab as getBumpedIndependentPackages, a9 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, a0 as getPackageNewVersion, K as getPackages, F as getPackagesToPublishInIndependentMode, E as getPackagesToPublishInSelectiveMode, a7 as getPreid, I as getRootPackage, z as github, B as gitlab, M as hasLernaJson, Y as isBumpedPackage, a8 as isChangedPreid, a6 as isGraduating, U as isInCI, a3 as isPrerelease, a5 as isPrereleaseReleaseType, a4 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, a1 as updateLernaVersion, w as writeChangelogToFile, $ as writeVersion } from './shared/relizy.
|
|
1
|
+
export { b as bump, c as changelog, m as checkGitStatusIfDirty, aa as confirmBump, s as createCommitAndTags, A as createGitlabRelease, f as defineConfig, o as detectGitProvider, C as detectPackageManager, D as determinePublishTag, _ as determineReleaseType, Z as determineSemverChange, X as executeBuildCmd, W as executeFormatCmd, T as executeHook, j as expandPackagesToBumpWithDependents, a2 as extractVersionFromPackageTag, n as fetchGitTags, g as generateChangelog, ab as getBumpedIndependentPackages, a9 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, a0 as getPackageNewVersion, K as getPackages, F as getPackagesToPublishInIndependentMode, E as getPackagesToPublishInSelectiveMode, a7 as getPreid, I as getRootPackage, z as github, B as gitlab, M as hasLernaJson, Y as isBumpedPackage, a8 as isChangedPreid, a6 as isGraduating, U as isInCI, a3 as isPrerelease, a5 as isPrereleaseReleaseType, a4 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, a1 as updateLernaVersion, w as writeChangelogToFile, $ as writeVersion } from './shared/relizy.DLoE22sp.mjs';
|
|
2
2
|
import '@maz-ui/node';
|
|
3
|
+
import 'node:process';
|
|
3
4
|
import 'node:child_process';
|
|
4
5
|
import 'node:fs';
|
|
5
6
|
import 'node:path';
|
|
6
|
-
import 'node:process';
|
|
7
7
|
import '@maz-ui/utils';
|
|
8
8
|
import 'c12';
|
|
9
9
|
import 'changelogen';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { logger, execPromise } from '@maz-ui/node';
|
|
2
|
+
import process$1, { exit } from 'node:process';
|
|
2
3
|
import { execSync } from 'node:child_process';
|
|
3
4
|
import { existsSync, readFileSync, writeFileSync, statSync } from 'node:fs';
|
|
4
5
|
import path, { join, relative } from 'node:path';
|
|
5
|
-
import process$1 from 'node:process';
|
|
6
6
|
import { upperFirst, formatJson } from '@maz-ui/utils';
|
|
7
7
|
import { setupDotenv, loadConfig } from 'c12';
|
|
8
8
|
import { formatCompareChanges, formatReference, resolveRepoConfig, getRepoConfig, createGithubRelease, getGitDiff, parseCommits } from 'changelogen';
|
|
@@ -255,8 +255,11 @@ async function createCommitAndTags({
|
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
const rootPackage = readPackageJson(internalConfig.cwd);
|
|
258
|
+
if (!rootPackage) {
|
|
259
|
+
throw new Error("Failed to read root package.json");
|
|
260
|
+
}
|
|
258
261
|
newVersion = newVersion || rootPackage.version;
|
|
259
|
-
const versionForMessage = internalConfig.monorepo?.versionMode === "independent" ? bumpedPackages?.map((pkg) => getIndependentTag(pkg)).join(", ") || "unknown" : newVersion || "unknown";
|
|
262
|
+
const versionForMessage = internalConfig.monorepo?.versionMode === "independent" ? bumpedPackages?.map((pkg) => getIndependentTag({ name: pkg.name, version: pkg.newVersion || pkg.version })).join(", ") || "unknown" : newVersion || "unknown";
|
|
260
263
|
const commitMessage = internalConfig.templates.commitMessage?.replaceAll("{{newVersion}}", versionForMessage) || `chore(release): bump version to ${versionForMessage}`;
|
|
261
264
|
const noVerifyFlag = noVerify ? "--no-verify " : "";
|
|
262
265
|
logger.debug(`No verify: ${noVerify}`);
|
|
@@ -275,7 +278,7 @@ async function createCommitAndTags({
|
|
|
275
278
|
const signTags = internalConfig.signTags ? "-s" : "";
|
|
276
279
|
logger.debug(`Sign tags: ${internalConfig.signTags}`);
|
|
277
280
|
const createdTags = [];
|
|
278
|
-
if (internalConfig.monorepo?.versionMode === "independent" && bumpedPackages && bumpedPackages.length > 0) {
|
|
281
|
+
if (internalConfig.monorepo?.versionMode === "independent" && bumpedPackages && bumpedPackages.length > 0 && internalConfig.release.gitTag) {
|
|
279
282
|
logger.debug(`Creating ${bumpedPackages.length} independent package tags`);
|
|
280
283
|
for (const pkg of bumpedPackages) {
|
|
281
284
|
if (!pkg.newVersion) {
|
|
@@ -304,7 +307,7 @@ async function createCommitAndTags({
|
|
|
304
307
|
createdTags.push(tagName);
|
|
305
308
|
}
|
|
306
309
|
logger.success(`Created ${createdTags.length} tags for independent packages, ${createdTags.join(", ")}`);
|
|
307
|
-
} else {
|
|
310
|
+
} else if (internalConfig.release.gitTag) {
|
|
308
311
|
const tagName = internalConfig.templates.tagBody?.replaceAll("{{newVersion}}", newVersion);
|
|
309
312
|
const tagMessage = internalConfig.templates?.tagMessage?.replaceAll("{{newVersion}}", newVersion) || tagName;
|
|
310
313
|
if (dryRun) {
|
|
@@ -337,13 +340,14 @@ async function createCommitAndTags({
|
|
|
337
340
|
throw error;
|
|
338
341
|
}
|
|
339
342
|
}
|
|
340
|
-
async function pushCommitAndTags({ dryRun, logLevel, cwd }) {
|
|
343
|
+
async function pushCommitAndTags({ config, dryRun, logLevel, cwd }) {
|
|
341
344
|
logger.start("Start push changes and tags");
|
|
345
|
+
const command = config.release.gitTag ? "git push --follow-tags" : "git push";
|
|
342
346
|
if (dryRun) {
|
|
343
|
-
logger.info(
|
|
347
|
+
logger.info(`[dry-run] ${command}`);
|
|
344
348
|
} else {
|
|
345
|
-
logger.debug(
|
|
346
|
-
await execPromise(
|
|
349
|
+
logger.debug(`Executing: ${command}`);
|
|
350
|
+
await execPromise(command, { noStderr: true, noStdout: true, logLevel, cwd });
|
|
347
351
|
}
|
|
348
352
|
logger.success("Pushing changes and tags completed!");
|
|
349
353
|
}
|
|
@@ -435,21 +439,23 @@ async function generateMarkDown({
|
|
|
435
439
|
_authors.set(name, { email: /* @__PURE__ */ new Set([commit.author.email]), name });
|
|
436
440
|
}
|
|
437
441
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
for (const data of [...meta.email, meta.name]) {
|
|
445
|
-
const { user } = await fetch$1(`https://ungh.cc/users/find/${data}`).then((r) => r.json()).catch(() => ({ user: null }));
|
|
446
|
-
if (user) {
|
|
447
|
-
meta.github = user.username;
|
|
448
|
-
break;
|
|
442
|
+
if (updatedConfig.repo?.provider === "github") {
|
|
443
|
+
await Promise.all(
|
|
444
|
+
[..._authors.keys()].map(async (authorName) => {
|
|
445
|
+
const meta = _authors.get(authorName);
|
|
446
|
+
if (!meta) {
|
|
447
|
+
return;
|
|
449
448
|
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
449
|
+
for (const data of [...meta.email, meta.name]) {
|
|
450
|
+
const { user } = await fetch$1(`https://ungh.cc/users/find/${data}`).then((r) => r.json()).catch(() => ({ user: null }));
|
|
451
|
+
if (user) {
|
|
452
|
+
meta.github = user.username;
|
|
453
|
+
break;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
})
|
|
457
|
+
);
|
|
458
|
+
}
|
|
453
459
|
const authors = [..._authors.entries()].map((e) => ({
|
|
454
460
|
name: e[0],
|
|
455
461
|
...e[1]
|
|
@@ -812,23 +818,33 @@ function topologicalSort(packages) {
|
|
|
812
818
|
for (const pkg of packages) {
|
|
813
819
|
packageMap.set(pkg.name, pkg);
|
|
814
820
|
}
|
|
815
|
-
function visit(pkgName) {
|
|
816
|
-
|
|
817
|
-
return;
|
|
821
|
+
function visit(pkgName, path = []) {
|
|
822
|
+
logger.debug(`Visiting ${pkgName}, path: ${path.join(" \u2192 ")}, visiting: ${Array.from(visiting).join(", ")}`);
|
|
818
823
|
if (visiting.has(pkgName)) {
|
|
819
|
-
|
|
824
|
+
const cycle = [...path, pkgName];
|
|
825
|
+
logger.warn(`Circular dependency detected: ${cycle.join(" \u2192 ")}`);
|
|
826
|
+
return;
|
|
827
|
+
}
|
|
828
|
+
if (visited.has(pkgName)) {
|
|
829
|
+
logger.debug(`${pkgName} already visited globally, skipping`);
|
|
820
830
|
return;
|
|
821
831
|
}
|
|
822
832
|
visiting.add(pkgName);
|
|
833
|
+
logger.debug(`Added ${pkgName} to visiting set`);
|
|
823
834
|
const pkg = packageMap.get(pkgName);
|
|
824
|
-
if (!pkg)
|
|
835
|
+
if (!pkg) {
|
|
836
|
+
logger.debug(`Package ${pkgName} not found in packageMap`);
|
|
837
|
+
visiting.delete(pkgName);
|
|
825
838
|
return;
|
|
839
|
+
}
|
|
840
|
+
logger.debug(`${pkgName} has dependencies: ${pkg.dependencies.join(", ")}`);
|
|
826
841
|
for (const depName of pkg.dependencies) {
|
|
827
|
-
visit(depName);
|
|
842
|
+
visit(depName, [...path, pkgName]);
|
|
828
843
|
}
|
|
829
844
|
visiting.delete(pkgName);
|
|
830
845
|
visited.add(pkgName);
|
|
831
846
|
sorted.push(pkg);
|
|
847
|
+
logger.debug(`Finished visiting ${pkgName}`);
|
|
832
848
|
}
|
|
833
849
|
for (const pkg of packages) {
|
|
834
850
|
visit(pkg.name);
|
|
@@ -993,6 +1009,9 @@ async function github(options) {
|
|
|
993
1009
|
});
|
|
994
1010
|
}
|
|
995
1011
|
const rootPackageBase = readPackageJson(config.cwd);
|
|
1012
|
+
if (!rootPackageBase) {
|
|
1013
|
+
throw new Error("Failed to read root package.json");
|
|
1014
|
+
}
|
|
996
1015
|
const { from, to } = await resolveTags({
|
|
997
1016
|
config,
|
|
998
1017
|
step: "provider-release",
|
|
@@ -1232,6 +1251,9 @@ async function gitlab(options = {}) {
|
|
|
1232
1251
|
});
|
|
1233
1252
|
}
|
|
1234
1253
|
const rootPackageBase = readPackageJson(config.cwd);
|
|
1254
|
+
if (!rootPackageBase) {
|
|
1255
|
+
throw new Error("Failed to read root package.json");
|
|
1256
|
+
}
|
|
1235
1257
|
const { from, to } = await resolveTags({
|
|
1236
1258
|
config,
|
|
1237
1259
|
step: "provider-release",
|
|
@@ -1246,7 +1268,7 @@ async function gitlab(options = {}) {
|
|
|
1246
1268
|
from,
|
|
1247
1269
|
to
|
|
1248
1270
|
});
|
|
1249
|
-
logger.debug(`Root package: ${getIndependentTag(rootPackage)}`);
|
|
1271
|
+
logger.debug(`Root package: ${getIndependentTag({ name: rootPackage.name, version: rootPackage.newVersion || rootPackage.version })}`);
|
|
1250
1272
|
return await gitlabUnified({
|
|
1251
1273
|
config,
|
|
1252
1274
|
dryRun,
|
|
@@ -1431,7 +1453,7 @@ You should use an explicit release type (use flag: --major, --minor, --patch, --
|
|
|
1431
1453
|
logger.info(`Graduating from prerelease ${currentVersion} to stable ${newVersion}`);
|
|
1432
1454
|
}
|
|
1433
1455
|
if (isChangedPreid(currentVersion, preid)) {
|
|
1434
|
-
logger.
|
|
1456
|
+
logger.debug(`Graduating from ${getPreid(currentVersion)} to ${preid}`);
|
|
1435
1457
|
}
|
|
1436
1458
|
return newVersion;
|
|
1437
1459
|
}
|
|
@@ -1572,21 +1594,21 @@ function displaySelectiveModePackages({
|
|
|
1572
1594
|
if (packagesWithCommits.length > 0) {
|
|
1573
1595
|
logger.log(`${packagesWithCommits.length} package(s) with commits:`);
|
|
1574
1596
|
packagesWithCommits.forEach((pkg) => {
|
|
1575
|
-
logger.log(` \u2022 ${pkg.name}: ${pkg.version} \u2192 ${newVersion}`);
|
|
1597
|
+
logger.log(` \u2022 ${pkg.name}: ${pkg.version} \u2192 ${newVersion} (${pkg.commits.length} commits) ${force ? "(force)" : ""}`);
|
|
1576
1598
|
});
|
|
1577
1599
|
logger.log("");
|
|
1578
1600
|
}
|
|
1579
1601
|
if (packagesAsDependents.length > 0) {
|
|
1580
1602
|
logger.log(`${packagesAsDependents.length} dependent package(s):`);
|
|
1581
1603
|
packagesAsDependents.forEach((pkg) => {
|
|
1582
|
-
logger.log(` \u2022 ${pkg.name}: ${pkg.version} \u2192 ${newVersion}`);
|
|
1604
|
+
logger.log(` \u2022 ${pkg.name}: ${pkg.version} \u2192 ${newVersion} ${force ? "(force)" : ""}`);
|
|
1583
1605
|
});
|
|
1584
1606
|
logger.log("");
|
|
1585
1607
|
}
|
|
1586
1608
|
if (packagesAsGraduation.length > 0) {
|
|
1587
1609
|
logger.log(`${packagesAsGraduation.length} graduation package(s):`);
|
|
1588
1610
|
packagesAsGraduation.forEach((pkg) => {
|
|
1589
|
-
logger.log(` \u2022 ${pkg.name}: ${pkg.version} \u2192 ${newVersion}`);
|
|
1611
|
+
logger.log(` \u2022 ${pkg.name}: ${pkg.version} \u2192 ${newVersion} ${force ? "(force)" : ""}`);
|
|
1590
1612
|
});
|
|
1591
1613
|
logger.log("");
|
|
1592
1614
|
}
|
|
@@ -1609,21 +1631,21 @@ function displayIndependentModePackages({
|
|
|
1609
1631
|
if (packagesWithCommits.length > 0) {
|
|
1610
1632
|
logger.log(`${packagesWithCommits.length} package(s) with commits:`);
|
|
1611
1633
|
packagesWithCommits.forEach((pkg) => {
|
|
1612
|
-
pkg.newVersion && logger.log(` \u2022 ${pkg.name}: ${pkg.version} \u2192 ${pkg.newVersion}`);
|
|
1634
|
+
pkg.newVersion && logger.log(` \u2022 ${pkg.name}: ${pkg.version} \u2192 ${pkg.newVersion} (${pkg.commits.length} commits) ${force ? "(force)" : ""}`);
|
|
1613
1635
|
});
|
|
1614
1636
|
logger.log("");
|
|
1615
1637
|
}
|
|
1616
1638
|
if (packagesAsDependents.length > 0) {
|
|
1617
1639
|
logger.log(`${packagesAsDependents.length} dependent package(s):`);
|
|
1618
1640
|
packagesAsDependents.forEach((pkg) => {
|
|
1619
|
-
pkg.newVersion && logger.log(` \u2022 ${pkg.name}: ${pkg.version} \u2192 ${pkg.newVersion}`);
|
|
1641
|
+
pkg.newVersion && logger.log(` \u2022 ${pkg.name}: ${pkg.version} \u2192 ${pkg.newVersion} ${force ? "(force)" : ""}`);
|
|
1620
1642
|
});
|
|
1621
1643
|
logger.log("");
|
|
1622
1644
|
}
|
|
1623
1645
|
if (packagesAsGraduation.length > 0) {
|
|
1624
1646
|
logger.log(`${packagesAsGraduation.length} graduation package(s):`);
|
|
1625
1647
|
packagesAsGraduation.forEach((pkg) => {
|
|
1626
|
-
pkg.newVersion && logger.log(` \u2022 ${pkg.name}: ${pkg.version} \u2192 ${pkg.newVersion}`);
|
|
1648
|
+
pkg.newVersion && logger.log(` \u2022 ${pkg.name}: ${pkg.version} \u2192 ${pkg.newVersion} ${force ? "(force)" : ""}`);
|
|
1627
1649
|
});
|
|
1628
1650
|
logger.log("");
|
|
1629
1651
|
}
|
|
@@ -1655,14 +1677,12 @@ async function confirmBump({
|
|
|
1655
1677
|
});
|
|
1656
1678
|
if (versionMode === "unified") {
|
|
1657
1679
|
if (!newVersion) {
|
|
1658
|
-
|
|
1659
|
-
process.exit(1);
|
|
1680
|
+
throw new Error("Cannot confirm bump in unified mode without a new version");
|
|
1660
1681
|
}
|
|
1661
1682
|
displayUnifiedModePackages({ packages, newVersion, force });
|
|
1662
1683
|
} else if (versionMode === "selective") {
|
|
1663
1684
|
if (!newVersion) {
|
|
1664
|
-
|
|
1665
|
-
process.exit(1);
|
|
1685
|
+
throw new Error("Cannot confirm bump in selective mode without a new version");
|
|
1666
1686
|
}
|
|
1667
1687
|
displaySelectiveModePackages({ packages, newVersion, force });
|
|
1668
1688
|
} else if (versionMode === "independent") {
|
|
@@ -2072,7 +2092,7 @@ async function publishPackage({
|
|
|
2072
2092
|
dryRun
|
|
2073
2093
|
}) {
|
|
2074
2094
|
const tag = determinePublishTag(pkg.version, config.publish.tag);
|
|
2075
|
-
const packageNameAndVersion = getIndependentTag(pkg);
|
|
2095
|
+
const packageNameAndVersion = getIndependentTag({ name: pkg.name, version: pkg.newVersion || pkg.version });
|
|
2076
2096
|
const baseCommand = packageManager === "yarn" && isYarnBerry() ? "yarn npm" : packageManager;
|
|
2077
2097
|
logger.debug(`Building publish command for ${pkg.name}`);
|
|
2078
2098
|
let dynamicOtp;
|
|
@@ -2115,10 +2135,14 @@ async function publishPackage({
|
|
|
2115
2135
|
|
|
2116
2136
|
function readPackageJson(packagePath) {
|
|
2117
2137
|
const packageJsonPath = join(packagePath, "package.json");
|
|
2118
|
-
if (!existsSync(packageJsonPath))
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2138
|
+
if (!existsSync(packageJsonPath)) {
|
|
2139
|
+
logger.fail(`package.json not found at ${packageJsonPath}`);
|
|
2140
|
+
return;
|
|
2141
|
+
}
|
|
2142
|
+
if (!statSync(packagePath).isDirectory()) {
|
|
2143
|
+
logger.fail(`Not a directory: ${packagePath}`);
|
|
2144
|
+
return;
|
|
2145
|
+
}
|
|
2122
2146
|
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
2123
2147
|
if (!packageJson.name || !packageJson.version) {
|
|
2124
2148
|
throw new Error(`Invalid package.json at ${packagePath}`);
|
|
@@ -2140,6 +2164,9 @@ async function getRootPackage({
|
|
|
2140
2164
|
}) {
|
|
2141
2165
|
try {
|
|
2142
2166
|
const packageJson = readPackageJson(config.cwd);
|
|
2167
|
+
if (!packageJson) {
|
|
2168
|
+
throw new Error("Failed to read root package.json");
|
|
2169
|
+
}
|
|
2143
2170
|
const commits = await getPackageCommits({
|
|
2144
2171
|
pkg: packageJson,
|
|
2145
2172
|
from,
|
|
@@ -2147,24 +2174,27 @@ async function getRootPackage({
|
|
|
2147
2174
|
config,
|
|
2148
2175
|
changelog
|
|
2149
2176
|
});
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2177
|
+
let newVersion;
|
|
2178
|
+
if (config.monorepo?.versionMode !== "independent") {
|
|
2179
|
+
const releaseType = determineReleaseType({
|
|
2180
|
+
currentVersion: packageJson.version,
|
|
2181
|
+
commits,
|
|
2182
|
+
releaseType: config.bump.type,
|
|
2183
|
+
preid: config.bump.preid,
|
|
2184
|
+
types: config.types,
|
|
2185
|
+
force
|
|
2186
|
+
});
|
|
2187
|
+
if (!releaseType) {
|
|
2188
|
+
logger.fail("No commits require a version bump");
|
|
2189
|
+
process.exit(0);
|
|
2190
|
+
}
|
|
2191
|
+
newVersion = getPackageNewVersion({
|
|
2192
|
+
currentVersion: packageJson.version,
|
|
2193
|
+
releaseType,
|
|
2194
|
+
preid: config.bump.preid,
|
|
2195
|
+
suffix
|
|
2196
|
+
});
|
|
2161
2197
|
}
|
|
2162
|
-
const newVersion = getPackageNewVersion({
|
|
2163
|
-
currentVersion: packageJson.version,
|
|
2164
|
-
releaseType,
|
|
2165
|
-
preid: config.bump.preid,
|
|
2166
|
-
suffix
|
|
2167
|
-
});
|
|
2168
2198
|
return {
|
|
2169
2199
|
...packageJson,
|
|
2170
2200
|
path: config.cwd,
|
|
@@ -2184,10 +2214,11 @@ function readPackages({
|
|
|
2184
2214
|
}) {
|
|
2185
2215
|
const packages = [];
|
|
2186
2216
|
const foundPaths = /* @__PURE__ */ new Set();
|
|
2217
|
+
const patternsSet = new Set(patterns);
|
|
2187
2218
|
if (!patterns)
|
|
2188
|
-
|
|
2189
|
-
logger.debug(`
|
|
2190
|
-
for (const pattern of
|
|
2219
|
+
patternsSet.add(".");
|
|
2220
|
+
logger.debug(`Read package.json files from patterns: ${patternsSet.values()}`);
|
|
2221
|
+
for (const pattern of patternsSet) {
|
|
2191
2222
|
try {
|
|
2192
2223
|
const matches = fastGlob.sync(pattern, {
|
|
2193
2224
|
cwd,
|
|
@@ -2258,10 +2289,10 @@ async function getPackages({
|
|
|
2258
2289
|
});
|
|
2259
2290
|
const packages = /* @__PURE__ */ new Map();
|
|
2260
2291
|
const foundPaths = /* @__PURE__ */ new Set();
|
|
2261
|
-
if (!patterns)
|
|
2262
|
-
patterns = ["."];
|
|
2263
|
-
logger.debug(`Getting packages from patterns: ${patterns.join(", ")}`);
|
|
2264
2292
|
const patternsSet = new Set(patterns);
|
|
2293
|
+
if (!patterns)
|
|
2294
|
+
patternsSet.add(".");
|
|
2295
|
+
logger.debug(`Getting packages from patterns: ${patternsSet.values()}`);
|
|
2265
2296
|
for (const pattern of patternsSet) {
|
|
2266
2297
|
const matches = fastGlob.sync(pattern, {
|
|
2267
2298
|
cwd: config.cwd,
|
|
@@ -2273,6 +2304,10 @@ async function getPackages({
|
|
|
2273
2304
|
if (foundPaths.has(matchPath))
|
|
2274
2305
|
continue;
|
|
2275
2306
|
const packageBase = readPackageJson(matchPath);
|
|
2307
|
+
if (!packageBase) {
|
|
2308
|
+
logger.debug(`Failed to read package.json at ${matchPath} - ignored`);
|
|
2309
|
+
continue;
|
|
2310
|
+
}
|
|
2276
2311
|
if (packageBase.private) {
|
|
2277
2312
|
logger.debug(`${packageBase.name} is private and will be ignored`);
|
|
2278
2313
|
continue;
|
|
@@ -2385,6 +2420,9 @@ async function getPackageCommits({
|
|
|
2385
2420
|
const hasBreakingChanges = allCommits.some((commit) => commit.isBreaking);
|
|
2386
2421
|
logger.debug(`Has breaking changes: ${hasBreakingChanges}`);
|
|
2387
2422
|
const rootPackage = readPackageJson(changelogConfig.cwd);
|
|
2423
|
+
if (!rootPackage) {
|
|
2424
|
+
throw new Error("Failed to read root package.json");
|
|
2425
|
+
}
|
|
2388
2426
|
const commits = allCommits.filter((commit) => {
|
|
2389
2427
|
const type = changelogConfig?.types[commit.type];
|
|
2390
2428
|
if (!isAllowedCommit({ commit, type, changelog })) {
|
|
@@ -2419,6 +2457,9 @@ async function bumpUnifiedMode({
|
|
|
2419
2457
|
}) {
|
|
2420
2458
|
logger.debug("Starting bump in unified mode");
|
|
2421
2459
|
const rootPackageBase = readPackageJson(config.cwd);
|
|
2460
|
+
if (!rootPackageBase) {
|
|
2461
|
+
throw new Error("Failed to read root package.json");
|
|
2462
|
+
}
|
|
2422
2463
|
const { from, to } = await resolveTags({
|
|
2423
2464
|
config,
|
|
2424
2465
|
step: "bump",
|
|
@@ -2436,7 +2477,7 @@ async function bumpUnifiedMode({
|
|
|
2436
2477
|
const currentVersion = rootPackage.version;
|
|
2437
2478
|
const newVersion = rootPackage.newVersion;
|
|
2438
2479
|
if (!newVersion) {
|
|
2439
|
-
throw new Error(`Could not determine a new version
|
|
2480
|
+
throw new Error(`Could not determine a new version`);
|
|
2440
2481
|
}
|
|
2441
2482
|
logger.debug(`Bump from ${from} to ${to}`);
|
|
2442
2483
|
logger.debug(`${currentVersion} \u2192 ${newVersion} (${config.monorepo?.versionMode || "standalone"} mode)`);
|
|
@@ -2446,6 +2487,10 @@ async function bumpUnifiedMode({
|
|
|
2446
2487
|
suffix,
|
|
2447
2488
|
force
|
|
2448
2489
|
});
|
|
2490
|
+
if (packages.length === 0) {
|
|
2491
|
+
logger.debug("No packages to bump");
|
|
2492
|
+
return { bumped: false };
|
|
2493
|
+
}
|
|
2449
2494
|
if (!config.bump.yes) {
|
|
2450
2495
|
await confirmBump({
|
|
2451
2496
|
versionMode: "unified",
|
|
@@ -2494,6 +2539,9 @@ async function bumpSelectiveMode({
|
|
|
2494
2539
|
}) {
|
|
2495
2540
|
logger.debug("Starting bump in selective mode");
|
|
2496
2541
|
const rootPackageBase = readPackageJson(config.cwd);
|
|
2542
|
+
if (!rootPackageBase) {
|
|
2543
|
+
throw new Error("Failed to read root package.json");
|
|
2544
|
+
}
|
|
2497
2545
|
const { from, to } = await resolveTags({
|
|
2498
2546
|
config,
|
|
2499
2547
|
step: "bump",
|
|
@@ -2510,6 +2558,9 @@ async function bumpSelectiveMode({
|
|
|
2510
2558
|
});
|
|
2511
2559
|
const currentVersion = rootPackage.version;
|
|
2512
2560
|
const newVersion = rootPackage.newVersion;
|
|
2561
|
+
if (!newVersion) {
|
|
2562
|
+
throw new Error("Could not determine a new version");
|
|
2563
|
+
}
|
|
2513
2564
|
logger.debug(`Bump from ${currentVersion} to ${newVersion}`);
|
|
2514
2565
|
logger.debug("Determining packages to bump...");
|
|
2515
2566
|
const packages = await getPackages({
|
|
@@ -2519,7 +2570,7 @@ async function bumpSelectiveMode({
|
|
|
2519
2570
|
force
|
|
2520
2571
|
});
|
|
2521
2572
|
if (packages.length === 0) {
|
|
2522
|
-
logger.debug("No packages
|
|
2573
|
+
logger.debug("No packages to bump");
|
|
2523
2574
|
return { bumped: false };
|
|
2524
2575
|
}
|
|
2525
2576
|
if (!config.bump.yes) {
|
|
@@ -2587,7 +2638,7 @@ async function bumpIndependentMode({
|
|
|
2587
2638
|
force
|
|
2588
2639
|
});
|
|
2589
2640
|
if (packagesToBump.length === 0) {
|
|
2590
|
-
logger.debug("No packages
|
|
2641
|
+
logger.debug("No packages to bump");
|
|
2591
2642
|
return { bumped: false };
|
|
2592
2643
|
}
|
|
2593
2644
|
if (!config.bump.yes) {
|
|
@@ -2679,7 +2730,8 @@ async function bump(options = {}) {
|
|
|
2679
2730
|
const resultLog = result.bumpedPackages.length === 1 ? result.bumpedPackages[0].name : result.bumpedPackages.length;
|
|
2680
2731
|
logger.success(`${dryRun ? "[dry-run] " : ""}Version bump completed (${resultLog} package${resultLog === 1 || typeof resultLog === "string" ? "" : "s"} bumped)`);
|
|
2681
2732
|
} else {
|
|
2682
|
-
logger.fail("No packages to bump, no commits found");
|
|
2733
|
+
logger.fail("No packages to bump, no relevant commits found");
|
|
2734
|
+
exit(1);
|
|
2683
2735
|
}
|
|
2684
2736
|
await executeHook("success:bump", config, dryRun);
|
|
2685
2737
|
return result;
|
|
@@ -2739,10 +2791,13 @@ async function generateIndependentRootChangelog({
|
|
|
2739
2791
|
|
|
2740
2792
|
${packageChangelogs.join("\n\n")}`;
|
|
2741
2793
|
logger.verbose(`Aggregated root changelog: ${aggregatedChangelog}`);
|
|
2742
|
-
const
|
|
2794
|
+
const rootPackageRead = readPackageJson(config.cwd);
|
|
2795
|
+
if (!rootPackageRead) {
|
|
2796
|
+
throw new Error("Failed to read root package.json");
|
|
2797
|
+
}
|
|
2743
2798
|
writeChangelogToFile({
|
|
2744
2799
|
cwd: config.cwd,
|
|
2745
|
-
pkg:
|
|
2800
|
+
pkg: rootPackageRead,
|
|
2746
2801
|
changelog: aggregatedChangelog,
|
|
2747
2802
|
dryRun
|
|
2748
2803
|
});
|
|
@@ -2761,6 +2816,9 @@ async function generateSimpleRootChangelog({
|
|
|
2761
2816
|
}
|
|
2762
2817
|
logger.debug("Generating simple root changelog");
|
|
2763
2818
|
const rootPackageRead = readPackageJson(config.cwd);
|
|
2819
|
+
if (!rootPackageRead) {
|
|
2820
|
+
throw new Error("Failed to read root package.json");
|
|
2821
|
+
}
|
|
2764
2822
|
const { from, to } = await resolveTags({
|
|
2765
2823
|
config,
|
|
2766
2824
|
step: "changelog",
|
|
@@ -3002,6 +3060,9 @@ async function publish(options = {}) {
|
|
|
3002
3060
|
try {
|
|
3003
3061
|
await executeHook("before:publish", config, dryRun);
|
|
3004
3062
|
const rootPackage = readPackageJson(config.cwd);
|
|
3063
|
+
if (!rootPackage) {
|
|
3064
|
+
throw new Error("Failed to read root package.json");
|
|
3065
|
+
}
|
|
3005
3066
|
logger.start("Start publishing packages");
|
|
3006
3067
|
const packages = options.bumpedPackages || await getPackages({
|
|
3007
3068
|
config,
|
|
@@ -3037,7 +3098,7 @@ async function publish(options = {}) {
|
|
|
3037
3098
|
});
|
|
3038
3099
|
for (const pkg of sortedPackages) {
|
|
3039
3100
|
if (publishedPackages.some((p) => p.name === pkg.name)) {
|
|
3040
|
-
logger.debug(`Publishing ${getIndependentTag(pkg)}...`);
|
|
3101
|
+
logger.debug(`Publishing ${getIndependentTag({ name: pkg.name, version: pkg.newVersion || pkg.version })}...`);
|
|
3041
3102
|
await publishPackage({
|
|
3042
3103
|
pkg,
|
|
3043
3104
|
config,
|
|
@@ -3098,7 +3159,8 @@ function getReleaseConfig(options = {}) {
|
|
|
3098
3159
|
publish: options.publish,
|
|
3099
3160
|
noVerify: options.noVerify,
|
|
3100
3161
|
providerRelease: options.providerRelease,
|
|
3101
|
-
clean: options.clean
|
|
3162
|
+
clean: options.clean,
|
|
3163
|
+
gitTag: options.gitTag
|
|
3102
3164
|
},
|
|
3103
3165
|
safetyCheck: options.safetyCheck
|
|
3104
3166
|
}
|
|
@@ -3175,7 +3237,12 @@ async function release(options = {}) {
|
|
|
3175
3237
|
if (config.release.push && config.release.commit) {
|
|
3176
3238
|
await executeHook("before:push", config, dryRun);
|
|
3177
3239
|
try {
|
|
3178
|
-
await pushCommitAndTags({
|
|
3240
|
+
await pushCommitAndTags({
|
|
3241
|
+
config,
|
|
3242
|
+
dryRun,
|
|
3243
|
+
logLevel: config.logLevel,
|
|
3244
|
+
cwd: config.cwd
|
|
3245
|
+
});
|
|
3179
3246
|
await executeHook("success:push", config, dryRun);
|
|
3180
3247
|
} catch (error) {
|
|
3181
3248
|
await executeHook("error:push", config, dryRun);
|
|
@@ -3230,10 +3297,10 @@ async function release(options = {}) {
|
|
|
3230
3297
|
logger.info("Skipping release (--no-provider-release)");
|
|
3231
3298
|
}
|
|
3232
3299
|
const publishedPackageCount = publishResponse?.publishedPackages.length ?? 0;
|
|
3233
|
-
const versionDisplay = config.monorepo?.versionMode === "independent" ? `${bumpResult.bumpedPackages.length} packages bumped independently` : bumpResult.newVersion || readPackageJson(config.cwd)
|
|
3300
|
+
const versionDisplay = config.monorepo?.versionMode === "independent" ? `${bumpResult.bumpedPackages.length} packages bumped independently` : bumpResult.newVersion || readPackageJson(config.cwd)?.version;
|
|
3234
3301
|
logger.box(`Release workflow completed!
|
|
3235
3302
|
|
|
3236
|
-
Version: ${versionDisplay}
|
|
3303
|
+
Version: ${versionDisplay ?? "Unknown"}
|
|
3237
3304
|
Tag(s): ${createdTags.length ? createdTags.join(", ") : "No"}
|
|
3238
3305
|
Pushed: ${config.release.push ? "Yes" : "Disabled"}
|
|
3239
3306
|
Published packages: ${config.release.publish ? publishedPackageCount : "Disabled"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "relizy",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.5-beta.
|
|
4
|
+
"version": "0.2.5-beta.11",
|
|
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",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"node": ">=20.0.0"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@inquirer/prompts": "^
|
|
59
|
-
"@maz-ui/node": "
|
|
58
|
+
"@inquirer/prompts": "^8.0.1",
|
|
59
|
+
"@maz-ui/node": "4.3.2-beta.1",
|
|
60
60
|
"@maz-ui/utils": "^4.3.0",
|
|
61
61
|
"c12": "^3.3.2",
|
|
62
62
|
"changelogen": "^0.6.2",
|
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
"@commitlint/config-conventional": "^20.0.0",
|
|
73
73
|
"@commitlint/cz-commitlint": "^20.1.0",
|
|
74
74
|
"@commitlint/types": "^20.0.0",
|
|
75
|
-
"@maz-ui/eslint-config": "4.3.
|
|
75
|
+
"@maz-ui/eslint-config": "4.3.2-beta.1",
|
|
76
76
|
"@types/node": "^24.10.1",
|
|
77
77
|
"@types/semver": "^7.7.1",
|
|
78
|
-
"@vitest/coverage-v8": "^4.0.
|
|
78
|
+
"@vitest/coverage-v8": "^4.0.10",
|
|
79
79
|
"cross-env": "^10.1.0",
|
|
80
80
|
"eslint": "^9.39.1",
|
|
81
81
|
"husky": "^9.1.7",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"memfs": "^4.51.0",
|
|
85
85
|
"typescript": "^5.9.3",
|
|
86
86
|
"unbuild": "^3.6.1",
|
|
87
|
-
"vitest": "^4.0.
|
|
87
|
+
"vitest": "^4.0.10"
|
|
88
88
|
},
|
|
89
89
|
"lint-staged": {
|
|
90
90
|
"*.{js,jsx,ts,tsx,mjs,mts,cjs,md,yml,json}": [
|