Class NodePackage.Builder
- java.lang.Object
-
- io.github.cdklabs.projen.javascript.NodePackage.Builder
-
- All Implemented Interfaces:
software.amazon.jsii.Builder<NodePackage>
- Enclosing class:
- NodePackage
@Stability(Experimental) public static final class NodePackage.Builder extends Object implements software.amazon.jsii.Builder<NodePackage>
(experimental) A fluent builder forNodePackage.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description NodePackage.BuilderallowLibraryDependencies(Boolean allowLibraryDependencies)(experimental) Allow the project to includepeerDependenciesandbundledDependencies.NodePackage.BuilderauthorEmail(String authorEmail)(experimental) Author's e-mail.NodePackage.BuilderauthorName(String authorName)(experimental) Author's name.NodePackage.BuilderauthorOrganization(Boolean authorOrganization)(experimental) Is the author an organization.NodePackage.BuilderauthorUrl(String authorUrl)(experimental) Author's URL / Website.NodePackage.BuilderautoDetectBin(Boolean autoDetectBin)(experimental) Automatically add all executables under thebindirectory to yourpackage.jsonfile under thebinsection.NodePackage.Builderbin(Map<String,String> bin)(experimental) Binary programs vended with your module.NodePackage.BuilderbugsEmail(String bugsEmail)(experimental) The email address to which issues should be reported.NodePackage.BuilderbugsUrl(String bugsUrl)(experimental) The url to your project's issue tracker.NodePackagebuild()NodePackage.BuilderbundledDeps(List<String> bundledDeps)(experimental) List of dependencies to bundle into this module.NodePackage.BuildercodeArtifactOptions(CodeArtifactOptions codeArtifactOptions)(experimental) Options for npm packages using AWS CodeArtifact.static NodePackage.Buildercreate(Project project)NodePackage.Builderdeps(List<String> deps)(experimental) Runtime dependencies of this module.NodePackage.Builderdescription(String description)(experimental) The description is just a string that helps people understand the purpose of the package.NodePackage.BuilderdevDeps(List<String> devDeps)(experimental) Build dependencies for this module.NodePackage.Builderentrypoint(String entrypoint)(experimental) Module entrypoint (maininpackage.json).NodePackage.Builderhomepage(String homepage)(experimental) Package's Homepage / Website.NodePackage.Builderkeywords(List<String> keywords)(experimental) Keywords to include inpackage.json.NodePackage.Builderlicense(String license)(experimental) License's SPDX identifier.NodePackage.Builderlicensed(Boolean licensed)(experimental) Indicates if a license should be added.NodePackage.BuildermaxNodeVersion(String maxNodeVersion)(experimental) Minimum node.js version to require viaengines(inclusive).NodePackage.BuilderminNodeVersion(String minNodeVersion)(experimental) Minimum Node.js version to require via package.jsonengines(inclusive).NodePackage.BuildernpmAccess(NpmAccess npmAccess)(experimental) Access level of the npm package.NodePackage.BuildernpmProvenance(Boolean npmProvenance)(experimental) Should provenance statements be generated when the package is published.NodePackage.BuildernpmRegistry(String npmRegistry)Deprecated.usenpmRegistryUrlinsteadNodePackage.BuildernpmRegistryUrl(String npmRegistryUrl)(experimental) The base URL of the npm package registry.NodePackage.BuildernpmTokenSecret(String npmTokenSecret)(experimental) GitHub secret which contains the NPM token to use when publishing packages.NodePackage.BuilderpackageManager(NodePackageManager packageManager)(experimental) The Node Package Manager used to execute scripts.NodePackage.BuilderpackageName(String packageName)(experimental) The "name" in package.json.NodePackage.BuilderpeerDependencyOptions(PeerDependencyOptions peerDependencyOptions)(experimental) Options forpeerDeps.NodePackage.BuilderpeerDeps(List<String> peerDeps)(experimental) Peer dependencies for this module.NodePackage.BuilderpnpmVersion(String pnpmVersion)(experimental) The version of PNPM to use if using PNPM as a package manager.NodePackage.Builderrepository(String repository)(experimental) The repository is the location where the actual code for your package lives.NodePackage.BuilderrepositoryDirectory(String repositoryDirectory)(experimental) If the package.json for your package is not in the root directory (for example if it is part of a monorepo), you can specify the directory in which it lives.NodePackage.BuilderscopedPackagesOptions(List<? extends ScopedPackagesOptions> scopedPackagesOptions)(experimental) Options for privately hosted scoped packages.NodePackage.Builderscripts(Map<String,String> scripts)Deprecated.useproject.addTask()orpackage.setScript()NodePackage.Builderstability(String stability)(experimental) Package's Stability.NodePackage.BuilderyarnBerryOptions(YarnBerryOptions yarnBerryOptions)(experimental) Options for Yarn Berry.
-
-
-
Method Detail
-
create
@Stability(Experimental) public static NodePackage.Builder create(Project project)
- Parameters:
project- This parameter is required.- Returns:
- a new instance of
NodePackage.Builder.
-
allowLibraryDependencies
@Stability(Experimental) public NodePackage.Builder allowLibraryDependencies(Boolean allowLibraryDependencies)
(experimental) Allow the project to includepeerDependenciesandbundledDependencies.This is normally only allowed for libraries. For apps, there's no meaning for specifying these.
Default: true
- Parameters:
allowLibraryDependencies- Allow the project to includepeerDependenciesandbundledDependencies. This parameter is required.- Returns:
this
-
authorEmail
@Stability(Experimental) public NodePackage.Builder authorEmail(String authorEmail)
(experimental) Author's e-mail.- Parameters:
authorEmail- Author's e-mail. This parameter is required.- Returns:
this
-
authorName
@Stability(Experimental) public NodePackage.Builder authorName(String authorName)
(experimental) Author's name.- Parameters:
authorName- Author's name. This parameter is required.- Returns:
this
-
authorOrganization
@Stability(Experimental) public NodePackage.Builder authorOrganization(Boolean authorOrganization)
(experimental) Is the author an organization.- Parameters:
authorOrganization- Is the author an organization. This parameter is required.- Returns:
this
-
authorUrl
@Stability(Experimental) public NodePackage.Builder authorUrl(String authorUrl)
(experimental) Author's URL / Website.- Parameters:
authorUrl- Author's URL / Website. This parameter is required.- Returns:
this
-
autoDetectBin
@Stability(Experimental) public NodePackage.Builder autoDetectBin(Boolean autoDetectBin)
(experimental) Automatically add all executables under thebindirectory to yourpackage.jsonfile under thebinsection.Default: true
- Parameters:
autoDetectBin- Automatically add all executables under thebindirectory to yourpackage.jsonfile under thebinsection. This parameter is required.- Returns:
this
-
bin
@Stability(Experimental) public NodePackage.Builder bin(Map<String,String> bin)
(experimental) Binary programs vended with your module.You can use this option to add/customize how binaries are represented in your
package.json, but unlessautoDetectBinisfalse, every executable file underbinwill automatically be added to this section.- Parameters:
bin- Binary programs vended with your module. This parameter is required.- Returns:
this
-
bugsEmail
@Stability(Experimental) public NodePackage.Builder bugsEmail(String bugsEmail)
(experimental) The email address to which issues should be reported.- Parameters:
bugsEmail- The email address to which issues should be reported. This parameter is required.- Returns:
this
-
bugsUrl
@Stability(Experimental) public NodePackage.Builder bugsUrl(String bugsUrl)
(experimental) The url to your project's issue tracker.- Parameters:
bugsUrl- The url to your project's issue tracker. This parameter is required.- Returns:
this
-
bundledDeps
@Stability(Experimental) public NodePackage.Builder bundledDeps(List<String> bundledDeps)
(experimental) List of dependencies to bundle into this module.These modules will be added both to the
dependenciessection andbundledDependenciessection of yourpackage.json.The recommendation is to only specify the module name here (e.g.
express). This will behave similar toyarn addornpm installin the sense that it will add the module as a dependency to yourpackage.jsonfile with the latest version (^). You can specify semver requirements in the same syntax passed tonpm ioryarn add(e.g.express@^2) and this will be what youpackage.jsonwill eventually include.- Parameters:
bundledDeps- List of dependencies to bundle into this module. This parameter is required.- Returns:
this
-
codeArtifactOptions
@Stability(Experimental) public NodePackage.Builder codeArtifactOptions(CodeArtifactOptions codeArtifactOptions)
(experimental) Options for npm packages using AWS CodeArtifact.This is required if publishing packages to, or installing scoped packages from AWS CodeArtifact
Default: - undefined
- Parameters:
codeArtifactOptions- Options for npm packages using AWS CodeArtifact. This parameter is required.- Returns:
this
-
deps
@Stability(Experimental) public NodePackage.Builder deps(List<String> deps)
(experimental) Runtime dependencies of this module.The recommendation is to only specify the module name here (e.g.
express). This will behave similar toyarn addornpm installin the sense that it will add the module as a dependency to yourpackage.jsonfile with the latest version (^). You can specify semver requirements in the same syntax passed tonpm ioryarn add(e.g.express@^2) and this will be what youpackage.jsonwill eventually include.Default: []
Example:
[ 'express', 'lodash', 'foo@^2' ]
- Parameters:
deps- Runtime dependencies of this module. This parameter is required.- Returns:
this
-
description
@Stability(Experimental) public NodePackage.Builder description(String description)
(experimental) The description is just a string that helps people understand the purpose of the package.It can be used when searching for packages in a package manager as well. See https://classic.yarnpkg.com/en/docs/package-json/#toc-description
- Parameters:
description- The description is just a string that helps people understand the purpose of the package. This parameter is required.- Returns:
this
-
devDeps
@Stability(Experimental) public NodePackage.Builder devDeps(List<String> devDeps)
(experimental) Build dependencies for this module.These dependencies will only be available in your build environment but will not be fetched when this module is consumed.
The recommendation is to only specify the module name here (e.g.
express). This will behave similar toyarn addornpm installin the sense that it will add the module as a dependency to yourpackage.jsonfile with the latest version (^). You can specify semver requirements in the same syntax passed tonpm ioryarn add(e.g.express@^2) and this will be what youpackage.jsonwill eventually include.Default: []
Example:
[ 'typescript', '@types/express' ]
- Parameters:
devDeps- Build dependencies for this module. This parameter is required.- Returns:
this
-
entrypoint
@Stability(Experimental) public NodePackage.Builder entrypoint(String entrypoint)
(experimental) Module entrypoint (maininpackage.json).Set to an empty string to not include
mainin your package.jsonDefault: "lib/index.js"
- Parameters:
entrypoint- Module entrypoint (maininpackage.json). This parameter is required.- Returns:
this
-
homepage
@Stability(Experimental) public NodePackage.Builder homepage(String homepage)
(experimental) Package's Homepage / Website.- Parameters:
homepage- Package's Homepage / Website. This parameter is required.- Returns:
this
-
keywords
@Stability(Experimental) public NodePackage.Builder keywords(List<String> keywords)
(experimental) Keywords to include inpackage.json.- Parameters:
keywords- Keywords to include inpackage.json. This parameter is required.- Returns:
this
-
license
@Stability(Experimental) public NodePackage.Builder license(String license)
(experimental) License's SPDX identifier.See https://github.com/projen/projen/tree/main/license-text for a list of supported licenses. Use the
licensedoption if you want to no license to be specified.Default: "Apache-2.0"
- Parameters:
license- License's SPDX identifier. This parameter is required.- Returns:
this
-
licensed
@Stability(Experimental) public NodePackage.Builder licensed(Boolean licensed)
(experimental) Indicates if a license should be added.Default: true
- Parameters:
licensed- Indicates if a license should be added. This parameter is required.- Returns:
this
-
maxNodeVersion
@Stability(Experimental) public NodePackage.Builder maxNodeVersion(String maxNodeVersion)
(experimental) Minimum node.js version to require viaengines(inclusive).Default: - no max
- Parameters:
maxNodeVersion- Minimum node.js version to require viaengines(inclusive). This parameter is required.- Returns:
this
-
minNodeVersion
@Stability(Experimental) public NodePackage.Builder minNodeVersion(String minNodeVersion)
(experimental) Minimum Node.js version to require via package.jsonengines(inclusive).Default: - no "engines" specified
- Parameters:
minNodeVersion- Minimum Node.js version to require via package.jsonengines(inclusive). This parameter is required.- Returns:
this
-
npmAccess
@Stability(Experimental) public NodePackage.Builder npmAccess(NpmAccess npmAccess)
(experimental) Access level of the npm package.Default: - for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`.
- Parameters:
npmAccess- Access level of the npm package. This parameter is required.- Returns:
this
-
npmProvenance
@Stability(Experimental) public NodePackage.Builder npmProvenance(Boolean npmProvenance)
(experimental) Should provenance statements be generated when the package is published.A supported package manager is required to publish a package with npm provenance statements and you will need to use a supported CI/CD provider.
Note that the projen
ReleaseandPublishercomponents are usingpublibto publish packages, which is using npm internally and supports provenance statements independently of the package manager used.Default: - true for public packages, false otherwise
- Parameters:
npmProvenance- Should provenance statements be generated when the package is published. This parameter is required.- Returns:
this- See Also:
- https://docs.npmjs.com/generating-provenance-statements
-
npmRegistry
@Stability(Deprecated) @Deprecated public NodePackage.Builder npmRegistry(String npmRegistry)
Deprecated.usenpmRegistryUrlinstead(deprecated) The host name of the npm registry to publish to.Cannot be set together with
npmRegistryUrl.- Parameters:
npmRegistry- The host name of the npm registry to publish to. This parameter is required.- Returns:
this
-
npmRegistryUrl
@Stability(Experimental) public NodePackage.Builder npmRegistryUrl(String npmRegistryUrl)
(experimental) The base URL of the npm package registry.Must be a URL (e.g. start with "https://" or "http://")
Default: "https://registry.npmjs.org"
- Parameters:
npmRegistryUrl- The base URL of the npm package registry. This parameter is required.- Returns:
this
-
npmTokenSecret
@Stability(Experimental) public NodePackage.Builder npmTokenSecret(String npmTokenSecret)
(experimental) GitHub secret which contains the NPM token to use when publishing packages.Default: "NPM_TOKEN"
- Parameters:
npmTokenSecret- GitHub secret which contains the NPM token to use when publishing packages. This parameter is required.- Returns:
this
-
packageManager
@Stability(Experimental) public NodePackage.Builder packageManager(NodePackageManager packageManager)
(experimental) The Node Package Manager used to execute scripts.Default: NodePackageManager.YARN_CLASSIC
- Parameters:
packageManager- The Node Package Manager used to execute scripts. This parameter is required.- Returns:
this
-
packageName
@Stability(Experimental) public NodePackage.Builder packageName(String packageName)
(experimental) The "name" in package.json.Default: - defaults to project name
- Parameters:
packageName- The "name" in package.json. This parameter is required.- Returns:
this
-
peerDependencyOptions
@Stability(Experimental) public NodePackage.Builder peerDependencyOptions(PeerDependencyOptions peerDependencyOptions)
(experimental) Options forpeerDeps.- Parameters:
peerDependencyOptions- Options forpeerDeps. This parameter is required.- Returns:
this
-
peerDeps
@Stability(Experimental) public NodePackage.Builder peerDeps(List<String> peerDeps)
(experimental) Peer dependencies for this module.Dependencies listed here are required to be installed (and satisfied) by the consumer of this library. Using peer dependencies allows you to ensure that only a single module of a certain library exists in the
node_modulestree of your consumers.Note that prior to npm@7, peer dependencies are not automatically installed, which means that adding peer dependencies to a library will be a breaking change for your customers.
Unless
peerDependencyOptions.pinnedDevDependencyis disabled (it is enabled by default), projen will automatically add a dev dependency with a pinned version for each peer dependency. This will ensure that you build & test your module against the lowest peer version required.Default: []
- Parameters:
peerDeps- Peer dependencies for this module. This parameter is required.- Returns:
this
-
pnpmVersion
@Stability(Experimental) public NodePackage.Builder pnpmVersion(String pnpmVersion)
(experimental) The version of PNPM to use if using PNPM as a package manager.Default: "7"
- Parameters:
pnpmVersion- The version of PNPM to use if using PNPM as a package manager. This parameter is required.- Returns:
this
-
repository
@Stability(Experimental) public NodePackage.Builder repository(String repository)
(experimental) The repository is the location where the actual code for your package lives.See https://classic.yarnpkg.com/en/docs/package-json/#toc-repository
- Parameters:
repository- The repository is the location where the actual code for your package lives. This parameter is required.- Returns:
this
-
repositoryDirectory
@Stability(Experimental) public NodePackage.Builder repositoryDirectory(String repositoryDirectory)
(experimental) If the package.json for your package is not in the root directory (for example if it is part of a monorepo), you can specify the directory in which it lives.- Parameters:
repositoryDirectory- If the package.json for your package is not in the root directory (for example if it is part of a monorepo), you can specify the directory in which it lives. This parameter is required.- Returns:
this
-
scopedPackagesOptions
@Stability(Experimental) public NodePackage.Builder scopedPackagesOptions(List<? extends ScopedPackagesOptions> scopedPackagesOptions)
(experimental) Options for privately hosted scoped packages.Default: - fetch all scoped packages from the public npm registry
- Parameters:
scopedPackagesOptions- Options for privately hosted scoped packages. This parameter is required.- Returns:
this
-
scripts
@Stability(Deprecated) @Deprecated public NodePackage.Builder scripts(Map<String,String> scripts)
Deprecated.useproject.addTask()orpackage.setScript()(deprecated) npm scripts to include.If a script has the same name as a standard script, the standard script will be overwritten. Also adds the script as a task.
Default: {}
- Parameters:
scripts- npm scripts to include. This parameter is required.- Returns:
this
-
stability
@Stability(Experimental) public NodePackage.Builder stability(String stability)
(experimental) Package's Stability.- Parameters:
stability- Package's Stability. This parameter is required.- Returns:
this
-
yarnBerryOptions
@Stability(Experimental) public NodePackage.Builder yarnBerryOptions(YarnBerryOptions yarnBerryOptions)
(experimental) Options for Yarn Berry.Default: - Yarn Berry v4 with all default options
- Parameters:
yarnBerryOptions- Options for Yarn Berry. This parameter is required.- Returns:
this
-
build
@Stability(Experimental) public NodePackage build()
- Specified by:
buildin interfacesoftware.amazon.jsii.Builder<NodePackage>- Returns:
- a newly built instance of
NodePackage.
-
-