Class Dependencies
- java.lang.Object
-
- software.amazon.jsii.JsiiObject
-
- software.constructs.Construct
-
- io.github.cdklabs.projen.Component
-
- io.github.cdklabs.projen.Dependencies
-
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.96.0 (build 921e240)", date="2024-03-28T21:16:42.727Z") @Stability(Experimental) public class Dependencies extends Component
(experimental) TheDependenciescomponent is responsible to track the list of dependencies a project has, and then used by project types as the model for rendering project-specific dependency manifests such as the dependencies sectionpackage.jsonfiles.To add a dependency you can use a project-type specific API such as
nodeProject.addDeps()or use the generic API ofproject.deps:
-
-
Field Summary
Fields Modifier and Type Field Description static StringMANIFEST_FILE(experimental) The project-relative path of the deps manifest file.
-
Constructor Summary
Constructors Modifier Constructor Description Dependencies(Project project)(experimental) Adds a dependencies component to the project.protectedDependencies(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)protectedDependencies(software.amazon.jsii.JsiiObjectRef objRef)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DependencyaddDependency(String spec, DependencyType type)(experimental) Adds a dependency to this project.DependencyaddDependency(String spec, DependencyType type, Map<String,Object> metadata)(experimental) Adds a dependency to this project.List<Dependency>getAll()(experimental) A copy of all dependencies recorded for this project.DependencygetDependency(String name)(experimental) Returns a dependency by name.DependencygetDependency(String name, DependencyType type)(experimental) Returns a dependency by name.static DependencyCoordinatesparseDependency(String spec)(experimental) Returns the coordinates of a dependency spec.voidremoveDependency(String name)(experimental) Removes a dependency.voidremoveDependency(String name, DependencyType type)(experimental) Removes a dependency.DependencytryGetDependency(String name)(experimental) Returns a dependency by name.DependencytryGetDependency(String name, DependencyType type)(experimental) Returns a dependency by name.-
Methods inherited from class io.github.cdklabs.projen.Component
getProject, isComponent, postSynthesize, preSynthesize, synthesize
-
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
-
-
-
-
Field Detail
-
MANIFEST_FILE
@Stability(Experimental) public static final String MANIFEST_FILE
(experimental) The project-relative path of the deps manifest file.
-
-
Constructor Detail
-
Dependencies
protected Dependencies(software.amazon.jsii.JsiiObjectRef objRef)
-
Dependencies
protected Dependencies(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
-
Dependencies
@Stability(Experimental) public Dependencies(@NotNull Project project)(experimental) Adds a dependencies component to the project.- Parameters:
project- The parent project. This parameter is required.
-
-
Method Detail
-
parseDependency
@Stability(Experimental) @NotNull public static DependencyCoordinates parseDependency(@NotNull String spec)
(experimental) Returns the coordinates of a dependency spec.Given
foo@^3.4.0returns{ name: "foo", version: "^3.4.0" }. Givenbar@npm:@bar/legacyreturns{ name: "bar", version: "npm:@bar/legacy" }.- Parameters:
spec- This parameter is required.
-
addDependency
@Stability(Experimental) @NotNull public Dependency addDependency(@NotNull String spec, @NotNull DependencyType type, @Nullable Map<String,Object> metadata)
(experimental) Adds a dependency to this project.- Parameters:
spec- The dependency spec in the formatMODULE[@VERSION]whereMODULEis the package-manager-specific module name andVERSIONis an optional semantic version requirement (e.g.^3.4.0). This parameter is required.type- The type of the dependency. This parameter is required.metadata-
-
addDependency
@Stability(Experimental) @NotNull public Dependency addDependency(@NotNull String spec, @NotNull DependencyType type)
(experimental) Adds a dependency to this project.- Parameters:
spec- The dependency spec in the formatMODULE[@VERSION]whereMODULEis the package-manager-specific module name andVERSIONis an optional semantic version requirement (e.g.^3.4.0). This parameter is required.type- The type of the dependency. This parameter is required.
-
getDependency
@Stability(Experimental) @NotNull public Dependency getDependency(@NotNull String name, @Nullable DependencyType type)
(experimental) Returns a dependency by name.Fails if there is no dependency defined by that name or if
typeis not provided and there is more then one dependency type for this dependency.- Parameters:
name- The name of the dependency. This parameter is required.type- The dependency type.- Returns:
- a copy (cannot be modified)
-
getDependency
@Stability(Experimental) @NotNull public Dependency getDependency(@NotNull String name)
(experimental) Returns a dependency by name.Fails if there is no dependency defined by that name or if
typeis not provided and there is more then one dependency type for this dependency.- Parameters:
name- The name of the dependency. This parameter is required.- Returns:
- a copy (cannot be modified)
-
removeDependency
@Stability(Experimental) public void removeDependency(@NotNull String name, @Nullable DependencyType type)(experimental) Removes a dependency.- Parameters:
name- The name of the module to remove (without the version). This parameter is required.type- The dependency type.
-
removeDependency
@Stability(Experimental) public void removeDependency(@NotNull String name)(experimental) Removes a dependency.- Parameters:
name- The name of the module to remove (without the version). This parameter is required.
-
tryGetDependency
@Stability(Experimental) @Nullable public Dependency tryGetDependency(@NotNull String name, @Nullable DependencyType type)
(experimental) Returns a dependency by name.Returns
undefinedif there is no dependency defined by that name or iftypeis not provided and there is more then one dependency type for this dependency.- Parameters:
name- The name of the dependency. This parameter is required.type- The dependency type.- Returns:
- a copy (cannot be modified) or undefined if there is no match
-
tryGetDependency
@Stability(Experimental) @Nullable public Dependency tryGetDependency(@NotNull String name)
(experimental) Returns a dependency by name.Returns
undefinedif there is no dependency defined by that name or iftypeis not provided and there is more then one dependency type for this dependency.- Parameters:
name- The name of the dependency. This parameter is required.- Returns:
- a copy (cannot be modified) or undefined if there is no match
-
getAll
@Stability(Experimental) @NotNull public List<Dependency> getAll()
(experimental) A copy of all dependencies recorded for this project.The list is sorted by type->name->version
-
-