Skip to content

Commit 0c313d2

Browse files
authored
Allow skipping packages in a release (#1505)
* allow skipping packages in a release * [AUTOMATED]: Prettier Code Styling * add lerna issue link * [AUTOMATED]: Prettier Code Styling
1 parent 27e683f commit 0c313d2

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

scripts/release/cli.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,15 @@ const { argv } = require('yargs');
137137
);
138138
versions = await prompt(versionUpdates);
139139

140+
/**
141+
* Remove the skipped packages
142+
*/
143+
Object.keys(versions).forEach(name => {
144+
if (versions[name] === 'skip') {
145+
delete versions[name];
146+
}
147+
});
148+
140149
/**
141150
* Verify that the versions selected are correct
142151
*/

scripts/release/utils/inquirer.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,30 @@ exports.packageVersionUpdate = async (package, releaseType) => {
105105
];
106106
}
107107

108+
/**
109+
* Skip a pacakage
110+
*
111+
* Reason:
112+
* Lerna doesn't work well with merge commits and may mark a package as changed
113+
* even though it's not changed except for the version bump from the last release.
114+
* https://github.com/lerna/lerna/issues/1377
115+
*
116+
* Background:
117+
* We introduced a release branch as a staging area for the next release
118+
* while development continues in the master branch. Eventually we publish the packages from
119+
* the release branch and make the version bumps in package.json and tags. It creats a merge
120+
* commit in the master branch when we merge the release branch back.
121+
*
122+
* Only skip a package if you are sure Lerna listed the package in mistake.
123+
* If you skipped a package, it won't show up in the candidate list going forward
124+
* unless additional changes are made in this package.
125+
*
126+
*/
127+
choices.push({
128+
name: chalk`Skip`,
129+
value: 'skip'
130+
});
131+
108132
/**
109133
* Create prompts
110134
*/

0 commit comments

Comments
 (0)