Skip to content

Commit a38b1c7

Browse files
committed
Add some parameter validation logic into rush publish action
1 parent 1172b9a commit a38b1c7

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎apps/rush-lib/src/cli/actions/PublishAction.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ export default class PublishAction extends BaseRushAction {
179179
return Promise.resolve();
180180
}
181181

182+
this._validate();
183+
182184
if (this._includeAll.value) {
183185
this._publishAll(allPackages);
184186
} else {
@@ -190,6 +192,21 @@ export default class PublishAction extends BaseRushAction {
190192
return Promise.resolve();
191193
}
192194

195+
/**
196+
* Validate some input parameters
197+
*/
198+
private _validate(): void {
199+
if (this._pack.value && !this._includeAll.value) {
200+
throw new Error('--pack can only be used with --include-all');
201+
}
202+
if (this._releaseFolder.value && !this._pack.value) {
203+
throw new Error(`--release-folder can only be used with --pack`);
204+
}
205+
if (this._registryUrl.value && this._pack.value) {
206+
throw new Error(`--registry cannot be used with --pack`);
207+
}
208+
}
209+
193210
private _publishChanges(allPackages: Map<string, RushConfigurationProject>): void {
194211
const changeManager: ChangeManager = new ChangeManager(this.rushConfiguration);
195212
changeManager.load(this.rushConfiguration.changesFolder,

0 commit comments

Comments
 (0)