relizy 0.2.0 → 0.2.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.mjs +1 -1
- package/dist/shared/{relizy.CBq0DAtR.mjs → relizy.CY8qqrIx.mjs} +101 -64
- package/package.json +2 -1
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 { R as isInCI, S as getCIName, b as bump, c as changelog, d as publish, a as providerRelease, r as release } from './shared/relizy.
|
|
8
|
+
import { R as isInCI, S as getCIName, b as bump, c as changelog, d as publish, a as providerRelease, r as release } from './shared/relizy.CY8qqrIx.mjs';
|
|
9
9
|
import 'node:child_process';
|
|
10
10
|
import '@maz-ui/utils';
|
|
11
11
|
import 'c12';
|
package/dist/index.d.mts
CHANGED
|
@@ -334,7 +334,7 @@ interface PackageWithCommits extends PackageInfo {
|
|
|
334
334
|
interface PublishResponse {
|
|
335
335
|
publishedPackages: PackageInfo[];
|
|
336
336
|
}
|
|
337
|
-
|
|
337
|
+
interface BumpResultTruthy {
|
|
338
338
|
/**
|
|
339
339
|
* Old version
|
|
340
340
|
*/
|
|
@@ -355,12 +355,14 @@ type BumpResult = {
|
|
|
355
355
|
* Bumped
|
|
356
356
|
*/
|
|
357
357
|
bumped: true;
|
|
358
|
-
}
|
|
358
|
+
}
|
|
359
|
+
interface BumpResultFalsy {
|
|
359
360
|
/**
|
|
360
361
|
* Bumped
|
|
361
362
|
*/
|
|
362
363
|
bumped: false;
|
|
363
|
-
}
|
|
364
|
+
}
|
|
365
|
+
type BumpResult = BumpResultTruthy | BumpResultFalsy;
|
|
364
366
|
interface PostedRelease {
|
|
365
367
|
/**
|
|
366
368
|
* Release name
|
|
@@ -719,7 +721,7 @@ interface RepoConfig {
|
|
|
719
721
|
*/
|
|
720
722
|
provider?: GitProvider;
|
|
721
723
|
}
|
|
722
|
-
type HookType = 'before' | '
|
|
724
|
+
type HookType = 'before' | 'success' | 'error';
|
|
723
725
|
type HookStep = 'bump' | 'changelog' | 'commit-and-tag' | 'provider-release' | 'publish' | 'push' | 'release';
|
|
724
726
|
/**
|
|
725
727
|
* Hooks configuration
|
|
@@ -811,4 +813,4 @@ declare function publish(options?: Partial<PublishOptions>): Promise<{
|
|
|
811
813
|
declare function release(options?: Partial<ReleaseOptions>): Promise<void>;
|
|
812
814
|
|
|
813
815
|
export { bump, bumpIndependentPackages, bumpPackageIndependently, bumpPackageVersion, changelog, checkGitStatusIfDirty, confirmBump, createCommitAndTags, createGitlabRelease, defineConfig, detectGitProvider, detectPackageManager, determinePublishTag, determineReleaseType, executeBuildCmd, executeFormatCmd, executeHook, expandPackagesToBumpWithDependents, extractVersionFromPackageTag, fetchGitTags, findPackagesWithCommitsAndCalculateVersions, generateChangelog, getCIName, getCurrentGitBranch, getCurrentGitRef, getDefaultConfig, getDependentsOf, getFirstCommit, getGitStatus, getLastPackageTag, getLastRepoTag, getPackageCommits, getPackageDependencies, getPackageToBump, getPackages, getPackagesToPublishInIndependentMode, getPackagesToPublishInSelectiveMode, getPackagesWithDependencies, getPreid, getRootPackage, github, gitlab, hasLernaJson, isChangedPreid, isGraduating, isInCI, isPrerelease, isPrereleaseReleaseType, isStableReleaseType, loadRelizyConfig, parseGitRemoteUrl, providerRelease, providerReleaseSafetyCheck, publish, publishPackage, pushCommitAndTags, release, resolveTags, topologicalSort, updateLernaVersion, writeChangelogToFile, writeVersion };
|
|
814
|
-
export type { BumpConfig, BumpOptions, BumpResult, ChangelogConfig, ChangelogOptions, ConfigType, GitProvider, GitlabRelease, GitlabReleaseResponse, HookConfig, HookStep, HookType, MonorepoConfig, PackageInfo, PackageManager, PackageToBump, PackageWithCommits, PackageWithDeps, PostedRelease, ProviderReleaseOptions, PublishConfig, PublishOptions, PublishResponse, ReleaseConfig, ReleaseOptions, RelizyConfig, RepoConfig, ResolveTagsOptions, ResolvedConfig, ResolvedRelizyConfig, ResolvedTags, Step, TemplatesConfig, VersionMode };
|
|
816
|
+
export type { BumpConfig, BumpOptions, BumpResult, BumpResultFalsy, BumpResultTruthy, ChangelogConfig, ChangelogOptions, ConfigType, GitProvider, GitlabRelease, GitlabReleaseResponse, HookConfig, HookStep, HookType, MonorepoConfig, PackageInfo, PackageManager, PackageToBump, PackageWithCommits, PackageWithDeps, PostedRelease, ProviderReleaseOptions, PublishConfig, PublishOptions, PublishResponse, ReleaseConfig, ReleaseOptions, RelizyConfig, RepoConfig, ResolveTagsOptions, ResolvedConfig, ResolvedRelizyConfig, ResolvedTags, Step, TemplatesConfig, VersionMode };
|
package/dist/index.d.ts
CHANGED
|
@@ -334,7 +334,7 @@ interface PackageWithCommits extends PackageInfo {
|
|
|
334
334
|
interface PublishResponse {
|
|
335
335
|
publishedPackages: PackageInfo[];
|
|
336
336
|
}
|
|
337
|
-
|
|
337
|
+
interface BumpResultTruthy {
|
|
338
338
|
/**
|
|
339
339
|
* Old version
|
|
340
340
|
*/
|
|
@@ -355,12 +355,14 @@ type BumpResult = {
|
|
|
355
355
|
* Bumped
|
|
356
356
|
*/
|
|
357
357
|
bumped: true;
|
|
358
|
-
}
|
|
358
|
+
}
|
|
359
|
+
interface BumpResultFalsy {
|
|
359
360
|
/**
|
|
360
361
|
* Bumped
|
|
361
362
|
*/
|
|
362
363
|
bumped: false;
|
|
363
|
-
}
|
|
364
|
+
}
|
|
365
|
+
type BumpResult = BumpResultTruthy | BumpResultFalsy;
|
|
364
366
|
interface PostedRelease {
|
|
365
367
|
/**
|
|
366
368
|
* Release name
|
|
@@ -719,7 +721,7 @@ interface RepoConfig {
|
|
|
719
721
|
*/
|
|
720
722
|
provider?: GitProvider;
|
|
721
723
|
}
|
|
722
|
-
type HookType = 'before' | '
|
|
724
|
+
type HookType = 'before' | 'success' | 'error';
|
|
723
725
|
type HookStep = 'bump' | 'changelog' | 'commit-and-tag' | 'provider-release' | 'publish' | 'push' | 'release';
|
|
724
726
|
/**
|
|
725
727
|
* Hooks configuration
|
|
@@ -811,4 +813,4 @@ declare function publish(options?: Partial<PublishOptions>): Promise<{
|
|
|
811
813
|
declare function release(options?: Partial<ReleaseOptions>): Promise<void>;
|
|
812
814
|
|
|
813
815
|
export { bump, bumpIndependentPackages, bumpPackageIndependently, bumpPackageVersion, changelog, checkGitStatusIfDirty, confirmBump, createCommitAndTags, createGitlabRelease, defineConfig, detectGitProvider, detectPackageManager, determinePublishTag, determineReleaseType, executeBuildCmd, executeFormatCmd, executeHook, expandPackagesToBumpWithDependents, extractVersionFromPackageTag, fetchGitTags, findPackagesWithCommitsAndCalculateVersions, generateChangelog, getCIName, getCurrentGitBranch, getCurrentGitRef, getDefaultConfig, getDependentsOf, getFirstCommit, getGitStatus, getLastPackageTag, getLastRepoTag, getPackageCommits, getPackageDependencies, getPackageToBump, getPackages, getPackagesToPublishInIndependentMode, getPackagesToPublishInSelectiveMode, getPackagesWithDependencies, getPreid, getRootPackage, github, gitlab, hasLernaJson, isChangedPreid, isGraduating, isInCI, isPrerelease, isPrereleaseReleaseType, isStableReleaseType, loadRelizyConfig, parseGitRemoteUrl, providerRelease, providerReleaseSafetyCheck, publish, publishPackage, pushCommitAndTags, release, resolveTags, topologicalSort, updateLernaVersion, writeChangelogToFile, writeVersion };
|
|
814
|
-
export type { BumpConfig, BumpOptions, BumpResult, ChangelogConfig, ChangelogOptions, ConfigType, GitProvider, GitlabRelease, GitlabReleaseResponse, HookConfig, HookStep, HookType, MonorepoConfig, PackageInfo, PackageManager, PackageToBump, PackageWithCommits, PackageWithDeps, PostedRelease, ProviderReleaseOptions, PublishConfig, PublishOptions, PublishResponse, ReleaseConfig, ReleaseOptions, RelizyConfig, RepoConfig, ResolveTagsOptions, ResolvedConfig, ResolvedRelizyConfig, ResolvedTags, Step, TemplatesConfig, VersionMode };
|
|
816
|
+
export type { BumpConfig, BumpOptions, BumpResult, BumpResultFalsy, BumpResultTruthy, ChangelogConfig, ChangelogOptions, ConfigType, GitProvider, GitlabRelease, GitlabReleaseResponse, HookConfig, HookStep, HookType, MonorepoConfig, PackageInfo, PackageManager, PackageToBump, PackageWithCommits, PackageWithDeps, PostedRelease, ProviderReleaseOptions, PublishConfig, PublishOptions, PublishResponse, ReleaseConfig, ReleaseOptions, RelizyConfig, RepoConfig, ResolveTagsOptions, ResolvedConfig, ResolvedRelizyConfig, ResolvedTags, Step, TemplatesConfig, VersionMode };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as bump, a7 as bumpIndependentPackages, a4 as bumpPackageIndependently, X as bumpPackageVersion, c as changelog, n as checkGitStatusIfDirty, a5 as confirmBump, u as createCommitAndTags, B as createGitlabRelease, f as defineConfig, q as detectGitProvider, I as detectPackageManager, J as determinePublishTag, V as determineReleaseType, U as executeBuildCmd, T as executeFormatCmd, Q as executeHook, k as expandPackagesToBumpWithDependents, Z as extractVersionFromPackageTag, o as fetchGitTags, a6 as findPackagesWithCommitsAndCalculateVersions, g as generateChangelog, S as getCIName, y as getCurrentGitBranch, z as getCurrentGitRef, e as getDefaultConfig, j as getDependentsOf, x as getFirstCommit, m as getGitStatus, O as getLastPackageTag, N as getLastRepoTag, E as getPackageCommits, h as getPackageDependencies, H as getPackageToBump, D as getPackages, L as getPackagesToPublishInIndependentMode, K as getPackagesToPublishInSelectiveMode, i as getPackagesWithDependencies, a2 as getPreid, F as getRootPackage, A as github, C as gitlab, G as hasLernaJson, a3 as isChangedPreid, a1 as isGraduating, R as isInCI, _ as isPrerelease, a0 as isPrereleaseReleaseType, $ as isStableReleaseType, l as loadRelizyConfig, s as parseGitRemoteUrl, a as providerRelease, p as providerReleaseSafetyCheck, d as publish, M as publishPackage, v as pushCommitAndTags, r as release, P as resolveTags, t as topologicalSort, Y as updateLernaVersion, w as writeChangelogToFile, W as writeVersion } from './shared/relizy.
|
|
1
|
+
export { b as bump, a7 as bumpIndependentPackages, a4 as bumpPackageIndependently, X as bumpPackageVersion, c as changelog, n as checkGitStatusIfDirty, a5 as confirmBump, u as createCommitAndTags, B as createGitlabRelease, f as defineConfig, q as detectGitProvider, I as detectPackageManager, J as determinePublishTag, V as determineReleaseType, U as executeBuildCmd, T as executeFormatCmd, Q as executeHook, k as expandPackagesToBumpWithDependents, Z as extractVersionFromPackageTag, o as fetchGitTags, a6 as findPackagesWithCommitsAndCalculateVersions, g as generateChangelog, S as getCIName, y as getCurrentGitBranch, z as getCurrentGitRef, e as getDefaultConfig, j as getDependentsOf, x as getFirstCommit, m as getGitStatus, O as getLastPackageTag, N as getLastRepoTag, E as getPackageCommits, h as getPackageDependencies, H as getPackageToBump, D as getPackages, L as getPackagesToPublishInIndependentMode, K as getPackagesToPublishInSelectiveMode, i as getPackagesWithDependencies, a2 as getPreid, F as getRootPackage, A as github, C as gitlab, G as hasLernaJson, a3 as isChangedPreid, a1 as isGraduating, R as isInCI, _ as isPrerelease, a0 as isPrereleaseReleaseType, $ as isStableReleaseType, l as loadRelizyConfig, s as parseGitRemoteUrl, a as providerRelease, p as providerReleaseSafetyCheck, d as publish, M as publishPackage, v as pushCommitAndTags, r as release, P as resolveTags, t as topologicalSort, Y as updateLernaVersion, w as writeChangelogToFile, W as writeVersion } from './shared/relizy.CY8qqrIx.mjs';
|
|
2
2
|
import '@maz-ui/node';
|
|
3
3
|
import 'node:child_process';
|
|
4
4
|
import 'node:fs';
|
|
@@ -13,26 +13,37 @@ import * as semver from 'semver';
|
|
|
13
13
|
import { convert } from 'convert-gitmoji';
|
|
14
14
|
import { fetch as fetch$1 } from 'node-fetch-native';
|
|
15
15
|
|
|
16
|
-
async function generateMarkDown(
|
|
16
|
+
async function generateMarkDown({
|
|
17
|
+
commits,
|
|
18
|
+
config,
|
|
19
|
+
from,
|
|
20
|
+
to
|
|
21
|
+
}) {
|
|
17
22
|
const typeGroups = groupBy(commits, "type");
|
|
18
23
|
const markdown = [];
|
|
19
24
|
const breakingChanges = [];
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
const updatedConfig = {
|
|
26
|
+
...config,
|
|
27
|
+
from,
|
|
28
|
+
to
|
|
29
|
+
};
|
|
30
|
+
const versionTitle = updatedConfig.to;
|
|
31
|
+
markdown.push("", `## ${versionTitle || `${updatedConfig.from || ""}...${updatedConfig.to}`}`, "");
|
|
32
|
+
if (updatedConfig.repo && updatedConfig.from && versionTitle) {
|
|
33
|
+
const formattedCompareLink = formatCompareChanges(versionTitle, updatedConfig);
|
|
34
|
+
markdown.push(formattedCompareLink);
|
|
24
35
|
}
|
|
25
|
-
for (const type in
|
|
36
|
+
for (const type in updatedConfig.types) {
|
|
26
37
|
const group = typeGroups[type];
|
|
27
38
|
if (!group || group.length === 0) {
|
|
28
39
|
continue;
|
|
29
40
|
}
|
|
30
|
-
if (typeof
|
|
41
|
+
if (typeof updatedConfig.types[type] === "boolean") {
|
|
31
42
|
continue;
|
|
32
43
|
}
|
|
33
|
-
markdown.push("", `### ${
|
|
44
|
+
markdown.push("", `### ${updatedConfig.types[type]?.title}`, "");
|
|
34
45
|
for (const commit of group.reverse()) {
|
|
35
|
-
const line = formatCommit(commit,
|
|
46
|
+
const line = formatCommit(commit, updatedConfig);
|
|
36
47
|
markdown.push(line);
|
|
37
48
|
if (commit.isBreaking) {
|
|
38
49
|
breakingChanges.push(line);
|
|
@@ -51,8 +62,8 @@ async function generateMarkDown(commits, config) {
|
|
|
51
62
|
if (!name || name.includes("[bot]")) {
|
|
52
63
|
continue;
|
|
53
64
|
}
|
|
54
|
-
if (
|
|
55
|
-
(
|
|
65
|
+
if (updatedConfig.excludeAuthors && updatedConfig.excludeAuthors.some(
|
|
66
|
+
(v) => name.includes(v) || commit.author.email?.includes(v)
|
|
56
67
|
)) {
|
|
57
68
|
continue;
|
|
58
69
|
}
|
|
@@ -82,7 +93,7 @@ async function generateMarkDown(commits, config) {
|
|
|
82
93
|
name: e[0],
|
|
83
94
|
...e[1]
|
|
84
95
|
}));
|
|
85
|
-
if (authors.length > 0 && !
|
|
96
|
+
if (authors.length > 0 && !updatedConfig.noAuthors) {
|
|
86
97
|
markdown.push(
|
|
87
98
|
"",
|
|
88
99
|
"### \u2764\uFE0F Contributors",
|
|
@@ -91,13 +102,14 @@ async function generateMarkDown(commits, config) {
|
|
|
91
102
|
const _email = [...i.email].find(
|
|
92
103
|
(e) => !e.includes("noreply.github.com")
|
|
93
104
|
);
|
|
94
|
-
const email =
|
|
105
|
+
const email = updatedConfig.hideAuthorEmail !== true && _email ? ` <${_email}>` : "";
|
|
95
106
|
const github = i.github ? ` ([@${i.github}](https://github.com/${i.github}))` : "";
|
|
96
107
|
return `- ${i.name}${github || email || ""}`;
|
|
97
108
|
})
|
|
98
109
|
);
|
|
99
110
|
}
|
|
100
|
-
|
|
111
|
+
const result = convert(markdown.join("\n").trim(), true);
|
|
112
|
+
return result;
|
|
101
113
|
}
|
|
102
114
|
function getCommitBody(commit) {
|
|
103
115
|
if (!commit.body) {
|
|
@@ -251,8 +263,7 @@ async function executeFormatCmd({
|
|
|
251
263
|
logger.log("[dry-run] exec format command: ", config.changelog.formatCmd);
|
|
252
264
|
}
|
|
253
265
|
} catch (error) {
|
|
254
|
-
|
|
255
|
-
process.exit(1);
|
|
266
|
+
throw new Error(`Format command failed: ${error}`);
|
|
256
267
|
}
|
|
257
268
|
} else {
|
|
258
269
|
logger.debug("No format command specified");
|
|
@@ -291,7 +302,7 @@ async function generateChangelog({
|
|
|
291
302
|
from,
|
|
292
303
|
dryRun
|
|
293
304
|
}) {
|
|
294
|
-
let fromTag = config.from || config.templates.tagBody.replace("{{newVersion}}", pkg.currentVersion) || from;
|
|
305
|
+
let fromTag = config.from || (config.monorepo?.versionMode === "independent" ? `${pkg.name}@${pkg.currentVersion}` : config.templates.tagBody.replace("{{newVersion}}", pkg.currentVersion)) || from;
|
|
295
306
|
const isFirstCommit = fromTagIsFirstCommit(fromTag, config.cwd);
|
|
296
307
|
if (isFirstCommit) {
|
|
297
308
|
fromTag = config.monorepo?.versionMode === "independent" ? `${pkg.name}@0.0.0` : config.templates.tagBody.replace("{{newVersion}}", "0.0.0");
|
|
@@ -304,7 +315,12 @@ async function generateChangelog({
|
|
|
304
315
|
from: fromTag,
|
|
305
316
|
to: toTag
|
|
306
317
|
};
|
|
307
|
-
const generatedChangelog = await generateMarkDown(
|
|
318
|
+
const generatedChangelog = await generateMarkDown({
|
|
319
|
+
commits,
|
|
320
|
+
config,
|
|
321
|
+
from: fromTag,
|
|
322
|
+
to: toTag
|
|
323
|
+
});
|
|
308
324
|
let changelog = generatedChangelog;
|
|
309
325
|
if (commits.length === 0) {
|
|
310
326
|
changelog = `${changelog}
|
|
@@ -593,7 +609,14 @@ function checkGitStatusIfDirty() {
|
|
|
593
609
|
if (dirty) {
|
|
594
610
|
logger.debug("git status:", `
|
|
595
611
|
${dirty.trim().split("\n").map((line) => line.trim()).join("\n")}`);
|
|
596
|
-
|
|
612
|
+
const error = `Git status is dirty!
|
|
613
|
+
|
|
614
|
+
Please commit or stash your changes before bumping or use --no-clean flag.
|
|
615
|
+
|
|
616
|
+
Unstaged files:
|
|
617
|
+
|
|
618
|
+
${dirty.trim()}`;
|
|
619
|
+
throw new Error(error);
|
|
597
620
|
}
|
|
598
621
|
}
|
|
599
622
|
async function fetchGitTags(cwd) {
|
|
@@ -753,7 +776,7 @@ async function createCommitAndTags({
|
|
|
753
776
|
}
|
|
754
777
|
logger.debug("Created Tags:", createdTags.join(", "));
|
|
755
778
|
logger.success("Commit and tag completed!");
|
|
756
|
-
await executeHook("
|
|
779
|
+
await executeHook("success:commit-and-tag", internalConfig, dryRun ?? false);
|
|
757
780
|
return createdTags;
|
|
758
781
|
} catch (error) {
|
|
759
782
|
logger.error("Error committing and tagging:", error);
|
|
@@ -879,8 +902,7 @@ async function githubUnified({
|
|
|
879
902
|
config,
|
|
880
903
|
dryRun,
|
|
881
904
|
rootPackage,
|
|
882
|
-
|
|
883
|
-
oldVersion
|
|
905
|
+
bumpResult
|
|
884
906
|
}) {
|
|
885
907
|
const repoConfig = config.repo;
|
|
886
908
|
if (!repoConfig) {
|
|
@@ -890,21 +912,20 @@ async function githubUnified({
|
|
|
890
912
|
if (!config.tokens.github && !config.repo?.token) {
|
|
891
913
|
throw new Error("No GitHub token specified. Set GITHUB_TOKEN or GH_TOKEN environment variable.");
|
|
892
914
|
}
|
|
893
|
-
const to = config.templates.tagBody.replace("{{newVersion}}", rootPackage.version);
|
|
894
|
-
const toTag = dryRun ?
|
|
915
|
+
const to = config.templates.tagBody.replace("{{newVersion}}", bumpResult?.newVersion || rootPackage.version);
|
|
916
|
+
const toTag = dryRun ? getCurrentGitRef(config.cwd) : to;
|
|
895
917
|
const commits = await getPackageCommits({
|
|
896
918
|
pkg: rootPackage,
|
|
897
919
|
config,
|
|
898
|
-
from: fromTag || getFirstCommit(config.cwd),
|
|
920
|
+
from: bumpResult?.fromTag || getFirstCommit(config.cwd),
|
|
899
921
|
to: toTag,
|
|
900
922
|
changelog: true
|
|
901
923
|
});
|
|
902
|
-
logger.debug(`Found ${commits.length} commit(s)`);
|
|
903
924
|
const changelog = await generateChangelog({
|
|
904
925
|
pkg: rootPackage,
|
|
905
926
|
commits,
|
|
906
927
|
config,
|
|
907
|
-
from: fromTag ||
|
|
928
|
+
from: bumpResult?.fromTag || "v0.0.0",
|
|
908
929
|
dryRun
|
|
909
930
|
});
|
|
910
931
|
const releaseBody = changelog.split("\n").slice(2).join("\n");
|
|
@@ -926,7 +947,7 @@ async function githubUnified({
|
|
|
926
947
|
logger.debug("Publishing release to GitHub...");
|
|
927
948
|
await createGithubRelease({
|
|
928
949
|
...config,
|
|
929
|
-
from: fromTag ||
|
|
950
|
+
from: bumpResult?.fromTag || "v0.0.0",
|
|
930
951
|
to,
|
|
931
952
|
repo: repoConfig
|
|
932
953
|
}, release);
|
|
@@ -962,13 +983,16 @@ async function github(options = {}) {
|
|
|
962
983
|
if (config.monorepo?.versionMode === "independent") {
|
|
963
984
|
return await githubIndependentMode({ config, dryRun, bumpedPackages: options.bumpResult.bumpedPackages });
|
|
964
985
|
}
|
|
965
|
-
|
|
986
|
+
let rootPackage = getRootPackage(config.cwd);
|
|
987
|
+
const foundedRootPackage = options.bumpResult.bumpedPackages.find((pkg) => pkg.path === rootPackage.path);
|
|
988
|
+
if (foundedRootPackage) {
|
|
989
|
+
rootPackage = foundedRootPackage;
|
|
990
|
+
}
|
|
966
991
|
return await githubUnified({
|
|
967
992
|
config,
|
|
968
993
|
dryRun,
|
|
969
994
|
rootPackage,
|
|
970
|
-
|
|
971
|
-
oldVersion: options.bumpResult.oldVersion
|
|
995
|
+
bumpResult: options.bumpResult
|
|
972
996
|
});
|
|
973
997
|
} catch (error) {
|
|
974
998
|
logger.error("Error publishing GitHub release:", error);
|
|
@@ -1537,21 +1561,27 @@ function bumpPackageVersion({
|
|
|
1537
1561
|
preid,
|
|
1538
1562
|
suffix
|
|
1539
1563
|
}) {
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1564
|
+
try {
|
|
1565
|
+
let newVersion = semver.inc(currentVersion, releaseType, preid);
|
|
1566
|
+
if (!newVersion) {
|
|
1567
|
+
throw new Error(`Unable to bump version "${currentVersion}" with release type "${releaseType}"
|
|
1568
|
+
|
|
1569
|
+
You should use an explicit release type (use flag: --major, --minor, --patch, --premajor, --preminor, --prepatch, --prerelease)`);
|
|
1570
|
+
}
|
|
1571
|
+
if (isPrereleaseReleaseType(releaseType) && suffix) {
|
|
1572
|
+
newVersion = newVersion.replace(/\.(\d+)$/, `.${suffix}`);
|
|
1573
|
+
}
|
|
1574
|
+
const isValidVersion = semver.gt(newVersion, currentVersion);
|
|
1575
|
+
if (!isValidVersion) {
|
|
1576
|
+
throw new Error(`Unable to bump version "${currentVersion}" to "${newVersion}", new version is not greater than current version`);
|
|
1577
|
+
}
|
|
1578
|
+
if (isGraduating(currentVersion, releaseType)) {
|
|
1579
|
+
logger.info(`Graduating from prerelease ${currentVersion} to stable ${newVersion}`);
|
|
1580
|
+
}
|
|
1581
|
+
return newVersion;
|
|
1582
|
+
} catch (error) {
|
|
1583
|
+
throw new Error(`Unable to bump version: ${error}`);
|
|
1553
1584
|
}
|
|
1554
|
-
return newVersion;
|
|
1555
1585
|
}
|
|
1556
1586
|
function updateLernaVersion({
|
|
1557
1587
|
rootDir,
|
|
@@ -2398,6 +2428,7 @@ async function bumpUnifiedMode({
|
|
|
2398
2428
|
return {
|
|
2399
2429
|
bumped: true,
|
|
2400
2430
|
oldVersion: currentVersion,
|
|
2431
|
+
fromTag: from,
|
|
2401
2432
|
newVersion,
|
|
2402
2433
|
bumpedPackages: packages.map((pkg) => ({
|
|
2403
2434
|
...pkg,
|
|
@@ -2581,12 +2612,7 @@ async function bump(options = {}) {
|
|
|
2581
2612
|
await executeHook("before:bump", config, dryRun);
|
|
2582
2613
|
logger.start("Start bumping versions");
|
|
2583
2614
|
if (config.bump.clean && config.release.clean) {
|
|
2584
|
-
|
|
2585
|
-
checkGitStatusIfDirty();
|
|
2586
|
-
} catch (error) {
|
|
2587
|
-
logger.error("Git status is dirty, please commit or stash your changes before bumping or use --no-clean flag", error);
|
|
2588
|
-
process.exit(1);
|
|
2589
|
-
}
|
|
2615
|
+
checkGitStatusIfDirty();
|
|
2590
2616
|
}
|
|
2591
2617
|
await fetchGitTags(config.cwd);
|
|
2592
2618
|
logger.info(`Version mode: ${config.monorepo?.versionMode || "standalone"}`);
|
|
@@ -2617,10 +2643,12 @@ async function bump(options = {}) {
|
|
|
2617
2643
|
} else {
|
|
2618
2644
|
logger.fail("No packages to bump, no commits found");
|
|
2619
2645
|
}
|
|
2620
|
-
await executeHook("
|
|
2646
|
+
await executeHook("success:bump", config, dryRun);
|
|
2621
2647
|
return result;
|
|
2622
2648
|
} catch (error) {
|
|
2623
|
-
|
|
2649
|
+
if (!options.config) {
|
|
2650
|
+
logger.error("Error while bumping version(s)!\n\n", error);
|
|
2651
|
+
}
|
|
2624
2652
|
await executeHook("error:bump", config, dryRun);
|
|
2625
2653
|
throw error;
|
|
2626
2654
|
}
|
|
@@ -2807,7 +2835,6 @@ async function changelog(options = {}) {
|
|
|
2807
2835
|
config,
|
|
2808
2836
|
changelog: true
|
|
2809
2837
|
});
|
|
2810
|
-
logger.debug(`${pkg.name}: ${commits.length} commit(s)`);
|
|
2811
2838
|
const changelog2 = await generateChangelog({
|
|
2812
2839
|
pkg,
|
|
2813
2840
|
commits,
|
|
@@ -2831,9 +2858,11 @@ async function changelog(options = {}) {
|
|
|
2831
2858
|
dryRun
|
|
2832
2859
|
});
|
|
2833
2860
|
logger.success(`${dryRun ? "[dry run] " : ""}Changelog generation completed!`);
|
|
2834
|
-
await executeHook("
|
|
2861
|
+
await executeHook("success:changelog", config, dryRun);
|
|
2835
2862
|
} catch (error) {
|
|
2836
|
-
|
|
2863
|
+
if (!options.config) {
|
|
2864
|
+
logger.error("Error generating changelogs!\n\n", error);
|
|
2865
|
+
}
|
|
2837
2866
|
await executeHook("error:changelog", config, dryRun);
|
|
2838
2867
|
throw error;
|
|
2839
2868
|
}
|
|
@@ -2863,7 +2892,7 @@ async function providerRelease(options = {}) {
|
|
|
2863
2892
|
configName: options.configName,
|
|
2864
2893
|
baseConfig: options.config,
|
|
2865
2894
|
overrides: {
|
|
2866
|
-
from: options.from,
|
|
2895
|
+
from: options.from || (options.bumpResult?.bumped === true ? options.bumpResult.fromTag : void 0),
|
|
2867
2896
|
to: options.to,
|
|
2868
2897
|
tokens: {
|
|
2869
2898
|
github: options.token,
|
|
@@ -2892,6 +2921,7 @@ async function providerRelease(options = {}) {
|
|
|
2892
2921
|
let postedReleases = [];
|
|
2893
2922
|
const payload = {
|
|
2894
2923
|
from: config.from,
|
|
2924
|
+
to: config.to,
|
|
2895
2925
|
dryRun,
|
|
2896
2926
|
config,
|
|
2897
2927
|
logLevel: config.logLevel,
|
|
@@ -2904,13 +2934,15 @@ async function providerRelease(options = {}) {
|
|
|
2904
2934
|
} else {
|
|
2905
2935
|
logger.warn(`Unsupported Git provider: ${detectedProvider}`);
|
|
2906
2936
|
}
|
|
2907
|
-
await executeHook("
|
|
2937
|
+
await executeHook("success:provider-release", config, dryRun);
|
|
2908
2938
|
return {
|
|
2909
2939
|
detectedProvider,
|
|
2910
2940
|
postedReleases
|
|
2911
2941
|
};
|
|
2912
2942
|
} catch (error) {
|
|
2913
|
-
|
|
2943
|
+
if (!options.config) {
|
|
2944
|
+
logger.error("Error publishing releases!\n\n", error);
|
|
2945
|
+
}
|
|
2914
2946
|
await executeHook("error:provider-release", config, dryRun);
|
|
2915
2947
|
throw error;
|
|
2916
2948
|
}
|
|
@@ -2993,12 +3025,14 @@ async function publish(options = {}) {
|
|
|
2993
3025
|
logger.info("Package(s) have been published to npm registry");
|
|
2994
3026
|
}
|
|
2995
3027
|
logger.success("Publishing packages completed!");
|
|
2996
|
-
await executeHook("
|
|
3028
|
+
await executeHook("success:publish", config, dryRun);
|
|
2997
3029
|
return {
|
|
2998
3030
|
publishedPackages
|
|
2999
3031
|
};
|
|
3000
3032
|
} catch (error) {
|
|
3001
|
-
|
|
3033
|
+
if (!options.config) {
|
|
3034
|
+
logger.error("Error during publishing packages!\n\n", error);
|
|
3035
|
+
}
|
|
3002
3036
|
await executeHook("error:publish", config, dryRun);
|
|
3003
3037
|
throw error;
|
|
3004
3038
|
}
|
|
@@ -3114,7 +3148,7 @@ async function release(options = {}) {
|
|
|
3114
3148
|
await executeHook("before:push", config, dryRun);
|
|
3115
3149
|
try {
|
|
3116
3150
|
await pushCommitAndTags({ dryRun, logLevel: config.logLevel, cwd: config.cwd });
|
|
3117
|
-
await executeHook("
|
|
3151
|
+
await executeHook("success:push", config, dryRun);
|
|
3118
3152
|
} catch (error) {
|
|
3119
3153
|
await executeHook("error:push", config, dryRun);
|
|
3120
3154
|
throw error;
|
|
@@ -3145,6 +3179,9 @@ async function release(options = {}) {
|
|
|
3145
3179
|
logger.debug(`Provider from config: ${provider}`);
|
|
3146
3180
|
try {
|
|
3147
3181
|
const response = await providerRelease({
|
|
3182
|
+
from: config.from,
|
|
3183
|
+
to: config.to,
|
|
3184
|
+
token: options.token,
|
|
3148
3185
|
provider,
|
|
3149
3186
|
dryRun,
|
|
3150
3187
|
config,
|
|
@@ -3170,10 +3207,10 @@ Pushed: ${config.release.push ? "Yes" : "Disabled"}
|
|
|
3170
3207
|
Published packages: ${config.release.publish ? publishedPackageCount : "Disabled"}
|
|
3171
3208
|
Published release: ${config.release.providerRelease ? postedReleases.length : "Disabled"}
|
|
3172
3209
|
Git provider: ${provider}`);
|
|
3173
|
-
await executeHook("
|
|
3210
|
+
await executeHook("success:release", config, dryRun);
|
|
3174
3211
|
} catch (error) {
|
|
3212
|
+
logger.error("Error during release workflow!\n\n", error);
|
|
3175
3213
|
await executeHook("error:release", config, dryRun);
|
|
3176
|
-
logger.error("Error during release workflow:", error);
|
|
3177
3214
|
throw error;
|
|
3178
3215
|
}
|
|
3179
3216
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "relizy",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.0",
|
|
4
|
+
"version": "0.2.2-beta.0",
|
|
5
5
|
"description": "Changelogen adapter for monorepo management with unified and independent versioning",
|
|
6
6
|
"author": "Louis Mazel <me@loicmazuel.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
|
+
"homepage": "https://louismazel.github.io/relizy",
|
|
8
9
|
"repository": {
|
|
9
10
|
"type": "git",
|
|
10
11
|
"url": "git+https://github.com/LouisMazel/relizy.git"
|