Class 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 for NodePackage.
    • Method Detail

      • allowLibraryDependencies

        @Stability(Experimental)
        public NodePackage.Builder allowLibraryDependencies​(Boolean allowLibraryDependencies)
        (experimental) Allow the project to include peerDependencies and bundledDependencies.

        This is normally only allowed for libraries. For apps, there's no meaning for specifying these.

        Default: true

        Parameters:
        allowLibraryDependencies - Allow the project to include peerDependencies and bundledDependencies. 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 the bin directory to your package.json file under the bin section.

        Default: true

        Parameters:
        autoDetectBin - Automatically add all executables under the bin directory to your package.json file under the bin section. 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 unless autoDetectBin is false, every executable file under bin will 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 dependencies section and bundledDependencies section of your package.json.

        The recommendation is to only specify the module name here (e.g. express). This will behave similar to yarn add or npm install in the sense that it will add the module as a dependency to your package.json file with the latest version (^). You can specify semver requirements in the same syntax passed to npm i or yarn add (e.g. express@^2) and this will be what you package.json will 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 to yarn add or npm install in the sense that it will add the module as a dependency to your package.json file with the latest version (^). You can specify semver requirements in the same syntax passed to npm i or yarn add (e.g. express@^2) and this will be what you package.json will 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 to yarn add or npm install in the sense that it will add the module as a dependency to your package.json file with the latest version (^). You can specify semver requirements in the same syntax passed to npm i or yarn add (e.g. express@^2) and this will be what you package.json will 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 (main in package.json).

        Set to an empty string to not include main in your package.json

        Default: "lib/index.js"

        Parameters:
        entrypoint - Module entrypoint (main in package.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 in package.json.

        Parameters:
        keywords - Keywords to include in package.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 licensed option 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 via engines (inclusive).

        Default: - no max

        Parameters:
        maxNodeVersion - Minimum node.js version to require via engines (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.json engines (inclusive).

        Default: - no "engines" specified

        Parameters:
        minNodeVersion - Minimum Node.js version to require via package.json engines (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 Release and Publisher components are using publib to 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.
        use npmRegistryUrl instead
        (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 for peerDeps.

        Parameters:
        peerDependencyOptions - Options for peerDeps. 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_modules tree 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.pinnedDevDependency is 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.
        use project.addTask() or package.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:
        build in interface software.amazon.jsii.Builder<NodePackage>
        Returns:
        a newly built instance of NodePackage.