-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ignore packages to be released with workspaces and CLI (#42)
- Loading branch information
1 parent
7f85e89
commit b98e181
Showing
26 changed files
with
11,077 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
/node_modules/ | ||
**/node_modules/** | ||
/coverage/ | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,25 @@ yarn add @qiwi/multi-semantic-release --dev | |
multi-semantic-release | ||
``` | ||
|
||
CLI flag options: | ||
|
||
```sh | ||
Options | ||
--dry-run Dry run mode. | ||
--debug Output debugging information. | ||
--sequential-init Avoid hypothetical concurrent initialization collisions. | ||
--first-parent Apply commit filtering to current branch only. | ||
--deps.bump Define deps version updating rule. Allowed: override, satisfy, inherit. | ||
--deps.release Define release type for dependent package if any of its deps changes. Supported values: patch, minor, major, inherit. | ||
--ignore-packages Packages list to be ignored on bumping process (append to the ones that already exist at package.json workspaces) | ||
--help Help info. | ||
|
||
Examples | ||
$ multi-semantic-release --debug | ||
$ multi-semantic-release --deps.bump=satisfy --deps.release=patch | ||
$ multi-semantic-release --ignore-packages=packages/a/**,packages/b/** | ||
``` | ||
## Configuration | ||
**MSR** requires **semrel** config to be added [in any supported format](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#configuration) for each package or/and declared in repo root (`globalConfig` is extremely useful if all the modules have the same strategy of release). | ||
NOTE config resolver joins `globalConfig` and `packageConfig` during execution. | ||
|
@@ -34,6 +53,41 @@ const { options: pkgOptions } = await getConfig(dir); | |
const finalOptions = Object.assign({}, globalOptions, pkgOptions); | ||
``` | ||
Make sure to have a `workspaces` attribute inside your `package.json` project file. In there, you can set a list of packages that you might want to process in the msr process, as well as ignore others. For example, let's say your project has 4 packages (i.e. a, b, c and d) and you want to process only a and d (ignore b and c). You can set the following structure in your `package.json` file: | ||
```json | ||
{ | ||
"name": "msr-test-yarn", | ||
"author": "Dave Houlbrooke <[email protected]", | ||
"version": "0.0.0-semantically-released", | ||
"private": true, | ||
"license": "0BSD", | ||
"engines": { | ||
"node": ">=8.3" | ||
}, | ||
"workspaces": [ | ||
"packages/*", | ||
"!packages/b/**", | ||
"!packages/c/**" | ||
], | ||
"release": { | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator" | ||
], | ||
"noCi": true | ||
} | ||
} | ||
``` | ||
You can also ignore it with the CLI: | ||
```bash | ||
$ multi-semantic-release --ignore-packages=packages/b/**,packages/c/** | ||
``` | ||
You can also combine the CLI ignore options with the `!` operator at each package inside `workspaces` attribute. Even though you can use the CLI to ignore options, you can't use it to set which packages to be released – i.e. you still need to set the `workspaces` attribute inside the `package.json`. | ||
## Verified examples | ||
We use this tool to release our JS platform code inhouse (GitHub Enterprise + JB TeamCity) and for our OSS (GitHub + Travis CI). Guaranteed working configurations available in projects. | ||
* [qiwi/substrate](https://github.com/qiwi/substrate) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
const bashGlob = require("bash-glob"); | ||
const bashPath = require("bash-path"); | ||
const globby = require("globby"); | ||
|
||
module.exports = (...args) => { | ||
if (!bashPath) { | ||
throw new TypeError("`bash` must be installed"); // TODO move this check to bash-glob | ||
} | ||
const [pattern, ...options] = args; | ||
|
||
return bashGlob.sync(...args); | ||
return globby.sync(pattern, ...options); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.