@release-change/release 0.1.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/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/commit-updated-files.d.ts +10 -0
- package/dist/commit-updated-files.d.ts.map +1 -0
- package/dist/commit-updated-files.js +73 -0
- package/dist/commit-updated-files.js.map +1 -0
- package/dist/get-version-from-tag.d.ts +7 -0
- package/dist/get-version-from-tag.d.ts.map +1 -0
- package/dist/get-version-from-tag.js +21 -0
- package/dist/get-version-from-tag.js.map +1 -0
- package/dist/increment-version.d.ts +55 -0
- package/dist/increment-version.d.ts.map +1 -0
- package/dist/increment-version.js +93 -0
- package/dist/increment-version.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/publish.d.ts +7 -0
- package/dist/publish.d.ts.map +1 -0
- package/dist/publish.js +87 -0
- package/dist/publish.js.map +1 -0
- package/dist/set-last-release.d.ts +7 -0
- package/dist/set-last-release.d.ts.map +1 -0
- package/dist/set-last-release.js +65 -0
- package/dist/set-last-release.js.map +1 -0
- package/dist/set-next-release.d.ts +11 -0
- package/dist/set-next-release.d.ts.map +1 -0
- package/dist/set-next-release.js +79 -0
- package/dist/set-next-release.js.map +1 -0
- package/dist/update-lock-file.d.ts +10 -0
- package/dist/update-lock-file.d.ts.map +1 -0
- package/dist/update-lock-file.js +56 -0
- package/dist/update-lock-file.js.map +1 -0
- package/dist/update-package-dependencies-versions.d.ts +9 -0
- package/dist/update-package-dependencies-versions.d.ts.map +1 -0
- package/dist/update-package-dependencies-versions.js +72 -0
- package/dist/update-package-dependencies-versions.js.map +1 -0
- package/dist/update-package-version.d.ts +8 -0
- package/dist/update-package-version.d.ts.map +1 -0
- package/dist/update-package-version.js +37 -0
- package/dist/update-package-version.js.map +1 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-present Victor Brito
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @release-change/release
|
|
2
|
+
|
|
3
|
+
Functions used internally in release-change to release packages
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
[](https://nodejs.org/api/esm.html)
|
|
7
|
+
[](https://conventionalcommits.org)
|
|
8
|
+
[](https://biomejs.dev/)
|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
## Copyright & licence
|
|
14
|
+
|
|
15
|
+
© 2025-present Victor Brito — Released under the [MIT licence](./LICENSE).
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PackageManager } from "@release-change/get-packages";
|
|
2
|
+
import type { Context, PackageNextRelease } from "@release-change/shared";
|
|
3
|
+
/**
|
|
4
|
+
* Commits the updated files.
|
|
5
|
+
* @param packageNextRelease - The next release data to use.
|
|
6
|
+
* @param packageManager - The package manager used by the project.
|
|
7
|
+
* @param context - The context where the CLI is running.
|
|
8
|
+
*/
|
|
9
|
+
export declare const commitUpdatedFiles: (packageNextRelease: PackageNextRelease, packageManager: PackageManager, context: Context) => Promise<void>;
|
|
10
|
+
//# sourceMappingURL=commit-updated-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit-updated-files.d.ts","sourceRoot":"","sources":["../src/commit-updated-files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAU1E;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAC7B,oBAAoB,kBAAkB,EACtC,gBAAgB,cAAc,EAC9B,SAAS,OAAO,KACf,OAAO,CAAC,IAAI,CAwEd,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { inspect } from "node:util";
|
|
4
|
+
import { add, COMMITTER_EMAIL, COMMITTER_NAME, commit } from "@release-change/git";
|
|
5
|
+
import { setLogger } from "@release-change/logger";
|
|
6
|
+
import { formatDetailedError } from "@release-change/shared";
|
|
7
|
+
/**
|
|
8
|
+
* Commits the updated files.
|
|
9
|
+
* @param packageNextRelease - The next release data to use.
|
|
10
|
+
* @param packageManager - The package manager used by the project.
|
|
11
|
+
* @param context - The context where the CLI is running.
|
|
12
|
+
*/
|
|
13
|
+
export const commitUpdatedFiles = async (packageNextRelease, packageManager, context) => {
|
|
14
|
+
const { cwd, config } = context;
|
|
15
|
+
const { debug } = config;
|
|
16
|
+
const logger = setLogger(debug);
|
|
17
|
+
if (packageManager) {
|
|
18
|
+
const { pathname } = packageNextRelease;
|
|
19
|
+
const packageManifestFile = path.join(cwd, pathname, "package.json");
|
|
20
|
+
const lockFile = path.join(cwd, pathname, packageManager === "pnpm" ? "pnpm-lock.yaml" : "package-lock.json");
|
|
21
|
+
const changelogFile = path.join(cwd, pathname, "CHANGELOG.md");
|
|
22
|
+
const filesToAdd = fs.existsSync(lockFile)
|
|
23
|
+
? [packageManifestFile, lockFile, changelogFile]
|
|
24
|
+
: [packageManifestFile, changelogFile];
|
|
25
|
+
const gitAddCommandResult = await add(filesToAdd, cwd);
|
|
26
|
+
const { status: gitAddStatus, stdout: gitAddStdout, stderr: gitAddStderr } = gitAddCommandResult;
|
|
27
|
+
if (gitAddStatus) {
|
|
28
|
+
process.exitCode = gitAddStatus;
|
|
29
|
+
throw formatDetailedError({
|
|
30
|
+
title: "Failed to run the `git` command",
|
|
31
|
+
message: `The command failed with status ${gitAddStatus}`,
|
|
32
|
+
details: {
|
|
33
|
+
output: gitAddStderr || gitAddStdout || `Command failed with status code ${gitAddStatus}.`,
|
|
34
|
+
command: `git add ${filesToAdd.join(" ")}`
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const commitMessage = `chore: ${packageNextRelease.gitTag} [skip ci]\n\nCo-authored-by: ${COMMITTER_NAME} <${COMMITTER_EMAIL}>`;
|
|
39
|
+
const gitCommitCommandResult = await commit(commitMessage, cwd);
|
|
40
|
+
const { status: gitCommitStatus, stdout: gitCommitStdout, stderr: gitCommitStderr } = gitCommitCommandResult;
|
|
41
|
+
if (gitCommitStatus) {
|
|
42
|
+
process.exitCode = gitCommitStatus;
|
|
43
|
+
throw formatDetailedError({
|
|
44
|
+
title: "Failed to run the `git` command",
|
|
45
|
+
message: `The command failed with status ${gitAddStatus}`,
|
|
46
|
+
details: {
|
|
47
|
+
output: gitCommitStderr ||
|
|
48
|
+
gitCommitStdout ||
|
|
49
|
+
`Command failed with status code ${gitCommitStatus}.`,
|
|
50
|
+
command: `git commit -m ${commitMessage}`
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
if (debug) {
|
|
55
|
+
logger.setDebugScope("release:commit-updated-files");
|
|
56
|
+
logger.logDebug(`Command run: git add ${filesToAdd.join(" ")}`);
|
|
57
|
+
logger.logDebug(inspect(gitAddCommandResult, { depth: Number.POSITIVE_INFINITY }));
|
|
58
|
+
logger.logDebug(`Command run: git commit -m '${commitMessage.replace(/\n/g, "\\n")}'`);
|
|
59
|
+
logger.logDebug(inspect(gitCommitCommandResult, { depth: Number.POSITIVE_INFINITY }));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
process.exitCode = process.exitCode ?? 1;
|
|
64
|
+
throw formatDetailedError({
|
|
65
|
+
title: "Failed to commit the updated files",
|
|
66
|
+
message: "The package manager is not found or is not one of those supported (npm or pnpm).",
|
|
67
|
+
details: {
|
|
68
|
+
output: `packageManager: ${packageManager}`
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=commit-updated-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit-updated-files.js","sourceRoot":"","sources":["../src/commit-updated-files.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,CAAC,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AAC,iBAAiB,EAAE,CAAC,CAAC,CAAC;QACxF,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC;QACzC,MAAM,mBAAmB,CAAC;YACxB,KAAK,EAAE,oCAAoC;YAC3C,OAAO,EAAE,kFAAkF;YAC3F,OAAO,EAAE;gBACP,MAAM,EAAE,mBAAmB,cAAc,EAAE;aAC5C;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-version-from-tag.d.ts","sourceRoot":"","sources":["../src/get-version-from-tag.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,KAAG,MAU/C,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GIT_TAG_PATTERN } from "@release-change/git";
|
|
2
|
+
import { validate } from "@release-change/semver";
|
|
3
|
+
import { formatDetailedError } from "@release-change/shared";
|
|
4
|
+
/**
|
|
5
|
+
* Gets the version as per semantic versioning from a tag.
|
|
6
|
+
* @param tag - The tag.
|
|
7
|
+
* @return The version if valid.
|
|
8
|
+
*/
|
|
9
|
+
export const getVersionFromTag = (tag) => {
|
|
10
|
+
const version = validate(tag.replace(GIT_TAG_PATTERN, ""));
|
|
11
|
+
if (version)
|
|
12
|
+
return version;
|
|
13
|
+
throw formatDetailedError({
|
|
14
|
+
title: "Failed to get the version from tag",
|
|
15
|
+
message: `No version could be extracted from tag ${tag}.`,
|
|
16
|
+
details: {
|
|
17
|
+
output: `tag: ${tag}`
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=get-version-from-tag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-version-from-tag.js","sourceRoot":"","sources":["../src/get-version-from-tag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAU,EAAE;IACvD,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3D,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC;IAC5B,MAAM,mBAAmB,CAAC;QACxB,KAAK,EAAE,oCAAoC;QAC3C,OAAO,EAAE,0CAA0C,GAAG,GAAG;QACzD,OAAO,EAAE;YACP,MAAM,EAAE,QAAQ,GAAG,EAAE;SACtB;KACF,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { BranchConfig, ReleaseType } from "@release-change/shared";
|
|
2
|
+
/**
|
|
3
|
+
* Increments the version.
|
|
4
|
+
* The version increment follows the following rules:
|
|
5
|
+
* - if the current version is not a pre-release, the rules as per semantic versioning apply (with addition of the pre-release identifier if the target branch is configured for pre-releases);
|
|
6
|
+
* - otherwise:
|
|
7
|
+
* - major releases do not increment the major version,
|
|
8
|
+
* - minor releases do not increment the minor version,
|
|
9
|
+
* - patch releases do not increment the patch version,
|
|
10
|
+
* - the pre-release components are removed if the target branch is not configured for pre-releases,
|
|
11
|
+
* - the pre-release components are incremented if the target branch is configured for pre-releases.
|
|
12
|
+
* @example
|
|
13
|
+
* Major releases from non-pre-release version:
|
|
14
|
+
* ```
|
|
15
|
+
* 1.0.0 -> 2.0.0
|
|
16
|
+
* 1.0.0 -> 2.0.0-alpha.1
|
|
17
|
+
* 1.0.0 -> 2.0.0-beta.1
|
|
18
|
+
* 1.0.0 -> 2.0.0-rc.1
|
|
19
|
+
* ```
|
|
20
|
+
* Minor releases from non-pre-release version:
|
|
21
|
+
* ```
|
|
22
|
+
* 1.0.0 -> 1.1.0
|
|
23
|
+
* 1.0.0 -> 1.1.0-alpha.1
|
|
24
|
+
* 1.0.0 -> 1.1.0-beta.1
|
|
25
|
+
* 1.0.0 -> 1.1.0-rc.1
|
|
26
|
+
* ```
|
|
27
|
+
* Patch releases from non-pre-release version:
|
|
28
|
+
* ```
|
|
29
|
+
* 1.0.0 -> 1.0.1
|
|
30
|
+
* 1.0.0 -> 1.0.1-alpha.1
|
|
31
|
+
* 1.0.0 -> 1.0.1-beta.1
|
|
32
|
+
* 1.0.0 -> 1.0.1-rc.1
|
|
33
|
+
* ```
|
|
34
|
+
* Releases from pre-release version, whichever the release type:
|
|
35
|
+
* ```
|
|
36
|
+
* 2.0.0-alpha.1 -> 2.0.0-alpha.2
|
|
37
|
+
* 2.0.0-alpha.1 -> 2.0.0-beta.1
|
|
38
|
+
* 2.0.0-alpha.1 -> 2.0.0-rc.1
|
|
39
|
+
* 2.0.0-alpha.1 -> 2.0.0
|
|
40
|
+
* 2.0.0-beta.1 -> 2.0.0-alpha.1
|
|
41
|
+
* 2.0.0-beta.1 -> 2.0.0-beta.2
|
|
42
|
+
* 2.0.0-beta.1 -> 2.0.0-rc.1
|
|
43
|
+
* 2.0.0-beta.1 -> 2.0.0
|
|
44
|
+
* 2.0.0-rc.1 -> 2.0.0-alpha.1
|
|
45
|
+
* 2.0.0-rc.1 -> 2.0.0-beta.1
|
|
46
|
+
* 2.0.0-rc.1 -> 2.0.0-rc.2
|
|
47
|
+
* 2.0.0-rc.1 -> 2.0.0
|
|
48
|
+
* ```
|
|
49
|
+
* @param currentVersion - The current version.
|
|
50
|
+
* @param releaseType - The release type.
|
|
51
|
+
* @param branchConfig - The target branch configuration in terms of releases.
|
|
52
|
+
* @return The next version if there is a release and the increment is valid.
|
|
53
|
+
*/
|
|
54
|
+
export declare const incrementVersion: (currentVersion: string, releaseType: ReleaseType, branchConfig: BranchConfig) => string;
|
|
55
|
+
//# sourceMappingURL=increment-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"increment-version.d.ts","sourceRoot":"","sources":["../src/increment-version.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAKxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,eAAO,MAAM,gBAAgB,GAC3B,gBAAgB,MAAM,EACtB,aAAa,WAAW,EACxB,cAAc,YAAY,KACzB,MAqCF,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { getPrerelease, increase } from "@release-change/semver";
|
|
2
|
+
import { formatDetailedError } from "@release-change/shared";
|
|
3
|
+
/**
|
|
4
|
+
* Increments the version.
|
|
5
|
+
* The version increment follows the following rules:
|
|
6
|
+
* - if the current version is not a pre-release, the rules as per semantic versioning apply (with addition of the pre-release identifier if the target branch is configured for pre-releases);
|
|
7
|
+
* - otherwise:
|
|
8
|
+
* - major releases do not increment the major version,
|
|
9
|
+
* - minor releases do not increment the minor version,
|
|
10
|
+
* - patch releases do not increment the patch version,
|
|
11
|
+
* - the pre-release components are removed if the target branch is not configured for pre-releases,
|
|
12
|
+
* - the pre-release components are incremented if the target branch is configured for pre-releases.
|
|
13
|
+
* @example
|
|
14
|
+
* Major releases from non-pre-release version:
|
|
15
|
+
* ```
|
|
16
|
+
* 1.0.0 -> 2.0.0
|
|
17
|
+
* 1.0.0 -> 2.0.0-alpha.1
|
|
18
|
+
* 1.0.0 -> 2.0.0-beta.1
|
|
19
|
+
* 1.0.0 -> 2.0.0-rc.1
|
|
20
|
+
* ```
|
|
21
|
+
* Minor releases from non-pre-release version:
|
|
22
|
+
* ```
|
|
23
|
+
* 1.0.0 -> 1.1.0
|
|
24
|
+
* 1.0.0 -> 1.1.0-alpha.1
|
|
25
|
+
* 1.0.0 -> 1.1.0-beta.1
|
|
26
|
+
* 1.0.0 -> 1.1.0-rc.1
|
|
27
|
+
* ```
|
|
28
|
+
* Patch releases from non-pre-release version:
|
|
29
|
+
* ```
|
|
30
|
+
* 1.0.0 -> 1.0.1
|
|
31
|
+
* 1.0.0 -> 1.0.1-alpha.1
|
|
32
|
+
* 1.0.0 -> 1.0.1-beta.1
|
|
33
|
+
* 1.0.0 -> 1.0.1-rc.1
|
|
34
|
+
* ```
|
|
35
|
+
* Releases from pre-release version, whichever the release type:
|
|
36
|
+
* ```
|
|
37
|
+
* 2.0.0-alpha.1 -> 2.0.0-alpha.2
|
|
38
|
+
* 2.0.0-alpha.1 -> 2.0.0-beta.1
|
|
39
|
+
* 2.0.0-alpha.1 -> 2.0.0-rc.1
|
|
40
|
+
* 2.0.0-alpha.1 -> 2.0.0
|
|
41
|
+
* 2.0.0-beta.1 -> 2.0.0-alpha.1
|
|
42
|
+
* 2.0.0-beta.1 -> 2.0.0-beta.2
|
|
43
|
+
* 2.0.0-beta.1 -> 2.0.0-rc.1
|
|
44
|
+
* 2.0.0-beta.1 -> 2.0.0
|
|
45
|
+
* 2.0.0-rc.1 -> 2.0.0-alpha.1
|
|
46
|
+
* 2.0.0-rc.1 -> 2.0.0-beta.1
|
|
47
|
+
* 2.0.0-rc.1 -> 2.0.0-rc.2
|
|
48
|
+
* 2.0.0-rc.1 -> 2.0.0
|
|
49
|
+
* ```
|
|
50
|
+
* @param currentVersion - The current version.
|
|
51
|
+
* @param releaseType - The release type.
|
|
52
|
+
* @param branchConfig - The target branch configuration in terms of releases.
|
|
53
|
+
* @return The next version if there is a release and the increment is valid.
|
|
54
|
+
*/
|
|
55
|
+
export const incrementVersion = (currentVersion, releaseType, branchConfig) => {
|
|
56
|
+
if (releaseType) {
|
|
57
|
+
const { prerelease, prereleaseIdentifier } = branchConfig;
|
|
58
|
+
const currentVersionPrereleaseComponents = getPrerelease(currentVersion);
|
|
59
|
+
const isCurrentVersionPrerelease = Boolean(currentVersionPrereleaseComponents?.length);
|
|
60
|
+
const prereleaseType = isCurrentVersionPrerelease
|
|
61
|
+
? "prerelease"
|
|
62
|
+
: releaseType === "major"
|
|
63
|
+
? "premajor"
|
|
64
|
+
: releaseType === "minor"
|
|
65
|
+
? "preminor"
|
|
66
|
+
: "prerelease";
|
|
67
|
+
const nextVersion = prerelease && prereleaseIdentifier
|
|
68
|
+
? increase(currentVersion, prereleaseType, {
|
|
69
|
+
prefix: prereleaseIdentifier,
|
|
70
|
+
identifierBase: 1
|
|
71
|
+
})
|
|
72
|
+
: isCurrentVersionPrerelease
|
|
73
|
+
? increase(currentVersion, "patch")
|
|
74
|
+
: increase(currentVersion, releaseType);
|
|
75
|
+
if (nextVersion)
|
|
76
|
+
return nextVersion;
|
|
77
|
+
throw formatDetailedError({
|
|
78
|
+
title: `Failed to increment version from ${currentVersion}`,
|
|
79
|
+
message: "No next version given.",
|
|
80
|
+
details: {
|
|
81
|
+
output: "nextVersion: null"
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
throw formatDetailedError({
|
|
86
|
+
title: `Failed to increment version from ${currentVersion}`,
|
|
87
|
+
message: "No release type retrieved.",
|
|
88
|
+
details: {
|
|
89
|
+
output: "releaseType: null"
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=increment-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"increment-version.js","sourceRoot":"","sources":["../src/increment-version.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,cAAsB,EACtB,WAAwB,EACxB,YAA0B,EAClB,EAAE;IACV,IAAI,WAAW,EAA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"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAkCtD;;;GAGG;AACH,eAAO,MAAM,OAAO,GAAU,SAAS,OAAO,KAAG,OAAO,CAAC,IAAI,CA4F5D,CAAC"}
|
package/dist/publish.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { getPackageDependencies, getPackageManager } from "@release-change/get-packages";
|
|
3
|
+
import { cancelCommitsSinceRef, createTag, getCurrentCommitId, push, removeTag, removeTagOnRemoteRepository, setBranchName, switchToNewBranch } from "@release-change/git";
|
|
4
|
+
import { createPullRequest } from "@release-change/github";
|
|
5
|
+
import { addErrorToContext, checkErrorType, isDetailedError, setLogger } from "@release-change/logger";
|
|
6
|
+
import { preparePublishing, publishToRegistry } from "@release-change/npm";
|
|
7
|
+
import { createReleaseNotes, prepareReleaseNotes, updateChangelogFile } from "@release-change/release-notes-generator";
|
|
8
|
+
import { commitUpdatedFiles } from "./commit-updated-files.js";
|
|
9
|
+
import { updateLockFile } from "./update-lock-file.js";
|
|
10
|
+
import { updatePackageDependenciesVersions } from "./update-package-dependencies-versions.js";
|
|
11
|
+
import { updatePackageVersion } from "./update-package-version.js";
|
|
12
|
+
/**
|
|
13
|
+
* Publishes the package
|
|
14
|
+
* @param context - The context where the CLI is running.
|
|
15
|
+
*/
|
|
16
|
+
export const publish = async (context) => {
|
|
17
|
+
const { cwd, env, config: { debug, isMonorepo }, branch, nextRelease } = context;
|
|
18
|
+
const logger = setLogger(debug);
|
|
19
|
+
logger.setScope("release");
|
|
20
|
+
const commitRef = getCurrentCommitId(cwd);
|
|
21
|
+
const newGitTags = [];
|
|
22
|
+
try {
|
|
23
|
+
if (nextRelease) {
|
|
24
|
+
const packageManager = getPackageManager(cwd, env);
|
|
25
|
+
const packagePublishingSet = [];
|
|
26
|
+
const releaseNotesSet = [];
|
|
27
|
+
const newBranch = setBranchName(branch, nextRelease);
|
|
28
|
+
switchToNewBranch(newBranch, cwd);
|
|
29
|
+
for (const nextReleasePackage of nextRelease) {
|
|
30
|
+
const { pathname } = nextReleasePackage;
|
|
31
|
+
const packageDependencies = getPackageDependencies(path.join(cwd, pathname, "package.json"));
|
|
32
|
+
const packageDependenciesToUpdate = isMonorepo && packageDependencies
|
|
33
|
+
? nextRelease.filter(packageNextRelease => packageDependencies.includes(packageNextRelease.name))
|
|
34
|
+
: null;
|
|
35
|
+
const preparedReleaseNotes = prepareReleaseNotes(nextReleasePackage, packageDependencies, context);
|
|
36
|
+
releaseNotesSet.push(preparedReleaseNotes);
|
|
37
|
+
updatePackageVersion(nextReleasePackage, context);
|
|
38
|
+
if (packageDependenciesToUpdate)
|
|
39
|
+
updatePackageDependenciesVersions(nextReleasePackage, packageDependenciesToUpdate, context);
|
|
40
|
+
await updateLockFile(nextReleasePackage, context, packageManager);
|
|
41
|
+
updateChangelogFile(nextReleasePackage, preparedReleaseNotes.body, cwd);
|
|
42
|
+
await commitUpdatedFiles(nextReleasePackage, packageManager, context);
|
|
43
|
+
createTag(nextReleasePackage, getCurrentCommitId(cwd), debug);
|
|
44
|
+
newGitTags.push(nextReleasePackage.gitTag);
|
|
45
|
+
const packagePublishing = await preparePublishing(nextReleasePackage, context);
|
|
46
|
+
if (packagePublishing)
|
|
47
|
+
packagePublishingSet.push(packagePublishing);
|
|
48
|
+
}
|
|
49
|
+
await push(context, { destinationBranch: newBranch, includeTags: true });
|
|
50
|
+
await createPullRequest(newBranch, context);
|
|
51
|
+
for (const releaseNotes of releaseNotesSet) {
|
|
52
|
+
await createReleaseNotes(releaseNotes, context);
|
|
53
|
+
}
|
|
54
|
+
for (const packagePublishing of packagePublishingSet) {
|
|
55
|
+
await publishToRegistry(packagePublishing, context);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
logger.logError("Failed to publish the release.");
|
|
61
|
+
logger.logError(checkErrorType(error));
|
|
62
|
+
addErrorToContext(error, context);
|
|
63
|
+
if (error instanceof Error) {
|
|
64
|
+
const { cause } = error;
|
|
65
|
+
if (cause && isDetailedError(cause)) {
|
|
66
|
+
const { details: { command } } = cause;
|
|
67
|
+
const isCommandGitPush = command === `git push --follow-tags ${context.config.remoteName} ${context.branch}`;
|
|
68
|
+
if (command &&
|
|
69
|
+
(isCommandGitPush ||
|
|
70
|
+
command.startsWith("git add") ||
|
|
71
|
+
command.startsWith("git commit") ||
|
|
72
|
+
command.match(/^POST \S+\/pulls$/))) {
|
|
73
|
+
cancelCommitsSinceRef(commitRef, cwd, debug);
|
|
74
|
+
for (const newGitTag of newGitTags) {
|
|
75
|
+
removeTag(newGitTag, cwd, debug);
|
|
76
|
+
await removeTagOnRemoteRepository(newGitTag, context);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
process.exitCode = process.exitCode || 1;
|
|
82
|
+
throw error instanceof Error
|
|
83
|
+
? new Error(error.message, { cause: error.cause })
|
|
84
|
+
: new Error(`${error}`);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=publish.js.map
|
|
@@ -0,0 +1 @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A0B,OAAO,CAAC,MAAM,CAAC,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;gBACtF,IACE,OAAO;oBACP,CAAC,gBAAgB;wBACf,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC;wBAC7B,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC;wBAChC,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,EACrC,CAAC;oBACD,qBAAqB,CAAC,SAAS,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;oBAC7C,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;wBACnC,SAAS,CAAC,SAAS,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;wBACjC,MAAM,2BAA2B,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;oBACxD,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC;QACzC,MAAM,KAAK,YAAY,KAAK;YAC1B,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;YAClD,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC;IAC5B,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Context } from "@release-change/shared";
|
|
2
|
+
/**
|
|
3
|
+
* Sets the last release from the latest valid Git tag, both for the whole repository and for each package, and adds it to the context where the CLI is running.
|
|
4
|
+
* @param context - The context where the CLI is running.
|
|
5
|
+
*/
|
|
6
|
+
export declare const setLastRelease: (context: Context) => void;
|
|
7
|
+
//# sourceMappingURL=set-last-release.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-last-release.d.ts","sourceRoot":"","sources":["../src/set-last-release.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAmC,MAAM,wBAAwB,CAAC;AAYvF;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,SAAS,OAAO,KAAG,IAoDjD,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { inspect } from "node:util";
|
|
3
|
+
import { getPackageVersion } from "@release-change/get-packages";
|
|
4
|
+
import { getLatestValidTag } from "@release-change/git";
|
|
5
|
+
import { addErrorToContext, checkErrorType, setLogger } from "@release-change/logger";
|
|
6
|
+
import { validate } from "@release-change/semver";
|
|
7
|
+
import { getVersionFromTag } from "./get-version-from-tag.js";
|
|
8
|
+
/**
|
|
9
|
+
* Sets the last release from the latest valid Git tag, both for the whole repository and for each package, and adds it to the context where the CLI is running.
|
|
10
|
+
* @param context - The context where the CLI is running.
|
|
11
|
+
*/
|
|
12
|
+
export const setLastRelease = (context) => {
|
|
13
|
+
const { cwd, branch, config, packages } = context;
|
|
14
|
+
const logger = setLogger(config.debug);
|
|
15
|
+
logger.setScope("release");
|
|
16
|
+
if (!branch || !config.branches.includes(branch))
|
|
17
|
+
return;
|
|
18
|
+
try {
|
|
19
|
+
const lastRelease = {
|
|
20
|
+
ref: null,
|
|
21
|
+
packages: []
|
|
22
|
+
};
|
|
23
|
+
const latestValidGitTag = getLatestValidTag(context);
|
|
24
|
+
if (latestValidGitTag)
|
|
25
|
+
lastRelease.ref = latestValidGitTag;
|
|
26
|
+
for (const { name, pathname } of packages) {
|
|
27
|
+
const packageName = name || "root";
|
|
28
|
+
const packageLastRelease = {
|
|
29
|
+
name,
|
|
30
|
+
pathname,
|
|
31
|
+
gitTag: null,
|
|
32
|
+
version: "0.0.0"
|
|
33
|
+
};
|
|
34
|
+
const latestValidGitTag = getLatestValidTag(context, name);
|
|
35
|
+
if (latestValidGitTag) {
|
|
36
|
+
const version = getVersionFromTag(latestValidGitTag);
|
|
37
|
+
logger.logInfo(`Found Git tag ${latestValidGitTag} for ${packageName} package, associated with version ${version} on branch ${branch}.`);
|
|
38
|
+
packageLastRelease.gitTag = latestValidGitTag;
|
|
39
|
+
packageLastRelease.version = version;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
logger.logInfo(`No Git tag version found for ${packageName} package on branch ${branch}.`);
|
|
43
|
+
const packageVersion = validate(getPackageVersion(path.join(cwd, pathname, "package.json")));
|
|
44
|
+
if (packageVersion) {
|
|
45
|
+
logger.logInfo(`Found package version ${packageVersion} for ${packageName} package on branch ${branch}.`);
|
|
46
|
+
packageLastRelease.version = packageVersion;
|
|
47
|
+
}
|
|
48
|
+
else
|
|
49
|
+
logger.logInfo(`No package version found for ${packageName} package.`);
|
|
50
|
+
}
|
|
51
|
+
lastRelease.packages.push(packageLastRelease);
|
|
52
|
+
}
|
|
53
|
+
context.lastRelease = lastRelease;
|
|
54
|
+
if (config.debug) {
|
|
55
|
+
logger.setDebugScope("cli:release:set-last-release");
|
|
56
|
+
logger.logDebug(inspect(context.lastRelease, { depth: Number.POSITIVE_INFINITY }));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
logger.logError(checkErrorType(error));
|
|
61
|
+
addErrorToContext(error, context);
|
|
62
|
+
process.exitCode = 1;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=set-last-release.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-last-release.js","sourceRoot":"","sources":["../src/set-last-release.ts"],"names":[],"mappings":"AAEA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,QAAQ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release-change/shared";
|
|
3
|
+
/**
|
|
4
|
+
* Sets the next release based on the last one and the release types of each concerned package and adds it to the context where the CLI is running.
|
|
5
|
+
*
|
|
6
|
+
* Due to GitHub limitations in terms of “latest” labelling and for correct lock file updates, the root package appears last in a monorepo context.
|
|
7
|
+
* @param packageReleaseTypes - The release types for each package.
|
|
8
|
+
* @param context - The context where the CLI is running.
|
|
9
|
+
*/
|
|
10
|
+
export declare const setNextRelease: (packageReleaseTypes: PackageReleaseType[], context: Context) => void;
|
|
11
|
+
//# sourceMappingURL=set-next-release.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-next-release.d.ts","sourceRoot":"","sources":["../src/set-next-release.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAsB,MAAM,wBAAwB,CAAC;AAQ1E;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GACzB,qBAAqB,kBAAkB,EAAE,EACzC,SAAS,OAAO,KACf,IAiEF,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { inspect } from "node:util";
|
|
2
|
+
import { addErrorToContext, checkErrorType, setLogger } from "@release-change/logger";
|
|
3
|
+
import { incrementVersion } from "./increment-version.js";
|
|
4
|
+
/**
|
|
5
|
+
* Sets the next release based on the last one and the release types of each concerned package and adds it to the context where the CLI is running.
|
|
6
|
+
*
|
|
7
|
+
* Due to GitHub limitations in terms of “latest” labelling and for correct lock file updates, the root package appears last in a monorepo context.
|
|
8
|
+
* @param packageReleaseTypes - The release types for each package.
|
|
9
|
+
* @param context - The context where the CLI is running.
|
|
10
|
+
*/
|
|
11
|
+
export const setNextRelease = (packageReleaseTypes, context) => {
|
|
12
|
+
const { branch, config, lastRelease } = context;
|
|
13
|
+
const logger = setLogger(config.debug);
|
|
14
|
+
logger.setScope("release");
|
|
15
|
+
if (!branch || !config.branches.includes(branch))
|
|
16
|
+
return;
|
|
17
|
+
if (!lastRelease) {
|
|
18
|
+
logger.logWarn("No last release found; therefore, a new version will not be published.");
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const branchConfig = config.releaseType[branch];
|
|
23
|
+
const nonNullablePackageReleaseTypes = packageReleaseTypes.filter(packageReleaseType => Boolean(packageReleaseType.releaseType));
|
|
24
|
+
if (branchConfig && nonNullablePackageReleaseTypes.length) {
|
|
25
|
+
const nextRelease = [];
|
|
26
|
+
let rootPackageNextRelease = null;
|
|
27
|
+
for (const packageReleaseType of nonNullablePackageReleaseTypes) {
|
|
28
|
+
const { name, releaseType } = packageReleaseType;
|
|
29
|
+
const packageLastRelease = lastRelease.packages.find(packageItem => packageItem.name === name);
|
|
30
|
+
if (packageLastRelease) {
|
|
31
|
+
const { pathname, gitTag, version: currentVersion } = packageLastRelease;
|
|
32
|
+
const version = incrementVersion(currentVersion, releaseType, branchConfig);
|
|
33
|
+
const { channel } = branchConfig;
|
|
34
|
+
const npmTag = channel && channel !== "default" ? channel : "latest";
|
|
35
|
+
const preparedGitTag = `${name ? `${name}@` : ""}v${version}`;
|
|
36
|
+
const packageNextRelease = npmTag === "latest"
|
|
37
|
+
? {
|
|
38
|
+
name,
|
|
39
|
+
pathname,
|
|
40
|
+
gitTag: preparedGitTag,
|
|
41
|
+
version
|
|
42
|
+
}
|
|
43
|
+
: {
|
|
44
|
+
name,
|
|
45
|
+
pathname,
|
|
46
|
+
gitTag: preparedGitTag,
|
|
47
|
+
version,
|
|
48
|
+
npmTag
|
|
49
|
+
};
|
|
50
|
+
if (config.isMonorepo && !name)
|
|
51
|
+
rootPackageNextRelease = packageNextRelease;
|
|
52
|
+
else
|
|
53
|
+
nextRelease.push(packageNextRelease);
|
|
54
|
+
const previousReleaseInfoMessage = gitTag
|
|
55
|
+
? `the previous release is ${currentVersion}`
|
|
56
|
+
: "there is no previous release";
|
|
57
|
+
logger.logInfo(`For ${name || "root"} package, ${previousReleaseInfoMessage} and the next release version is ${version}.`);
|
|
58
|
+
}
|
|
59
|
+
else
|
|
60
|
+
logger.logWarn(`No last release found for ${name || "root"} package.`);
|
|
61
|
+
}
|
|
62
|
+
if (config.isMonorepo && rootPackageNextRelease)
|
|
63
|
+
nextRelease.push(rootPackageNextRelease);
|
|
64
|
+
context.nextRelease = nextRelease;
|
|
65
|
+
}
|
|
66
|
+
else
|
|
67
|
+
logger.logInfo("There are no relevant changes; therefore, no new version is released.");
|
|
68
|
+
if (config.debug) {
|
|
69
|
+
logger.setDebugScope("cli:release:set-next-release");
|
|
70
|
+
logger.logDebug(inspect(context.nextRelease, { depth: Number.POSITIVE_INFINITY }));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
logger.logError(checkErrorType(error));
|
|
75
|
+
addErrorToContext(error, context);
|
|
76
|
+
process.exitCode = 1;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=set-next-release.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-next-release.js","sourceRoot":"","sources":["../src/set-next-release.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,mBAAyC,EACzC,OAAgB,EACV,EAAE;IACR,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAChD,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3B,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM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,KAAK,CAAC,CAAC,CAAC;QACvC,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAClC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PackageManager } from "@release-change/get-packages";
|
|
2
|
+
import type { Context, PackageNextRelease } from "@release-change/shared";
|
|
3
|
+
/**
|
|
4
|
+
* Updates the lock file.
|
|
5
|
+
* @param packageNextRelease - The next release data to use.
|
|
6
|
+
* @param context - The context where the CLI is running.
|
|
7
|
+
* @param packageManager - The package manager used by the project.
|
|
8
|
+
*/
|
|
9
|
+
export declare const updateLockFile: (packageNextRelease: PackageNextRelease, context: Context, packageManager: PackageManager) => Promise<void>;
|
|
10
|
+
//# sourceMappingURL=update-lock-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-lock-file.d.ts","sourceRoot":"","sources":["../src/update-lock-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAS1E;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GACzB,oBAAoB,kBAAkB,EACtC,SAAS,OAAO,EAChB,gBAAgB,cAAc,KAC7B,OAAO,CAAC,IAAI,CAuCd,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { inspect } from "node:util";
|
|
4
|
+
import { setLogger } from "@release-change/logger";
|
|
5
|
+
import { formatDetailedError, runCommand, runCommandSync } from "@release-change/shared";
|
|
6
|
+
/**
|
|
7
|
+
* Updates the lock file.
|
|
8
|
+
* @param packageNextRelease - The next release data to use.
|
|
9
|
+
* @param context - The context where the CLI is running.
|
|
10
|
+
* @param packageManager - The package manager used by the project.
|
|
11
|
+
*/
|
|
12
|
+
export const updateLockFile = async (packageNextRelease, context, packageManager) => {
|
|
13
|
+
const { cwd, config } = context;
|
|
14
|
+
const { debug } = config;
|
|
15
|
+
const { pathname } = packageNextRelease;
|
|
16
|
+
const logger = setLogger(debug);
|
|
17
|
+
const args = [];
|
|
18
|
+
if (debug)
|
|
19
|
+
logger.setDebugScope("release:update-lock-file");
|
|
20
|
+
if (packageManager === "pnpm") {
|
|
21
|
+
if (fs.existsSync(path.join(cwd, pathname, "pnpm-lock.yaml"))) {
|
|
22
|
+
args.push("install", "--lockfile-only");
|
|
23
|
+
const pnpmCommandResult = await runCommand("pnpm", args);
|
|
24
|
+
if (debug) {
|
|
25
|
+
logger.logDebug(`Command run: pnpm ${args.join(" ")}`);
|
|
26
|
+
logger.logDebug(inspect(pnpmCommandResult, { depth: Number.POSITIVE_INFINITY }));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else if (packageManager === "npm") {
|
|
31
|
+
if (fs.existsSync(path.join(cwd, pathname, "package-lock.json"))) {
|
|
32
|
+
args.push("install", "--package-lock-only");
|
|
33
|
+
const npmCommandResult = await runCommand("npm", args);
|
|
34
|
+
if (debug) {
|
|
35
|
+
logger.logDebug(`Command run: npm ${args.join(" ")}`);
|
|
36
|
+
logger.logDebug(inspect(npmCommandResult, { depth: Number.POSITIVE_INFINITY }));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
const { pathname } = packageNextRelease;
|
|
42
|
+
args.push("restore", path.join(cwd, pathname, "package.json"));
|
|
43
|
+
runCommandSync("git", args);
|
|
44
|
+
if (debug)
|
|
45
|
+
logger.logDebug(`Command run: git ${args.join(" ")}`);
|
|
46
|
+
process.exitCode = 1;
|
|
47
|
+
throw formatDetailedError({
|
|
48
|
+
title: "Failed to update the lock file",
|
|
49
|
+
message: "The package manager is not found or is not one of those supported (npm or pnpm).",
|
|
50
|
+
details: {
|
|
51
|
+
output: `packageManager: ${packageManager}`
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=update-lock-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-lock-file.js","sourceRoot":"","sources":["../src/update-lock-file.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEzF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,kBAAsC,EACtC,OAAgB,EAChB,cAA8B,EACf,EAAE;IACjB,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAChC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IACzB,MAAM,EAAE,QAAQ,EAAE,GAAG,kBAAkB,CAAC;IACxC,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,IAAI,KAAK;QAAE,MAAM,CAAC,aAAa,CAAC,0BAA0B,CAAC,CAAC;IAC5D,IAAI,cAAc,KAAK,MAAM,EAAE,CAAC;QAC9B,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC;YAC9D,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;YACxC,MAAM,iBAAiB,GAAG,MAAM,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YACzD,IAAI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rB,MAAM,mBAAmB,CAAC;YACxB,KAAK,EAAE,gCAAgC;YACvC,OAAO,EAAE,kFAAkF;YAC3F,OAAO,EAAE;gBACP,MAAM,EAAE,mBAAmB,cAAc,EAAE;aAC5C;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Context, PackageNextRelease } from "@release-change/shared";
|
|
2
|
+
/**
|
|
3
|
+
* Updates the package manifest file with the new version of the updated internal dependencies.
|
|
4
|
+
* @param packageNextRelease - The next release data to use.
|
|
5
|
+
* @param packageDependencies - The package internal dependencies to update.
|
|
6
|
+
* @param context - The context where the CLI is running.
|
|
7
|
+
*/
|
|
8
|
+
export declare const updatePackageDependenciesVersions: (packageNextRelease: PackageNextRelease, packageDependencies: PackageNextRelease[], context: Context) => void;
|
|
9
|
+
//# sourceMappingURL=update-package-dependencies-versions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-package-dependencies-versions.d.ts","sourceRoot":"","sources":["../src/update-package-dependencies-versions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAQ1E;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,GAC5C,oBAAoB,kBAAkB,EACtC,qBAAqB,kBAAkB,EAAE,EACzC,SAAS,OAAO,KACf,IAmEF,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { setLogger } from "@release-change/logger";
|
|
4
|
+
import { formatDetailedError } from "@release-change/shared";
|
|
5
|
+
/**
|
|
6
|
+
* Updates the package manifest file with the new version of the updated internal dependencies.
|
|
7
|
+
* @param packageNextRelease - The next release data to use.
|
|
8
|
+
* @param packageDependencies - The package internal dependencies to update.
|
|
9
|
+
* @param context - The context where the CLI is running.
|
|
10
|
+
*/
|
|
11
|
+
export const updatePackageDependenciesVersions = (packageNextRelease, packageDependencies, context) => {
|
|
12
|
+
const { name, pathname } = packageNextRelease;
|
|
13
|
+
const { cwd, config: { debug, dependencyUpdateMethod } } = context;
|
|
14
|
+
const logger = setLogger(debug);
|
|
15
|
+
logger.setScope("release");
|
|
16
|
+
const packageName = `${name || "root"} package`;
|
|
17
|
+
const packagePath = path.join(cwd, pathname, "package.json");
|
|
18
|
+
if (dependencyUpdateMethod) {
|
|
19
|
+
if (fs.existsSync(packagePath)) {
|
|
20
|
+
if (debug)
|
|
21
|
+
logger.setDebugScope("release:update-package-dependencies-versions");
|
|
22
|
+
const packageManifest = JSON.parse(fs.readFileSync(packagePath, "utf-8"));
|
|
23
|
+
const { dependencies, devDependencies } = packageManifest;
|
|
24
|
+
for (const packageDependency of packageDependencies) {
|
|
25
|
+
const { name, version } = packageDependency;
|
|
26
|
+
const dependencyType = dependencies && name in dependencies
|
|
27
|
+
? "dependencies"
|
|
28
|
+
: devDependencies && name in devDependencies
|
|
29
|
+
? "devDependencies"
|
|
30
|
+
: undefined;
|
|
31
|
+
if (dependencyType && packageManifest[dependencyType]) {
|
|
32
|
+
if (dependencyUpdateMethod === "workspace") {
|
|
33
|
+
packageManifest[dependencyType][name] = "workspace:*";
|
|
34
|
+
logger.logInfo(`Package version updated to workspace:* for package dependency ${name} in ${packageName}.`);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const range = dependencyUpdateMethod === "caret-range"
|
|
38
|
+
? "^"
|
|
39
|
+
: dependencyUpdateMethod === "tilde-range"
|
|
40
|
+
? "~"
|
|
41
|
+
: "";
|
|
42
|
+
packageManifest[dependencyType][name] = range + version;
|
|
43
|
+
logger.logInfo(`Package version updated to ${version} for package dependency ${name} in ${packageName}.`);
|
|
44
|
+
}
|
|
45
|
+
if (debug) {
|
|
46
|
+
logger.logDebug(`Package version for package dependency ${name} in ${packageName}: ${packageManifest[dependencyType][name]}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
fs.writeFileSync(packagePath, `${JSON.stringify(packageManifest, null, 2)}\n`);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
throw formatDetailedError({
|
|
54
|
+
title: "Failed to update the package dependencies versions",
|
|
55
|
+
message: `Package ${packagePath} not found for ${packageName}.`,
|
|
56
|
+
details: {
|
|
57
|
+
output: `fs.existsSync(${packagePath}): false`
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
throw formatDetailedError({
|
|
64
|
+
title: "Failed to update the package dependencies versions",
|
|
65
|
+
message: "The dependency update method is not found.",
|
|
66
|
+
details: {
|
|
67
|
+
output: `dependencyUpdateMethod: ${dependencyUpdateMethod}`
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=update-package-dependencies-versions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-package-dependencies-versions.js","sourceRoot":"","sources":["../src/update-package-dependencies-versions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAC/C,kBAAsC,EACtC,mBAAyC,EACzC,OAAgB,EACV,EAAE;IACR,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,kBAAkB,CAAC;IAC9C,MAAM,EACJ,GAAG,EACH,MAAM,EAAE,EAAE,KAAK,EAAE,sBAAsB,EAAE,EAC1C,GAAG,OAAO,CAAC;IACZ,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,CAAC,QAA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GAAG;gCACL,CAAC,CAAC,EAAE,CAAC;wBACX,eAAe,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,KAAK,GAAG,OAAO,CAAC;wBACxD,MAAM,CAAC,OAAO,CACZ,8BAA8B,OAAO,2BAA2B,IAAI,OAAO,WAAW,GAAG,CAC1F,CAAC;oBACJ,CAAC;oBACD,IAAI,KAAK,EAAE,CAAC;wBACV,MAAM,CAAC,QAAQ,CACb,0CAA0C,IAAI,OAAO,WAAW,KAAK,eAAe,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,EAAE,CAC7G,CAAC;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC;YACD,EAAE,CAAC,aAAa,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QACjF,CAAC;aAAM,CAAC;YACN,MAAM,mBAAmB,CAAC;gBACxB,KAAK,EAAE,oDAAoD;gBAC3D,OAAO,EAAE,WAAW,WAAW,kBAAkB,WAAW,GAAG;gBAC/D,OAAO,EAAE;oBACP,MAAM,EAAE,iBAAiB,WAAW,UAAU;iBAC/C;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;SAAM,CAAC;QACN,MAAM,mBAAmB,CAAC;YACxB,KAAK,EAAE,oDAAoD;YAC3D,OAAO,EAAE,4CAA4C;YACrD,OAAO,EAAE;gBACP,MAAM,EAAE,2BAA2B,sBAAsB,EAAE;aAC5D;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Context, PackageNextRelease } from "@release-change/shared";
|
|
2
|
+
/**
|
|
3
|
+
* Updates the package manifest file with the new version.
|
|
4
|
+
* @param packageNextRelease - The next release data to use.
|
|
5
|
+
* @param context - The context where the CLI is running.
|
|
6
|
+
*/
|
|
7
|
+
export declare const updatePackageVersion: (packageNextRelease: PackageNextRelease, context: Context) => void;
|
|
8
|
+
//# sourceMappingURL=update-package-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-package-version.d.ts","sourceRoot":"","sources":["../src/update-package-version.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAQ1E;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC/B,oBAAoB,kBAAkB,EACtC,SAAS,OAAO,KACf,IA8BF,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { setLogger } from "@release-change/logger";
|
|
4
|
+
import { formatDetailedError } from "@release-change/shared";
|
|
5
|
+
/**
|
|
6
|
+
* Updates the package manifest file with the new version.
|
|
7
|
+
* @param packageNextRelease - The next release data to use.
|
|
8
|
+
* @param context - The context where the CLI is running.
|
|
9
|
+
*/
|
|
10
|
+
export const updatePackageVersion = (packageNextRelease, context) => {
|
|
11
|
+
const { name, pathname, version } = packageNextRelease;
|
|
12
|
+
const { cwd, config: { debug } } = context;
|
|
13
|
+
const logger = setLogger(debug);
|
|
14
|
+
logger.setScope("release");
|
|
15
|
+
const packageName = `${name || "root"} package`;
|
|
16
|
+
const packageManifestPath = path.join(cwd, pathname, "package.json");
|
|
17
|
+
if (fs.existsSync(packageManifestPath)) {
|
|
18
|
+
const packageManifest = JSON.parse(fs.readFileSync(packageManifestPath, "utf-8"));
|
|
19
|
+
packageManifest.version = version;
|
|
20
|
+
fs.writeFileSync(packageManifestPath, `${JSON.stringify(packageManifest, null, 2)}\n`);
|
|
21
|
+
logger.logInfo(`Package version updated to ${version} for ${packageName}.`);
|
|
22
|
+
if (debug) {
|
|
23
|
+
logger.setDebugScope("release:update-package-version");
|
|
24
|
+
logger.logDebug(`Package version for ${packageName}: ${packageManifest.version}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
throw formatDetailedError({
|
|
29
|
+
title: "Failed to update the package version",
|
|
30
|
+
message: `Package ${packageManifestPath} not found for ${packageName}.`,
|
|
31
|
+
details: {
|
|
32
|
+
output: `fs.existsSync(${packageManifestPath}): false`
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=update-package-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-package-version.js","sourceRoot":"","sources":["../src/update-package-version.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,kBAAsC,EACtC,OAAgB,EACV,EAAE;IACR,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,kBAAkB,CAAC;IACvD,MAAM,EACJ,GAAG,EACH,MAAM,EAAE,EAAE,KAAK,EAAE,EAClB,GAAG,OAAO,CAAC;IACZ,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3B,MAAM,WAAW,GAAG,GAAG,IAAI,IAAI,MAAM,UAAU,CAAC;IAChD,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;IACrE,IAAI,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAAE,CAAC;QACvC,MAAM,eAAe,GAAoB,IAAI,CAAC,KAAK,CACjD,EAAE,CAAC,YAAY,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAC9C,CAAC;QACF,eAAe,CAAC,OAAO,GAAG,OAAO,CAAC;QAClC,EAAE,CAAC,aAAa,CAAC,mBAAmB,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QACvF,MAAM,CAAC,OAAO,CAAC,8BAA8B,OAAO,QAAQ,WAAW,GAAG,CAAC,CAAC;QAC5E,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,CAAC,aAAa,CAAC,gCAAgC,CAAC,CAAC;YACvD,MAAM,CAAC,QAAQ,CAAC,uBAAuB,WAAW,KAAK,eAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACpF,CAAC;IACH,CAAC;SAAM,CAAC;QACN,MAAM,mBAAmB,CAAC;YACxB,KAAK,EAAE,sCAAsC;YAC7C,OAAO,EAAE,WAAW,mBAAmB,kBAAkB,WAAW,GAAG;YACvE,OAAO,EAAE;gBACP,MAAM,EAAE,iBAAiB,mBAAmB,UAAU;aACvD;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@release-change/release",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Functions used internally in release-change to release packages",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"homepage": "https://github.com/release-change/release-change",
|
|
7
|
+
"bugs": {
|
|
8
|
+
"url": "https://github.com/release-change/release-change/issues"
|
|
9
|
+
},
|
|
10
|
+
"author": "Victor Brito (https://victor-brito.dev)",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/release-change/release-change.git"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"exports": {
|
|
21
|
+
"import": "./dist/index.js",
|
|
22
|
+
"types": "./dist/index.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": "^20.18.3 || ^22.12.0 || ^24.0.0",
|
|
26
|
+
"npm": ">=10.8.2",
|
|
27
|
+
"pnpm": ">=10.28.0"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@release-change/config": "0.1.0",
|
|
31
|
+
"@release-change/get-packages": "0.1.0",
|
|
32
|
+
"@release-change/git": "0.1.0",
|
|
33
|
+
"@release-change/github": "0.1.0",
|
|
34
|
+
"@release-change/commit-analyser": "0.1.0",
|
|
35
|
+
"@release-change/logger": "0.1.0",
|
|
36
|
+
"@release-change/npm": "0.1.0",
|
|
37
|
+
"@release-change/release-notes-generator": "0.1.0",
|
|
38
|
+
"@release-change/shared": "0.1.0",
|
|
39
|
+
"@release-change/semver": "0.1.0"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsc",
|
|
43
|
+
"dev": "tsc --watch --preserveWatchOutput & vitest"
|
|
44
|
+
}
|
|
45
|
+
}
|