You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Proof of concept that wraps [semantic-release](https://github.com/semantic-release/semantic-release) to work with monorepos.
9
+
Proof of concept that wraps [semantic-release](https://github.com/semantic-release/semantic-release) to work with monorepos.
10
10
11
11
This package should work well, but may not be fundamentally stable enough for important production use as it's pretty dependent on how semantic-release works (so it may break or get out-of-date in future versions of semantic-release).
12
12
@@ -26,7 +26,7 @@ multi-semantic-release
26
26
27
27
## Configuration
28
28
29
-
Configuration for releases is the same as [semantic-release configuration](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md), i.e. using a `release` key under `package.json` or in `.releaserc` file of any type e.g. `.yaml`, `.json`.
29
+
Configuration for releases is the same as [semantic-release configuration](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md), i.e. using a `release` key under `package.json` or in `.releaserc` file of any type e.g. `.yaml`, `.json`.
30
30
31
31
_But_ in multi-semantic-release this configuration can be done globally (in your top-level dir), or per-package (in that individual package's dir). If you set both then per-package settings will override global settings.
32
32
@@ -96,18 +96,18 @@ The plugin starts all release at once, then pauses them (using Promises) at vari
96
96
The inline plugin does the following:
97
97
98
98
-**verifyConditions:**_not used_
99
-
-**analyzeCommits:**
99
+
-**analyzeCommits:**
100
100
- Replaces `context.commits` with a list of commits filtered to the folder only
101
-
- Calls `plugins.analyzeCommits()` to get the next release type (e.g. from @semantic-release/commit-analyzer)
101
+
- Calls `plugins.analyzeCommits()` to get the next release type (e.g. from @semantic-release/commit-analyzer)
102
102
- Waits for _all_ packages to catch up to this point.
103
103
- For packages that haven't bumped, checks if it has local deps (or deps of deps) that have bumped and returns `patch` if that's true
104
104
-**verifyRelease:**_not used_
105
-
-**generateNotes:**
106
-
- Calls `plugins.generateNotes()` to get the notes (e.g. from @semantic-release/release-notes-generator)
105
+
-**generateNotes:**
106
+
- Calls `plugins.generateNotes()` to get the notes (e.g. from @semantic-release/release-notes-generator)
107
107
- Appends a section listing any local deps bumps (e.g. "my-pkg-2: upgraded to 1.2.1")
108
-
-**prepare:**
108
+
-**prepare:**
109
109
- Writes in the correct version for local deps in `dependencies`, `devDependencies`, `peerDependencies` in `package.json`
110
-
- Serialize the releases so they happen one-at-a-time (because semantic-release calls `git push`asyncronously, multiple releases at once fail because Git refs aren't locked — semantic-release should use `execa.sync()` so Git operations are atomic)
110
+
- Serialize the releases so they happen one-at-a-time (because semantic-release calls `git push`asynchronously, multiple releases at once fail because Git refs aren't locked — semantic-release should use `execa.sync()` so Git operations are atomic)
111
111
-**publish:**_not used_
112
112
-**success:**_not used_
113
113
-**fail:**_not used_
@@ -119,13 +119,13 @@ The integration with semantic release is pretty janky — this is a quick summar
119
119
1. Had to filter `context.commits` object before it was used by `@semantic-release/commit-analyzer` (so it only lists commits for the corresponding directory).
120
120
- The actual Git filtering is easy peasy: see [getCommitsFiltered.js](https://github.com/dhoulb/multi-semantic-release/blob/master/lib/getCommitsFiltered.js)
121
121
- But overriding `context.commits` was very difficult! I did it eventually creating an _inline plugin_ and passing it into `semanticRelease()` via `options.plugins`
122
-
- The inline plugin proxies between semantic release and other configured plugins. It does what it needs to then calls e.g. `plugins.analyzeCommits()` with an overridden `context.commits` — see [createInlinePluginCreator.js](https://github.com/dhoulb/multi-semantic-release/blob/master/lib/createInlinePluginCreator.js)
122
+
- The inline plugin proxies between semantic release and other configured plugins. It does what it needs to then calls e.g. `plugins.analyzeCommits()` with an overridden `context.commits` — see [createInlinePluginCreator.js](https://github.com/dhoulb/multi-semantic-release/blob/master/lib/createInlinePluginCreator.js)
123
123
- I think this is messy — inline plugins aren't even documented :(
124
124
2. Need to run the analyze commit step on *all* plugins before any proceed to the publish step
125
125
- The inline plugin returns a Promise for every package then waits for all packages to analyze their commits before resolving them one at a time
126
126
- If packages have local deps (e.g. `dependencies` in package.json points to an internal package) this step also does a `patch` bump if any of them did a bump.
127
127
- This has to work recursively! See [hasChangedDeep.js](https://github.com/dhoulb/multi-semantic-release/blob/master/lib/hasChangedDeep.js)
128
-
3. The configuration can be layered (i.e. global `.releaserc` and then per-directory overrides for individual packages).
128
+
3. The configuration can be layered (i.e. global `.releaserc` and then per-directory overrides for individual packages).
129
129
- Had to duplicate the internal cosmiconfig setup from semantic release to get this working :(
130
130
4. I found Git getting itself into weird states because e.g. `git tag` is done asynchronously
131
131
- To get around this I had to stagger package publishing so they were done one at a time (which slows things down)
0 commit comments