forked from jhipster/jhipster-lite
-
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.
Angular: use single version in dependencies
Fixes jhipster#3836
- Loading branch information
Showing
7 changed files
with
182 additions
and
26 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
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
101 changes: 97 additions & 4 deletions
101
src/main/java/tech/jhipster/lite/module/domain/packagejson/PackageJsonDependency.java
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,103 @@ | ||
package tech.jhipster.lite.module.domain.packagejson; | ||
|
||
import java.util.Objects; | ||
import java.util.Optional; | ||
import tech.jhipster.lite.shared.error.domain.Assert; | ||
|
||
public record PackageJsonDependency(PackageName packageName, VersionSource versionSource) { | ||
public PackageJsonDependency { | ||
Assert.notNull("packageName", packageName); | ||
Assert.notNull("versionSource", versionSource); | ||
public final class PackageJsonDependency { | ||
|
||
private final PackageName packageName; | ||
private final VersionSource versionSource; | ||
private final Optional<PackageName> versionPackageName; | ||
|
||
private PackageJsonDependency(PackageJsonDependencyBuilder builder) { | ||
Assert.notNull("packageName", builder.packageName); | ||
Assert.notNull("versionSource", builder.versionSource); | ||
this.packageName = builder.packageName; | ||
this.versionSource = builder.versionSource; | ||
this.versionPackageName = Optional.ofNullable(builder.versionPackageName); | ||
} | ||
|
||
public PackageName packageName() { | ||
return packageName; | ||
} | ||
|
||
public VersionSource versionSource() { | ||
return versionSource; | ||
} | ||
|
||
public Optional<PackageName> versionPackageName() { | ||
return versionPackageName; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (obj == this) { | ||
return true; | ||
} | ||
if (obj == null || obj.getClass() != this.getClass()) { | ||
return false; | ||
} | ||
var that = (PackageJsonDependency) obj; | ||
return Objects.equals(this.packageName, that.packageName) && Objects.equals(this.versionSource, that.versionSource); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(packageName, versionSource); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "PackageJsonDependency[" + "packageName=" + packageName + ", " + "versionSource=" + versionSource + ']'; | ||
} | ||
|
||
public static PackageJsonDependencyBuilder builder() { | ||
return new PackageJsonDependencyBuilder(); | ||
} | ||
|
||
public static class PackageJsonDependencyBuilder | ||
implements PackageJsonDependencyPackageNameBuilder, PackageJsonDependencyVersionSourceBuilder, PackageJsonDependencyOptionalBuilder { | ||
|
||
private PackageName packageName; | ||
private VersionSource versionSource; | ||
private PackageName versionPackageName; | ||
|
||
@Override | ||
public PackageJsonDependencyVersionSourceBuilder packageName(PackageName packageName) { | ||
this.packageName = packageName; | ||
return this; | ||
} | ||
|
||
@Override | ||
public PackageJsonDependencyOptionalBuilder versionSource(VersionSource versionSource) { | ||
this.versionSource = versionSource; | ||
return this; | ||
} | ||
|
||
@Override | ||
public PackageJsonDependencyOptionalBuilder versionPackageName(PackageName versionPackageName) { | ||
this.versionPackageName = versionPackageName; | ||
return this; | ||
} | ||
|
||
@Override | ||
public PackageJsonDependency build() { | ||
return new PackageJsonDependency(this); | ||
} | ||
} | ||
|
||
public interface PackageJsonDependencyPackageNameBuilder { | ||
PackageJsonDependencyVersionSourceBuilder packageName(PackageName packageName); | ||
} | ||
|
||
public interface PackageJsonDependencyVersionSourceBuilder { | ||
PackageJsonDependencyOptionalBuilder versionSource(VersionSource versionSource); | ||
} | ||
|
||
public interface PackageJsonDependencyOptionalBuilder { | ||
PackageJsonDependencyOptionalBuilder versionPackageName(PackageName versionPackageName); | ||
|
||
PackageJsonDependency build(); | ||
} | ||
} |
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
7 changes: 0 additions & 7 deletions
7
src/main/resources/generator/dependencies/angular/package.json
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