relizy 0.2.5-beta.0 → 0.2.5-beta.10
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.D41jJZ2S.mjs → relizy.CfJAOU-Q.mjs} +146 -78
- package/package.json +5 -4
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.CfJAOU-Q.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.CfJAOU-Q.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]
|
|
@@ -482,9 +488,8 @@ function getCommitBody(commit) {
|
|
|
482
488
|
if (!trimmedLine) {
|
|
483
489
|
return false;
|
|
484
490
|
}
|
|
485
|
-
const isFileLine = /^[
|
|
486
|
-
|
|
487
|
-
return !isFileLine && !R100;
|
|
491
|
+
const isFileLine = /^[AMDTUXB](?:\d{3})?\s+/.test(trimmedLine) || /^[RCM]\d{3}\s+/.test(trimmedLine);
|
|
492
|
+
return !isFileLine;
|
|
488
493
|
});
|
|
489
494
|
if (contentLines.length === 0) {
|
|
490
495
|
return "";
|
|
@@ -813,23 +818,33 @@ function topologicalSort(packages) {
|
|
|
813
818
|
for (const pkg of packages) {
|
|
814
819
|
packageMap.set(pkg.name, pkg);
|
|
815
820
|
}
|
|
816
|
-
function visit(pkgName) {
|
|
817
|
-
|
|
818
|
-
return;
|
|
821
|
+
function visit(pkgName, path = []) {
|
|
822
|
+
logger.debug(`Visiting ${pkgName}, path: ${path.join(" \u2192 ")}, visiting: ${Array.from(visiting).join(", ")}`);
|
|
819
823
|
if (visiting.has(pkgName)) {
|
|
820
|
-
|
|
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`);
|
|
821
830
|
return;
|
|
822
831
|
}
|
|
823
832
|
visiting.add(pkgName);
|
|
833
|
+
logger.debug(`Added ${pkgName} to visiting set`);
|
|
824
834
|
const pkg = packageMap.get(pkgName);
|
|
825
|
-
if (!pkg)
|
|
835
|
+
if (!pkg) {
|
|
836
|
+
logger.debug(`Package ${pkgName} not found in packageMap`);
|
|
837
|
+
visiting.delete(pkgName);
|
|
826
838
|
return;
|
|
839
|
+
}
|
|
840
|
+
logger.debug(`${pkgName} has dependencies: ${pkg.dependencies.join(", ")}`);
|
|
827
841
|
for (const depName of pkg.dependencies) {
|
|
828
|
-
visit(depName);
|
|
842
|
+
visit(depName, [...path, pkgName]);
|
|
829
843
|
}
|
|
830
844
|
visiting.delete(pkgName);
|
|
831
845
|
visited.add(pkgName);
|
|
832
846
|
sorted.push(pkg);
|
|
847
|
+
logger.debug(`Finished visiting ${pkgName}`);
|
|
833
848
|
}
|
|
834
849
|
for (const pkg of packages) {
|
|
835
850
|
visit(pkg.name);
|
|
@@ -994,6 +1009,9 @@ async function github(options) {
|
|
|
994
1009
|
});
|
|
995
1010
|
}
|
|
996
1011
|
const rootPackageBase = readPackageJson(config.cwd);
|
|
1012
|
+
if (!rootPackageBase) {
|
|
1013
|
+
throw new Error("Failed to read root package.json");
|
|
1014
|
+
}
|
|
997
1015
|
const { from, to } = await resolveTags({
|
|
998
1016
|
config,
|
|
999
1017
|
step: "provider-release",
|
|
@@ -1233,6 +1251,9 @@ async function gitlab(options = {}) {
|
|
|
1233
1251
|
});
|
|
1234
1252
|
}
|
|
1235
1253
|
const rootPackageBase = readPackageJson(config.cwd);
|
|
1254
|
+
if (!rootPackageBase) {
|
|
1255
|
+
throw new Error("Failed to read root package.json");
|
|
1256
|
+
}
|
|
1236
1257
|
const { from, to } = await resolveTags({
|
|
1237
1258
|
config,
|
|
1238
1259
|
step: "provider-release",
|
|
@@ -1247,7 +1268,7 @@ async function gitlab(options = {}) {
|
|
|
1247
1268
|
from,
|
|
1248
1269
|
to
|
|
1249
1270
|
});
|
|
1250
|
-
logger.debug(`Root package: ${getIndependentTag(rootPackage)}`);
|
|
1271
|
+
logger.debug(`Root package: ${getIndependentTag({ name: rootPackage.name, version: rootPackage.newVersion || rootPackage.version })}`);
|
|
1251
1272
|
return await gitlabUnified({
|
|
1252
1273
|
config,
|
|
1253
1274
|
dryRun,
|
|
@@ -1432,7 +1453,7 @@ You should use an explicit release type (use flag: --major, --minor, --patch, --
|
|
|
1432
1453
|
logger.info(`Graduating from prerelease ${currentVersion} to stable ${newVersion}`);
|
|
1433
1454
|
}
|
|
1434
1455
|
if (isChangedPreid(currentVersion, preid)) {
|
|
1435
|
-
logger.
|
|
1456
|
+
logger.debug(`Graduating from ${getPreid(currentVersion)} to ${preid}`);
|
|
1436
1457
|
}
|
|
1437
1458
|
return newVersion;
|
|
1438
1459
|
}
|
|
@@ -1573,21 +1594,21 @@ function displaySelectiveModePackages({
|
|
|
1573
1594
|
if (packagesWithCommits.length > 0) {
|
|
1574
1595
|
logger.log(`${packagesWithCommits.length} package(s) with commits:`);
|
|
1575
1596
|
packagesWithCommits.forEach((pkg) => {
|
|
1576
|
-
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)" : ""}`);
|
|
1577
1598
|
});
|
|
1578
1599
|
logger.log("");
|
|
1579
1600
|
}
|
|
1580
1601
|
if (packagesAsDependents.length > 0) {
|
|
1581
1602
|
logger.log(`${packagesAsDependents.length} dependent package(s):`);
|
|
1582
1603
|
packagesAsDependents.forEach((pkg) => {
|
|
1583
|
-
logger.log(` \u2022 ${pkg.name}: ${pkg.version} \u2192 ${newVersion}`);
|
|
1604
|
+
logger.log(` \u2022 ${pkg.name}: ${pkg.version} \u2192 ${newVersion} ${force ? "(force)" : ""}`);
|
|
1584
1605
|
});
|
|
1585
1606
|
logger.log("");
|
|
1586
1607
|
}
|
|
1587
1608
|
if (packagesAsGraduation.length > 0) {
|
|
1588
1609
|
logger.log(`${packagesAsGraduation.length} graduation package(s):`);
|
|
1589
1610
|
packagesAsGraduation.forEach((pkg) => {
|
|
1590
|
-
logger.log(` \u2022 ${pkg.name}: ${pkg.version} \u2192 ${newVersion}`);
|
|
1611
|
+
logger.log(` \u2022 ${pkg.name}: ${pkg.version} \u2192 ${newVersion} ${force ? "(force)" : ""}`);
|
|
1591
1612
|
});
|
|
1592
1613
|
logger.log("");
|
|
1593
1614
|
}
|
|
@@ -1610,21 +1631,21 @@ function displayIndependentModePackages({
|
|
|
1610
1631
|
if (packagesWithCommits.length > 0) {
|
|
1611
1632
|
logger.log(`${packagesWithCommits.length} package(s) with commits:`);
|
|
1612
1633
|
packagesWithCommits.forEach((pkg) => {
|
|
1613
|
-
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)" : ""}`);
|
|
1614
1635
|
});
|
|
1615
1636
|
logger.log("");
|
|
1616
1637
|
}
|
|
1617
1638
|
if (packagesAsDependents.length > 0) {
|
|
1618
1639
|
logger.log(`${packagesAsDependents.length} dependent package(s):`);
|
|
1619
1640
|
packagesAsDependents.forEach((pkg) => {
|
|
1620
|
-
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)" : ""}`);
|
|
1621
1642
|
});
|
|
1622
1643
|
logger.log("");
|
|
1623
1644
|
}
|
|
1624
1645
|
if (packagesAsGraduation.length > 0) {
|
|
1625
1646
|
logger.log(`${packagesAsGraduation.length} graduation package(s):`);
|
|
1626
1647
|
packagesAsGraduation.forEach((pkg) => {
|
|
1627
|
-
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)" : ""}`);
|
|
1628
1649
|
});
|
|
1629
1650
|
logger.log("");
|
|
1630
1651
|
}
|
|
@@ -2073,7 +2094,7 @@ async function publishPackage({
|
|
|
2073
2094
|
dryRun
|
|
2074
2095
|
}) {
|
|
2075
2096
|
const tag = determinePublishTag(pkg.version, config.publish.tag);
|
|
2076
|
-
const packageNameAndVersion = getIndependentTag(pkg);
|
|
2097
|
+
const packageNameAndVersion = getIndependentTag({ name: pkg.name, version: pkg.newVersion || pkg.version });
|
|
2077
2098
|
const baseCommand = packageManager === "yarn" && isYarnBerry() ? "yarn npm" : packageManager;
|
|
2078
2099
|
logger.debug(`Building publish command for ${pkg.name}`);
|
|
2079
2100
|
let dynamicOtp;
|
|
@@ -2116,10 +2137,14 @@ async function publishPackage({
|
|
|
2116
2137
|
|
|
2117
2138
|
function readPackageJson(packagePath) {
|
|
2118
2139
|
const packageJsonPath = join(packagePath, "package.json");
|
|
2119
|
-
if (!existsSync(packageJsonPath))
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2140
|
+
if (!existsSync(packageJsonPath)) {
|
|
2141
|
+
logger.fail(`package.json not found at ${packageJsonPath}`);
|
|
2142
|
+
return;
|
|
2143
|
+
}
|
|
2144
|
+
if (!statSync(packagePath).isDirectory()) {
|
|
2145
|
+
logger.fail(`Not a directory: ${packagePath}`);
|
|
2146
|
+
return;
|
|
2147
|
+
}
|
|
2123
2148
|
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
2124
2149
|
if (!packageJson.name || !packageJson.version) {
|
|
2125
2150
|
throw new Error(`Invalid package.json at ${packagePath}`);
|
|
@@ -2141,6 +2166,9 @@ async function getRootPackage({
|
|
|
2141
2166
|
}) {
|
|
2142
2167
|
try {
|
|
2143
2168
|
const packageJson = readPackageJson(config.cwd);
|
|
2169
|
+
if (!packageJson) {
|
|
2170
|
+
throw new Error("Failed to read root package.json");
|
|
2171
|
+
}
|
|
2144
2172
|
const commits = await getPackageCommits({
|
|
2145
2173
|
pkg: packageJson,
|
|
2146
2174
|
from,
|
|
@@ -2148,24 +2176,27 @@ async function getRootPackage({
|
|
|
2148
2176
|
config,
|
|
2149
2177
|
changelog
|
|
2150
2178
|
});
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2179
|
+
let newVersion;
|
|
2180
|
+
if (config.monorepo?.versionMode !== "independent") {
|
|
2181
|
+
const releaseType = determineReleaseType({
|
|
2182
|
+
currentVersion: packageJson.version,
|
|
2183
|
+
commits,
|
|
2184
|
+
releaseType: config.bump.type,
|
|
2185
|
+
preid: config.bump.preid,
|
|
2186
|
+
types: config.types,
|
|
2187
|
+
force
|
|
2188
|
+
});
|
|
2189
|
+
if (!releaseType) {
|
|
2190
|
+
logger.fail("No commits require a version bump");
|
|
2191
|
+
process.exit(1);
|
|
2192
|
+
}
|
|
2193
|
+
newVersion = getPackageNewVersion({
|
|
2194
|
+
currentVersion: packageJson.version,
|
|
2195
|
+
releaseType,
|
|
2196
|
+
preid: config.bump.preid,
|
|
2197
|
+
suffix
|
|
2198
|
+
});
|
|
2162
2199
|
}
|
|
2163
|
-
const newVersion = getPackageNewVersion({
|
|
2164
|
-
currentVersion: packageJson.version,
|
|
2165
|
-
releaseType,
|
|
2166
|
-
preid: config.bump.preid,
|
|
2167
|
-
suffix
|
|
2168
|
-
});
|
|
2169
2200
|
return {
|
|
2170
2201
|
...packageJson,
|
|
2171
2202
|
path: config.cwd,
|
|
@@ -2185,10 +2216,11 @@ function readPackages({
|
|
|
2185
2216
|
}) {
|
|
2186
2217
|
const packages = [];
|
|
2187
2218
|
const foundPaths = /* @__PURE__ */ new Set();
|
|
2219
|
+
const patternsSet = new Set(patterns);
|
|
2188
2220
|
if (!patterns)
|
|
2189
|
-
|
|
2190
|
-
logger.debug(`
|
|
2191
|
-
for (const pattern of
|
|
2221
|
+
patternsSet.add(".");
|
|
2222
|
+
logger.debug(`Read package.json files from patterns: ${patternsSet.values()}`);
|
|
2223
|
+
for (const pattern of patternsSet) {
|
|
2192
2224
|
try {
|
|
2193
2225
|
const matches = fastGlob.sync(pattern, {
|
|
2194
2226
|
cwd,
|
|
@@ -2259,10 +2291,10 @@ async function getPackages({
|
|
|
2259
2291
|
});
|
|
2260
2292
|
const packages = /* @__PURE__ */ new Map();
|
|
2261
2293
|
const foundPaths = /* @__PURE__ */ new Set();
|
|
2262
|
-
if (!patterns)
|
|
2263
|
-
patterns = ["."];
|
|
2264
|
-
logger.debug(`Getting packages from patterns: ${patterns.join(", ")}`);
|
|
2265
2294
|
const patternsSet = new Set(patterns);
|
|
2295
|
+
if (!patterns)
|
|
2296
|
+
patternsSet.add(".");
|
|
2297
|
+
logger.debug(`Getting packages from patterns: ${patternsSet.values()}`);
|
|
2266
2298
|
for (const pattern of patternsSet) {
|
|
2267
2299
|
const matches = fastGlob.sync(pattern, {
|
|
2268
2300
|
cwd: config.cwd,
|
|
@@ -2274,6 +2306,10 @@ async function getPackages({
|
|
|
2274
2306
|
if (foundPaths.has(matchPath))
|
|
2275
2307
|
continue;
|
|
2276
2308
|
const packageBase = readPackageJson(matchPath);
|
|
2309
|
+
if (!packageBase) {
|
|
2310
|
+
logger.debug(`Failed to read package.json at ${matchPath} - ignored`);
|
|
2311
|
+
continue;
|
|
2312
|
+
}
|
|
2277
2313
|
if (packageBase.private) {
|
|
2278
2314
|
logger.debug(`${packageBase.name} is private and will be ignored`);
|
|
2279
2315
|
continue;
|
|
@@ -2386,6 +2422,9 @@ async function getPackageCommits({
|
|
|
2386
2422
|
const hasBreakingChanges = allCommits.some((commit) => commit.isBreaking);
|
|
2387
2423
|
logger.debug(`Has breaking changes: ${hasBreakingChanges}`);
|
|
2388
2424
|
const rootPackage = readPackageJson(changelogConfig.cwd);
|
|
2425
|
+
if (!rootPackage) {
|
|
2426
|
+
throw new Error("Failed to read root package.json");
|
|
2427
|
+
}
|
|
2389
2428
|
const commits = allCommits.filter((commit) => {
|
|
2390
2429
|
const type = changelogConfig?.types[commit.type];
|
|
2391
2430
|
if (!isAllowedCommit({ commit, type, changelog })) {
|
|
@@ -2420,6 +2459,9 @@ async function bumpUnifiedMode({
|
|
|
2420
2459
|
}) {
|
|
2421
2460
|
logger.debug("Starting bump in unified mode");
|
|
2422
2461
|
const rootPackageBase = readPackageJson(config.cwd);
|
|
2462
|
+
if (!rootPackageBase) {
|
|
2463
|
+
throw new Error("Failed to read root package.json");
|
|
2464
|
+
}
|
|
2423
2465
|
const { from, to } = await resolveTags({
|
|
2424
2466
|
config,
|
|
2425
2467
|
step: "bump",
|
|
@@ -2437,7 +2479,7 @@ async function bumpUnifiedMode({
|
|
|
2437
2479
|
const currentVersion = rootPackage.version;
|
|
2438
2480
|
const newVersion = rootPackage.newVersion;
|
|
2439
2481
|
if (!newVersion) {
|
|
2440
|
-
throw new Error(`Could not determine a new version
|
|
2482
|
+
throw new Error(`Could not determine a new version`);
|
|
2441
2483
|
}
|
|
2442
2484
|
logger.debug(`Bump from ${from} to ${to}`);
|
|
2443
2485
|
logger.debug(`${currentVersion} \u2192 ${newVersion} (${config.monorepo?.versionMode || "standalone"} mode)`);
|
|
@@ -2447,6 +2489,10 @@ async function bumpUnifiedMode({
|
|
|
2447
2489
|
suffix,
|
|
2448
2490
|
force
|
|
2449
2491
|
});
|
|
2492
|
+
if (packages.length === 0) {
|
|
2493
|
+
logger.debug("No packages to bump");
|
|
2494
|
+
return { bumped: false };
|
|
2495
|
+
}
|
|
2450
2496
|
if (!config.bump.yes) {
|
|
2451
2497
|
await confirmBump({
|
|
2452
2498
|
versionMode: "unified",
|
|
@@ -2495,6 +2541,9 @@ async function bumpSelectiveMode({
|
|
|
2495
2541
|
}) {
|
|
2496
2542
|
logger.debug("Starting bump in selective mode");
|
|
2497
2543
|
const rootPackageBase = readPackageJson(config.cwd);
|
|
2544
|
+
if (!rootPackageBase) {
|
|
2545
|
+
throw new Error("Failed to read root package.json");
|
|
2546
|
+
}
|
|
2498
2547
|
const { from, to } = await resolveTags({
|
|
2499
2548
|
config,
|
|
2500
2549
|
step: "bump",
|
|
@@ -2511,6 +2560,9 @@ async function bumpSelectiveMode({
|
|
|
2511
2560
|
});
|
|
2512
2561
|
const currentVersion = rootPackage.version;
|
|
2513
2562
|
const newVersion = rootPackage.newVersion;
|
|
2563
|
+
if (!newVersion) {
|
|
2564
|
+
throw new Error("Could not determine a new version");
|
|
2565
|
+
}
|
|
2514
2566
|
logger.debug(`Bump from ${currentVersion} to ${newVersion}`);
|
|
2515
2567
|
logger.debug("Determining packages to bump...");
|
|
2516
2568
|
const packages = await getPackages({
|
|
@@ -2520,7 +2572,7 @@ async function bumpSelectiveMode({
|
|
|
2520
2572
|
force
|
|
2521
2573
|
});
|
|
2522
2574
|
if (packages.length === 0) {
|
|
2523
|
-
logger.debug("No packages
|
|
2575
|
+
logger.debug("No packages to bump");
|
|
2524
2576
|
return { bumped: false };
|
|
2525
2577
|
}
|
|
2526
2578
|
if (!config.bump.yes) {
|
|
@@ -2588,7 +2640,7 @@ async function bumpIndependentMode({
|
|
|
2588
2640
|
force
|
|
2589
2641
|
});
|
|
2590
2642
|
if (packagesToBump.length === 0) {
|
|
2591
|
-
logger.debug("No packages
|
|
2643
|
+
logger.debug("No packages to bump");
|
|
2592
2644
|
return { bumped: false };
|
|
2593
2645
|
}
|
|
2594
2646
|
if (!config.bump.yes) {
|
|
@@ -2680,7 +2732,8 @@ async function bump(options = {}) {
|
|
|
2680
2732
|
const resultLog = result.bumpedPackages.length === 1 ? result.bumpedPackages[0].name : result.bumpedPackages.length;
|
|
2681
2733
|
logger.success(`${dryRun ? "[dry-run] " : ""}Version bump completed (${resultLog} package${resultLog === 1 || typeof resultLog === "string" ? "" : "s"} bumped)`);
|
|
2682
2734
|
} else {
|
|
2683
|
-
logger.fail("No packages to bump, no commits found");
|
|
2735
|
+
logger.fail("No packages to bump, no relevant commits found");
|
|
2736
|
+
exit(1);
|
|
2684
2737
|
}
|
|
2685
2738
|
await executeHook("success:bump", config, dryRun);
|
|
2686
2739
|
return result;
|
|
@@ -2740,10 +2793,13 @@ async function generateIndependentRootChangelog({
|
|
|
2740
2793
|
|
|
2741
2794
|
${packageChangelogs.join("\n\n")}`;
|
|
2742
2795
|
logger.verbose(`Aggregated root changelog: ${aggregatedChangelog}`);
|
|
2743
|
-
const
|
|
2796
|
+
const rootPackageRead = readPackageJson(config.cwd);
|
|
2797
|
+
if (!rootPackageRead) {
|
|
2798
|
+
throw new Error("Failed to read root package.json");
|
|
2799
|
+
}
|
|
2744
2800
|
writeChangelogToFile({
|
|
2745
2801
|
cwd: config.cwd,
|
|
2746
|
-
pkg:
|
|
2802
|
+
pkg: rootPackageRead,
|
|
2747
2803
|
changelog: aggregatedChangelog,
|
|
2748
2804
|
dryRun
|
|
2749
2805
|
});
|
|
@@ -2762,6 +2818,9 @@ async function generateSimpleRootChangelog({
|
|
|
2762
2818
|
}
|
|
2763
2819
|
logger.debug("Generating simple root changelog");
|
|
2764
2820
|
const rootPackageRead = readPackageJson(config.cwd);
|
|
2821
|
+
if (!rootPackageRead) {
|
|
2822
|
+
throw new Error("Failed to read root package.json");
|
|
2823
|
+
}
|
|
2765
2824
|
const { from, to } = await resolveTags({
|
|
2766
2825
|
config,
|
|
2767
2826
|
step: "changelog",
|
|
@@ -3003,6 +3062,9 @@ async function publish(options = {}) {
|
|
|
3003
3062
|
try {
|
|
3004
3063
|
await executeHook("before:publish", config, dryRun);
|
|
3005
3064
|
const rootPackage = readPackageJson(config.cwd);
|
|
3065
|
+
if (!rootPackage) {
|
|
3066
|
+
throw new Error("Failed to read root package.json");
|
|
3067
|
+
}
|
|
3006
3068
|
logger.start("Start publishing packages");
|
|
3007
3069
|
const packages = options.bumpedPackages || await getPackages({
|
|
3008
3070
|
config,
|
|
@@ -3038,7 +3100,7 @@ async function publish(options = {}) {
|
|
|
3038
3100
|
});
|
|
3039
3101
|
for (const pkg of sortedPackages) {
|
|
3040
3102
|
if (publishedPackages.some((p) => p.name === pkg.name)) {
|
|
3041
|
-
logger.debug(`Publishing ${getIndependentTag(pkg)}...`);
|
|
3103
|
+
logger.debug(`Publishing ${getIndependentTag({ name: pkg.name, version: pkg.newVersion || pkg.version })}...`);
|
|
3042
3104
|
await publishPackage({
|
|
3043
3105
|
pkg,
|
|
3044
3106
|
config,
|
|
@@ -3099,7 +3161,8 @@ function getReleaseConfig(options = {}) {
|
|
|
3099
3161
|
publish: options.publish,
|
|
3100
3162
|
noVerify: options.noVerify,
|
|
3101
3163
|
providerRelease: options.providerRelease,
|
|
3102
|
-
clean: options.clean
|
|
3164
|
+
clean: options.clean,
|
|
3165
|
+
gitTag: options.gitTag
|
|
3103
3166
|
},
|
|
3104
3167
|
safetyCheck: options.safetyCheck
|
|
3105
3168
|
}
|
|
@@ -3176,7 +3239,12 @@ async function release(options = {}) {
|
|
|
3176
3239
|
if (config.release.push && config.release.commit) {
|
|
3177
3240
|
await executeHook("before:push", config, dryRun);
|
|
3178
3241
|
try {
|
|
3179
|
-
await pushCommitAndTags({
|
|
3242
|
+
await pushCommitAndTags({
|
|
3243
|
+
config,
|
|
3244
|
+
dryRun,
|
|
3245
|
+
logLevel: config.logLevel,
|
|
3246
|
+
cwd: config.cwd
|
|
3247
|
+
});
|
|
3180
3248
|
await executeHook("success:push", config, dryRun);
|
|
3181
3249
|
} catch (error) {
|
|
3182
3250
|
await executeHook("error:push", config, dryRun);
|
|
@@ -3231,10 +3299,10 @@ async function release(options = {}) {
|
|
|
3231
3299
|
logger.info("Skipping release (--no-provider-release)");
|
|
3232
3300
|
}
|
|
3233
3301
|
const publishedPackageCount = publishResponse?.publishedPackages.length ?? 0;
|
|
3234
|
-
const versionDisplay = config.monorepo?.versionMode === "independent" ? `${bumpResult.bumpedPackages.length} packages bumped independently` : bumpResult.newVersion || readPackageJson(config.cwd)
|
|
3302
|
+
const versionDisplay = config.monorepo?.versionMode === "independent" ? `${bumpResult.bumpedPackages.length} packages bumped independently` : bumpResult.newVersion || readPackageJson(config.cwd)?.version;
|
|
3235
3303
|
logger.box(`Release workflow completed!
|
|
3236
3304
|
|
|
3237
|
-
Version: ${versionDisplay}
|
|
3305
|
+
Version: ${versionDisplay ?? "Unknown"}
|
|
3238
3306
|
Tag(s): ${createdTags.length ? createdTags.join(", ") : "No"}
|
|
3239
3307
|
Pushed: ${config.release.push ? "Yes" : "Disabled"}
|
|
3240
3308
|
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.10",
|
|
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,7 +55,7 @@
|
|
|
55
55
|
"node": ">=20.0.0"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@inquirer/prompts": "^
|
|
58
|
+
"@inquirer/prompts": "^8.0.1",
|
|
59
59
|
"@maz-ui/node": "^4.3.1-alpha.0",
|
|
60
60
|
"@maz-ui/utils": "^4.3.0",
|
|
61
61
|
"c12": "^3.3.2",
|
|
@@ -75,15 +75,16 @@
|
|
|
75
75
|
"@maz-ui/eslint-config": "4.3.1-alpha.2",
|
|
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",
|
|
82
82
|
"jiti": "^2.6.1",
|
|
83
83
|
"lint-staged": "^16.2.6",
|
|
84
|
+
"memfs": "^4.51.0",
|
|
84
85
|
"typescript": "^5.9.3",
|
|
85
86
|
"unbuild": "^3.6.1",
|
|
86
|
-
"vitest": "^4.0.
|
|
87
|
+
"vitest": "^4.0.10"
|
|
87
88
|
},
|
|
88
89
|
"lint-staged": {
|
|
89
90
|
"*.{js,jsx,ts,tsx,mjs,mts,cjs,md,yml,json}": [
|