relizy 0.2.5-beta.1 → 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.DYn3rUjq.mjs → relizy.CfJAOU-Q.mjs} +144 -75
- package/package.json +4 -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]
|
|
@@ -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
|
}
|
|
@@ -2072,7 +2094,7 @@ async function publishPackage({
|
|
|
2072
2094
|
dryRun
|
|
2073
2095
|
}) {
|
|
2074
2096
|
const tag = determinePublishTag(pkg.version, config.publish.tag);
|
|
2075
|
-
const packageNameAndVersion = getIndependentTag(pkg);
|
|
2097
|
+
const packageNameAndVersion = getIndependentTag({ name: pkg.name, version: pkg.newVersion || pkg.version });
|
|
2076
2098
|
const baseCommand = packageManager === "yarn" && isYarnBerry() ? "yarn npm" : packageManager;
|
|
2077
2099
|
logger.debug(`Building publish command for ${pkg.name}`);
|
|
2078
2100
|
let dynamicOtp;
|
|
@@ -2115,10 +2137,14 @@ async function publishPackage({
|
|
|
2115
2137
|
|
|
2116
2138
|
function readPackageJson(packagePath) {
|
|
2117
2139
|
const packageJsonPath = join(packagePath, "package.json");
|
|
2118
|
-
if (!existsSync(packageJsonPath))
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
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
|
+
}
|
|
2122
2148
|
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
2123
2149
|
if (!packageJson.name || !packageJson.version) {
|
|
2124
2150
|
throw new Error(`Invalid package.json at ${packagePath}`);
|
|
@@ -2140,6 +2166,9 @@ async function getRootPackage({
|
|
|
2140
2166
|
}) {
|
|
2141
2167
|
try {
|
|
2142
2168
|
const packageJson = readPackageJson(config.cwd);
|
|
2169
|
+
if (!packageJson) {
|
|
2170
|
+
throw new Error("Failed to read root package.json");
|
|
2171
|
+
}
|
|
2143
2172
|
const commits = await getPackageCommits({
|
|
2144
2173
|
pkg: packageJson,
|
|
2145
2174
|
from,
|
|
@@ -2147,24 +2176,27 @@ async function getRootPackage({
|
|
|
2147
2176
|
config,
|
|
2148
2177
|
changelog
|
|
2149
2178
|
});
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
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
|
+
});
|
|
2161
2199
|
}
|
|
2162
|
-
const newVersion = getPackageNewVersion({
|
|
2163
|
-
currentVersion: packageJson.version,
|
|
2164
|
-
releaseType,
|
|
2165
|
-
preid: config.bump.preid,
|
|
2166
|
-
suffix
|
|
2167
|
-
});
|
|
2168
2200
|
return {
|
|
2169
2201
|
...packageJson,
|
|
2170
2202
|
path: config.cwd,
|
|
@@ -2184,10 +2216,11 @@ function readPackages({
|
|
|
2184
2216
|
}) {
|
|
2185
2217
|
const packages = [];
|
|
2186
2218
|
const foundPaths = /* @__PURE__ */ new Set();
|
|
2219
|
+
const patternsSet = new Set(patterns);
|
|
2187
2220
|
if (!patterns)
|
|
2188
|
-
|
|
2189
|
-
logger.debug(`
|
|
2190
|
-
for (const pattern of
|
|
2221
|
+
patternsSet.add(".");
|
|
2222
|
+
logger.debug(`Read package.json files from patterns: ${patternsSet.values()}`);
|
|
2223
|
+
for (const pattern of patternsSet) {
|
|
2191
2224
|
try {
|
|
2192
2225
|
const matches = fastGlob.sync(pattern, {
|
|
2193
2226
|
cwd,
|
|
@@ -2258,10 +2291,10 @@ async function getPackages({
|
|
|
2258
2291
|
});
|
|
2259
2292
|
const packages = /* @__PURE__ */ new Map();
|
|
2260
2293
|
const foundPaths = /* @__PURE__ */ new Set();
|
|
2261
|
-
if (!patterns)
|
|
2262
|
-
patterns = ["."];
|
|
2263
|
-
logger.debug(`Getting packages from patterns: ${patterns.join(", ")}`);
|
|
2264
2294
|
const patternsSet = new Set(patterns);
|
|
2295
|
+
if (!patterns)
|
|
2296
|
+
patternsSet.add(".");
|
|
2297
|
+
logger.debug(`Getting packages from patterns: ${patternsSet.values()}`);
|
|
2265
2298
|
for (const pattern of patternsSet) {
|
|
2266
2299
|
const matches = fastGlob.sync(pattern, {
|
|
2267
2300
|
cwd: config.cwd,
|
|
@@ -2273,6 +2306,10 @@ async function getPackages({
|
|
|
2273
2306
|
if (foundPaths.has(matchPath))
|
|
2274
2307
|
continue;
|
|
2275
2308
|
const packageBase = readPackageJson(matchPath);
|
|
2309
|
+
if (!packageBase) {
|
|
2310
|
+
logger.debug(`Failed to read package.json at ${matchPath} - ignored`);
|
|
2311
|
+
continue;
|
|
2312
|
+
}
|
|
2276
2313
|
if (packageBase.private) {
|
|
2277
2314
|
logger.debug(`${packageBase.name} is private and will be ignored`);
|
|
2278
2315
|
continue;
|
|
@@ -2385,6 +2422,9 @@ async function getPackageCommits({
|
|
|
2385
2422
|
const hasBreakingChanges = allCommits.some((commit) => commit.isBreaking);
|
|
2386
2423
|
logger.debug(`Has breaking changes: ${hasBreakingChanges}`);
|
|
2387
2424
|
const rootPackage = readPackageJson(changelogConfig.cwd);
|
|
2425
|
+
if (!rootPackage) {
|
|
2426
|
+
throw new Error("Failed to read root package.json");
|
|
2427
|
+
}
|
|
2388
2428
|
const commits = allCommits.filter((commit) => {
|
|
2389
2429
|
const type = changelogConfig?.types[commit.type];
|
|
2390
2430
|
if (!isAllowedCommit({ commit, type, changelog })) {
|
|
@@ -2419,6 +2459,9 @@ async function bumpUnifiedMode({
|
|
|
2419
2459
|
}) {
|
|
2420
2460
|
logger.debug("Starting bump in unified mode");
|
|
2421
2461
|
const rootPackageBase = readPackageJson(config.cwd);
|
|
2462
|
+
if (!rootPackageBase) {
|
|
2463
|
+
throw new Error("Failed to read root package.json");
|
|
2464
|
+
}
|
|
2422
2465
|
const { from, to } = await resolveTags({
|
|
2423
2466
|
config,
|
|
2424
2467
|
step: "bump",
|
|
@@ -2436,7 +2479,7 @@ async function bumpUnifiedMode({
|
|
|
2436
2479
|
const currentVersion = rootPackage.version;
|
|
2437
2480
|
const newVersion = rootPackage.newVersion;
|
|
2438
2481
|
if (!newVersion) {
|
|
2439
|
-
throw new Error(`Could not determine a new version
|
|
2482
|
+
throw new Error(`Could not determine a new version`);
|
|
2440
2483
|
}
|
|
2441
2484
|
logger.debug(`Bump from ${from} to ${to}`);
|
|
2442
2485
|
logger.debug(`${currentVersion} \u2192 ${newVersion} (${config.monorepo?.versionMode || "standalone"} mode)`);
|
|
@@ -2446,6 +2489,10 @@ async function bumpUnifiedMode({
|
|
|
2446
2489
|
suffix,
|
|
2447
2490
|
force
|
|
2448
2491
|
});
|
|
2492
|
+
if (packages.length === 0) {
|
|
2493
|
+
logger.debug("No packages to bump");
|
|
2494
|
+
return { bumped: false };
|
|
2495
|
+
}
|
|
2449
2496
|
if (!config.bump.yes) {
|
|
2450
2497
|
await confirmBump({
|
|
2451
2498
|
versionMode: "unified",
|
|
@@ -2494,6 +2541,9 @@ async function bumpSelectiveMode({
|
|
|
2494
2541
|
}) {
|
|
2495
2542
|
logger.debug("Starting bump in selective mode");
|
|
2496
2543
|
const rootPackageBase = readPackageJson(config.cwd);
|
|
2544
|
+
if (!rootPackageBase) {
|
|
2545
|
+
throw new Error("Failed to read root package.json");
|
|
2546
|
+
}
|
|
2497
2547
|
const { from, to } = await resolveTags({
|
|
2498
2548
|
config,
|
|
2499
2549
|
step: "bump",
|
|
@@ -2510,6 +2560,9 @@ async function bumpSelectiveMode({
|
|
|
2510
2560
|
});
|
|
2511
2561
|
const currentVersion = rootPackage.version;
|
|
2512
2562
|
const newVersion = rootPackage.newVersion;
|
|
2563
|
+
if (!newVersion) {
|
|
2564
|
+
throw new Error("Could not determine a new version");
|
|
2565
|
+
}
|
|
2513
2566
|
logger.debug(`Bump from ${currentVersion} to ${newVersion}`);
|
|
2514
2567
|
logger.debug("Determining packages to bump...");
|
|
2515
2568
|
const packages = await getPackages({
|
|
@@ -2519,7 +2572,7 @@ async function bumpSelectiveMode({
|
|
|
2519
2572
|
force
|
|
2520
2573
|
});
|
|
2521
2574
|
if (packages.length === 0) {
|
|
2522
|
-
logger.debug("No packages
|
|
2575
|
+
logger.debug("No packages to bump");
|
|
2523
2576
|
return { bumped: false };
|
|
2524
2577
|
}
|
|
2525
2578
|
if (!config.bump.yes) {
|
|
@@ -2587,7 +2640,7 @@ async function bumpIndependentMode({
|
|
|
2587
2640
|
force
|
|
2588
2641
|
});
|
|
2589
2642
|
if (packagesToBump.length === 0) {
|
|
2590
|
-
logger.debug("No packages
|
|
2643
|
+
logger.debug("No packages to bump");
|
|
2591
2644
|
return { bumped: false };
|
|
2592
2645
|
}
|
|
2593
2646
|
if (!config.bump.yes) {
|
|
@@ -2679,7 +2732,8 @@ async function bump(options = {}) {
|
|
|
2679
2732
|
const resultLog = result.bumpedPackages.length === 1 ? result.bumpedPackages[0].name : result.bumpedPackages.length;
|
|
2680
2733
|
logger.success(`${dryRun ? "[dry-run] " : ""}Version bump completed (${resultLog} package${resultLog === 1 || typeof resultLog === "string" ? "" : "s"} bumped)`);
|
|
2681
2734
|
} else {
|
|
2682
|
-
logger.fail("No packages to bump, no commits found");
|
|
2735
|
+
logger.fail("No packages to bump, no relevant commits found");
|
|
2736
|
+
exit(1);
|
|
2683
2737
|
}
|
|
2684
2738
|
await executeHook("success:bump", config, dryRun);
|
|
2685
2739
|
return result;
|
|
@@ -2739,10 +2793,13 @@ async function generateIndependentRootChangelog({
|
|
|
2739
2793
|
|
|
2740
2794
|
${packageChangelogs.join("\n\n")}`;
|
|
2741
2795
|
logger.verbose(`Aggregated root changelog: ${aggregatedChangelog}`);
|
|
2742
|
-
const
|
|
2796
|
+
const rootPackageRead = readPackageJson(config.cwd);
|
|
2797
|
+
if (!rootPackageRead) {
|
|
2798
|
+
throw new Error("Failed to read root package.json");
|
|
2799
|
+
}
|
|
2743
2800
|
writeChangelogToFile({
|
|
2744
2801
|
cwd: config.cwd,
|
|
2745
|
-
pkg:
|
|
2802
|
+
pkg: rootPackageRead,
|
|
2746
2803
|
changelog: aggregatedChangelog,
|
|
2747
2804
|
dryRun
|
|
2748
2805
|
});
|
|
@@ -2761,6 +2818,9 @@ async function generateSimpleRootChangelog({
|
|
|
2761
2818
|
}
|
|
2762
2819
|
logger.debug("Generating simple root changelog");
|
|
2763
2820
|
const rootPackageRead = readPackageJson(config.cwd);
|
|
2821
|
+
if (!rootPackageRead) {
|
|
2822
|
+
throw new Error("Failed to read root package.json");
|
|
2823
|
+
}
|
|
2764
2824
|
const { from, to } = await resolveTags({
|
|
2765
2825
|
config,
|
|
2766
2826
|
step: "changelog",
|
|
@@ -3002,6 +3062,9 @@ async function publish(options = {}) {
|
|
|
3002
3062
|
try {
|
|
3003
3063
|
await executeHook("before:publish", config, dryRun);
|
|
3004
3064
|
const rootPackage = readPackageJson(config.cwd);
|
|
3065
|
+
if (!rootPackage) {
|
|
3066
|
+
throw new Error("Failed to read root package.json");
|
|
3067
|
+
}
|
|
3005
3068
|
logger.start("Start publishing packages");
|
|
3006
3069
|
const packages = options.bumpedPackages || await getPackages({
|
|
3007
3070
|
config,
|
|
@@ -3037,7 +3100,7 @@ async function publish(options = {}) {
|
|
|
3037
3100
|
});
|
|
3038
3101
|
for (const pkg of sortedPackages) {
|
|
3039
3102
|
if (publishedPackages.some((p) => p.name === pkg.name)) {
|
|
3040
|
-
logger.debug(`Publishing ${getIndependentTag(pkg)}...`);
|
|
3103
|
+
logger.debug(`Publishing ${getIndependentTag({ name: pkg.name, version: pkg.newVersion || pkg.version })}...`);
|
|
3041
3104
|
await publishPackage({
|
|
3042
3105
|
pkg,
|
|
3043
3106
|
config,
|
|
@@ -3098,7 +3161,8 @@ function getReleaseConfig(options = {}) {
|
|
|
3098
3161
|
publish: options.publish,
|
|
3099
3162
|
noVerify: options.noVerify,
|
|
3100
3163
|
providerRelease: options.providerRelease,
|
|
3101
|
-
clean: options.clean
|
|
3164
|
+
clean: options.clean,
|
|
3165
|
+
gitTag: options.gitTag
|
|
3102
3166
|
},
|
|
3103
3167
|
safetyCheck: options.safetyCheck
|
|
3104
3168
|
}
|
|
@@ -3175,7 +3239,12 @@ async function release(options = {}) {
|
|
|
3175
3239
|
if (config.release.push && config.release.commit) {
|
|
3176
3240
|
await executeHook("before:push", config, dryRun);
|
|
3177
3241
|
try {
|
|
3178
|
-
await pushCommitAndTags({
|
|
3242
|
+
await pushCommitAndTags({
|
|
3243
|
+
config,
|
|
3244
|
+
dryRun,
|
|
3245
|
+
logLevel: config.logLevel,
|
|
3246
|
+
cwd: config.cwd
|
|
3247
|
+
});
|
|
3179
3248
|
await executeHook("success:push", config, dryRun);
|
|
3180
3249
|
} catch (error) {
|
|
3181
3250
|
await executeHook("error:push", config, dryRun);
|
|
@@ -3230,10 +3299,10 @@ async function release(options = {}) {
|
|
|
3230
3299
|
logger.info("Skipping release (--no-provider-release)");
|
|
3231
3300
|
}
|
|
3232
3301
|
const publishedPackageCount = publishResponse?.publishedPackages.length ?? 0;
|
|
3233
|
-
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;
|
|
3234
3303
|
logger.box(`Release workflow completed!
|
|
3235
3304
|
|
|
3236
|
-
Version: ${versionDisplay}
|
|
3305
|
+
Version: ${versionDisplay ?? "Unknown"}
|
|
3237
3306
|
Tag(s): ${createdTags.length ? createdTags.join(", ") : "No"}
|
|
3238
3307
|
Pushed: ${config.release.push ? "Yes" : "Disabled"}
|
|
3239
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,7 +75,7 @@
|
|
|
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",
|
|
@@ -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}": [
|