@anolilab/multi-semantic-release 2.0.0 → 2.0.2
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/CHANGELOG.md +20 -7
- package/README.md +83 -1
- package/bin/cli.js +1 -2
- package/lib/create-inline-plugin-creator.js +18 -20
- package/lib/get-commits-filtered.js +1 -2
- package/lib/get-config-multi-semrel.js +3 -5
- package/lib/get-config-semantic.js +7 -5
- package/lib/get-config.js +1 -3
- package/lib/get-manifest.js +1 -4
- package/lib/logger.js +4 -0
- package/lib/multi-semantic-release.js +32 -15
- package/lib/rescoped-stream.js +0 -2
- package/lib/update-deps.js +7 -18
- package/lib/utils/clean-path.js +1 -2
- package/lib/utils/get-version.js +2 -1
- package/lib/utils/recognize-format.js +0 -1
- package/lib/utils/stream-to-array.js +18 -2
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,31 @@
|
|
|
1
|
-
## @anolilab/multi-semantic-release [2.0.
|
|
1
|
+
## @anolilab/multi-semantic-release [2.0.2](https://github.com/anolilab/semantic-release/compare/@anolilab/multi-semantic-release@2.0.1...@anolilab/multi-semantic-release@2.0.2) (2025-07-02)
|
|
2
2
|
|
|
3
|
-
###
|
|
3
|
+
### Bug Fixes
|
|
4
4
|
|
|
5
|
-
*
|
|
5
|
+
* add channel configuration for prereleases in multiple .releaserc.json files ([8aa95b8](https://github.com/anolilab/semantic-release/commit/8aa95b82e6b1e92dab49fe1cde6cf894eb105c0f))
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Documentation
|
|
8
|
+
|
|
9
|
+
* enhance README with configuration file formats and search order for multi-semantic-release ([823e9e1](https://github.com/anolilab/semantic-release/commit/823e9e16732582b07823e49d55eb789760a79d36))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Dependencies
|
|
13
|
+
|
|
14
|
+
* **@anolilab/semantic-release-clean-package-json:** upgraded to 3.0.2
|
|
15
|
+
* **@anolilab/semantic-release-pnpm:** upgraded to 2.0.2
|
|
16
|
+
|
|
17
|
+
## @anolilab/multi-semantic-release [2.0.1](https://github.com/anolilab/semantic-release/compare/@anolilab/multi-semantic-release@2.0.0...@anolilab/multi-semantic-release@2.0.1) (2025-07-02)
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
8
20
|
|
|
9
|
-
* update
|
|
21
|
+
* update dependencies and configurations for multi-semantic-release ([6e76f22](https://github.com/anolilab/semantic-release/commit/6e76f226f886f22b37be75024ed4156269379281))
|
|
22
|
+
* update dependencies and configurations for semantic-release packages ([e025cff](https://github.com/anolilab/semantic-release/commit/e025cffb7d3bb9e2f3c00bd6a2847b0e93354f6d))
|
|
10
23
|
|
|
11
24
|
|
|
12
25
|
### Dependencies
|
|
13
26
|
|
|
14
|
-
* **@anolilab/semantic-release-clean-package-json:** upgraded to 3.0.
|
|
15
|
-
* **@anolilab/semantic-release-pnpm:** upgraded to 2.0.
|
|
27
|
+
* **@anolilab/semantic-release-clean-package-json:** upgraded to 3.0.1
|
|
28
|
+
* **@anolilab/semantic-release-pnpm:** upgraded to 2.0.1
|
|
16
29
|
|
|
17
30
|
## @anolilab/multi-semantic-release [1.1.7](https://github.com/anolilab/semantic-release/compare/@anolilab/multi-semantic-release@1.1.6...@anolilab/multi-semantic-release@1.1.7) (2025-01-14)
|
|
18
31
|
|
package/README.md
CHANGED
|
@@ -140,6 +140,88 @@ Alternatively some options may be set via CLI flags.
|
|
|
140
140
|
|
|
141
141
|
**Note:** CLI arguments take precedence over options configured in the configuration file.
|
|
142
142
|
|
|
143
|
+
## Configuration
|
|
144
|
+
|
|
145
|
+
Multi-semantic-release can be configured using a configuration file in any of the following formats:
|
|
146
|
+
|
|
147
|
+
### Configuration File Formats
|
|
148
|
+
|
|
149
|
+
1. **`package.json`** (under the `"multi-release"` key):
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"name": "my-monorepo",
|
|
153
|
+
"version": "1.0.0",
|
|
154
|
+
"multi-release": {
|
|
155
|
+
"deps": {
|
|
156
|
+
"bump": "inherit",
|
|
157
|
+
},
|
|
158
|
+
"ignorePackages": ["packages/legacy/**"],
|
|
159
|
+
"tagFormat": "${name}@${version}"
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
2. **`.multi-releaserc`** (JSON format):
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"deps": {
|
|
168
|
+
"bump": "inherit",
|
|
169
|
+
},
|
|
170
|
+
"ignorePackages": ["packages/legacy/**"],
|
|
171
|
+
"tagFormat": "${name}@${version}"
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
3. **`.multi-releaserc.json`**:
|
|
176
|
+
```json
|
|
177
|
+
{
|
|
178
|
+
"deps": {
|
|
179
|
+
"bump": "inherit",
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
4. **`.multi-releaserc.js`** (CommonJS module):
|
|
185
|
+
```javascript
|
|
186
|
+
module.exports = {
|
|
187
|
+
deps: {
|
|
188
|
+
bump: "inherit",
|
|
189
|
+
},
|
|
190
|
+
ignorePackages: ["packages/legacy/**"]
|
|
191
|
+
};
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
5. **`.multi-releaserc.cjs`** (CommonJS module):
|
|
195
|
+
```javascript
|
|
196
|
+
module.exports = {
|
|
197
|
+
deps: {
|
|
198
|
+
bump: "inherit",
|
|
199
|
+
excludeDependencies: ["@visulima/packem", "my-circular-package"]
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
6. **`multi-release.config.js`** (ES module):
|
|
205
|
+
```javascript
|
|
206
|
+
export default {
|
|
207
|
+
deps: {
|
|
208
|
+
bump: "inherit",
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Configuration Search
|
|
214
|
+
|
|
215
|
+
Multi-semantic-release will search for configuration files in the following order:
|
|
216
|
+
1. `package.json` (under `"multi-release"` property)
|
|
217
|
+
2. `.multi-releaserc`
|
|
218
|
+
3. `.multi-releaserc.json`
|
|
219
|
+
4. `.multi-releaserc.js`
|
|
220
|
+
5. `.multi-releaserc.cjs`
|
|
221
|
+
6. `multi-release.config.js`
|
|
222
|
+
|
|
223
|
+
The first configuration file found will be used, and the search stops there.
|
|
224
|
+
|
|
143
225
|
### Options
|
|
144
226
|
|
|
145
227
|
| Option | Type | CLI Flag | Description |
|
|
@@ -354,7 +436,7 @@ To make the `tagFormat` option work as intended the following would need to happ
|
|
|
354
436
|
## Supported Node.js Versions
|
|
355
437
|
|
|
356
438
|
Libraries in this ecosystem make the best effort to track
|
|
357
|
-
[Node.js
|
|
439
|
+
[Node.js' release schedule](https://nodejs.org/en/about/releases/). Here's [a
|
|
358
440
|
post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
|
|
359
441
|
|
|
360
442
|
## Contributing
|
package/bin/cli.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
// eslint-disable-next-line import/no-unused-modules
|
|
4
3
|
import { exit } from "node:process";
|
|
5
4
|
|
|
6
5
|
import yargs from "yargs";
|
|
@@ -70,7 +69,7 @@ await (async () => {
|
|
|
70
69
|
.option("tag-format", {
|
|
71
70
|
describe:
|
|
72
71
|
// eslint-disable-next-line no-template-curly-in-string
|
|
73
|
-
|
|
72
|
+
"Format to use for creating tag names. Should include \"name\" and \"version\" vars. Default: \"${name}@${version}\" generates \"package-name@1.0.0\"",
|
|
74
73
|
type: "string",
|
|
75
74
|
})
|
|
76
75
|
.strict(false)
|
|
@@ -9,12 +9,10 @@ const { debug } = logger.withScope("msr:inlinePlugin");
|
|
|
9
9
|
/**
|
|
10
10
|
* Create an inline plugin creator for a multirelease.
|
|
11
11
|
* This is caused once per multirelease and returns a function which should be called once per package within the release.
|
|
12
|
-
*
|
|
13
12
|
* @param {Package[]} packages The multi-semantic-release context.
|
|
14
13
|
* @param {MultiContext} multiContext The multi-semantic-release context.
|
|
15
|
-
* @param {
|
|
14
|
+
* @param {object} flags argv options
|
|
16
15
|
* @returns {Function} A function that creates an inline package.
|
|
17
|
-
*
|
|
18
16
|
* @internal
|
|
19
17
|
*/
|
|
20
18
|
function createInlinePluginCreator(packages, multiContext, flags) {
|
|
@@ -24,13 +22,15 @@ function createInlinePluginCreator(packages, multiContext, flags) {
|
|
|
24
22
|
/**
|
|
25
23
|
* Create an inline plugin for an individual package in a multirelease.
|
|
26
24
|
* This is called once per package and returns the inline plugin used for semanticRelease()
|
|
27
|
-
*
|
|
28
25
|
* @param {Package} package_ The package this function is being called on.
|
|
29
|
-
* @returns {
|
|
30
|
-
*
|
|
26
|
+
* @returns {object} A semantic-release inline plugin containing plugin step functions.
|
|
31
27
|
* @internal
|
|
32
28
|
*/
|
|
33
|
-
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @param package_
|
|
33
|
+
*/
|
|
34
34
|
function createInlinePlugin(package_) {
|
|
35
35
|
// Vars.
|
|
36
36
|
const { dir, name, plugins } = package_;
|
|
@@ -50,6 +50,7 @@ function createInlinePluginCreator(packages, multiContext, flags) {
|
|
|
50
50
|
Object.assign(package_.fakeLogger, context.logger);
|
|
51
51
|
|
|
52
52
|
const result = await plugins.verifyConditions(context);
|
|
53
|
+
|
|
53
54
|
// eslint-disable-next-line no-param-reassign
|
|
54
55
|
package_._ready = true;
|
|
55
56
|
|
|
@@ -64,11 +65,9 @@ function createInlinePluginCreator(packages, multiContext, flags) {
|
|
|
64
65
|
*
|
|
65
66
|
* In multirelease: Returns "patch" if the package contains references to other local packages that have changed, or null if this package references no local packages or they have not changed.
|
|
66
67
|
* Also updates the `context.commits` setting with one returned from `getCommitsFiltered()` (which is filtered by package directory).
|
|
67
|
-
*
|
|
68
68
|
* @param {object} pluginOptions Options to configure this plugin.
|
|
69
69
|
* @param {object} context The semantic-release context.
|
|
70
70
|
* @returns {Promise<void>} Promise that resolves when done.
|
|
71
|
-
*
|
|
72
71
|
* @internal
|
|
73
72
|
*/
|
|
74
73
|
const analyzeCommits = async (pluginOptions, context) => {
|
|
@@ -121,21 +120,19 @@ function createInlinePluginCreator(packages, multiContext, flags) {
|
|
|
121
120
|
*
|
|
122
121
|
* Should look like:
|
|
123
122
|
*
|
|
124
|
-
*
|
|
123
|
+
* ## my-amazing-package [9.2.1](github.com/etc) 2018-12-01
|
|
125
124
|
*
|
|
126
|
-
*
|
|
125
|
+
* ### Features
|
|
127
126
|
*
|
|
128
|
-
*
|
|
127
|
+
* etc
|
|
129
128
|
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
* * **my-amazing-plugin:** upgraded to 1.2.3
|
|
133
|
-
* * **my-other-plugin:** upgraded to 4.9.6
|
|
129
|
+
* ### Dependencies
|
|
134
130
|
*
|
|
131
|
+
* **my-amazing-plugin:** upgraded to 1.2.3
|
|
132
|
+
* **my-other-plugin:** upgraded to 4.9.6
|
|
135
133
|
* @param {object} pluginOptions Options to configure this plugin.
|
|
136
134
|
* @param {object} context The semantic-release context.
|
|
137
135
|
* @returns {Promise<void>} Promise that resolves to the string
|
|
138
|
-
*
|
|
139
136
|
* @internal
|
|
140
137
|
*/
|
|
141
138
|
const generateNotes = async (pluginOptions, context) => {
|
|
@@ -151,9 +148,9 @@ function createInlinePluginCreator(packages, multiContext, flags) {
|
|
|
151
148
|
|
|
152
149
|
// get SHA of lastRelease if not already there (should have been done by Semantic Release...)
|
|
153
150
|
if (
|
|
154
|
-
context.lastRelease
|
|
155
|
-
context.lastRelease.gitTag
|
|
156
|
-
(!context.lastRelease.gitHead || context.lastRelease.gitHead === context.lastRelease.gitTag)
|
|
151
|
+
context.lastRelease
|
|
152
|
+
&& context.lastRelease.gitTag
|
|
153
|
+
&& (!context.lastRelease.gitHead || context.lastRelease.gitHead === context.lastRelease.gitTag)
|
|
157
154
|
) {
|
|
158
155
|
context.lastRelease.gitHead = getTagHead(context.lastRelease.gitTag, {
|
|
159
156
|
cwd: context.cwd,
|
|
@@ -177,6 +174,7 @@ function createInlinePluginCreator(packages, multiContext, flags) {
|
|
|
177
174
|
// Get subnotes and add to list.
|
|
178
175
|
// Inject pkg name into title if it matches e.g. `# 1.0.0` or `## [1.0.1]` (as generate-release-notes does).
|
|
179
176
|
const subs = await plugins.generateNotes(context);
|
|
177
|
+
|
|
180
178
|
// istanbul ignore else (unnecessary to __tests__)
|
|
181
179
|
if (subs) {
|
|
182
180
|
notes.push(subs.replace(/^(#+) (\[?\d+\.\d+\.\d+\]?)/u, `$1 ${name} $2`));
|
|
@@ -16,13 +16,12 @@ const { debug } = logger.withScope("msr:commitsFilter");
|
|
|
16
16
|
* Commits are filtered to only return those that corresponding to the package directory.
|
|
17
17
|
*
|
|
18
18
|
* This is achieved by using "-- my/dir/path" with `git log` — passing this into gitLogParser() with
|
|
19
|
-
*
|
|
20
19
|
* @param {string} cwd Absolute path of the working directory the Git repo is in.
|
|
21
20
|
* @param {string} direction Path to the target directory to filter by. Either absolute, or relative to cwd param.
|
|
22
21
|
* @param {string|void} lastRelease The SHA of the previous release (default to start of all commits if undefined)
|
|
23
22
|
* @param {string|void} nextRelease The SHA of the next release (default to HEAD if undefined)
|
|
24
23
|
* @param {string|void} firstParentBranch first-parent to determine which merges went into master
|
|
25
|
-
* @
|
|
24
|
+
* @returns {Promise<Array<Commit>>} The list of commits on the branch `branch` since the last release.
|
|
26
25
|
*/
|
|
27
26
|
async function getCommitsFiltered(cwd, direction, lastRelease, nextRelease, firstParentBranch) {
|
|
28
27
|
// Clean paths and make sure directories exist.
|
|
@@ -22,15 +22,13 @@ const CONFIG_FILES = [
|
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Get the multi semantic release configuration options for a given directory.
|
|
25
|
-
*
|
|
26
25
|
* @param {string} cwd The directory to search.
|
|
27
|
-
* @param {
|
|
28
|
-
* @returns {
|
|
29
|
-
*
|
|
26
|
+
* @param {object} cliOptions cli supplied options.
|
|
27
|
+
* @returns {object} The found configuration option
|
|
30
28
|
* @internal
|
|
31
29
|
*/
|
|
32
30
|
export default async function getConfig(cwd, cliOptions) {
|
|
33
|
-
const { config } =
|
|
31
|
+
const { config } = await cosmiconfig(CONFIG_NAME, { searchPlaces: CONFIG_FILES }).search(cwd) || {};
|
|
34
32
|
const { extends: extendPaths, ...rest } = { ...config };
|
|
35
33
|
|
|
36
34
|
let options = rest;
|
|
@@ -9,11 +9,13 @@ const { Signale } = signale;
|
|
|
9
9
|
/**
|
|
10
10
|
* Get the release configuration options for a given directory.
|
|
11
11
|
* Unfortunately we've had to copy this over from semantic-release, creating unnecessary duplication.
|
|
12
|
-
*
|
|
13
|
-
* @param
|
|
14
|
-
* @param
|
|
15
|
-
* @
|
|
16
|
-
*
|
|
12
|
+
* @param {object} context Object containing cwd, env, and logger properties that are passed to getConfig()
|
|
13
|
+
* @param context.cwd
|
|
14
|
+
* @param context.env
|
|
15
|
+
* @param {object} options Options object for the config.
|
|
16
|
+
* @param context.stderr
|
|
17
|
+
* @param context.stdout
|
|
18
|
+
* @returns {object} Returns what semantic-release's get config returns (object with options and plugins objects).
|
|
17
19
|
* @internal
|
|
18
20
|
*/
|
|
19
21
|
async function getConfigSemantic({ cwd, env, stderr, stdout }, options) {
|
package/lib/get-config.js
CHANGED
|
@@ -17,10 +17,8 @@ const CONFIG_FILES = [
|
|
|
17
17
|
/**
|
|
18
18
|
* Get the release configuration options for a given directory.
|
|
19
19
|
* Unfortunately we've had to copy this over from semantic-release, creating unnecessary duplication.
|
|
20
|
-
*
|
|
21
20
|
* @param {string} cwd The directory to search.
|
|
22
|
-
* @returns {
|
|
23
|
-
*
|
|
21
|
+
* @returns {object} The found configuration option
|
|
24
22
|
* @internal
|
|
25
23
|
*/
|
|
26
24
|
export default async function getConfig(cwd) {
|
package/lib/get-manifest.js
CHANGED
|
@@ -2,10 +2,8 @@ import { existsSync, lstatSync, readFileSync } from "node:fs";
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Read the content of target package.json if exists.
|
|
5
|
-
*
|
|
6
5
|
* @param {string} path file path
|
|
7
6
|
* @returns {string} file content
|
|
8
|
-
*
|
|
9
7
|
* @internal
|
|
10
8
|
*/
|
|
11
9
|
function readManifest(path) {
|
|
@@ -43,10 +41,8 @@ function readManifest(path) {
|
|
|
43
41
|
|
|
44
42
|
/**
|
|
45
43
|
* Get the parsed contents of a package.json manifest file.
|
|
46
|
-
*
|
|
47
44
|
* @param {string} path The path to the package.json manifest file.
|
|
48
45
|
* @returns {object} The manifest file's contents.
|
|
49
|
-
*
|
|
50
46
|
* @internal
|
|
51
47
|
*/
|
|
52
48
|
export default function getManifest(path) {
|
|
@@ -55,6 +51,7 @@ export default function getManifest(path) {
|
|
|
55
51
|
|
|
56
52
|
// Parse the file.
|
|
57
53
|
let manifest;
|
|
54
|
+
|
|
58
55
|
try {
|
|
59
56
|
manifest = JSON.parse(contents);
|
|
60
57
|
} catch {
|
package/lib/logger.js
CHANGED
|
@@ -21,12 +21,15 @@ const logger = {
|
|
|
21
21
|
if (!l) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
+
|
|
24
25
|
if (assertLevel(l, "debug")) {
|
|
25
26
|
dbg.enable("msr:");
|
|
26
27
|
}
|
|
28
|
+
|
|
27
29
|
if (assertLevel(l, "trace")) {
|
|
28
30
|
dbg.enable("semantic-release:");
|
|
29
31
|
}
|
|
32
|
+
|
|
30
33
|
this._level = l;
|
|
31
34
|
},
|
|
32
35
|
get level() {
|
|
@@ -69,6 +72,7 @@ const logger = {
|
|
|
69
72
|
(this.config._signale[l] || console[l] || (() => {}))(this.prefix, ...arguments_);
|
|
70
73
|
}
|
|
71
74
|
};
|
|
75
|
+
|
|
72
76
|
return m;
|
|
73
77
|
}, {}),
|
|
74
78
|
debug: dbg("msr:"),
|
|
@@ -18,12 +18,16 @@ import cleanPath from "./utils/clean-path.js";
|
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Load details about a package.
|
|
21
|
-
*
|
|
22
21
|
* @param {string} path The path to load details about.
|
|
23
|
-
* @param {
|
|
22
|
+
* @param {object} allOptions Options that apply to all packages.
|
|
24
23
|
* @param {MultiContext} multiContext Context object for the multirelease.
|
|
24
|
+
* @param allOptions.cwd
|
|
25
|
+
* @param allOptions.env
|
|
26
|
+
* @param allOptions.globalOptions
|
|
27
|
+
* @param allOptions.inputOptions
|
|
28
|
+
* @param allOptions.stderr
|
|
29
|
+
* @param allOptions.stdout
|
|
25
30
|
* @returns {Promise<Package|void>} A package object, or void if the package was skipped.
|
|
26
|
-
*
|
|
27
31
|
* @internal
|
|
28
32
|
*/
|
|
29
33
|
async function getPackage(path, { cwd, env, globalOptions, inputOptions, stderr, stdout }) {
|
|
@@ -65,13 +69,12 @@ async function getPackage(path, { cwd, env, globalOptions, inputOptions, stderr,
|
|
|
65
69
|
|
|
66
70
|
/**
|
|
67
71
|
* Release an individual package.
|
|
68
|
-
*
|
|
69
72
|
* @param {Package} pkg The specific package.
|
|
73
|
+
* @param package_
|
|
70
74
|
* @param {Function} createInlinePlugin A function that creates an inline plugin.
|
|
71
75
|
* @param {MultiContext} multiContext Context object for the multirelease.
|
|
72
|
-
* @param {
|
|
76
|
+
* @param {object} flags Argv flags.
|
|
73
77
|
* @returns {Promise<void>} Promise that resolves when done.
|
|
74
|
-
*
|
|
75
78
|
* @internal
|
|
76
79
|
*/
|
|
77
80
|
async function releasePackage(package_, createInlinePlugin, multiContext, flags) {
|
|
@@ -136,7 +139,7 @@ async function releasePackage(package_, createInlinePlugin, multiContext, flags)
|
|
|
136
139
|
* @param {Package[]} packages Array of all packages in this multirelease.
|
|
137
140
|
* @param {Package[]} releasing Array of packages that will release.
|
|
138
141
|
* @param {string} cwd The current working directory.
|
|
139
|
-
* @param {
|
|
142
|
+
* @param {object} env The environment variables.
|
|
140
143
|
* @param {Logger} logger The logger for the multirelease.
|
|
141
144
|
* @param {Stream} stdout The output stream for this multirelease.
|
|
142
145
|
* @param {Stream} stderr The error stream for this multirelease.
|
|
@@ -152,20 +155,34 @@ async function releasePackage(package_, createInlinePlugin, multiContext, flags)
|
|
|
152
155
|
* @param {Package[]} localDeps Array of local dependencies this package relies on.
|
|
153
156
|
* @param {context|void} context The semantic-release context for this package's release (filled in once semantic-release runs).
|
|
154
157
|
* @param {undefined|Result|false} result The result of semantic-release (object with lastRelease, nextRelease, commits, releases), false if this package was skipped (no changes or similar), or undefined if the package's release hasn't completed yet.
|
|
155
|
-
* @param {
|
|
156
|
-
* @param {
|
|
158
|
+
* @param {object} _lastRelease The last release object for the package before its current release (set during anaylze-commit)
|
|
159
|
+
* @param {object} _nextRelease The next release object (the release the package is releasing for this cycle) (set during generateNotes)
|
|
157
160
|
*/
|
|
158
161
|
|
|
159
162
|
/**
|
|
160
163
|
* Perform a multirelease.
|
|
161
|
-
*
|
|
162
164
|
* @param {string[]} paths An array of paths to package.json files.
|
|
163
|
-
* @param {
|
|
164
|
-
* @param {
|
|
165
|
-
* @param
|
|
165
|
+
* @param {object} inputOptions An object containing semantic-release options.
|
|
166
|
+
* @param {object} settings An object containing: cwd, env, stdout, stderr (mainly for configuring tests).
|
|
167
|
+
* @param settings.cwd
|
|
168
|
+
* @param settings.env
|
|
169
|
+
* @param {object} _flags Argv flags.
|
|
170
|
+
* @param settings.stderr
|
|
171
|
+
* @param settings.stdout
|
|
166
172
|
* @returns {Promise<Package[]>} Promise that resolves to a list of package objects with `result` property describing whether it released or not.
|
|
167
173
|
*/
|
|
168
|
-
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
*
|
|
177
|
+
* @param paths
|
|
178
|
+
* @param inputOptions
|
|
179
|
+
* @param root0
|
|
180
|
+
* @param root0.cwd
|
|
181
|
+
* @param root0.env
|
|
182
|
+
* @param root0.stderr
|
|
183
|
+
* @param root0.stdout
|
|
184
|
+
* @param _flags
|
|
185
|
+
*/
|
|
169
186
|
async function multiSemanticRelease(
|
|
170
187
|
paths,
|
|
171
188
|
inputOptions = {},
|
|
@@ -186,7 +203,7 @@ async function multiSemanticRelease(
|
|
|
186
203
|
|
|
187
204
|
const flags = {
|
|
188
205
|
deps: {},
|
|
189
|
-
...
|
|
206
|
+
...await getConfigMultiSemrel(cwd, _flags),
|
|
190
207
|
};
|
|
191
208
|
|
|
192
209
|
const require = createRequire(import.meta.url);
|
package/lib/rescoped-stream.js
CHANGED
|
@@ -5,11 +5,9 @@ import { check } from "./utils/blork.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* Create a stream that passes messages through while rewriting scope.
|
|
7
7
|
* Replaces `[semantic-release]` with a custom scope (e.g. `[my-awesome-package]`) so output makes more sense.
|
|
8
|
-
*
|
|
9
8
|
* @param {stream.Writable} stream The actual stream to write messages to.
|
|
10
9
|
* @param {string} scope The string scope for the stream (instances of the text `[semantic-release]` are replaced in the stream).
|
|
11
10
|
* @returns {stream.Writable} Object that's compatible with stream.Writable (implements a `write()` property).
|
|
12
|
-
*
|
|
13
11
|
* @internal
|
|
14
12
|
*/
|
|
15
13
|
class RescopedStream extends Writable {
|
package/lib/update-deps.js
CHANGED
|
@@ -12,7 +12,6 @@ const { debug } = logger.withScope("msr:updateDeps");
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Resolve next prerelease comparing bumped tags versions with last version.
|
|
15
|
-
*
|
|
16
15
|
* @param {string|null} latestTag Last released tag from branch or null if non-existent.
|
|
17
16
|
* @param {string} lastVersion Last version released.
|
|
18
17
|
* @param {string} packagePreRelease Prerelease tag from package to-be-released.
|
|
@@ -28,7 +27,6 @@ const _nextPreHighestVersion = (latestTag, lastVersion, packagePreRelease) => {
|
|
|
28
27
|
|
|
29
28
|
/**
|
|
30
29
|
* Resolve next prerelease special cases: highest version from tags or major/minor/patch.#
|
|
31
|
-
*
|
|
32
30
|
* @param {Array<string>} tags - if non-empty, we will use these tags as part fo the comparison
|
|
33
31
|
* @param {string} lastVersionForCurrentMultiRelease Last package version released from multi-semantic-release
|
|
34
32
|
* @param {string} packageNextType Next type evaluated for the next package type.
|
|
@@ -52,7 +50,6 @@ const _nextPreVersionCases = (tags, lastVersionForCurrentMultiRelease, packageNe
|
|
|
52
50
|
|
|
53
51
|
/**
|
|
54
52
|
* Get dependent release type by recursive scanning and updating pkg deps.
|
|
55
|
-
*
|
|
56
53
|
* @param {Package} package_ The package with local deps to check.
|
|
57
54
|
* @param {string} bumpStrategy Dependency resolution strategy: override, satisfy, inherit.
|
|
58
55
|
* @param {string} releaseStrategy Release type triggered by deps updating: patch, minor, major, inherit.
|
|
@@ -101,13 +98,13 @@ const getDependentRelease = (package_, bumpStrategy, releaseStrategy, ignore, pr
|
|
|
101
98
|
const nextVersion = nextType
|
|
102
99
|
? // Update the nextVersion only if there is a next type to be bumped
|
|
103
100
|
|
|
104
|
-
|
|
101
|
+
p._preRelease
|
|
105
102
|
? // eslint-disable-next-line no-use-before-define
|
|
106
|
-
|
|
103
|
+
getNextPreVersion(p)
|
|
107
104
|
: // eslint-disable-next-line no-use-before-define
|
|
108
|
-
|
|
105
|
+
getNextVersion(p)
|
|
109
106
|
: // Set the nextVersion fallback to the last local dependency package last version
|
|
110
|
-
|
|
107
|
+
p._lastRelease && p._lastRelease.version;
|
|
111
108
|
|
|
112
109
|
// 3. And this change should correspond to the manifest updating rule.
|
|
113
110
|
const requireRelease = scopes
|
|
@@ -124,7 +121,6 @@ const getDependentRelease = (package_, bumpStrategy, releaseStrategy, ignore, pr
|
|
|
124
121
|
* See:
|
|
125
122
|
* {@link https://yarnpkg.com/features/workspaces#publishing-workspaces}
|
|
126
123
|
* {@link https://pnpm.io/workspaces#publishing-workspace-packages}
|
|
127
|
-
*
|
|
128
124
|
* @param {string} currentVersion Current version, may start with "workspace:"
|
|
129
125
|
* @param {string} nextVersion Next version
|
|
130
126
|
* @returns {string} current version without "workspace:"
|
|
@@ -134,7 +130,7 @@ const substituteWorkspaceVersion = (currentVersion, nextVersion) => {
|
|
|
134
130
|
// eslint-disable-next-line regexp/optimal-quantifier-concatenation
|
|
135
131
|
const [, range, caret] = /^workspace:(([\^~*])?.*)$/u.exec(currentVersion);
|
|
136
132
|
|
|
137
|
-
return caret === range ?
|
|
133
|
+
return caret === range ? caret === "*" ? nextVersion : caret + nextVersion : range;
|
|
138
134
|
}
|
|
139
135
|
|
|
140
136
|
return currentVersion;
|
|
@@ -190,7 +186,6 @@ const auditManifestChanges = (actualManifest, path) => {
|
|
|
190
186
|
|
|
191
187
|
/**
|
|
192
188
|
* Resolve next package version.
|
|
193
|
-
*
|
|
194
189
|
* @param {Package} package_ Package object.
|
|
195
190
|
* @returns {string|undefined} Next pkg version.
|
|
196
191
|
* @internal
|
|
@@ -203,7 +198,6 @@ export const getNextVersion = (package_) => {
|
|
|
203
198
|
|
|
204
199
|
/**
|
|
205
200
|
* Parse the prerelease tag from a semver version.
|
|
206
|
-
*
|
|
207
201
|
* @param {string} version Semver version in a string format.
|
|
208
202
|
* @returns {string|null} preReleaseTag Version prerelease tag or null.
|
|
209
203
|
* @internal
|
|
@@ -225,10 +219,8 @@ export const getPreReleaseTag = (version) => {
|
|
|
225
219
|
*
|
|
226
220
|
* 1. The last release for the package during this multi-release cycle
|
|
227
221
|
* 2. (if tag options provided):
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
222
|
+
* a. the highest increment of the tags array provided
|
|
223
|
+
* b. the highest increment of the gitTags for the prerelease
|
|
232
224
|
* @param {Package} package_ Package object.
|
|
233
225
|
* @returns {string|undefined} Next pkg version.
|
|
234
226
|
* @internal
|
|
@@ -247,7 +239,6 @@ export const getNextPreVersion = (package_) => {
|
|
|
247
239
|
|
|
248
240
|
/**
|
|
249
241
|
* Resolve package release type taking into account the cascading dependency update.
|
|
250
|
-
*
|
|
251
242
|
* @param {Package} package_ Package object.
|
|
252
243
|
* @param {string|undefined} bumpStrategy Dependency resolution strategy: override, satisfy, inherit.
|
|
253
244
|
* @param {string|undefined} releaseStrategy Release type triggered by deps updating: patch, minor, major, inherit.
|
|
@@ -282,7 +273,6 @@ export const resolveReleaseType = (package_, bumpStrategy = "override", releaseS
|
|
|
282
273
|
|
|
283
274
|
/**
|
|
284
275
|
* Resolve next version of dependency.
|
|
285
|
-
*
|
|
286
276
|
* @param {string} currentVersion Current dep version
|
|
287
277
|
* @param {string} nextVersion Next release type: patch, minor, major
|
|
288
278
|
* @param {string|undefined} bumpStrategy Resolution strategy: inherit, override, satisfy
|
|
@@ -332,7 +322,6 @@ export const resolveNextVersion = (currentVersion, nextVersion, bumpStrategy = "
|
|
|
332
322
|
|
|
333
323
|
/**
|
|
334
324
|
* Update pkg deps.
|
|
335
|
-
*
|
|
336
325
|
* @param {Package} package_ The package this function is being called on.
|
|
337
326
|
* @returns {void}
|
|
338
327
|
* @internal
|
package/lib/utils/clean-path.js
CHANGED
|
@@ -5,11 +5,10 @@ import { check } from "./blork.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* Normalize and make a path absolute, optionally using a custom CWD.
|
|
7
7
|
* Trims any trailing slashes from the path.
|
|
8
|
-
*
|
|
9
8
|
* @param {string} path The path to normalize and make absolute.
|
|
10
9
|
* @param {string} cwd=process.cwd() The CWD to prepend to the path to make it absolute.
|
|
10
|
+
* @param cwd
|
|
11
11
|
* @returns {string} The absolute and normalized path.
|
|
12
|
-
*
|
|
13
12
|
* @internal
|
|
14
13
|
*/
|
|
15
14
|
function cleanPath(path, cwd = process.cwd()) {
|
package/lib/utils/get-version.js
CHANGED
|
@@ -17,6 +17,7 @@ const _selectVersionBy = (predicate, version1, version2) => {
|
|
|
17
17
|
if (predicate && version1 && version2) {
|
|
18
18
|
return predicate(version1, version2) ? version1 : version2;
|
|
19
19
|
}
|
|
20
|
+
|
|
20
21
|
return version1 || version2;
|
|
21
22
|
};
|
|
22
23
|
|
|
@@ -27,7 +28,7 @@ export const getHighestVersion = _selectVersionBy.bind(null, gt);
|
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* Retrieve the latest version from a list of versions.
|
|
30
|
-
* @param {
|
|
31
|
+
* @param {Array} versions Versions as string list.
|
|
31
32
|
* @param {boolean|undefined} withPrerelease Prerelease flag.
|
|
32
33
|
* @returns {string|undefined} Latest version.
|
|
33
34
|
* @internal
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Converts a stream to an array
|
|
3
|
-
*
|
|
4
3
|
* @param {ReadStream} stream
|
|
5
|
-
* @returns {Promise<
|
|
4
|
+
* @returns {Promise<Array>}
|
|
6
5
|
*/
|
|
7
6
|
export default function streamToArray(stream) {
|
|
8
7
|
if (!stream.readable) {
|
|
@@ -20,6 +19,9 @@ export default function streamToArray(stream) {
|
|
|
20
19
|
|
|
21
20
|
let array = [];
|
|
22
21
|
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
23
25
|
function cleanup() {
|
|
24
26
|
array = null;
|
|
25
27
|
|
|
@@ -33,20 +35,34 @@ export default function streamToArray(stream) {
|
|
|
33
35
|
stream.removeListener("close", onClose);
|
|
34
36
|
}
|
|
35
37
|
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
* @param document_
|
|
41
|
+
*/
|
|
36
42
|
function onData(document_) {
|
|
37
43
|
array.push(document_);
|
|
38
44
|
}
|
|
39
45
|
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
*/
|
|
40
49
|
function onEnd() {
|
|
41
50
|
resolve(array);
|
|
42
51
|
cleanup();
|
|
43
52
|
}
|
|
44
53
|
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
* @param error
|
|
57
|
+
*/
|
|
45
58
|
function onError(error) {
|
|
46
59
|
reject(error);
|
|
47
60
|
cleanup();
|
|
48
61
|
}
|
|
49
62
|
|
|
63
|
+
/**
|
|
64
|
+
*
|
|
65
|
+
*/
|
|
50
66
|
function onClose() {
|
|
51
67
|
resolve(array);
|
|
52
68
|
cleanup();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anolilab/multi-semantic-release",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "A multi semantic release tool for a monorepo.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"multi-semantic-release": "./bin/cli.js"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
|
-
"README.md",
|
|
23
22
|
"CHANGELOG.md",
|
|
24
|
-
"
|
|
25
|
-
"bin"
|
|
23
|
+
"README.md",
|
|
24
|
+
"bin",
|
|
25
|
+
"lib"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@semrel-extra/topo": "^1.14.1",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"semver": "^7.7.2",
|
|
39
39
|
"signale": "^1.4.0",
|
|
40
40
|
"stream-buffers": "^3.0.3",
|
|
41
|
-
"yargs": "
|
|
41
|
+
"yargs": "18.0.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"semantic-release": ">=22.0.3"
|