@release-change/cli 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 +278 -0
- package/bin/index.js +5 -0
- package/configuration-schema.json +68 -0
- package/dist/check-requirements.d.ts +5 -0
- package/dist/check-requirements.d.ts.map +1 -0
- package/dist/check-requirements.js +32 -0
- package/dist/check-requirements.js.map +1 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +32 -0
- package/dist/cli.js.map +1 -0
- package/dist/cli.types.d.ts +8 -0
- package/dist/cli.types.d.ts.map +1 -0
- package/dist/cli.types.js +30 -0
- package/dist/cli.types.js.map +1 -0
- package/dist/constants.d.ts +53 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +54 -0
- package/dist/constants.js.map +1 -0
- package/dist/display-cli-options.d.ts +6 -0
- package/dist/display-cli-options.d.ts.map +1 -0
- package/dist/display-cli-options.js +24 -0
- package/dist/display-cli-options.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/is-git-version-compatible.d.ts +7 -0
- package/dist/is-git-version-compatible.d.ts.map +1 -0
- package/dist/is-git-version-compatible.js +11 -0
- package/dist/is-git-version-compatible.js.map +1 -0
- package/dist/is-node-version-compatible.d.ts +8 -0
- package/dist/is-node-version-compatible.d.ts.map +1 -0
- package/dist/is-node-version-compatible.js +11 -0
- package/dist/is-node-version-compatible.js.map +1 -0
- package/dist/parse-cli-options.d.ts +9 -0
- package/dist/parse-cli-options.d.ts.map +1 -0
- package/dist/parse-cli-options.js +54 -0
- package/dist/parse-cli-options.js.map +1 -0
- package/dist/run.d.ts +8 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +84 -0
- package/dist/run.js.map +1 -0
- package/dist/show-help.d.ts +5 -0
- package/dist/show-help.d.ts.map +1 -0
- package/dist/show-help.js +16 -0
- package/dist/show-help.js.map +1 -0
- package/dist/show-version.d.ts +5 -0
- package/dist/show-version.d.ts.map +1 -0
- package/dist/show-version.js +10 -0
- package/dist/show-version.js.map +1 -0
- package/package.json +69 -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,278 @@
|
|
|
1
|
+
# @release-change/cli
|
|
2
|
+
|
|
3
|
+
Fully automated version management, changelog management and package publishing with a focus on monorepos, pre-releases and major version zero
|
|
4
|
+
|
|
5
|
+

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

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
**release-change** automates the release workflow, determining the next version number, generating release notes and publishing the package.
|
|
14
|
+
|
|
15
|
+
## How does it work?
|
|
16
|
+
|
|
17
|
+
release-change uses the commit messages to determine the type of change in the codebase. It automatically determines the next [semantic version](https://semver.org).
|
|
18
|
+
|
|
19
|
+
It uses the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification. The following table shows which release type is got from which commit message when `release-change` runs:
|
|
20
|
+
|
|
21
|
+
| Commit message | Release type |
|
|
22
|
+
|-------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------|
|
|
23
|
+
| `fix: prevent racing of requests` | Patch (fix release) |
|
|
24
|
+
| `feat(lang): add Polish language` | Minor (feature release) |
|
|
25
|
+
| `chore!: drop support for Node 6` | Major (breaking release) |
|
|
26
|
+
| `chore: drop support for Node 6`<br><br>`BREAKING CHANGE: use JavaScript features not available in Node 6.` | Major (breaking release, note that the `BREAKING CHANGE: ` token must be in the footer of the commit) |
|
|
27
|
+
|
|
28
|
+
It is meant to be integrated in a CI environment. For each new commit added to one of the release branches (for example: `main`), with `git push`, a pull request merging or a merging from another branch, a CI build is triggered and runs the `release-change` command to make a release if there are codebase changes since the last release which affect the package functionalities.
|
|
29
|
+
|
|
30
|
+
## Requirements
|
|
31
|
+
|
|
32
|
+
To use release-change, you need:
|
|
33
|
+
- to host your code in a GitHub repository,
|
|
34
|
+
- to use GitHub Actions,
|
|
35
|
+
- Git 2.48.1+,
|
|
36
|
+
- a [Node.js](https://nodejs.org) which meets the [version requirements](../../SECURITY.md#supported-nodejs-versions),
|
|
37
|
+
- a package manager which meets the [version requirements](../../SECURITY.md#supported-package-manager-versions).
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
Install package for Node.js:
|
|
42
|
+
```
|
|
43
|
+
pnpm add --save-dev @release-change/cli
|
|
44
|
+
```
|
|
45
|
+
You can also install it using `npm`:
|
|
46
|
+
```
|
|
47
|
+
npm install --save-dev @release-change/cli
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
Use the following command to run release-change in the CI environment:
|
|
53
|
+
```
|
|
54
|
+
pnpx release-change
|
|
55
|
+
```
|
|
56
|
+
If you are using `npm`:
|
|
57
|
+
```
|
|
58
|
+
npx release-change
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Documentation
|
|
62
|
+
|
|
63
|
+
### CI configuration
|
|
64
|
+
|
|
65
|
+
release-change requires access to the project repository. The Git authentication is set with the `RELEASE_TOKEN` environment variable, which is a [GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens).
|
|
66
|
+
|
|
67
|
+
Here are examples of the workflow configuration (the file must be saved in the `.github/workflows/` directory):
|
|
68
|
+
- using `pnpm`:
|
|
69
|
+
```yaml
|
|
70
|
+
name: Release
|
|
71
|
+
|
|
72
|
+
on:
|
|
73
|
+
push:
|
|
74
|
+
branches:
|
|
75
|
+
- main
|
|
76
|
+
|
|
77
|
+
permissions:
|
|
78
|
+
contents: read # for checkout
|
|
79
|
+
|
|
80
|
+
jobs:
|
|
81
|
+
release:
|
|
82
|
+
name: Release
|
|
83
|
+
runs-on: ubuntu-latest
|
|
84
|
+
permissions:
|
|
85
|
+
contents: write # to be able to publish a GitHub release
|
|
86
|
+
issues: write # to be able to comment on issues
|
|
87
|
+
pull-requests: write # to be able to comment on pull requests
|
|
88
|
+
id-token: write # to enable use of OpenID Connect to publish to NPM with provenance
|
|
89
|
+
steps:
|
|
90
|
+
- name: Checkout
|
|
91
|
+
uses: actions/checkout@v5
|
|
92
|
+
with:
|
|
93
|
+
fetch-depth: 0 # to clone the whole Git history
|
|
94
|
+
- name: Install pnpm
|
|
95
|
+
uses: pnpm/action-setup@v4
|
|
96
|
+
with:
|
|
97
|
+
version: 10
|
|
98
|
+
- name: Setup Node.js
|
|
99
|
+
uses: actions/setup-node@v5
|
|
100
|
+
with:
|
|
101
|
+
node-version: "lts/*"
|
|
102
|
+
cache: "pnpm"
|
|
103
|
+
- name: Install dependencies
|
|
104
|
+
run: pnpm install
|
|
105
|
+
- name: Release
|
|
106
|
+
env:
|
|
107
|
+
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
108
|
+
ISSUE_PR_TOKEN: ${{ secrets.GITHUB_TOKEN }} # to be able to comment on issues and pull requests, close issues and tag pull requests using the GitHub Actions bot
|
|
109
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
110
|
+
NPM_CONFIG_PROVENANCE: true # to be able to publish to NPM with provenance
|
|
111
|
+
run: pnpx release-change
|
|
112
|
+
```
|
|
113
|
+
- using `npm`:
|
|
114
|
+
```yaml
|
|
115
|
+
name: Release
|
|
116
|
+
|
|
117
|
+
on:
|
|
118
|
+
push:
|
|
119
|
+
branches:
|
|
120
|
+
- main
|
|
121
|
+
|
|
122
|
+
permissions:
|
|
123
|
+
contents: read # for checkout
|
|
124
|
+
|
|
125
|
+
jobs:
|
|
126
|
+
release:
|
|
127
|
+
name: Release
|
|
128
|
+
runs-on: ubuntu-latest
|
|
129
|
+
permissions:
|
|
130
|
+
contents: write # to be able to publish a GitHub release
|
|
131
|
+
issues: write # to be able to comment on issues
|
|
132
|
+
pull-requests: write # to be able to comment on pull requests
|
|
133
|
+
id-token: write # to enable use of OpenID Connect to publish to NPM with provenance
|
|
134
|
+
steps:
|
|
135
|
+
- name: Checkout
|
|
136
|
+
uses: actions/checkout@v5
|
|
137
|
+
with:
|
|
138
|
+
fetch-depth: 0 # to clone the whole Git history
|
|
139
|
+
- name: Setup Node.js
|
|
140
|
+
uses: actions/setup-node@v5
|
|
141
|
+
with:
|
|
142
|
+
node-version: "lts/*"
|
|
143
|
+
cache: "npm"
|
|
144
|
+
- name: Install dependencies
|
|
145
|
+
run: npm clean-install
|
|
146
|
+
- name: Release
|
|
147
|
+
env:
|
|
148
|
+
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
149
|
+
ISSUE_PR_TOKEN: ${{ secrets.GITHUB_TOKEN }} # to be able to comment on issues and pull requests, close issues and tag pull requests using the GitHub Actions bot
|
|
150
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
151
|
+
NPM_CONFIG_PROVENANCE: true # to be able to publish to NPM with provenance
|
|
152
|
+
run: npx release-change
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Configuration
|
|
156
|
+
|
|
157
|
+
#### Configuration file
|
|
158
|
+
|
|
159
|
+
release-change’s options can be set via a `release-change.config.json` file, written in JSON and placed at the root of the project.
|
|
160
|
+
|
|
161
|
+
Alternatively, some options can be set via CLI arguments.
|
|
162
|
+
|
|
163
|
+
The following examples are the same:
|
|
164
|
+
- via `release-change.config.json` file:
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"branches": ["main", "next"]
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
- via CLI arguments:
|
|
171
|
+
```
|
|
172
|
+
release-change --branches main next
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
#### Options
|
|
176
|
+
|
|
177
|
+
##### branches
|
|
178
|
+
|
|
179
|
+
Type: `array`
|
|
180
|
+
Default: `["alpha", "beta", "main", "master", "next"]`
|
|
181
|
+
CLI arguments: `-b`, `--branches`
|
|
182
|
+
|
|
183
|
+
The branches on which releases should happen.
|
|
184
|
+
|
|
185
|
+
##### repositoryUrl
|
|
186
|
+
|
|
187
|
+
Type: `string`
|
|
188
|
+
Default: `repository` property in `package.json` file
|
|
189
|
+
CLI arguments: `-r`, `--repository-url`
|
|
190
|
+
|
|
191
|
+
The Git repository URL.
|
|
192
|
+
|
|
193
|
+
##### remoteName
|
|
194
|
+
|
|
195
|
+
Type: `string`
|
|
196
|
+
Default: `"origin"`
|
|
197
|
+
CLI arguments: `--remote-name`
|
|
198
|
+
|
|
199
|
+
The remote repository name.
|
|
200
|
+
|
|
201
|
+
##### debug
|
|
202
|
+
|
|
203
|
+
Type: `boolean`
|
|
204
|
+
Default: `false`
|
|
205
|
+
CLI arguments: `--debug`
|
|
206
|
+
|
|
207
|
+
Output debugging information.
|
|
208
|
+
|
|
209
|
+
##### dryRun
|
|
210
|
+
|
|
211
|
+
Type: `boolean`
|
|
212
|
+
Default: `false`
|
|
213
|
+
CLI arguments: `-d`, `--dry-run`
|
|
214
|
+
|
|
215
|
+
The goal of the dry-run mode is to get a preview of the pending release. The dry-run mode skips the release and the publication steps but checks the repository push permissions.
|
|
216
|
+
|
|
217
|
+
##### releaseType
|
|
218
|
+
|
|
219
|
+
Type: `object`
|
|
220
|
+
Default:
|
|
221
|
+
```
|
|
222
|
+
{
|
|
223
|
+
alpha: {
|
|
224
|
+
channel: "alpha",
|
|
225
|
+
prerelease: true,
|
|
226
|
+
prereleaseIdentifier: "alpha"
|
|
227
|
+
},
|
|
228
|
+
beta: {
|
|
229
|
+
channel: "beta",
|
|
230
|
+
prerelease: true,
|
|
231
|
+
prereleaseIdentifier: "beta"
|
|
232
|
+
},
|
|
233
|
+
main: {
|
|
234
|
+
channel: "default"
|
|
235
|
+
},
|
|
236
|
+
master: {
|
|
237
|
+
channel: "default"
|
|
238
|
+
},
|
|
239
|
+
next: {
|
|
240
|
+
channel: "next",
|
|
241
|
+
prerelease: true,
|
|
242
|
+
prereleaseIdentifier: "rc"
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Sets an object whose properties are the names of the branches on which the releases should happen. Each branch property is an object with the following properties (all of them are optional):
|
|
248
|
+
- `channel`: the distribution tag associated with the releases when publishing to NPM, which will use the default distribution tag (`"latest"`) if the value is `"default"`, the value provided otherwise;
|
|
249
|
+
- `prerelease`: `true` if the release should be treated like a pre-release (e.g.: for unstable versions), `false` otherwise;
|
|
250
|
+
- `prereleaseIdentifier`: the identifier to use when tagging a pre-release version (for example, `"beta"` if the pre-release should be tagged as something like `2.0.0-beta.1`).
|
|
251
|
+
|
|
252
|
+
##### dependencyUpdateMethod
|
|
253
|
+
|
|
254
|
+
Type: `string` or `null`
|
|
255
|
+
Default: `"pin"` if it is a monorepo, `null` otherwise
|
|
256
|
+
|
|
257
|
+
This optional option sets a string telling how dependencies in each `package.json` file of the monorepo should be updated as far as the monorepo packages are concerned. Its value can be one of the following:
|
|
258
|
+
- `"pin"`: the dependencies will be updated using their exact new version (e.g.: `"@my-monorepo/my-package": "1.2.3"`);
|
|
259
|
+
- `"caret-range"`: the dependencies will be updated using their new version within a caret range (e.g.: `"@my-monorepo/my-package": "^1.2.3"`);
|
|
260
|
+
- `"tilde-range"`: the dependencies will be updated using their new version within a tilde range (e.g.: `"@my-monorepo/my-package": "~1.2.3"`);
|
|
261
|
+
- `"workspace"`: the dependencies will be updated using the `workspace` keyword (e.g.: `"@my-monorepo/my-package": "workspace:*"`).
|
|
262
|
+
|
|
263
|
+
If the repository is not a monorepo, the option is ignored.
|
|
264
|
+
|
|
265
|
+
##### npmPublish
|
|
266
|
+
|
|
267
|
+
Type: `false`
|
|
268
|
+
Default: see below
|
|
269
|
+
|
|
270
|
+
This optional option, when set, can only be `false`. When this option is set, no packages are published to the NPM registry at all; however, the next release is still released and the `package.json` files are still updated. When the option is not set, the publication of each package depends on whether the `private` property in the `package.json` files is set to `true` or not.
|
|
271
|
+
|
|
272
|
+
## Get help
|
|
273
|
+
|
|
274
|
+
- [Stack Overflow](https://stackoverflow.com/questions/tagged/release-change)
|
|
275
|
+
|
|
276
|
+
## Copyright & licence
|
|
277
|
+
|
|
278
|
+
© 2025-present Victor Brito — Released under the [MIT licence](./LICENSE).
|
package/bin/index.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Configuration",
|
|
4
|
+
"description": "The configuration which is contained inside the `release-change.config.json` file",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"$schema": "string",
|
|
8
|
+
"branches": {
|
|
9
|
+
"description": "The branches on which releases should happen",
|
|
10
|
+
"type": "array",
|
|
11
|
+
"items": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
"minItems": 1
|
|
15
|
+
},
|
|
16
|
+
"repositoryUrl": {
|
|
17
|
+
"description": "The Git repository URL",
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"remoteName": {
|
|
21
|
+
"description": "The remote repository name",
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"debug": {
|
|
25
|
+
"description": "Output debugging information",
|
|
26
|
+
"type": "boolean"
|
|
27
|
+
},
|
|
28
|
+
"dryRun": {
|
|
29
|
+
"description": "Whether to activate the dry-run mode or not",
|
|
30
|
+
"type": "boolean"
|
|
31
|
+
},
|
|
32
|
+
"releaseType": {
|
|
33
|
+
"description": "The release type configuration on the branches on which the releases should happen",
|
|
34
|
+
"type": "object",
|
|
35
|
+
"patternProperties": {
|
|
36
|
+
"description": "The name of the branch used as a property key",
|
|
37
|
+
"\\S+": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"properties": {
|
|
40
|
+
"channel": {
|
|
41
|
+
"description": "The distribution tag associated with the releases when publishing to NPM",
|
|
42
|
+
"type": "string"
|
|
43
|
+
},
|
|
44
|
+
"prerelease": {
|
|
45
|
+
"description": "Whether the release should be treated like a pre-release or not",
|
|
46
|
+
"type": "boolean"
|
|
47
|
+
},
|
|
48
|
+
"prereleaseIdentifier": {
|
|
49
|
+
"description": "The identifier to use when tagging a pre-release version",
|
|
50
|
+
"type": "string"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"additionalProperties": false
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"additionalProperties": false
|
|
57
|
+
},
|
|
58
|
+
"dependencyUpdateMethod": {
|
|
59
|
+
"description": "The method to use to update internal dependencies in a monorepo",
|
|
60
|
+
"enum": ["pin", "caret-range", "tilde-range", "workspace", null]
|
|
61
|
+
},
|
|
62
|
+
"npmPublish": {
|
|
63
|
+
"description": "To prevent package publishing to NPM",
|
|
64
|
+
"const": false
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"additionalProperties": false
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-requirements.d.ts","sourceRoot":"","sources":["../src/check-requirements.ts"],"names":[],"mappings":"AAYA;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAAa,OAAO,CAAC,IAAI,CAuBtD,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
import { setLogger } from "@release-change/logger";
|
|
3
|
+
import { coerce } from "@release-change/semver";
|
|
4
|
+
import { runCommandSync } from "@release-change/shared";
|
|
5
|
+
import { cli } from "./cli.js";
|
|
6
|
+
import { isGitVersionCompatible } from "./is-git-version-compatible.js";
|
|
7
|
+
import { isNodeVersionCompatible } from "./is-node-version-compatible.js";
|
|
8
|
+
import { GIT_MIN_VERSION, REQUIRED_NODE_VERSIONS } from "./constants.js";
|
|
9
|
+
/**
|
|
10
|
+
* Checks whether Node and Git versions match the versions required.
|
|
11
|
+
*/
|
|
12
|
+
export const checkRequirements = async () => {
|
|
13
|
+
const logger = setLogger();
|
|
14
|
+
logger.setScope("cli");
|
|
15
|
+
const { version } = process;
|
|
16
|
+
if (!isNodeVersionCompatible(version.replace("v", ""), REQUIRED_NODE_VERSIONS)) {
|
|
17
|
+
const formattedRequiredNodeVersions = new Intl.ListFormat("en-GB", {
|
|
18
|
+
style: "long",
|
|
19
|
+
type: "disjunction"
|
|
20
|
+
}).format(REQUIRED_NODE_VERSIONS.replaceAll(/\^([.0-9]+)/gi, "$1+").split(" || "));
|
|
21
|
+
const foundVersion = version.replace("v", "");
|
|
22
|
+
logger.logError(`Required one of the following Node versions: ${formattedRequiredNodeVersions}. Found ${foundVersion}.`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
const gitVersion = coerce(runCommandSync("git", ["--version"]).stdout);
|
|
26
|
+
if (!gitVersion || !isGitVersionCompatible(gitVersion.version)) {
|
|
27
|
+
logger.logError(`Git version ${GIT_MIN_VERSION} required. Found ${gitVersion?.version ?? null}.`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
process.exitCode = await cli();
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=check-requirements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-requirements.js","sourceRoot":"","sources":["../src/check-requirements.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE1E,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAEzE;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,IAAmB,EAAE;IACzD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACvB,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC5B,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,sBAAsB,CAAC,EAAE,CAAC;QAC/E,MAAM,6BAA6B,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE;YACjE,KAAK,EAAE,MAAM;YACb,IAAI,EAAE,aAAa;SACpB,CAAC,CAAC,MAAM,CAAC,sBAAsB,CAAC,UAAU,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QACnF,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAC9C,MAAM,CAAC,QAAQ,CACb,gDAAgD,6BAA6B,WAAW,YAAY,GAAG,CACxG,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,MAAM,UAAU,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACvE,IAAI,CAAC,UAAU,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC/D,MAAM,CAAC,QAAQ,CACb,eAAe,eAAe,oBAAoB,UAAU,EAAE,OAAO,IAAI,IAAI,GAAG,CACjF,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,CAAC,QAAQ,GAAG,MAAM,GAAG,EAAE,CAAC;AACjC,CAAC,CAAC"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,eAAO,MAAM,GAAG,QAAa,OAAO,CAAC,MAAM,CAqB1C,CAAC"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
import { parseCliOptions } from "./parse-cli-options.js";
|
|
3
|
+
import { run } from "./run.js";
|
|
4
|
+
import { showHelp } from "./show-help.js";
|
|
5
|
+
import { showVersion } from "./show-version.js";
|
|
6
|
+
/**
|
|
7
|
+
* Runs the CLI
|
|
8
|
+
* @return The exit code.
|
|
9
|
+
*/
|
|
10
|
+
export const cli = async () => {
|
|
11
|
+
const { argv, cwd, env } = process;
|
|
12
|
+
const args = argv.slice(2);
|
|
13
|
+
const parsedCliOptions = parseCliOptions(args);
|
|
14
|
+
const { help, version, ...cliOptions } = parsedCliOptions;
|
|
15
|
+
const context = {
|
|
16
|
+
cwd: cwd(),
|
|
17
|
+
env,
|
|
18
|
+
config: { debug: Boolean(cliOptions.debug) },
|
|
19
|
+
errors: []
|
|
20
|
+
};
|
|
21
|
+
if (help) {
|
|
22
|
+
showHelp();
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
if (version) {
|
|
26
|
+
showVersion();
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
await run(cliOptions, context);
|
|
30
|
+
return Number(process.exitCode ?? 0);
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAGA,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;GAGG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,IAAqB,EAAE;IAC7C,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IACnC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAS,CAAC;IACnC,MAAM,gBAAgB,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,UAAU,EAAE,GAAG,gBAAgB,CAAC;IAC1D,MAAM,OAAO,GAAgB;QAC3B,GAAG,EAAE,GAAG,EAAE;QACV,GAAG;QACH,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;QAC5C,MAAM,EAAE,EAAE;KACX,CAAC;IACF,IAAI,IAAI,EAAE,CAAC;QACT,QAAQ,EAAE,CAAC;QACX,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,OAAO,EAAE,CAAC;QACZ,WAAW,EAAE,CAAC;QACd,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC;AACvC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const letters: readonly ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
|
|
2
|
+
type Letter = (typeof letters)[number];
|
|
3
|
+
type Alias = `-${Lowercase<Letter> | Uppercase<Letter>}`;
|
|
4
|
+
type Flag = `--${string}`;
|
|
5
|
+
export type CliOptionCommand = Alias | Flag;
|
|
6
|
+
export type Args = (Alias | Flag | string)[];
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=cli.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.types.d.ts","sourceRoot":"","sources":["../src/cli.types.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,OAAO,6IA2BH,CAAC;AACX,KAAK,MAAM,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AACvC,KAAK,KAAK,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;AACzD,KAAK,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;AAC1B,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,IAAI,CAAC;AAC5C,MAAM,MAAM,IAAI,GAAG,CAAC,KAAK,GAAG,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const letters = [
|
|
2
|
+
"a",
|
|
3
|
+
"b",
|
|
4
|
+
"c",
|
|
5
|
+
"d",
|
|
6
|
+
"e",
|
|
7
|
+
"f",
|
|
8
|
+
"g",
|
|
9
|
+
"h",
|
|
10
|
+
"i",
|
|
11
|
+
"j",
|
|
12
|
+
"k",
|
|
13
|
+
"l",
|
|
14
|
+
"m",
|
|
15
|
+
"n",
|
|
16
|
+
"o",
|
|
17
|
+
"p",
|
|
18
|
+
"q",
|
|
19
|
+
"r",
|
|
20
|
+
"s",
|
|
21
|
+
"t",
|
|
22
|
+
"u",
|
|
23
|
+
"v",
|
|
24
|
+
"w",
|
|
25
|
+
"x",
|
|
26
|
+
"y",
|
|
27
|
+
"z"
|
|
28
|
+
];
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=cli.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.types.js","sourceRoot":"","sources":["../src/cli.types.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;IACd,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;CACK,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export declare const REQUIRED_NODE_VERSIONS: string;
|
|
2
|
+
export declare const GIT_MIN_VERSION = "2.48.1";
|
|
3
|
+
export declare const TAB: string;
|
|
4
|
+
export declare const AVAILABLE_CLI_OPTIONS: {
|
|
5
|
+
readonly branches: {
|
|
6
|
+
readonly cliOptionName: "branches";
|
|
7
|
+
readonly flag: "--branches";
|
|
8
|
+
readonly alias: "-b";
|
|
9
|
+
readonly description: "Git branches to release from";
|
|
10
|
+
readonly type: "array";
|
|
11
|
+
};
|
|
12
|
+
readonly repositoryUrl: {
|
|
13
|
+
readonly cliOptionName: "repositoryUrl";
|
|
14
|
+
readonly flag: "--repository-url";
|
|
15
|
+
readonly alias: "-r";
|
|
16
|
+
readonly description: "Git repository URL";
|
|
17
|
+
readonly type: "string";
|
|
18
|
+
};
|
|
19
|
+
readonly remoteName: {
|
|
20
|
+
readonly cliOptionName: "remoteName";
|
|
21
|
+
readonly flag: "--remote-name";
|
|
22
|
+
readonly description: "Remote Git repository name";
|
|
23
|
+
readonly type: "string";
|
|
24
|
+
};
|
|
25
|
+
readonly debug: {
|
|
26
|
+
readonly cliOptionName: "debug";
|
|
27
|
+
readonly flag: "--debug";
|
|
28
|
+
readonly description: "Output debugging information";
|
|
29
|
+
readonly type: "boolean";
|
|
30
|
+
};
|
|
31
|
+
readonly dryRun: {
|
|
32
|
+
readonly cliOptionName: "dryRun";
|
|
33
|
+
readonly flag: "--dry-run";
|
|
34
|
+
readonly alias: "-d";
|
|
35
|
+
readonly description: "Skip release and publishing";
|
|
36
|
+
readonly type: "boolean";
|
|
37
|
+
};
|
|
38
|
+
readonly version: {
|
|
39
|
+
readonly cliOptionName: "version";
|
|
40
|
+
readonly flag: "--version";
|
|
41
|
+
readonly alias: "-v";
|
|
42
|
+
readonly description: "Show version number";
|
|
43
|
+
readonly type: "boolean";
|
|
44
|
+
};
|
|
45
|
+
readonly help: {
|
|
46
|
+
readonly cliOptionName: "help";
|
|
47
|
+
readonly flag: "--help";
|
|
48
|
+
readonly alias: "-h";
|
|
49
|
+
readonly description: "Show help";
|
|
50
|
+
readonly type: "boolean";
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,QAAqC,CAAC;AACzE,eAAO,MAAM,eAAe,WAAW,CAAC;AACxC,eAAO,MAAM,GAAG,QAAgB,CAAC;AACjC,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDxB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ROOT_PACKAGE_MANIFEST } from "@release-change/shared";
|
|
2
|
+
export const REQUIRED_NODE_VERSIONS = ROOT_PACKAGE_MANIFEST.engines.node;
|
|
3
|
+
export const GIT_MIN_VERSION = "2.48.1";
|
|
4
|
+
export const TAB = " ".repeat(2);
|
|
5
|
+
export const AVAILABLE_CLI_OPTIONS = {
|
|
6
|
+
branches: {
|
|
7
|
+
cliOptionName: "branches",
|
|
8
|
+
flag: "--branches",
|
|
9
|
+
alias: "-b",
|
|
10
|
+
description: "Git branches to release from",
|
|
11
|
+
type: "array"
|
|
12
|
+
},
|
|
13
|
+
repositoryUrl: {
|
|
14
|
+
cliOptionName: "repositoryUrl",
|
|
15
|
+
flag: "--repository-url",
|
|
16
|
+
alias: "-r",
|
|
17
|
+
description: "Git repository URL",
|
|
18
|
+
type: "string"
|
|
19
|
+
},
|
|
20
|
+
remoteName: {
|
|
21
|
+
cliOptionName: "remoteName",
|
|
22
|
+
flag: "--remote-name",
|
|
23
|
+
description: "Remote Git repository name",
|
|
24
|
+
type: "string"
|
|
25
|
+
},
|
|
26
|
+
debug: {
|
|
27
|
+
cliOptionName: "debug",
|
|
28
|
+
flag: "--debug",
|
|
29
|
+
description: "Output debugging information",
|
|
30
|
+
type: "boolean"
|
|
31
|
+
},
|
|
32
|
+
dryRun: {
|
|
33
|
+
cliOptionName: "dryRun",
|
|
34
|
+
flag: "--dry-run",
|
|
35
|
+
alias: "-d",
|
|
36
|
+
description: "Skip release and publishing",
|
|
37
|
+
type: "boolean"
|
|
38
|
+
},
|
|
39
|
+
version: {
|
|
40
|
+
cliOptionName: "version",
|
|
41
|
+
flag: "--version",
|
|
42
|
+
alias: "-v",
|
|
43
|
+
description: "Show version number",
|
|
44
|
+
type: "boolean"
|
|
45
|
+
},
|
|
46
|
+
help: {
|
|
47
|
+
cliOptionName: "help",
|
|
48
|
+
flag: "--help",
|
|
49
|
+
alias: "-h",
|
|
50
|
+
description: "Show help",
|
|
51
|
+
type: "boolean"
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,MAAM,CAAC,MAAM,sBAAsB,GAAG,qBAAqB,CAAC,OAAO,CAAC,IAAI,CAAC;AACzE,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC;AACxC,MAAM,CAAC,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACjC,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,QAAQ,EAAE;QACR,aAAa,EAAE,UAAU;QACzB,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,IAAI;QACX,WAAW,EAAE,8BAA8B;QAC3C,IAAI,EAAE,OAAO;KACd;IACD,aAAa,EAAE;QACb,aAAa,EAAE,eAAe;QAC9B,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE,IAAI;QACX,WAAW,EAAE,oBAAoB;QACjC,IAAI,EAAE,QAAQ;KACf;IACD,UAAU,EAAE;QACV,aAAa,EAAE,YAAY;QAC3B,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,4BAA4B;QACzC,IAAI,EAAE,QAAQ;KACf;IACD,KAAK,EAAE;QACL,aAAa,EAAE,OAAO;QACtB,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,8BAA8B;QAC3C,IAAI,EAAE,SAAS;KAChB;IACD,MAAM,EAAE;QACN,aAAa,EAAE,QAAQ;QACvB,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,IAAI;QACX,WAAW,EAAE,6BAA6B;QAC1C,IAAI,EAAE,SAAS;KAChB;IACD,OAAO,EAAE;QACP,aAAa,EAAE,SAAS;QACxB,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,IAAI;QACX,WAAW,EAAE,qBAAqB;QAClC,IAAI,EAAE,SAAS;KAChB;IACD,IAAI,EAAE;QACJ,aAAa,EAAE,MAAM;QACrB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,IAAI;QACX,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,SAAS;KAChB;CACO,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Displays the CLI options when running the CLI with the `--help` or `-h` options.
|
|
3
|
+
* @return The CLI options, with their alias (if available), flag, description and type.
|
|
4
|
+
*/
|
|
5
|
+
export declare const displayCliOptions: () => string;
|
|
6
|
+
//# sourceMappingURL=display-cli-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display-cli-options.d.ts","sourceRoot":"","sources":["../src/display-cli-options.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,MAwBpC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AVAILABLE_CLI_OPTIONS, TAB } from "./constants.js";
|
|
2
|
+
/**
|
|
3
|
+
* Displays the CLI options when running the CLI with the `--help` or `-h` options.
|
|
4
|
+
* @return The CLI options, with their alias (if available), flag, description and type.
|
|
5
|
+
*/
|
|
6
|
+
export const displayCliOptions = () => {
|
|
7
|
+
const availableCliOptionsValues = Object.values(AVAILABLE_CLI_OPTIONS);
|
|
8
|
+
const aliasMaxLength = Math.max(...availableCliOptionsValues.map(cliOption => "alias" in cliOption && cliOption.alias ? cliOption.alias.length : 0));
|
|
9
|
+
const flagMaxLength = Math.max(...availableCliOptionsValues.map(option => option.flag.length));
|
|
10
|
+
const descriptionMaxLength = Math.max(...availableCliOptionsValues.map(cliOption => cliOption.description.length));
|
|
11
|
+
const typeMaxLength = Math.max(...availableCliOptionsValues.map(option => option.type.length)) + 2;
|
|
12
|
+
const header = "Options";
|
|
13
|
+
const cliOptions = [];
|
|
14
|
+
for (const cliOption of availableCliOptionsValues) {
|
|
15
|
+
const alias = "alias" in cliOption ? `${cliOption.alias}, ` : " ".repeat(aliasMaxLength + 2);
|
|
16
|
+
const cliOptionName = `${TAB}${alias}${cliOption.flag.padEnd(flagMaxLength, " ")}`;
|
|
17
|
+
const description = `${cliOption.description.padEnd(descriptionMaxLength, " ")}`;
|
|
18
|
+
const type = `[${cliOption.type}]`.padStart(typeMaxLength, " ");
|
|
19
|
+
const cliOptionElements = [cliOptionName, description, type];
|
|
20
|
+
cliOptions.push(cliOptionElements.join(TAB));
|
|
21
|
+
}
|
|
22
|
+
return `${header}\n${cliOptions.join("\n")}`;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=display-cli-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display-cli-options.js","sourceRoot":"","sources":["../src/display-cli-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAE5D;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAW,EAAE;IAC5C,MAAM,yBAAyB,GAAG,MAAM,CAAC,MA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AE,GAAG,CAAC,EAAE,CAAC;QACjF,MAAM,IAAI,GAAG,IAAI,SAAS,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;QAChE,MAAM,iBAAiB,GAAG,CAAC,aAAa,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;QAC7D,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,GAAG,MAAM,KAAK,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAC/C,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,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,iBAAiB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether the version of Git installed matches the minimal version required.
|
|
3
|
+
* @param gitVersion - The Git version installed.
|
|
4
|
+
* @return `true` if the version installed matches the minimal version required, `false` otherwise.
|
|
5
|
+
*/
|
|
6
|
+
export declare const isGitVersionCompatible: (gitVersion: string) => boolean;
|
|
7
|
+
//# sourceMappingURL=is-git-version-compatible.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-git-version-compatible.d.ts","sourceRoot":"","sources":["../src/is-git-version-compatible.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAAI,YAAY,MAAM,KAAG,OAE3D,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { gte } from "@release-change/semver";
|
|
2
|
+
import { GIT_MIN_VERSION } from "./constants.js";
|
|
3
|
+
/**
|
|
4
|
+
* Checks whether the version of Git installed matches the minimal version required.
|
|
5
|
+
* @param gitVersion - The Git version installed.
|
|
6
|
+
* @return `true` if the version installed matches the minimal version required, `false` otherwise.
|
|
7
|
+
*/
|
|
8
|
+
export const isGitVersionCompatible = (gitVersion) => {
|
|
9
|
+
return gte(gitVersion, GIT_MIN_VERSION);
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=is-git-version-compatible.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-git-version-compatible.js","sourceRoot":"","sources":["../src/is-git-version-compatible.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,UAAkB,EAAW,EAAE;IACpE,OAAO,GAAG,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;AAC1C,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether the version of Node installed matches the versions required by `engines.node` in root `package.json`.
|
|
3
|
+
* @param nodeVersion - The Node version installed.
|
|
4
|
+
* @param nodeVersionsRequired - The versions required by `engines.node` in root `package.json`.
|
|
5
|
+
* @return `true` if the version installed matches the versions required, `false` otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export declare const isNodeVersionCompatible: (nodeVersion: string, nodeVersionsRequired: string) => boolean;
|
|
8
|
+
//# sourceMappingURL=is-node-version-compatible.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-node-version-compatible.d.ts","sourceRoot":"","sources":["../src/is-node-version-compatible.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAClC,aAAa,MAAM,EACnB,sBAAsB,MAAM,KAC3B,OAEF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { satisfies } from "@release-change/semver";
|
|
2
|
+
/**
|
|
3
|
+
* Checks whether the version of Node installed matches the versions required by `engines.node` in root `package.json`.
|
|
4
|
+
* @param nodeVersion - The Node version installed.
|
|
5
|
+
* @param nodeVersionsRequired - The versions required by `engines.node` in root `package.json`.
|
|
6
|
+
* @return `true` if the version installed matches the versions required, `false` otherwise.
|
|
7
|
+
*/
|
|
8
|
+
export const isNodeVersionCompatible = (nodeVersion, nodeVersionsRequired) => {
|
|
9
|
+
return satisfies(nodeVersion, nodeVersionsRequired);
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=is-node-version-compatible.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-node-version-compatible.js","sourceRoot":"","sources":["../src/is-node-version-compatible.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,WAAmB,EACnB,oBAA4B,EACnB,EAAE;IACX,OAAO,SAAS,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;AACtD,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ParsedCliOptions } from "@release-change/shared";
|
|
2
|
+
import type { Args } from "./cli.types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Parses the CLI options run from the CLI.
|
|
5
|
+
* @param args - The arguments from the process.
|
|
6
|
+
* @return The CLI options as defined by `AVAILABLE_CLI_OPTIONS`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const parseCliOptions: (args: Args) => ParsedCliOptions;
|
|
9
|
+
//# sourceMappingURL=parse-cli-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-cli-options.d.ts","sourceRoot":"","sources":["../src/parse-cli-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,IAAI,EAAoB,MAAM,gBAAgB,CAAC;AAI7D;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,IAAI,KAAG,gBAiD5C,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { AVAILABLE_CLI_OPTIONS } from "./constants.js";
|
|
2
|
+
/**
|
|
3
|
+
* Parses the CLI options run from the CLI.
|
|
4
|
+
* @param args - The arguments from the process.
|
|
5
|
+
* @return The CLI options as defined by `AVAILABLE_CLI_OPTIONS`.
|
|
6
|
+
*/
|
|
7
|
+
export const parseCliOptions = (args) => {
|
|
8
|
+
const allowedCliOptions = Object.values(AVAILABLE_CLI_OPTIONS).reduce((acc, cliOption) => {
|
|
9
|
+
acc[cliOption.flag] =
|
|
10
|
+
cliOption;
|
|
11
|
+
if ("alias" in cliOption && cliOption.alias) {
|
|
12
|
+
acc[cliOption.alias] =
|
|
13
|
+
cliOption;
|
|
14
|
+
}
|
|
15
|
+
return acc;
|
|
16
|
+
}, {});
|
|
17
|
+
const parsedCliOptions = {};
|
|
18
|
+
let currentCliOption = null;
|
|
19
|
+
for (const arg of args) {
|
|
20
|
+
if (arg.startsWith("-")) {
|
|
21
|
+
if (!(arg in allowedCliOptions))
|
|
22
|
+
continue;
|
|
23
|
+
const allowedCliOption = allowedCliOptions[arg];
|
|
24
|
+
if (allowedCliOption) {
|
|
25
|
+
const { cliOptionName, type } = allowedCliOption;
|
|
26
|
+
currentCliOption = cliOptionName;
|
|
27
|
+
switch (type) {
|
|
28
|
+
case "array":
|
|
29
|
+
Object.assign(parsedCliOptions, { [currentCliOption]: [] });
|
|
30
|
+
break;
|
|
31
|
+
case "string":
|
|
32
|
+
Object.assign(parsedCliOptions, { [currentCliOption]: "" });
|
|
33
|
+
break;
|
|
34
|
+
default:
|
|
35
|
+
Object.assign(parsedCliOptions, { [currentCliOption]: true });
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
if (currentCliOption && currentCliOption in parsedCliOptions) {
|
|
42
|
+
const parsedCliOption = parsedCliOptions[currentCliOption];
|
|
43
|
+
if (typeof parsedCliOption !== "undefined") {
|
|
44
|
+
if (Array.isArray(parsedCliOption))
|
|
45
|
+
parsedCliOption.push(arg);
|
|
46
|
+
else if (typeof parsedCliOption === "string")
|
|
47
|
+
Object.assign(parsedCliOptions, { [currentCliOption]: arg });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return parsedCliOptions;
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=parse-cli-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-cli-options.js","sourceRoot":"","sources":["../src/parse-cli-options.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAU,EAAoB,EAAE;IAC9D,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,MAAM,CACnE,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE;QACjB,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC;YACjB,SAA+E,CAAC;QAClF,IAAI,OAAO,IAAI,SAAS,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC;YAC5C,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC;gBAClB,SAA+E,CAAC;QACpF,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAGC,CACF,CAAC;IACF,MAAM,gBAAgB,GAAqB,EAAE,CAAC;IAC9C,IAAI,gBAAgB,GAA8C,IAAI,CAAC;IACvE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,CAAC;gBACjE,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC"}
|
package/dist/run.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CliOptions, ContextBase } from "@release-change/shared";
|
|
2
|
+
/**
|
|
3
|
+
* Runs the CLI.
|
|
4
|
+
* @param cliOptions - The CLI options.
|
|
5
|
+
* @param contextBase - The already known context where the CLI is running.
|
|
6
|
+
*/
|
|
7
|
+
export declare const run: (cliOptions: CliOptions, contextBase: ContextBase) => Promise<void>;
|
|
8
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAW,WAAW,EAAE,MAAM,wBAAwB,CAAC;AA0B/E;;;;GAIG;AACH,eAAO,MAAM,GAAG,GAAU,YAAY,UAAU,EAAE,aAAa,WAAW,KAAG,OAAO,CAAC,IAAI,CAmExF,CAAC"}
|
package/dist/run.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { configureCiEnvironment, isUsableCiEnvironment } from "@release-change/ci";
|
|
2
|
+
import { getReleaseType } from "@release-change/commit-analyser";
|
|
3
|
+
import { debugConfig, getConfig } from "@release-change/config";
|
|
4
|
+
import { getPackages, isMonorepo } from "@release-change/get-packages";
|
|
5
|
+
import { COMMITTER_EMAIL, COMMITTER_NAME, checkBranch, checkPushPermissions, checkRepository, getBranchName, getCommitsSinceRef } from "@release-change/git";
|
|
6
|
+
import { closeIssue, getRelatedPullRequestsAndIssues, postFailComment, postSuccessComment, tagPullRequestAndIssue } from "@release-change/github";
|
|
7
|
+
import { addErrorToContext, checkErrorType, setLogger } from "@release-change/logger";
|
|
8
|
+
import { publish, setLastRelease, setNextRelease } from "@release-change/release";
|
|
9
|
+
import { WORKSPACE_NAME, WORKSPACE_VERSION } from "@release-change/shared";
|
|
10
|
+
/**
|
|
11
|
+
* Runs the CLI.
|
|
12
|
+
* @param cliOptions - The CLI options.
|
|
13
|
+
* @param contextBase - The already known context where the CLI is running.
|
|
14
|
+
*/
|
|
15
|
+
export const run = async (cliOptions, contextBase) => {
|
|
16
|
+
const logger = setLogger(contextBase.config.debug);
|
|
17
|
+
logger.setScope("cli");
|
|
18
|
+
logger.logInfo(`Running ${WORKSPACE_NAME} version ${WORKSPACE_VERSION}…`);
|
|
19
|
+
const packages = await getPackages(contextBase);
|
|
20
|
+
const config = await getConfig(cliOptions, isMonorepo(packages));
|
|
21
|
+
const branch = getBranchName(contextBase, logger);
|
|
22
|
+
const ci = configureCiEnvironment(contextBase.env);
|
|
23
|
+
const context = {
|
|
24
|
+
...contextBase,
|
|
25
|
+
branch,
|
|
26
|
+
config,
|
|
27
|
+
ci,
|
|
28
|
+
packages,
|
|
29
|
+
releaseInfos: []
|
|
30
|
+
};
|
|
31
|
+
await checkRepository(context, logger);
|
|
32
|
+
if (isUsableCiEnvironment(context)) {
|
|
33
|
+
Object.assign(context.env, {
|
|
34
|
+
GIT_AUTHOR_NAME: COMMITTER_NAME,
|
|
35
|
+
GIT_AUTHOR_EMAIL: COMMITTER_EMAIL,
|
|
36
|
+
GIT_COMMITTER_NAME: COMMITTER_NAME,
|
|
37
|
+
GIT_COMMITTER_EMAIL: COMMITTER_EMAIL
|
|
38
|
+
});
|
|
39
|
+
debugConfig(context);
|
|
40
|
+
checkBranch(context);
|
|
41
|
+
await checkPushPermissions(context.config.repositoryUrl, context);
|
|
42
|
+
setLastRelease(context);
|
|
43
|
+
const commits = getCommitsSinceRef(context);
|
|
44
|
+
context.commits = commits;
|
|
45
|
+
const releaseType = getReleaseType(commits, context);
|
|
46
|
+
setNextRelease(releaseType, context);
|
|
47
|
+
if (context.nextRelease) {
|
|
48
|
+
const { debug, dryRun } = context.config;
|
|
49
|
+
if (debug) {
|
|
50
|
+
logger.setDebugScope("cli:run");
|
|
51
|
+
logger.logDebug(`Dry-run mode enabled: ${dryRun}`);
|
|
52
|
+
}
|
|
53
|
+
if (dryRun) {
|
|
54
|
+
logger.logWarn("The dry-run mode is enabled; therefore, the release will not be published.");
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
await getRelatedPullRequestsAndIssues(commits, context);
|
|
58
|
+
const { references } = context;
|
|
59
|
+
try {
|
|
60
|
+
await publish(context);
|
|
61
|
+
if (references) {
|
|
62
|
+
for (const reference of references) {
|
|
63
|
+
const { number, isPullRequest } = reference;
|
|
64
|
+
await postSuccessComment(reference, context);
|
|
65
|
+
if (!isPullRequest)
|
|
66
|
+
await closeIssue(number, context);
|
|
67
|
+
await tagPullRequestAndIssue(reference, context);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
logger.logError(checkErrorType(error));
|
|
73
|
+
addErrorToContext(error, context);
|
|
74
|
+
if (references) {
|
|
75
|
+
for (const reference of references) {
|
|
76
|
+
await postFailComment(reference, context);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=run.js.map
|
package/dist/run.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EACL,eAAe,EACf,cAAc,EACd,WAAW,EACX,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,kB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AS,EAAE,OAAO,CAAC,CAAC;4BAC7C,IAAI,CAAC,aAAa;gCAAE,MAAM,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;4BACtD,MAAM,sBAAsB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;wBACnD,CAAC;oBACH,CAAC;gBACH,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;oBACvC,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;oBAClC,IAAI,UAAU,EAAE,CAAC;wBACf,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;4BACnC,MAAM,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;wBAC5C,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"show-help.d.ts","sourceRoot":"","sources":["../src/show-help.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,eAAO,MAAM,QAAQ,QAAO,IAO3B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { setLogger } from "@release-change/logger";
|
|
2
|
+
import { WORKSPACE_NAME } from "@release-change/shared";
|
|
3
|
+
import { displayCliOptions } from "./display-cli-options.js";
|
|
4
|
+
import { TAB } from "./constants.js";
|
|
5
|
+
/**
|
|
6
|
+
* Shows the help for the `release-change` command.
|
|
7
|
+
*/
|
|
8
|
+
export const showHelp = () => {
|
|
9
|
+
const logger = setLogger();
|
|
10
|
+
const intro = "Runs automated package release and publishing";
|
|
11
|
+
const usage = `Usage:\n${TAB}${WORKSPACE_NAME} [options]`;
|
|
12
|
+
const cliOptions = displayCliOptions();
|
|
13
|
+
const output = [intro, usage, cliOptions].join("\n".repeat(2));
|
|
14
|
+
logger.logWithoutFormatting(output);
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=show-help.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"show-help.js","sourceRoot":"","sources":["../src/show-help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAS,EAAE;IACjC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,KAAK,GAAG,+CAA+C,CAAC;IAC9D,MAAM,KAAK,GAAG,WAAW,GAAG,GAAG,cAAc,YAAY,CAAC;IAC1D,MAAM,UAAU,GAAG,iBAAiB,EAAE,CAAC;IACvC,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,MAAM,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"show-version.d.ts","sourceRoot":"","sources":["../src/show-version.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,WAAW,QAAO,IAG9B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { setLogger } from "@release-change/logger";
|
|
2
|
+
import { WORKSPACE_VERSION } from "@release-change/shared";
|
|
3
|
+
/**
|
|
4
|
+
* Shows the current version of `release-change`.
|
|
5
|
+
*/
|
|
6
|
+
export const showVersion = () => {
|
|
7
|
+
const logger = setLogger();
|
|
8
|
+
logger.logWithoutFormatting(`v${WORKSPACE_VERSION}`);
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=show-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"show-version.js","sourceRoot":"","sources":["../src/show-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,GAAS,EAAE;IACpC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,CAAC,oBAAoB,CAAC,IAAI,iBAAiB,EAAE,CAAC,CAAC;AACvD,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@release-change/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Fully automated version management, changelog management and package publishing with a focus on monorepos, pre-releases and major version zero",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"automation",
|
|
7
|
+
"changelog",
|
|
8
|
+
"cli",
|
|
9
|
+
"major-version-zero",
|
|
10
|
+
"monorepo",
|
|
11
|
+
"package",
|
|
12
|
+
"pre-release",
|
|
13
|
+
"publish",
|
|
14
|
+
"release",
|
|
15
|
+
"release-automation",
|
|
16
|
+
"release-workflow",
|
|
17
|
+
"semantic",
|
|
18
|
+
"semantic-version",
|
|
19
|
+
"semver",
|
|
20
|
+
"semver-release",
|
|
21
|
+
"tags",
|
|
22
|
+
"version",
|
|
23
|
+
"versioning"
|
|
24
|
+
],
|
|
25
|
+
"homepage": "https://github.com/release-change/release-change",
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/release-change/release-change/issues"
|
|
28
|
+
},
|
|
29
|
+
"author": "Victor Brito (https://victor-brito.dev)",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/release-change/release-change.git"
|
|
33
|
+
},
|
|
34
|
+
"type": "module",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"files": [
|
|
37
|
+
"configuration-schema.json",
|
|
38
|
+
"dist"
|
|
39
|
+
],
|
|
40
|
+
"exports": {
|
|
41
|
+
"import": "./dist/index.js",
|
|
42
|
+
"types": "./dist/index.d.ts"
|
|
43
|
+
},
|
|
44
|
+
"bin": {
|
|
45
|
+
"release-change": "./bin/index.js"
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": "^20.18.3 || ^22.12.0 || ^24.0.0",
|
|
49
|
+
"npm": ">=10.8.2",
|
|
50
|
+
"pnpm": ">=10.28.0"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@release-change/ci": "0.1.0",
|
|
54
|
+
"@release-change/commit-analyser": "0.1.0",
|
|
55
|
+
"@release-change/config": "0.1.0",
|
|
56
|
+
"@release-change/git": "0.1.0",
|
|
57
|
+
"@release-change/get-packages": "0.1.0",
|
|
58
|
+
"@release-change/github": "0.1.0",
|
|
59
|
+
"@release-change/logger": "0.1.0",
|
|
60
|
+
"@release-change/semver": "0.1.0",
|
|
61
|
+
"@release-change/shared": "0.1.0",
|
|
62
|
+
"@release-change/release": "0.1.0"
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "tsc",
|
|
66
|
+
"dev": "tsc --watch --preserveWatchOutput & vitest",
|
|
67
|
+
"release-change": "./bin/index.js"
|
|
68
|
+
}
|
|
69
|
+
}
|