Skip to content

Commit

Permalink
fix sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
aayushRedHat committed Dec 14, 2023
1 parent bebee11 commit 678ceec
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Generator {
const options = arguments[arguments.length - 1];
const invalidOptions = getInvalidOptions(GENERATOR_OPTIONS, options || []);
if (invalidOptions.length) throw new Error(`These options are not supported by the generator: ${invalidOptions.join(', ')}`);
if (options && options.registry) {
if (options?.registry) {
const invalidRegOptions = getInvalidOptions(REGISTRY_OPTIONS, options.registry || []);
invalidRegOptions(invalidOptions)
}
Expand Down Expand Up @@ -565,11 +565,13 @@ class Generator {
const arbOptions = {
path: ROOT_DIR,
};

if (this.registry) {
if (this.registry.url) arbOptions.registry = this.registry.url;
if (this.registry.username) arbOptions.username = this.registry.username;
if (this.registry.password) arbOptions.password = this.registry.password;
if (this.registry.token) arbOptions.token = this.registry.token;

arbOptions.registry = this.registry.url ?? arbOptions.registry;
arbOptions.username = this.registry.username ?? arbOptions.username;
arbOptions.password = this.registry.password ?? arbOptions.password;
arbOptions.token = this.registry.token ?? arbOptions.token;
}
const arb = new Arborist(arbOptions)

Expand Down

0 comments on commit 678ceec

Please sign in to comment.