projen

API Reference

Classes

Name Description
Component Represents a project component.
Dependencies The Dependencies component 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 section package.json files.
DevEnvironmentDockerImage Options for specifying the Docker image of the container.
DockerCompose Create a docker-compose YAML file.
DockerComposeService A docker-compose service.
FileBase No description
GitAttributesFile Assign attributes to file names in a git repository.
Gitpod The Gitpod component which emits .gitpod.yml.
IgnoreFile No description
IniFile Represents an INI file.
JsonFile Represents a JSON file.
JsonPatch Utility for applying RFC-6902 JSON-Patch to a document.
License No description
Logger Project-level logging utilities.
Makefile Minimal Makefile.
ObjectFile Represents an Object file.
Project Base project.
ProjectBuild Manages a standard build process for all projects.
Projects Programmatic API for projen.
Projenrc Sets up a project to use JSON for projenrc.
Renovatebot Defines renovatebot configuration for projen project.
SampleDir Renders the given files into the directory if the directory does not exist.
SampleFile Produces a file with the given contents but only once, if the file doesn’t already exist.
SampleReadme Represents a README.md sample file. You are expected to manage this file after creation.
Semver No description
SourceCode Represents a source file.
Task A task that can be performed on the project.
TaskRuntime The runtime component of the tasks engine.
Tasks Defines project tasks.
Testing A Testing static class with a .synth helper for getting a snapshots of construct outputs. Useful for snapshot testing with Jest.
TextFile A text file.
TomlFile Represents a TOML file.
Version No description
XmlFile Represents an XML file.
YamlFile Represents a YAML file.
awscdk.AutoDiscover Discovers and creates integration tests and lambdas from code in the project’s source and test trees.
awscdk.AwsCdkConstructLibrary AWS CDK construct library project.
awscdk.AwsCdkDeps Manages dependencies on the AWS CDK.
awscdk.AwsCdkDepsJava Manages dependencies on the AWS CDK for Java projects.
awscdk.AwsCdkDepsJs Manages dependencies on the AWS CDK for Node.js projects.
awscdk.AwsCdkDepsPy Manages dependencies on the AWS CDK for Python projects.
awscdk.AwsCdkJavaApp AWS CDK app in Java.
awscdk.AwsCdkPythonApp AWS CDK app in Python.
awscdk.AwsCdkTypeScriptApp AWS CDK app in TypeScript.
awscdk.CdkConfig Represents cdk.json file.
awscdk.CdkTasks Adds standard AWS CDK tasks to your project.
awscdk.ConstructLibraryAws No description
awscdk.EdgeLambdaAutoDiscover Creates edge lambdas from entry points discovered in the project’s source tree.
awscdk.IntegrationTest Cloud integration tests.
awscdk.IntegrationTestAutoDiscover Creates integration tests from entry points discovered in the test tree.
awscdk.LambdaAutoDiscover Creates lambdas from entry points discovered in the project’s source tree.
awscdk.LambdaExtension Create a Lambda Extension.
awscdk.LambdaExtensionAutoDiscover Creates Lambda Extensions from entrypoints discovered in the project’s source tree.
awscdk.LambdaFunction Generates a pre-bundled AWS Lambda function construct from handler code.
awscdk.LambdaRuntime The runtime for the AWS Lambda function.
build.BuildWorkflow No description
cdk.AutoDiscoverBase Base class for auto-discovering and creating project subcomponents.
cdk.ConstructLibrary A multi-language library for CDK constructs.
cdk.IntegrationTestAutoDiscoverBase Base class for locating integration tests in the project’s test tree.
cdk.IntegrationTestBase No description
cdk.JsiiDocgen Creates a markdown file based on the jsii manifest: - Adds a docgen script to package.json - Runs jsii-docgen after compilation - Enforces that markdown file is checked in.
cdk.JsiiProject Multi-language jsii library project.
cdk8s.AutoDiscover Automatically discovers and creates IntegrationTests from entry points found in the test tree.
cdk8s.Cdk8sDeps Manages dependencies on the CDK8s.
cdk8s.Cdk8sDepsPy No description
cdk8s.Cdk8sPythonApp CDK8s app in Python.
cdk8s.Cdk8sTypeScriptApp CDK8s app in TypeScript.
cdk8s.ConstructLibraryCdk8s CDK8s construct library project.
cdk8s.IntegrationTest CDK8S integration test.
cdk8s.IntegrationTestAutoDiscover Discovers and creates integration tests from files in the test root.
cdktf.ConstructLibraryCdktf CDKTF construct library project.
circleci.Circleci Circleci Class to manage .circleci/config.yml. Check projen’s docs for more information.
github.AutoApprove Auto approve pull requests that meet a criteria.
github.AutoMerge Sets up mergify to merging approved pull requests.
github.Dependabot Defines dependabot configuration for node projects.
github.GitHub No description
github.GitHubProject GitHub-based project.
github.GithubCredentials Represents a method of providing GitHub API access for projen workflows.
github.GithubWorkflow Workflow for GitHub.
github.Mergify No description
github.PullRequestLint Configure validations to run on GitHub pull requests.
github.PullRequestTemplate Template for GitHub pull requests.
github.Stale Warns and then closes issues and PRs that have had no activity for a specified amount of time.
github.TaskWorkflow A GitHub workflow for common build tasks within a project.
gitlab.CiConfiguration CI for GitLab.
gitlab.GitlabConfiguration A GitLab CI for the main .gitlab-ci.yml file.
gitlab.NestedConfiguration A GitLab CI for templates that are created and included in the .gitlab-ci.yml file.
java.JavaProject Java project.
java.Junit Implements JUnit-based testing.
java.MavenCompile Adds the maven-compiler plugin to a POM file and the compile task.
java.MavenPackaging Configures a maven project to produce a .jar archive with sources and javadocs.
java.MavenSample Java code sample.
java.Pom A Project Object Model or POM is the fundamental unit of work in Maven.
java.Projenrc Allows writing projenrc files in java.
javascript.Bundler Adds support for bundling JavaScript applications and dependencies into a single file.
javascript.Eslint Represents eslint configuration.
javascript.Jest Installs the following npm scripts:.
javascript.NodePackage Represents the npm package.json file.
javascript.NodeProject Node.js project.
javascript.NpmConfig File representing the local NPM config in .npmrc.
javascript.Prettier Represents prettier configuration.
javascript.Projenrc Sets up a javascript project to use TypeScript for projenrc.
javascript.TypescriptConfig No description
javascript.UpgradeDependencies Upgrade node project dependencies.
javascript.UpgradeDependenciesSchedule How often to check for new versions and raise pull requests for version upgrades.
python.Pip Manages dependencies using a requirements.txt file and the pip CLI tool.
python.Poetry Manage project dependencies, virtual environments, and packaging through the poetry CLI tool.
python.PoetryPyproject Represents configuration of a pyproject.toml file for a Poetry project.
python.Projenrc Allows writing projenrc files in python.
python.Pytest No description
python.PytestSample Python test code sample.
python.PythonProject Python project.
python.PythonSample Python code sample.
python.RequirementsFile Specifies a list of packages to be installed using pip.
python.SetupPy Python packaging script where package metadata can be placed.
python.Setuptools Manages packaging through setuptools with a setup.py script.
python.Venv Manages a virtual environment through the Python venv module.
release.Publisher Implements GitHub jobs for publishing modules to package managers.
release.Release Manages releases (currently through GitHub workflows).
release.ReleaseTrigger Used to manage release strategies.
typescript.Projenrc Sets up a typescript project to use TypeScript for projenrc.
typescript.TypeScriptAppProject TypeScript app.
typescript.TypeScriptLibraryProject No description
typescript.TypeScriptProject TypeScript project.
typescript.TypedocDocgen Adds a simple Typescript documentation generator.
vscode.DevContainer A development environment running VSCode in a container;
vscode.VsCode No description
vscode.VsCodeLaunchConfig VSCode launch configuration file (launch.json), useful for enabling in-editor debugger.
vscode.VsCodeRecommendedExtensions VS Code Workspace recommended extensions Source: https://code.visualstudio.com/docs/editor/extension-marketplace#_workspace-recommended-extensions.
vscode.VsCodeSettings VS Code Workspace settings Source: https://code.visualstudio.com/docs/getstarted/settings#_workspace-settings.
web.NextComponent No description
web.NextJsProject Next.js project without TypeScript.
web.NextJsTypeScriptProject Next.js project with TypeScript.
web.PostCss Declares a PostCSS dependency with a default config file.
web.ReactComponent No description
web.ReactProject React project without TypeScript.
web.ReactTypeDef No description
web.ReactTypeScriptProject React project with TypeScript.
web.TailwindConfig Declares a Tailwind CSS configuration file.

Structs

Name Description
CreateProjectOptions No description
Dependency Represents a project dependency.
DependencyCoordinates Coordinates of the dependency (name and version).
DepsManifest No description
DevEnvironmentOptions Base options for configuring a container-based development environment.
DockerComposeBuild Build arguments for creating a docker image.
DockerComposePortMappingOptions Options for port mappings.
DockerComposeProps Props for DockerCompose.
DockerComposeServiceDescription Description of a docker-compose.yml service.
DockerComposeServicePort A service port mapping.
DockerComposeVolumeConfig Volume configuration.
DockerComposeVolumeMount Service volume mounting information.
FileBaseOptions No description
GitpodOptions Constructor options for the Gitpod component.
GitpodPort Options for an exposed port on Gitpod.
GitpodPrebuilds Configure the Gitpod App for prebuilds.
GitpodTask Configure options for a task to be run when opening a Gitpod workspace (e.g. running tests, or starting a dev server).
IniFileOptions Options for IniFile.
InitProject Information passed from projen new to the project object when the project is first created.
JsonFileOptions Options for JsonFile.
LicenseOptions No description
LoggerOptions Options for logging utilities.
MakefileOptions Options for Makefiles.
ObjectFileOptions Options for ObjectFile.
ProjectOptions Options for Project.
ProjenrcOptions No description
RenovatebotOptions Options for Renovatebot.
ResolveOptions Resolve options.
Rule A Make rule.
SampleDirOptions SampleDir options.
SampleFileOptions Options for the SampleFile object.
SampleReadmeProps SampleReadme Properties.
SnapshotOptions Options for the Snapshot synthesis.
SourceCodeOptions Options for SourceCodeFile.
TaskCommonOptions No description
TaskOptions No description
TaskSpec Specification of a single task.
TaskStep A single step within a task.
TaskStepOptions Options for task steps.
TasksManifest Schema for tasks.json.
TextFileOptions Options for TextFile.
TomlFileOptions Options for TomlFile.
VersionOptions Options for Version.
XmlFileOptions Options for XmlFile.
YamlFileOptions Options for JsonFile.
awscdk.AutoDiscoverCommonOptions Common options for auto discovering project subcomponents.
awscdk.AutoDiscoverOptions Options for AutoDiscover.
awscdk.AwsCdkConstructLibraryOptions Options for AwsCdkConstructLibrary.
awscdk.AwsCdkDepsCommonOptions Options for AwsCdkDeps.
awscdk.AwsCdkDepsOptions No description
awscdk.AwsCdkJavaAppOptions No description
awscdk.AwsCdkPackageNames Language-specific AWS CDK package names.
awscdk.AwsCdkPythonAppOptions Options for AwsCdkPythonApp.
awscdk.AwsCdkTypeScriptAppOptions No description
awscdk.CdkConfigCommonOptions Common options for cdk.json.
awscdk.CdkConfigOptions Options for CdkJson.
awscdk.ConstructLibraryAwsOptions No description
awscdk.EdgeLambdaAutoDiscoverOptions Options for EdgeLambdaAutoDiscover.
awscdk.IntegrationTestAutoDiscoverOptions Options for IntegrationTestAutoDiscover.
awscdk.IntegrationTestCommonOptions No description
awscdk.IntegrationTestOptions Options for IntegrationTest.
awscdk.LambdaAutoDiscoverOptions Options for LambdaAutoDiscover.
awscdk.LambdaExtensionAutoDiscoverOptions Options for LambdaExtensionAutoDiscover.
awscdk.LambdaExtensionCommonOptions Common options for creating lambda extensions.
awscdk.LambdaExtensionOptions Options for creating lambda extensions.
awscdk.LambdaFunctionCommonOptions Common options for LambdaFunction.
awscdk.LambdaFunctionOptions Options for Function.
build.AddPostBuildJobCommandsOptions Options for BuildWorkflow.addPostBuildJobCommands.
build.AddPostBuildJobTaskOptions Options for BuildWorkflow.addPostBuildJobTask.
build.BuildWorkflowOptions No description
cdk.AutoDiscoverBaseOptions Options for AutoDiscoverBase.
cdk.Catalog No description
cdk.ConstructLibraryOptions No description
cdk.IntegrationTestAutoDiscoverBaseOptions Options for IntegrationTestAutoDiscoverBase.
cdk.IntegrationTestBaseOptions Options for IntegrationTest.
cdk.JsiiDocgenOptions Options for JsiiDocgen.
cdk.JsiiDotNetTarget No description
cdk.JsiiGoTarget Go target configuration.
cdk.JsiiJavaTarget No description
cdk.JsiiProjectOptions No description
cdk.JsiiPythonTarget No description
cdk8s.AutoDiscoverOptions Options for AutoDiscover.
cdk8s.Cdk8sDepsCommonOptions Options for Cdk8sDeps.
cdk8s.Cdk8sDepsOptions No description
cdk8s.Cdk8sPackageNames No description
cdk8s.Cdk8sPythonOptions Options for Cdk8sPythonApp.
cdk8s.Cdk8sTypeScriptAppOptions No description
cdk8s.ConstructLibraryCdk8sOptions No description
cdk8s.IntegrationTestAutoDiscoverOptions No description
cdk8s.IntegrationTestOptions Options for IntegrationTest.
cdktf.ConstructLibraryCdktfOptions No description
circleci.CircleCiProps Options for class {@link Circleci}.
circleci.Docker Options for docker executor.
circleci.Filter The branches key controls whether the current branch should have a schedule trigger created for it, where current branch is the branch containing the config.yml file with the trigger stanza. That is, a push on the main branch will only schedule a workflow for the main branch.
circleci.FilterConfig set an inclusive or exclusive filter.
circleci.Job A Workflow is comprised of one or more uniquely named jobs.
circleci.Machine No description
circleci.Macos CircleCI supports running jobs on macOS, to allow you to build, test, and deploy apps for macOS, iOS, tvOS and watchOS.
circleci.Matrix The matrix stanza allows you to run a parameterized job multiple times with different arguments.
circleci.PipelineParameter Parameters are declared by name under a job, command, or executor.
circleci.Run Used for invoking all command-line programs, taking either a map of configuration values, or, when called in its short-form, a string that will be used as both the command and name.
circleci.Schedule A workflow may have a schedule indicating it runs at a certain time.
circleci.StepRun Execution steps for Job.
circleci.Triggers Specifies which triggers will cause this workflow to be executed.
circleci.Workflow Used for orchestrating all jobs.
circleci.WorkflowJob A Job is part of Workflow.
github.AutoApproveOptions Options for ‘AutoApprove’.
github.AutoMergeOptions No description
github.DependabotIgnore You can use the ignore option to customize which dependencies are updated.
github.DependabotOptions No description
github.DependabotRegistry Use to add private registry support for dependabot.
github.GitHubOptions No description
github.GitHubProjectOptions Options for GitHubProject.
github.GitIdentity Represents the git identity.
github.GithubCredentialsAppOptions Options for GithubCredentials.fromApp.
github.GithubCredentialsPersonalAccessTokenOptions Options for GithubCredentials.fromPersonalAccessToken.
github.GithubWorkflowOptions Options for GithubWorkflow.
github.MergifyConditionalOperator The Mergify conditional operators that can be used are: or and and.
github.MergifyOptions No description
github.MergifyQueue No description
github.MergifyRule No description
github.PullRequestLintOptions Options for PullRequestLint.
github.PullRequestTemplateOptions Options for PullRequestTemplate.
github.SemanticTitleOptions Options for linting that PR titles follow Conventional Commits.
github.StaleBehavior Stale behavior.
github.StaleOptions Options for Stale.
github.TaskWorkflowOptions No description
gitlab.AllowFailure Exit code that are not considered failure.
gitlab.Artifacts Used to specify a list of files and directories that should be attached to the job if it succeeds.
gitlab.Assets Asset configuration for a release.
gitlab.Cache Cache Definition.
gitlab.CacheKeyFiles Use this construct to generate a new key when one or two specific files change.
gitlab.CiConfigurationOptions Options for CiConfiguration.
gitlab.Default Default settings for the CI Configuration.
gitlab.Engine The engine configuration for a secret.
gitlab.Environment The environment that a job deploys to.
gitlab.Filter Filtering options for when a job will run.
gitlab.Image Specifies the docker image to use for the job or globally for all jobs.
gitlab.Include An included YAML file.
gitlab.IncludeRule Rules allows for an array of individual rule objects to be evaluated in order, until one matches and dynamically provides attributes to the job.
gitlab.Inherit Controls inheritance of globally-defined defaults and variables.
gitlab.Job Jobs are the most fundamental element of a .gitlab-ci.yml file.
gitlab.KubernetesConfig Used to configure the kubernetes deployment for this environment.
gitlab.Link Link configuration for an asset.
gitlab.Need A jobs in a previous stage whose sole completion is needed to start the current job.
gitlab.Parallel Used to run a job multiple times in parallel in a single pipeline.
gitlab.Release Indicates that the job creates a Release.
gitlab.Reports Reports will be uploaded as artifacts, and often displayed in the Gitlab UI, such as in Merge Requests.
gitlab.Retry How many times a job is retried if it fails.
gitlab.Secret A CI/CD secret.
gitlab.Service Used to specify an additional Docker image to run scripts in.
gitlab.Trigger Trigger a multi-project or a child pipeline.
gitlab.TriggerInclude References a local file or an artifact from another job to define the pipeline configuration.
gitlab.VariableConfig Explains what the global variable is used for, what the acceptable values are.
gitlab.VaultConfig Specification for a secret provided by a HashiCorp Vault.
gitlab.Workflow Used to control pipeline behavior.
gitlab.WorkflowRule Used to control whether or not a whole pipeline is created.
java.JavaProjectCommonOptions Options for JavaProject.
java.JavaProjectOptions Options for JavaProject.
java.JunitOptions Options for Junit.
java.MavenCompileOptions Options for MavenCompile.
java.MavenPackagingOptions Options for MavenPackage.
java.MavenRepository Represents a Maven repository.
java.MavenSampleOptions No description
java.PluginExecution Plugin execution definition.
java.PluginOptions Options for Maven plugins.
java.PomOptions Options for Pom.
java.ProjenrcOptions Options for Projenrc.
javascript.AddBundleOptions Options for addBundle().
javascript.Bundle No description
javascript.BundlerOptions Options for Bundler.
javascript.BundlingOptions Options for bundling.
javascript.CodeArtifactOptions Options for publishing npm packages to AWS CodeArtifact.
javascript.CoverageThreshold No description
javascript.EslintOptions No description
javascript.EslintOverride eslint rules override.
javascript.HasteConfig No description
javascript.JestConfigOptions No description
javascript.JestOptions No description
javascript.NodePackageOptions No description
javascript.NodeProjectOptions No description
javascript.NpmConfigOptions Options to configure the local NPM config.
javascript.PeerDependencyOptions No description
javascript.PrettierOptions Options for Prettier.
javascript.PrettierOverride No description
javascript.PrettierSettings Options to set in Prettier directly or through overrides.
javascript.ProjenrcOptions No description
javascript.RenderWorkflowSetupOptions Options for renderInstallSteps().
javascript.ScopedPackagesOptions Options for scoped packages.
javascript.TypeScriptCompilerOptions No description
javascript.TypescriptConfigOptions No description
javascript.UpgradeDependenciesOptions Options for UpgradeDependencies.
javascript.UpgradeDependenciesWorkflowOptions Options for UpgradeDependencies.workflowOptions.
python.PipOptions Options for pip.
python.PoetryPyprojectOptions Poetry-specific options.
python.PoetryPyprojectOptionsWithoutDeps Poetry-specific options.
python.ProjenrcOptions Options for Projenrc.
python.PytestOptions No description
python.PytestSampleOptions Options for python test code sample.
python.PythonPackagingOptions No description
python.PythonProjectOptions Options for PythonProject.
python.PythonSampleOptions Options for python sample code.
python.RequirementsFileOptions No description
python.SetupPyOptions Fields to pass in the setup() function of setup.py.
python.VenvOptions Options for venv.
release.BranchOptions Options for a release branch.
release.CodeArtifactOptions Options for publishing packages to AWS CodeArtifact.
release.CommonPublishOptions Common publishing options.
release.GitHubReleasesPublishOptions Publishing options for GitHub releases.
release.GitPublishOptions Publishing options for Git releases.
release.GoPublishOptions Options for Go releases.
release.JsiiReleaseGo No description
release.JsiiReleaseMaven No description
release.JsiiReleaseNpm No description
release.JsiiReleaseNuget No description
release.JsiiReleasePyPi No description
release.ManualReleaseOptions No description
release.MavenPublishOptions Options for Maven releases.
release.NpmPublishOptions Options for npm release.
release.NugetPublishOptions Options for NuGet releases.
release.PublisherOptions Options for Publisher.
release.PyPiPublishOptions Options for PyPI release.
release.ReleaseOptions Options for Release.
release.ReleaseProjectOptions Project options for release.
release.ScheduledReleaseOptions No description
typescript.ProjenrcOptions No description
typescript.TypeScriptLibraryProjectOptions No description
typescript.TypeScriptProjectOptions No description
vscode.DevContainerOptions Constructor options for the DevContainer component.
vscode.Presentation VSCode launch configuration Presentation interface “using the order, group, and hidden attributes in the presentation object you can sort, group, and hide configurations and compounds in the Debug configuration dropdown and in the Debug quick pick.” Source: https://code.visualstudio.com/docs/editor/debugging#_launchjson-attributes.
vscode.ServerReadyAction VSCode launch configuration ServerReadyAction interface “if you want to open a URL in a web browser whenever the program under debugging outputs a specific message to the debug console or integrated terminal.” Source: https://code.visualstudio.com/docs/editor/debugging#_launchjson-attributes.
vscode.VsCodeLaunchConfigurationEntry Options for a ‘VsCodeLaunchConfigurationEntry’ Source: https://code.visualstudio.com/docs/editor/debugging#_launchjson-attributes.
web.NextComponentOptions No description
web.NextJsCommonProjectOptions No description
web.NextJsProjectOptions No description
web.NextJsTypeScriptProjectOptions No description
web.PostCssOptions No description
web.ReactComponentOptions No description
web.ReactProjectOptions No description
web.ReactRewireOptions No description
web.ReactTypeDefOptions No description
web.ReactTypeScriptProjectOptions No description
web.TailwindConfigOptions No description

Interfaces

Name Description
IDevEnvironment Abstract interface for container-based development environments, such as Gitpod and GitHub Codespaces.
IDockerComposeServiceName An interface providing the name of a docker compose service.
IDockerComposeVolumeBinding Volume binding information.
IDockerComposeVolumeConfig Storage for volume configuration.
IResolvable No description
IResolver API for resolving tokens when synthesizing file content.
github.IAddConditionsLater No description
github.IJobProvider No description
python.IPackageProvider No description
python.IPythonDeps No description
python.IPythonEnv No description
python.IPythonPackaging No description

Enums

Name Description
DependencyType Type of dependency.
DockerComposeProtocol Network protocol for port mapping.
GitpodOnOpen What to do when a service on a port is detected.
GitpodOpenIn Configure where in the IDE the terminal should be opened.
GitpodOpenMode Configure how the terminal should be opened relative to the previous task.
GitpodPortVisibility Whether the port visibility should be private or public.
InitProjectOptionHints Choices for how to display commented out options in projenrc files.
LogLevel Logging verbosity.
ProjectType Which type of project this is.
RenovatebotScheduleInterval How often to check for new versions and raise pull requests for version updates.
awscdk.ApprovalLevel Which approval is required when deploying CDK apps.
cdk.Stability No description
circleci.JobType A job may have a type of approval indicating it must be manually approved before downstream jobs may proceed.
circleci.JobWhen Specify when to enable or disable the step.
circleci.PipelineParameterType Pipeline parameter types.
circleci.ResourceClass The resource_class feature allows configuring CPU and RAM resources for each job.
github.DependabotRegistryType Each configuration type requires you to provide particular settings.
github.DependabotScheduleInterval How often to check for new versions and raise pull requests for version updates.
github.VersioningStrategy The strategy to use when edits manifest and lock files.
gitlab.Action Specifies what this job will do.
gitlab.CachePolicy Configure the upload and download behaviour of a cache.
gitlab.CacheWhen Configure when artifacts are uploaded depended on job status.
gitlab.DefaultElement No description
gitlab.DeploymentTier Explicitly specifies the tier of the deployment environment if non-standard environment name is used.
gitlab.JobWhen Describes the conditions for when to run the job.
gitlab.KubernetesEnum Filter job based on if Kubernetes integration is active.
gitlab.LinkType The content kind of what users can download via url.
gitlab.Strategy You can mirror the pipeline status from the triggered pipeline to the source bridge job by using strategy: depend.
gitlab.WorkflowWhen Describes the conditions for when to run the job.
javascript.ArrowParens No description
javascript.AutoRelease Automatic bump modes.
javascript.CodeArtifactAuthProvider Options for authorizing requests to a AWS CodeArtifact npm repository.
javascript.EmbeddedLanguageFormatting No description
javascript.EndOfLine No description
javascript.HTMLWhitespaceSensitivity No description
javascript.NodePackageManager The node package manager to use.
javascript.NpmAccess Npm package access level.
javascript.ProseWrap No description
javascript.QuoteProps No description
javascript.TrailingComma No description
javascript.TypeScriptJsxMode Determines how JSX should get transformed into valid JavaScript.
javascript.TypeScriptModuleResolution Determines how modules get resolved.
javascript.UpdateSnapshot No description
release.CodeArtifactAuthProvider Options for authorizing requests to a AWS CodeArtifact npm repository.
vscode.Console Controls where to launch the debug target Source: https://code.visualstudio.com/docs/editor/debugging#_launchjson-attributes.
vscode.InternalConsoleOptions Controls the visibility of the VSCode Debug Console panel during a debugging session Source: https://code.visualstudio.com/docs/editor/debugging#_launchjson-attributes.

class Component 🔹

Represents a project component.

Initializer

new Component(project: Project)

Properties

Name Type Description
project🔹 [Project](#projen-project)

Methods

postSynthesize()🔹

Called after synthesis.

Order is not guaranteed.

postSynthesize(): void

preSynthesize()🔹

Called before synthesis.

preSynthesize(): void

synthesize()🔹

Synthesizes files to the project output directory.

synthesize(): void

class Dependencies 🔹

The Dependencies component 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 section package.json files.

To add a dependency you can use a project-type specific API such as nodeProject.addDeps() or use the generic API of project.deps:

Extends: Component

Initializer

Adds a dependencies component to the project.

new Dependencies(project: Project)

Properties

Name Type Description
all🔹 Array<[Dependency](#projen-dependency)> A copy of all dependencies recorded for this project.
static MANIFEST_FILE🔹 string The project-relative path of the deps manifest file.

Methods

addDependency(spec, type, metadata?)🔹

Adds a dependency to this project.

addDependency(spec: string, type: DependencyType, metadata?: Map<string, any>): Dependency

Returns:

getDependency(name, type?)🔹

Returns a dependency by name.

Fails if there is no dependency defined by that name or if type is not provided and there is more then one dependency type for this dependency.

getDependency(name: string, type?: DependencyType): Dependency

Returns:

removeDependency(name, type?)🔹

Removes a dependency.

removeDependency(name: string, type?: DependencyType): void

tryGetDependency(name, type?)🔹

Returns a dependency by name.

Returns undefined if there is no dependency defined by that name or if type is not provided and there is more then one dependency type for this dependency.

tryGetDependency(name: string, type?: DependencyType): Dependency

Returns:

static parseDependency(spec)🔹

Returns the coordinates of a dependency spec.

Given foo@^3.4.0 returns { name: "foo", version: "^3.4.0" }. Given bar@npm:@bar/legacy returns { name: "bar", version: "npm:@bar/legacy" }.

static parseDependency(spec: string): DependencyCoordinates

Returns:

class DevEnvironmentDockerImage 🔹

Options for specifying the Docker image of the container.

Properties

Name Type Description
dockerFile?🔹 string The relative path of a Dockerfile that defines the container contents.
Optional
image?🔹 string A publicly available Docker image.
Optional

Methods

static fromFile(dockerFile)🔹

The relative path of a Dockerfile that defines the container contents.

static fromFile(dockerFile: string): DevEnvironmentDockerImage

Returns:

static fromImage(image)🔹

A publicly available Docker image.

static fromImage(image: string): DevEnvironmentDockerImage

Returns:

class DockerCompose 🔹

Create a docker-compose YAML file.

Extends: Component

Initializer

new DockerCompose(project: Project, props?: DockerComposeProps)

Methods

addService(serviceName, description)🔹

Add a service to the docker-compose file.

addService(serviceName: string, description: DockerComposeServiceDescription): DockerComposeService

Returns:

static bindVolume(sourcePath, targetPath)🔹

Create a bind volume that binds a host path to the target path in the container.

static bindVolume(sourcePath: string, targetPath: string): IDockerComposeVolumeBinding

Returns:

static namedVolume(volumeName, targetPath, options?)🔹

Create a named volume and mount it to the target path.

If you use this named volume in several services, the volume will be shared. In this case, the volume configuration of the first-provided options are used.

static namedVolume(volumeName: string, targetPath: string, options?: DockerComposeVolumeConfig): IDockerComposeVolumeBinding

Returns:

static portMapping(publishedPort, targetPort, options?)🔹

Create a port mapping.

static portMapping(publishedPort: number, targetPort: number, options?: DockerComposePortMappingOptions): DockerComposeServicePort

Returns:

static serviceName(serviceName)🔹

Depends on a service name.

static serviceName(serviceName: string): IDockerComposeServiceName

Returns:

class DockerComposeService 🔹

A docker-compose service.

Implements: IDockerComposeServiceName

Initializer

new DockerComposeService(serviceName: string, serviceDescription: DockerComposeServiceDescription)

Properties

Name Type Description
dependsOn🔹 Array<[IDockerComposeServiceName](#projen-idockercomposeservicename)> Other services that this service depends on.
environment🔹 Map<string, string> Environment variables.
ports🔹 Array<[DockerComposeServicePort](#projen-dockercomposeserviceport)> Published ports.
serviceName🔹 string Name of the service.
volumes🔹 Array<[IDockerComposeVolumeBinding](#projen-idockercomposevolumebinding)> Volumes mounted in the container.
command?🔹 Array</code> Command to run in the container.
Optional
image?🔹 string Docker image.
Optional
imageBuild?🔹 [DockerComposeBuild](#projen-dockercomposebuild) Docker image build instructions.
Optional

Methods

addDependsOn(serviceName)🔹

Make the service depend on another service.

addDependsOn(serviceName: IDockerComposeServiceName): void

addEnvironment(name, value)🔹

Add an environment variable.

addEnvironment(name: string, value: string): void

addPort(publishedPort, targetPort, options?)🔹

Add a port mapping.

addPort(publishedPort: number, targetPort: number, options?: DockerComposePortMappingOptions): void

addVolume(volume)🔹

Add a volume to the service.

addVolume(volume: IDockerComposeVolumeBinding): void

class FileBase 🔹

Extends: Component Implemented by: github.PullRequestTemplate, python.RequirementsFile, python.SetupPy, web.ReactTypeDef, GitAttributesFile, IgnoreFile, IniFile, JsonFile, License, Makefile, TextFile, TomlFile, XmlFile, YamlFile Obtainable from: Project.tryFindFile(), Project.tryRemoveFile()

Initializer

new FileBase(project: Project, filePath: string, options?: FileBaseOptions)

Properties

Name Type Description
absolutePath🔹 string The absolute path of this file.
executable🔹 boolean Indicates if the file should be marked as executable.
path🔹 string The file path, relative to the project root.
readonly🔹 boolean Indicates if the file should be read-only or read-write.
changed?🔹 boolean Indicates if the file has been changed during synthesis.
Optional
marker?🔹 string The projen marker, used to identify files as projen-generated.
Optional

Methods

synthesize()🔹

Writes the file to the project’s output directory.

synthesize(): void

protected synthesizeContent(resolver)🔹

Implemented by derived classes and returns the contents of the file to emit.

protected synthesizeContent(resolver: IResolver): string

Returns:

class GitAttributesFile 🔹

Assign attributes to file names in a git repository.

Extends: FileBase

Initializer

new GitAttributesFile(project: Project)

Methods

addAttributes(glob, …attributes)🔹

Maps a set of attributes to a set of files.

addAttributes(glob: string, ...attributes: string[]): void

protected synthesizeContent(_)🔹

Implemented by derived classes and returns the contents of the file to emit.

protected synthesizeContent(_: IResolver): string

Returns:

class Gitpod 🔹

The Gitpod component which emits .gitpod.yml.

Implements: IDevEnvironment Extends: Component

Initializer

new Gitpod(project: Project, options?: GitpodOptions)

Properties

Name Type Description
config🔹 any Direct access to the gitpod configuration (escape hatch).

Methods

addCustomTask(options)🔹

Add a task with more granular options.

By default, all tasks will be run in parallel. To run tasks in sequence, create a new Task and set the other tasks as subtasks.

addCustomTask(options: GitpodTask): void

addDockerImage(image)🔹

Add a custom Docker image or Dockerfile for the container.

addDockerImage(image: DevEnvironmentDockerImage): void

addPorts(…ports)🔹

Add ports that should be exposed (forwarded) from the container.

addPorts(...ports: string[]): void

addPrebuilds(config)🔹

Add a prebuilds configuration for the Gitpod App.

addPrebuilds(config: GitpodPrebuilds): void

addTasks(…tasks)🔹

Add tasks to run when gitpod starts.

By default, all tasks will be run in parallel. To run tasks in sequence, create a new Task and specify the other tasks as subtasks.

addTasks(...tasks: Task[]): void

addVscodeExtensions(…extensions)🔹

Add a list of VSCode extensions that should be automatically installed in the container.

These must be in the format defined in the Open VSX registry.

addVscodeExtensions(...extensions: string[]): void

class IgnoreFile 🔹

Extends: FileBase

Initializer

new IgnoreFile(project: Project, filePath: string)

Methods

addPatterns(…patterns)🔹

Add ignore patterns.

Files that match this pattern will be ignored. If the pattern starts with a negation mark !, files that match will not be ignored.

Comment lines (start with #) are ignored.

addPatterns(...patterns: string[]): void

exclude(…patterns)🔹

Ignore the files that match these patterns.

exclude(...patterns: string[]): void

include(…patterns)🔹

Always include the specified file patterns.

include(...patterns: string[]): void

removePatterns(…patterns)🔹

Removes patterns previously added from the ignore file.

If addPattern() is called after this, the pattern will be added again.

removePatterns(...patterns: string[]): void

protected synthesizeContent(resolver)🔹

Implemented by derived classes and returns the contents of the file to emit.

protected synthesizeContent(resolver: IResolver): string

Returns:

class IniFile 🔹

Represents an INI file.

Extends: ObjectFile

Initializer

new IniFile(project: Project, filePath: string, options: IniFileOptions)

Methods

protected synthesizeContent(resolver)🔹

Implemented by derived classes and returns the contents of the file to emit.

protected synthesizeContent(resolver: IResolver): string

Returns:

class JsonFile 🔹

Represents a JSON file.

Extends: ObjectFile

Initializer

new JsonFile(project: Project, filePath: string, options: JsonFileOptions)

Methods

protected synthesizeContent(resolver)🔹

Implemented by derived classes and returns the contents of the file to emit.

protected synthesizeContent(resolver: IResolver): string

Returns:

class JsonPatch 🔹

Utility for applying RFC-6902 JSON-Patch to a document.

Use the the JsonPatch.apply(doc, ...ops) function to apply a set of operations to a JSON document and return the result.

Operations can be created using the factory methods JsonPatch.add(), JsonPatch.remove(), etc.

Methods

static add(path, value)🔹

Adds a value to an object or inserts it into an array.

In the case of an array, the value is inserted before the given index. The - character can be used instead of an index to insert at the end of an array.

static add(path: string, value: any): JsonPatch

Returns:

static apply(document, …ops)🔹

Applies a set of JSON-Patch (RFC-6902) operations to document and returns the result.

static apply(document: any, ...ops: JsonPatch[]): any

Returns:

static copy(from, path)🔹

Copies a value from one location to another within the JSON document.

Both from and path are JSON Pointers.

static copy(from: string, path: string): JsonPatch

Returns:

static move(from, path)🔹

Moves a value from one location to the other.

Both from and path are JSON Pointers.

static move(from: string, path: string): JsonPatch

Returns:

static remove(path)🔹

Removes a value from an object or array.

static remove(path: string): JsonPatch

Returns:

static replace(path, value)🔹

Replaces a value.

Equivalent to a “remove” followed by an “add”.

static replace(path: string, value: any): JsonPatch

Returns:

static test(path, value)🔹

Tests that the specified value is set in the document.

If the test fails, then the patch as a whole should not apply.

static test(path: string, value: any): JsonPatch

Returns:

class License 🔹

Extends: FileBase

Initializer

new License(project: Project, options: LicenseOptions)

Methods

protected synthesizeContent(_)🔹

Implemented by derived classes and returns the contents of the file to emit.

protected synthesizeContent(_: IResolver): string

Returns:

class Logger 🔹

Project-level logging utilities.

Extends: Component

Initializer

new Logger(project: Project, options?: LoggerOptions)

Methods

debug(…text)🔹

Log a message to stderr with DEBUG severity.

debug(...text: any[]): void

error(…text)🔹

Log a message to stderr with ERROR severity.

error(...text: any[]): void

info(…text)🔹

Log a message to stderr with INFO severity.

info(...text: any[]): void

log(level, …text)🔹

Log a message to stderr with a given logging level.

The message will be printed as long as logger.level is set to the message’s severity or higher.

log(level: LogLevel, ...text: any[]): void

verbose(…text)🔹

Log a message to stderr with VERBOSE severity.

verbose(...text: any[]): void

warn(…text)🔹

Log a message to stderr with WARN severity.

warn(...text: any[]): void

class Makefile 🔹

Minimal Makefile.

Extends: FileBase

Initializer

new Makefile(project: Project, filePath: string, options?: MakefileOptions)

Properties

Name Type Description
rules🔹 Array<[Rule](#projen-rule)> List of rule definitions.

Methods

addAll(target)🔹

Add a target to all.

addAll(target: string): Makefile

Returns:

addAlls(…targets)🔹

Add multiple targets to all.

addAlls(...targets: string[]): Makefile

Returns:

addRule(rule)🔹

Add a rule to the Makefile.

addRule(rule: Rule): Makefile

Returns:

addRules(…rules)🔹

Add multiple rules to the Makefile.

addRules(...rules: Rule[]): Makefile

Returns:

protected synthesizeContent(resolver)🔹

Implemented by derived classes and returns the contents of the file to emit.

protected synthesizeContent(resolver: IResolver): string

Returns:

class ObjectFile 🔹

Represents an Object file.

Extends: FileBase Implemented by: IniFile, JsonFile, TomlFile, XmlFile, YamlFile Obtainable from: Project.tryFindObjectFile()

Initializer

new ObjectFile(project: Project, filePath: string, options: ObjectFileOptions)

Properties

Name Type Description
omitEmpty🔹 boolean Indicates if empty objects and arrays are omitted from the output object.

Methods

addDeletionOverride(path)🔹

Syntactic sugar for addOverride(path, undefined).

addDeletionOverride(path: string): void

addOverride(path, value)🔹

Adds an override to the synthesized object file.

If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.

To include a literal . in the property name, prefix with a \. In most programming languages you will need to write this as "\\." because the \ itself will need to be escaped.

For example,

project.tsconfig.file.addOverride('compilerOptions.alwaysStrict', true);
project.tsconfig.file.addOverride('compilerOptions.lib', ['dom', 'dom.iterable', 'esnext']);

would add the overrides

"compilerOptions": {
   "alwaysStrict": true,
   "lib": [
     "dom",
     "dom.iterable",
     "esnext"
   ]
   ...
}
...
addOverride(path: string, value: any): void

addToArray(path, …values)🔹

Adds to an array in the synthesized object file.

If the array is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.

To include a literal . in the property name, prefix with a \. In most programming languages you will need to write this as "\\." because the \ itself will need to be escaped.

For example, with the following object file

"compilerOptions": {
   "exclude": ["node_modules"],
   "lib": ["es2019"]
   ...
}
...
project.tsconfig.file.addToArray('compilerOptions.exclude', 'coverage');
project.tsconfig.file.addToArray('compilerOptions.lib', 'dom', 'dom.iterable', 'esnext');

would result in the following object file

"compilerOptions": {
   "exclude": ["node_modules", "coverage"],
   "lib": ["es2019", "dom", "dom.iterable", "esnext"]
   ...
}
...
addToArray(path: string, ...values: any[]): void

patch(…patches)🔹

Applies an RFC 6902 JSON-patch to the synthesized object file. See https://datatracker.ietf.org/doc/html/rfc6902 for more information.

For example, with the following object file

"compilerOptions": {
   "exclude": ["node_modules"],
   "lib": ["es2019"]
   ...
}
...
project.tsconfig.file.patch(JsonPatch.add("/compilerOptions/exclude/-", "coverage"));
project.tsconfig.file.patch(JsonPatch.replace("/compilerOptions/lib", ["dom", "dom.iterable", "esnext"]));

would result in the following object file

"compilerOptions": {
   "exclude": ["node_modules", "coverage"],
   "lib": ["dom", "dom.iterable", "esnext"]
   ...
}
...
patch(...patches: JsonPatch[]): void

protected synthesizeContent(resolver)🔹

Implemented by derived classes and returns the contents of the file to emit.

protected synthesizeContent(resolver: IResolver): string

Returns:

class Project 🔹

Base project.

Initializer

new Project(options: ProjectOptions)

Properties

Name Type Description
buildTask🔹 [Task](#projen-task)
commitGenerated🔹 boolean Whether to commit the managed files by default.
compileTask🔹 [Task](#projen-task)
components🔹 Array<[Component](#projen-component)> Returns all the components within this project.
deps🔹 [Dependencies](#projen-dependencies) Project dependencies.
ejected🔹 boolean Whether or not the project is being ejected.
files🔹 Array<[FileBase](#projen-filebase)> All files in this project.
gitattributes🔹 [GitAttributesFile](#projen-gitattributesfile) The .gitattributes file for this repository.
gitignore🔹 [IgnoreFile](#projen-ignorefile) .gitignore.
logger🔹 [Logger](#projen-logger) Logging utilities.
name🔹 string Project name.
outdir🔹 string Absolute output directory of this project.
packageTask🔹 [Task](#projen-task)
postCompileTask🔹 [Task](#projen-task)
preCompileTask🔹 [Task](#projen-task)
projectBuild🔹 [ProjectBuild](#projen-projectbuild) Manages the build process of the project.
projenCommand🔹 string The command to use in order to run the projen CLI.
root🔹 [Project](#projen-project) The root project.
tasks🔹 [Tasks](#projen-tasks) Project tasks.
testTask🔹 [Task](#projen-task)
defaultTask?🔹 [Task](#projen-task) This is the “default” task, the one that executes “projen”.
Optional
initProject?🔹 [InitProject](#projen-initproject) The options used when this project is bootstrapped via projen new.
Optional
parent?🔹 [Project](#projen-project) A parent project.
Optional
static DEFAULT_TASK🔹 string The name of the default task (the task executed when projen is run without arguments).

Methods

addExcludeFromCleanup(…globs)🔹

Exclude the matching files from pre-synth cleanup.

Can be used when, for example, some source files include the projen marker and we don’t want them to be erased during synth.

addExcludeFromCleanup(...globs: string[]): void

addGitIgnore(pattern)🔹

Adds a .gitignore pattern.

addGitIgnore(pattern: string): void

addPackageIgnore(_pattern)🔹

Exclude these files from the bundled package.

Implemented by project types based on the packaging mechanism. For example, NodeProject delegates this to .npmignore.

addPackageIgnore(_pattern: string): void

addTask(name, props?)🔹

Adds a new task to this project.

This will fail if the project already has a task with this name.

addTask(name: string, props?: TaskOptions): Task

Returns:

addTip(message)⚠️

Prints a “tip” message during synthesis.

addTip(message: string): void

annotateGenerated(_glob)🔹

Consider a set of files as “generated”.

This method is implemented by derived classes and used for example, to add git attributes to tell GitHub that certain files are generated.

annotateGenerated(_glob: string): void

postSynthesize()🔹

Called after all components are synthesized.

Order is not guaranteed.

postSynthesize(): void

preSynthesize()🔹

Called before all components are synthesized.

preSynthesize(): void

removeTask(name)🔹

Removes a task from a project.

removeTask(name: string): Task

Returns:

runTaskCommand(task)🔹

Returns the shell command to execute in order to run a task.

By default, this is npx projen@<version> <task>

runTaskCommand(task: Task): string

Returns:

synth()🔹

Synthesize all project files into outdir.

  1. Call “this.preSynthesize()”
  2. Delete all generated files
  3. Synthesize all sub-projects
  4. Synthesize all components of this project
  5. Call “postSynthesize()” for all components of this project
  6. Call “this.postSynthesize()”
synth(): void

tryFindFile(filePath)🔹

Finds a file at the specified relative path within this project and all its subprojects.

tryFindFile(filePath: string): FileBase

Returns:

tryFindJsonFile(filePath)⚠️

Finds a json file by name.

tryFindJsonFile(filePath: string): JsonFile

Returns:

tryFindObjectFile(filePath)🔹

Finds an object file (like JsonFile, YamlFile, etc.) by name.

tryFindObjectFile(filePath: string): ObjectFile

Returns:

tryRemoveFile(filePath)🔹

Finds a file at the specified relative path within this project and removes it.

tryRemoveFile(filePath: string): FileBase

Returns:

class ProjectBuild 🔹

Manages a standard build process for all projects.

Build spawns these tasks in order:

  1. default
  2. pre-compile
  3. compile
  4. post-compile
  5. test
  6. package

Extends: Component

Initializer

new ProjectBuild(project: Project)

Properties

Name Type Description
buildTask🔹 [Task](#projen-task) The task responsible for a full release build.
compileTask🔹 [Task](#projen-task) Compiles the code.
packageTask🔹 [Task](#projen-task) The “package” task.
postCompileTask🔹 [Task](#projen-task) Post-compile task.
preCompileTask🔹 [Task](#projen-task) Pre-compile task.
testTask🔹 [Task](#projen-task) Tests the code.

class Projects 🔹

Programmatic API for projen.

Methods

static createProject(options)🔹

Creates a new project with defaults.

This function creates the project type in-process (with in VM) and calls .synth() on it (if options.synth is not false).

At the moment, it also generates a .projenrc.js file with the same code that was just executed. In the future, this will also be done by the project type, so we can easily support multiple languages of projenrc.

static createProject(options: CreateProjectOptions): void

class Projenrc 🔹

Sets up a project to use JSON for projenrc.

Extends: Component

Initializer

new Projenrc(project: Project, options?: ProjenrcOptions)

class Renovatebot 🔹

Defines renovatebot configuration for projen project.

Ignores the versions controlled by Projen.

Extends: Component

Initializer

new Renovatebot(project: Project, options?: RenovatebotOptions)

Methods

preSynthesize()🔹

Called before synthesis.

preSynthesize(): void

class SampleDir 🔹

Renders the given files into the directory if the directory does not exist.

Use this to create sample code files

Extends: Component

Initializer

Create sample files in the given directory if the given directory does not exist.

new SampleDir(project: Project, dir: string, options: SampleDirOptions)

Methods

synthesize()🔹

Synthesizes files to the project output directory.

synthesize(): void

class SampleFile 🔹

Produces a file with the given contents but only once, if the file doesn’t already exist.

Use this for creating example code files or other resources.

Extends: Component

Initializer

Creates a new SampleFile object.

new SampleFile(project: Project, filePath: string, options: SampleFileOptions)

Methods

synthesize()🔹

Synthesizes files to the project output directory.

synthesize(): void

class SampleReadme 🔹

Represents a README.md sample file. You are expected to manage this file after creation.

Extends: SampleFile

Initializer

new SampleReadme(project: Project, props?: SampleReadmeProps)

class Semver ⚠️

Properties

Name Type Description
spec⚠️ string
mode?⚠️ string Optional
version?⚠️ string Optional

Methods

static caret(version)⚠️

Accept any minor version.

= version < next major version

static caret(version: string): Semver

Returns:

static latest()⚠️

Latest version.

static latest(): Semver

Returns:

static of(spec)⚠️

static of(spec: string): Semver

Returns:

static pinned(version)⚠️

Accept only an exact version.

static pinned(version: string): Semver

Returns:

static tilde(version)⚠️

Accept patches.

= version < next minor version

static tilde(version: string): Semver

Returns:

class SourceCode 🔹

Represents a source file.

Extends: Component

Initializer

new SourceCode(project: Project, filePath: string, options?: SourceCodeOptions)

Properties

Name Type Description
filePath🔹 string
marker?🔹 string Optional

Methods

close(code?)🔹

Decreases the indentation level and closes a code block.

close(code?: string): void

line(code?)🔹

Emit a line of code.

line(code?: string): void

open(code?)🔹

Opens a code block and increases the indentation level.

open(code?: string): void

class Task 🔹

A task that can be performed on the project.

Modeled as a series of shell commands and subtasks.

Initializer

new Task(name: string, props?: TaskOptions)

Properties

Name Type Description
name🔹 string Task name.
steps🔹 Array<[TaskStep](#projen-taskstep)> Returns an immutable copy of all the step specifications of the task.
condition?🔹 string A command to execute which determines if the task should be skipped.
Optional
description?🔹 string Returns the description of this task.
Optional

Methods

builtin(name)🔹

Execute a builtin task.

Builtin tasks are programs bundled as part of projen itself and used as helpers for various components.

In the future we should support built-in tasks from external modules.

builtin(name: string): void

env(name, value)🔹

Adds an environment variable to this task.

env(name: string, value: string): void

exec(command, options?)🔹

Executes a shell command.

exec(command: string, options?: TaskStepOptions): void

lock()🔹

Forbid additional changes to this task.

lock(): void

prepend(shell, options?)⚠️

Adds a command at the beginning of the task.

prepend(shell: string, options?: TaskStepOptions): void

prependExec(shell, options?)🔹

Adds a command at the beginning of the task.

prependExec(shell: string, options?: TaskStepOptions): void

prependSay(message, options?)🔹

Says something at the beginning of the task.

prependSay(message: string, options?: TaskStepOptions): void

prependSpawn(subtask, options?)🔹

Adds a spawn instruction at the beginning of the task.

prependSpawn(subtask: Task, options?: TaskStepOptions): void

reset(command?, options?)🔹

Reset the task so it no longer has any commands.

reset(command?: string, options?: TaskStepOptions): void

say(message, options?)🔹

Say something.

say(message: string, options?: TaskStepOptions): void

spawn(subtask, options?)🔹

Spawns a sub-task.

spawn(subtask: Task, options?: TaskStepOptions): void

class TaskRuntime 🔹

The runtime component of the tasks engine.

Initializer

new TaskRuntime(workdir: string)

Properties

Name Type Description
manifest🔹 [TasksManifest](#projen-tasksmanifest) The contents of tasks.json.
tasks🔹 Array<[TaskSpec](#projen-taskspec)> The tasks in this project.
workdir🔹 string The root directory of the project and the cwd for executing tasks.
static MANIFEST_FILE🔹 string The project-relative path of the tasks manifest file.

Methods

runTask(name, parents?)🔹

Runs the task.

runTask(name: string, parents?: Array<string>): void

tryFindTask(name)🔹

Find a task by name, or undefined if not found.

tryFindTask(name: string): TaskSpec

Returns:

class Tasks 🔹

Defines project tasks.

Tasks extend the projen CLI by adding subcommands to it. Task definitions are synthesized into .projen/tasks.json.

Extends: Component

Initializer

new Tasks(project: Project)

Properties

Name Type Description
all🔹 Array<[Task](#projen-task)> All tasks.
env🔹 Map<string, string> Returns a copy of the currently global environment for this project.

Methods

addEnvironment(name, value)🔹

Adds global environment.

addEnvironment(name: string, value: string): void

addTask(name, options?)🔹

Adds a task to a project.

addTask(name: string, options?: TaskOptions): Task

Returns:

removeTask(name)🔹

Removes a task from a project.

removeTask(name: string): Task

Returns:

synthesize()🔹

Synthesizes files to the project output directory.

synthesize(): void

tryFind(name)🔹

Finds a task by name.

Returns undefined if the task cannot be found.

tryFind(name: string): Task

Returns:

class Testing 🔹

A Testing static class with a .synth helper for getting a snapshots of construct outputs. Useful for snapshot testing with Jest.

Methods

static synth(project, options?)🔹

Produces a simple JS object that represents the contents of the projects with field names being file paths.

static synth(project: Project, options?: SnapshotOptions): Map<string, any>

Returns:

class TextFile 🔹

A text file.

Extends: FileBase

Initializer

Defines a text file.

new TextFile(project: Project, filePath: string, options?: TextFileOptions)

Methods

addLine(line)🔹

Adds a line to the text file.

addLine(line: string): void

protected synthesizeContent(_)🔹

Implemented by derived classes and returns the contents of the file to emit.

protected synthesizeContent(_: IResolver): string

Returns:

class TomlFile 🔹

Represents a TOML file.

Extends: ObjectFile

Initializer

new TomlFile(project: Project, filePath: string, options: TomlFileOptions)

Methods

protected synthesizeContent(resolver)🔹

Implemented by derived classes and returns the contents of the file to emit.

protected synthesizeContent(resolver: IResolver): string

Returns:

class Version 🔹

Extends: Component

Initializer

new Version(project: Project, options: VersionOptions)

Properties

Name Type Description
bumpTask🔹 [Task](#projen-task)
changelogFileName🔹 string The name of the changelog file (under artifactsDirectory).
releaseTagFileName🔹 string The name of the file that contains the release tag (under artifactsDirectory).
unbumpTask🔹 [Task](#projen-task)
versionFileName🔹 string The name of the file that contains the version (under artifactsDirectory).
static STANDARD_VERSION🔹 string

class XmlFile 🔹

Represents an XML file.

Objects passed in will be synthesized using the npm “xml” library.

Extends: ObjectFile

Initializer

new XmlFile(project: Project, filePath: string, options?: XmlFileOptions)

Methods

protected synthesizeContent(resolver)🔹

Implemented by derived classes and returns the contents of the file to emit.

protected synthesizeContent(resolver: IResolver): string

Returns:

class YamlFile 🔹

Represents a YAML file.

Extends: ObjectFile

Initializer

new YamlFile(project: Project, filePath: string, options: YamlFileOptions)

Properties

Name Type Description
lineWidth🔹 number Maximum line width (set to 0 to disable folding).

Methods

protected synthesizeContent(resolver)🔹

Implemented by derived classes and returns the contents of the file to emit.

protected synthesizeContent(resolver: IResolver): string

Returns:

class AutoDiscover 🔹

Discovers and creates integration tests and lambdas from code in the project’s source and test trees.

Submodule: awscdk

Extends: Component

Initializer

new awscdk.AutoDiscover(project: Project, options: AutoDiscoverOptions)

class AwsCdkConstructLibrary 🔹

AWS CDK construct library project.

A multi-language (jsii) construct library which vends constructs designed to use within the AWS CDK with a friendly workflow and automatic publishing to the construct catalog.

Submodule: awscdk

Extends: cdk.ConstructLibrary

Initializer

new awscdk.AwsCdkConstructLibrary(options: AwsCdkConstructLibraryOptions)

Properties

Name Type Description
cdkDeps🔹 [awscdk.AwsCdkDeps](#projen-awscdk-awscdkdeps)
cdkVersion🔹 string The target CDK version for this library.
version⚠️ string

Methods

addCdkDependencies(…deps)⚠️

Adds dependencies to AWS CDK modules.

Since this is a library project, dependencies will be added as peer dependencies.

addCdkDependencies(...deps: string[]): void

addCdkTestDependencies(…deps)⚠️

Adds AWS CDK modules as dev dependencies.

addCdkTestDependencies(...deps: string[]): void

class AwsCdkDeps 🔹

Manages dependencies on the AWS CDK.

Submodule: awscdk

Extends: Component Implemented by: awscdk.AwsCdkDepsJava, awscdk.AwsCdkDepsJs, awscdk.AwsCdkDepsPy

Initializer

new awscdk.AwsCdkDeps(project: Project, options: AwsCdkDepsOptions)

Properties

Name Type Description
cdkDependenciesAsDeps⚠️ boolean Whether CDK dependencies are added as normal dependencies (and peer dependencies).
cdkMajorVersion🔹 number The major version of the AWS CDK (e.g. 1, 2, …).
cdkMinimumVersion🔹 string The minimum version of the AWS CDK (e.g. 2.0.0).
cdkVersion🔹 string The dependency requirement for AWS CDK (e.g. ^2.0.0).

Methods

addV1Dependencies(…deps)🔹

Adds dependencies to AWS CDK modules.

The type of dependency is determined by the dependencyType option.

This method is not supported in CDK v2. Use project.addPeerDeps() or project.addDeps() as appropriate.

addV1Dependencies(...deps: string[]): void

addV1DevDependencies(…deps)🔹

Adds AWS CDK modules as dev dependencies.

This method is not supported in CDK v2. Use project.addPeerDeps() or project.addDeps() as appropriate.

addV1DevDependencies(...deps: string[]): void

preSynthesize()🔹

Called before synthesis.

preSynthesize(): void

protected packageNames()🔹

Return a configuration object with information about package naming in various languages.

protected packageNames(): AwsCdkPackageNames

Returns:

class AwsCdkDepsJava 🔹

Manages dependencies on the AWS CDK for Java projects.

Submodule: awscdk

Extends: awscdk.AwsCdkDeps

Initializer

new awscdk.AwsCdkDepsJava(project: Project, options: AwsCdkDepsOptions)

Methods

protected packageNames()🔹

Return a configuration object with information about package naming in various languages.

protected packageNames(): AwsCdkPackageNames

Returns:

class AwsCdkDepsJs 🔹

Manages dependencies on the AWS CDK for Node.js projects.

Submodule: awscdk

Extends: awscdk.AwsCdkDeps

Initializer

new awscdk.AwsCdkDepsJs(project: Project, options: AwsCdkDepsOptions)

Methods

protected packageNames()🔹

Return a configuration object with information about package naming in various languages.

protected packageNames(): AwsCdkPackageNames

Returns:

class AwsCdkDepsPy 🔹

Manages dependencies on the AWS CDK for Python projects.

Submodule: awscdk

Extends: awscdk.AwsCdkDeps

Initializer

new awscdk.AwsCdkDepsPy(project: Project, options: AwsCdkDepsOptions)

Methods

protected packageNames()🔹

Return a configuration object with information about package naming in various languages.

protected packageNames(): AwsCdkPackageNames

Returns:

class AwsCdkJavaApp 🔹

AWS CDK app in Java.

Submodule: awscdk

Extends: java.JavaProject

Initializer

new awscdk.AwsCdkJavaApp(options: AwsCdkJavaAppOptions)

Properties

Name Type Description
cdkConfig🔹 [awscdk.CdkConfig](#projen-awscdk-cdkconfig) The cdk.json file.
cdkDeps🔹 [awscdk.AwsCdkDeps](#projen-awscdk-awscdkdeps) CDK dependency management helper class.
cdkTasks🔹 [awscdk.CdkTasks](#projen-awscdk-cdktasks) CDK tasks.
mainClass🔹 string The full name of the main class of the java app (package.Class).
mainClassName🔹 string The name of the Java class with the static main() method.
mainPackage🔹 string The name of the Java package that includes the main class.

Methods

addCdkDependency(…modules)⚠️

Adds an AWS CDK module dependencies.

addCdkDependency(...modules: string[]): void

class AwsCdkPythonApp 🔹

AWS CDK app in Python.

Submodule: awscdk

Extends: python.PythonProject

Initializer

new awscdk.AwsCdkPythonApp(options: AwsCdkPythonAppOptions)

Properties

Name Type Description
appEntrypoint🔹 string The CDK app entrypoint.
cdkConfig🔹 [awscdk.CdkConfig](#projen-awscdk-cdkconfig) cdk.json configuration.
cdkDeps🔹 [awscdk.AwsCdkDeps](#projen-awscdk-awscdkdeps)
cdkTasks🔹 [awscdk.CdkTasks](#projen-awscdk-cdktasks) Common CDK tasks.
cdkVersion🔹 string The CDK version this app is using.
testdir🔹 string The directory in which the python tests reside.

class AwsCdkTypeScriptApp 🔹

AWS CDK app in TypeScript.

Submodule: awscdk

Extends: typescript.TypeScriptAppProject

Initializer

new awscdk.AwsCdkTypeScriptApp(options: AwsCdkTypeScriptAppOptions)

Properties

Name Type Description
appEntrypoint🔹 string The CDK app entrypoint.
cdkConfig🔹 [awscdk.CdkConfig](#projen-awscdk-cdkconfig) cdk.json configuration.
cdkDeps🔹 [awscdk.AwsCdkDeps](#projen-awscdk-awscdkdeps)
cdkTasks🔹 [awscdk.CdkTasks](#projen-awscdk-cdktasks) Common CDK tasks.
cdkVersion🔹 string The CDK version this app is using.

Methods

addCdkDependency(…modules)🔹

Adds an AWS CDK module dependencies.

addCdkDependency(...modules: string[]): void

class CdkConfig 🔹

Represents cdk.json file.

Submodule: awscdk

Extends: Component

Initializer

new awscdk.CdkConfig(project: Project, options: CdkConfigOptions)

Properties

Name Type Description
cdkout🔹 string Name of the cdk.out directory.
exclude🔹 Array</code> List of glob patterns to be excluded by CDK.
include🔹 Array</code> List of glob patterns to be included by CDK.
json🔹 [JsonFile](#projen-jsonfile) Represents the JSON file.

Methods

addExcludes(…patterns)🔹

Add excludes to cdk.json.

addExcludes(...patterns: string[]): void

addIncludes(…patterns)🔹

Add includes to cdk.json.

addIncludes(...patterns: string[]): void

class CdkTasks 🔹

Adds standard AWS CDK tasks to your project.

Submodule: awscdk

Extends: Component

Initializer

new awscdk.CdkTasks(project: Project)

Properties

Name Type Description
deploy🔹 [Task](#projen-task) Deploys your app.
destroy🔹 [Task](#projen-task) Destroys all the stacks.
diff🔹 [Task](#projen-task) Diff against production.
synth🔹 [Task](#projen-task) Synthesizes your app.
synthSilent🔹 [Task](#projen-task) Synthesizes your app and suppresses stdout.
watch🔹 [Task](#projen-task) Watch task.

class ConstructLibraryAws ⚠️

Submodule: awscdk

Extends: awscdk.AwsCdkConstructLibrary

Initializer

new awscdk.ConstructLibraryAws(options: AwsCdkConstructLibraryOptions)

class EdgeLambdaAutoDiscover 🔹

Creates edge lambdas from entry points discovered in the project’s source tree.

Submodule: awscdk

Extends: cdk.AutoDiscoverBase

Initializer

new awscdk.EdgeLambdaAutoDiscover(project: Project, options: EdgeLambdaAutoDiscoverOptions)

class IntegrationTest 🔹

Cloud integration tests.

Submodule: awscdk

Extends: cdk.IntegrationTestBase

Initializer

new awscdk.IntegrationTest(project: Project, options: IntegrationTestOptions)

Properties

Name Type Description
destroyTask🔹 [Task](#projen-task) Destroy the integration test resources.
watchTask🔹 [Task](#projen-task) The watch task.

class IntegrationTestAutoDiscover 🔹

Creates integration tests from entry points discovered in the test tree.

Submodule: awscdk

Extends: cdk.IntegrationTestAutoDiscoverBase

Initializer

new awscdk.IntegrationTestAutoDiscover(project: Project, options: IntegrationTestAutoDiscoverOptions)

class LambdaAutoDiscover 🔹

Creates lambdas from entry points discovered in the project’s source tree.

Submodule: awscdk

Extends: cdk.AutoDiscoverBase

Initializer

new awscdk.LambdaAutoDiscover(project: Project, options: LambdaAutoDiscoverOptions)

class LambdaExtension 🔹

Create a Lambda Extension.

Submodule: awscdk

Extends: Component

Initializer

new awscdk.LambdaExtension(project: Project, options: LambdaExtensionOptions)

class LambdaExtensionAutoDiscover 🔹

Creates Lambda Extensions from entrypoints discovered in the project’s source tree.

Submodule: awscdk

Extends: cdk.AutoDiscoverBase

Initializer

new awscdk.LambdaExtensionAutoDiscover(project: Project, options: LambdaExtensionAutoDiscoverOptions)

class LambdaFunction 🔹

Generates a pre-bundled AWS Lambda function construct from handler code.

To use this, create an AWS Lambda handler file under your source tree with the .lambda.ts extension and add a LambdaFunction component to your typescript project pointing to this entrypoint.

This will add a task to your “compile” step which will use esbuild to bundle the handler code into the build directory. It will also generate a file src/foo-function.ts with a custom AWS construct called FooFunction which extends @aws-cdk/aws-lambda.Function which is bound to the bundled handle through an asset.

Submodule: awscdk

Extends: Component

Initializer

Defines a pre-bundled AWS Lambda function construct from handler code.

new awscdk.LambdaFunction(project: Project, options: LambdaFunctionOptions)

class LambdaRuntime 🔹

The runtime for the AWS Lambda function.

Submodule: awscdk

Initializer

new awscdk.LambdaRuntime(functionRuntime: string, esbuildTarget: string)

Properties

Name Type Description
esbuildPlatform🔹 string
esbuildTarget🔹 string The esbuild setting to use.
functionRuntime🔹 string The Node.js runtime to use.
static NODEJS_10_X🔹 [awscdk.LambdaRuntime](#projen-awscdk-lambdaruntime) Node.js 10.x.
static NODEJS_12_X🔹 [awscdk.LambdaRuntime](#projen-awscdk-lambdaruntime) Node.js 12.x.
static NODEJS_14_X🔹 [awscdk.LambdaRuntime](#projen-awscdk-lambdaruntime) Node.js 14.x.
static NODEJS_16_X🔹 [awscdk.LambdaRuntime](#projen-awscdk-lambdaruntime) Node.js 16.x.

class BuildWorkflow 🔹

Submodule: build

Extends: Component

Initializer

new build.BuildWorkflow(project: Project, options: BuildWorkflowOptions)

Properties

Name Type Description
buildJobIds🔹 Array</code> Returns a list of job IDs that are part of the build.

Methods

addPostBuildJob(id, job)🔹

Adds another job to the build workflow which is executed after the build job succeeded.

Jobs are executed only if the build did NOT self mutate. If the build self-mutate, the branch will either be updated or the build will fail (in forks), so there is no point in executing the post-build job.

addPostBuildJob(id: string, job: Job): void

addPostBuildJobCommands(id, commands, options?)🔹

Run a sequence of commands as a job within the build workflow which is executed after the build job succeeded.

Jobs are executed only if the build did NOT self mutate. If the build self-mutate, the branch will either be updated or the build will fail (in forks), so there is no point in executing the post-build job.

addPostBuildJobCommands(id: string, commands: Array<string>, options?: AddPostBuildJobCommandsOptions): void

addPostBuildJobTask(task, options?)🔹

Run a task as a job within the build workflow which is executed after the build job succeeded.

The job will have access to build artifacts and will install project dependencies in order to be able to run any commands used in the tasks.

Jobs are executed only if the build did NOT self mutate. If the build self-mutate, the branch will either be updated or the build will fail (in forks), so there is no point in executing the post-build job.

addPostBuildJobTask(task: Task, options?: AddPostBuildJobTaskOptions): void

addPostBuildSteps(…steps)🔹

Adds steps that are executed after the build.

addPostBuildSteps(...steps: JobStep[]): void

class AutoDiscoverBase 🔹

Base class for auto-discovering and creating project subcomponents.

Submodule: cdk

Extends: Component Implemented by: awscdk.EdgeLambdaAutoDiscover, awscdk.IntegrationTestAutoDiscover, awscdk.LambdaAutoDiscover, awscdk.LambdaExtensionAutoDiscover, cdk.IntegrationTestAutoDiscoverBase, cdk8s.IntegrationTestAutoDiscover

Initializer

new cdk.AutoDiscoverBase(project: Project, options: AutoDiscoverBaseOptions)

Properties

Name Type Description
entrypoints🔹 Array</code> Auto-discovered entry points with paths relative to the project directory.

class ConstructLibrary 🔹

A multi-language library for CDK constructs.

Submodule: cdk

Extends: cdk.JsiiProject Implemented by: awscdk.AwsCdkConstructLibrary, awscdk.ConstructLibraryAws, cdk8s.ConstructLibraryCdk8s, cdktf.ConstructLibraryCdktf

Initializer

new cdk.ConstructLibrary(options: ConstructLibraryOptions)

class IntegrationTestAutoDiscoverBase 🔹

Base class for locating integration tests in the project’s test tree.

Submodule: cdk

Extends: cdk.AutoDiscoverBase

Initializer

new cdk.IntegrationTestAutoDiscoverBase(project: Project, options: IntegrationTestAutoDiscoverBaseOptions)

class IntegrationTestBase 🔹

Submodule: cdk

Extends: Component Implemented by: awscdk.IntegrationTest, cdk8s.IntegrationTest

Initializer

new cdk.IntegrationTestBase(project: Project, options: IntegrationTestBaseOptions)

Properties

Name Type Description
assertTask🔹 [Task](#projen-task) Synthesizes the integration test and compares against a local copy (runs during build).
deployTask🔹 [Task](#projen-task) Deploy the integration test and update the snapshot upon success.
name🔹 string Integration test name.
snapshotDir🔹 string Snapshot output directory.
snapshotTask🔹 [Task](#projen-task) Just update snapshot (without deployment).
tmpDir🔹 string Temporary directory for each integration test.

class JsiiDocgen 🔹

Creates a markdown file based on the jsii manifest: - Adds a docgen script to package.json - Runs jsii-docgen after compilation - Enforces that markdown file is checked in.

Submodule: cdk

Initializer

new cdk.JsiiDocgen(project: JsiiProject, options?: JsiiDocgenOptions)

class JsiiProject 🔹

Multi-language jsii library project.

Submodule: cdk

Extends: typescript.TypeScriptProject

Initializer

new cdk.JsiiProject(options: JsiiProjectOptions)

Properties

Name Type Description
eslint?🔹 [javascript.Eslint](#projen-javascript-eslint) Optional

class AutoDiscover 🔹

Automatically discovers and creates IntegrationTests from entry points found in the test tree.

Submodule: cdk8s

Extends: Component

Initializer

new cdk8s.AutoDiscover(project: Project, options: AutoDiscoverOptions)

class Cdk8sDeps 🔹

Manages dependencies on the CDK8s.

Submodule: cdk8s

Extends: Component Implemented by: cdk8s.Cdk8sDepsPy

Initializer

new cdk8s.Cdk8sDeps(project: Project, options: Cdk8sDepsOptions)

Properties

Name Type Description
cdk8sMajorVersion🔹 number The major version of the CDK8s (e.g. 1, 2, …).
cdk8sMinimumVersion🔹 string The minimum version of the CDK8s (e.g. 2.0.0).
cdk8sVersion🔹 string The dependency requirement for CDK8s.

Methods

protected packageNames()🔹

Return a configuration object with information about package naming in various languages.

protected packageNames(): Cdk8sPackageNames

Returns:

class Cdk8sDepsPy 🔹

Submodule: cdk8s

Extends: cdk8s.Cdk8sDeps

Initializer

new cdk8s.Cdk8sDepsPy(project: Project, options: Cdk8sDepsOptions)

Methods

protected packageNames()🔹

Return a configuration object with information about package naming in various languages.

protected packageNames(): Cdk8sPackageNames

Returns:

class Cdk8sPythonApp 🔹

CDK8s app in Python.

Submodule: cdk8s

Extends: python.PythonProject

Initializer

new cdk8s.Cdk8sPythonApp(options: Cdk8sPythonOptions)

Properties

Name Type Description
appEntrypoint🔹 string The CDK8s app entrypoint.
cdk8sDeps🔹 [cdk8s.Cdk8sDeps](#projen-cdk8s-cdk8sdeps)

class Cdk8sTypeScriptApp 🔹

CDK8s app in TypeScript.

Submodule: cdk8s

Extends: typescript.TypeScriptAppProject

Initializer

new cdk8s.Cdk8sTypeScriptApp(options: Cdk8sTypeScriptAppOptions)

Properties

Name Type Description
appEntrypoint🔹 string The CDK8s app entrypoint.
cdk8sDeps🔹 [cdk8s.Cdk8sDeps](#projen-cdk8s-cdk8sdeps)

class ConstructLibraryCdk8s 🔹

CDK8s construct library project.

A multi-language (jsii) construct library which vends constructs designed to use within the CDK for Kubernetes (CDK8s), with a friendly workflow and automatic publishing to the construct catalog.

Submodule: cdk8s

Extends: cdk.ConstructLibrary

Initializer

new cdk8s.ConstructLibraryCdk8s(options: ConstructLibraryCdk8sOptions)

Properties

Name Type Description
cdk8sVersion🔹 string The CDK8s version this app is using.
constructsVersion🔹 string The constructs version this app is using.

class IntegrationTest 🔹

CDK8S integration test.

Submodule: cdk8s

Extends: cdk.IntegrationTestBase

Initializer

new cdk8s.IntegrationTest(project: Project, options: IntegrationTestOptions)

class IntegrationTestAutoDiscover 🔹

Discovers and creates integration tests from files in the test root.

Submodule: cdk8s

Extends: cdk.IntegrationTestAutoDiscoverBase

Initializer

new cdk8s.IntegrationTestAutoDiscover(project: Project, options: IntegrationTestAutoDiscoverOptions)

class ConstructLibraryCdktf 🔹

CDKTF construct library project.

A multi-language (jsii) construct library which vends constructs designed to use within the CDK for Terraform (CDKTF), with a friendly workflow and automatic publishing to the construct catalog.

Submodule: cdktf

Extends: cdk.ConstructLibrary

Initializer

new cdktf.ConstructLibraryCdktf(options: ConstructLibraryCdktfOptions)

class Circleci 🔹

Circleci Class to manage .circleci/config.yml. Check projen’s docs for more information.

Submodule: circleci

Extends: Component

Initializer

new circleci.Circleci(project: Project, options?: CircleCiProps)

Properties

Name Type Description
file🔹 [YamlFile](#projen-yamlfile) The yaml file for the Circleci pipeline.

Methods

addOrb(name, orb)🔹

Add a Circleci Orb to pipeline.

Will throw error if the orb already exists

addOrb(name: string, orb: string): void

addWorkflow(workflow)🔹

add new workflow to existing pipeline.

addWorkflow(workflow: Workflow): void

class AutoApprove 🔹

Auto approve pull requests that meet a criteria.

Submodule: github

Extends: Component

Initializer

new github.AutoApprove(github: GitHub, options?: AutoApproveOptions)

Properties

Name Type Description
label🔹 string

class AutoMerge 🔹

Sets up mergify to merging approved pull requests.

If buildJob is specified, the specified GitHub workflow job ID is required to succeed in order for the PR to be merged.

approvedReviews specified the number of code review approvals required for the PR to be merged.

Submodule: github

Extends: Component

Initializer

new github.AutoMerge(github: GitHub, options?: AutoMergeOptions)

Methods

addConditions(…conditions)🔹

Adds conditions to the auto merge rule.

addConditions(...conditions: string[]): void

addConditionsLater(later)🔹

Adds conditions that will be rendered only during synthesis.

addConditionsLater(later: IAddConditionsLater): void

class Dependabot 🔹

Defines dependabot configuration for node projects.

Since module versions are managed in projen, the versioning strategy will be configured to “lockfile-only” which means that only updates that can be done on the lockfile itself will be proposed.

Submodule: github

Extends: Component

Initializer

new github.Dependabot(github: GitHub, options?: DependabotOptions)

Properties

Name Type Description
config🔹 any The raw dependabot configuration.
ignoresProjen🔹 boolean Whether or not projen is also upgraded in this config,.

Methods

addIgnore(dependencyName, …versions)🔹

Ignores a dependency from automatic updates.

addIgnore(dependencyName: string, ...versions: string[]): void

class GitHub 🔹

Submodule: github

Extends: Component

Initializer

new github.GitHub(project: Project, options?: GitHubOptions)

Properties

Name Type Description
projenCredentials🔹 [github.GithubCredentials](#projen-github-githubcredentials) GitHub API authentication method used by projen workflows.
workflows🔹 Array<[github.GithubWorkflow](#projen-github-githubworkflow)> All workflows.
workflowsEnabled🔹 boolean Are workflows enabled?
mergify?🔹 [github.Mergify](#projen-github-mergify) The Mergify configured on this repository.
Optional

Methods

addDependabot(options?)🔹

addDependabot(options?: DependabotOptions): Dependabot

Returns:

addPullRequestTemplate(…content)🔹

addPullRequestTemplate(...content: string[]): PullRequestTemplate

Returns:

addWorkflow(name)🔹

Adds a workflow to the project.

addWorkflow(name: string): GithubWorkflow

Returns:

tryFindWorkflow(name)🔹

Finds a GitHub workflow by name.

Returns undefined if the workflow cannot be found.

tryFindWorkflow(name: string): GithubWorkflow

Returns:

static of(project)🔹

Returns the GitHub component of a project or undefined if the project does not have a GitHub component.

static of(project: Project): GitHub

Returns:

class GitHubProject ⚠️

GitHub-based project.

Submodule: github

Extends: Project

Initializer

new github.GitHubProject(options: GitHubProjectOptions)

Properties

Name Type Description
projectType⚠️ [ProjectType](#projen-projecttype)
autoApprove?⚠️ [github.AutoApprove](#projen-github-autoapprove) Auto approve set up for this project.
Optional
devContainer?⚠️ [vscode.DevContainer](#projen-vscode-devcontainer) Access for .devcontainer.json (used for GitHub Codespaces).
Optional
github?⚠️ [github.GitHub](#projen-github-github) Access all github components.
Optional
gitpod?⚠️ [Gitpod](#projen-gitpod) Access for Gitpod.
Optional
vscode?⚠️ [vscode.VsCode](#projen-vscode-vscode) Access all VSCode components.
Optional

Methods

annotateGenerated(glob)⚠️

Marks the provided file(s) as being generated.

This is achieved using the github-linguist attributes. Generated files do not count against the repository statistics and language breakdown.

annotateGenerated(glob: string): void

class GithubCredentials 🔹

Represents a method of providing GitHub API access for projen workflows.

Submodule: github

Properties

Name Type Description
setupSteps🔹 Array<[github.workflows.JobStep](#projen-github-workflows-jobstep)> Setup steps to obtain GitHub credentials.
tokenRef🔹 string The value to use in a workflow when a GitHub token is expected.

Methods

static fromApp(options?)🔹

Provide API access through a GitHub App.

The GitHub App must be installed on the GitHub repo, its App ID and a private key must be added as secrets to the repo. The name of the secrets can be specified here.

static fromApp(options?: GithubCredentialsAppOptions): GithubCredentials

Returns:

static fromPersonalAccessToken(options?)🔹

Provide API access through a GitHub personal access token.

The token must be added as a secret to the GitHub repo, and the name of the secret can be specified here.

static fromPersonalAccessToken(options?: GithubCredentialsPersonalAccessTokenOptions): GithubCredentials

Returns:

class GithubWorkflow 🔹

Workflow for GitHub.

A workflow is a configurable automated process made up of one or more jobs.

Submodule: github

Extends: Component

Initializer

new github.GithubWorkflow(github: GitHub, name: string, options?: GithubWorkflowOptions)

Properties

Name Type Description
name🔹 string The name of the workflow.
projenCredentials🔹 [github.GithubCredentials](#projen-github-githubcredentials) GitHub API authentication method used by projen workflows.
concurrency?🔹 string Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time.
Default: disabled
file?🔹 [YamlFile](#projen-yamlfile) The workflow YAML file.
Optional

Methods

addJob(id, job)🔹

Adds a single job to the workflow.

addJob(id: string, job: JobCallingReusableWorkflow &#124; Job): void

addJobs(jobs)🔹

Add jobs to the workflow.

addJobs(jobs: Map<string, JobCallingReusableWorkflow &#124; Job>): void

on(events)🔹

Add events to triggers the workflow.

on(events: Triggers): void

class Mergify 🔹

Submodule: github

Extends: Component

Initializer

new github.Mergify(github: GitHub, options?: MergifyOptions)

Methods

addQueue(queue)🔹

addQueue(queue: MergifyQueue): void

addRule(rule)🔹

addRule(rule: MergifyRule): void

class PullRequestLint 🔹

Configure validations to run on GitHub pull requests.

Only generates a file if at least one linter is configured.

Submodule: github

Extends: Component

Initializer

new github.PullRequestLint(github: GitHub, options?: PullRequestLintOptions)

class PullRequestTemplate 🔹

Template for GitHub pull requests.

Submodule: github

Extends: TextFile

Initializer

new github.PullRequestTemplate(github: GitHub, options?: PullRequestTemplateOptions)

class Stale 🔹

Warns and then closes issues and PRs that have had no activity for a specified amount of time.

The default configuration will:

Submodule: github

Extends: Component

Initializer

new github.Stale(github: GitHub, options?: StaleOptions)

class TaskWorkflow 🔹

A GitHub workflow for common build tasks within a project.

Submodule: github

Extends: github.GithubWorkflow

Initializer

new github.TaskWorkflow(github: GitHub, options: TaskWorkflowOptions)

Properties

Name Type Description
jobId🔹 string
artifactsDirectory?🔹 string Optional

class CiConfiguration 🔹

CI for GitLab.

A CI is a configurable automated process made up of one or more stages/jobs.

Submodule: gitlab

Extends: Component

Initializer

new gitlab.CiConfiguration(project: Project, name: string, options?: CiConfigurationOptions)

Properties

Name Type Description
defaultAfterScript🔹 Array</code> Defines default scripts that should run after all jobs.
defaultBeforeScript🔹 Array</code> Defines default scripts that should run before all jobs.
defaultTags🔹 Array</code> Used to select a specific runner from the list of all runners that are available for the project.
file🔹 [YamlFile](#projen-yamlfile) The workflow YAML file.
jobs🔹 Map<string, [gitlab.Job](#projen-gitlab-job)> The jobs in the CI configuration.
name🔹 string The name of the configuration.
path🔹 string Path to CI file generated by the configuration.
project🔹 [Project](#projen-project) The project the configuration belongs to.
stages🔹 Array</code> Groups jobs into stages.
variables🔹 Map<string, string | number | [gitlab.VariableConfig](#projen-gitlab-variableconfig)> Global variables that are passed to jobs.
defaultArtifacts?🔹 [gitlab.Artifacts](#projen-gitlab-artifacts) Default list of files and directories that should be attached to the job if it succeeds.
Optional
defaultCache?🔹 [gitlab.Cache](#projen-gitlab-cache) A default list of files and directories to cache between jobs.
Optional
defaultImage?🔹 [gitlab.Image](#projen-gitlab-image) Specifies the default docker image to use globally for all jobs.
Optional
defaultInterruptible?🔹 boolean The default behavior for whether a job should be canceled when a newer pipeline starts before the job completes (Default: false).
Optional
defaultRetry?🔹 [gitlab.Retry](#projen-gitlab-retry) How many times a job is retried if it fails.
Optional
defaultTimeout?🔹 string A default timeout job written in natural language (Ex.
Optional
pages?🔹 [gitlab.Job](#projen-gitlab-job) A special job used to upload static sites to Gitlab pages.
Optional
workflow?🔹 [gitlab.Workflow](#projen-gitlab-workflow) Used to control pipeline behavior.
Optional

Methods

addGlobalVariables(variables)🔹

Add a globally defined variable to the CI configuration.

addGlobalVariables(variables: Map<string, any>): void

addIncludes(…includes)🔹

Add additional yml/yaml files to the CI includes.

addIncludes(...includes: Include[]): void

addJobs(jobs)🔹

Add jobs and their stages to the CI configuration.

addJobs(jobs: Map<string, Job>): void

addServices(…services)🔹

Add additional services.

addServices(...services: Service[]): void

addStages(…stages)🔹

Add stages to the CI configuration if not already present.

addStages(...stages: string[]): void

class GitlabConfiguration 🔹

A GitLab CI for the main .gitlab-ci.yml file.

Submodule: gitlab

Extends: gitlab.CiConfiguration

Initializer

new gitlab.GitlabConfiguration(project: Project, options?: CiConfigurationOptions)

Properties

Name Type Description
nestedTemplates🔹 Map<string, [gitlab.NestedConfiguration](#projen-gitlab-nestedconfiguration)>

Methods

createNestedTemplates(config)🔹

Creates and adds nested templates to the includes of the main CI.

Additionally adds their stages to the main CI if they are not already present. You can futher customize nested templates through the nestedTemplates property. E.g. gitlabConfig.nestedTemplates[‘templateName’]?.addStages(‘stageName’)

createNestedTemplates(config: Map<string, CiConfigurationOptions>): void

class NestedConfiguration 🔹

A GitLab CI for templates that are created and included in the .gitlab-ci.yml file.

Submodule: gitlab

Extends: gitlab.CiConfiguration

Initializer

new gitlab.NestedConfiguration(project: Project, parent: GitlabConfiguration, name: string, options?: CiConfigurationOptions)

Properties

Name Type Description
parent🔹 [gitlab.GitlabConfiguration](#projen-gitlab-gitlabconfiguration)

class JavaProject 🔹

Java project.

Submodule: java

Extends: github.GitHubProject

Initializer

new java.JavaProject(options: JavaProjectOptions)

Properties

Name Type Description
compile🔹 [java.MavenCompile](#projen-java-mavencompile) Compile component.
distdir🔹 string Maven artifact output directory.
packaging🔹 [java.MavenPackaging](#projen-java-mavenpackaging) Packaging component.
pom🔹 [java.Pom](#projen-java-pom) API for managing pom.xml.
junit?🔹 [java.Junit](#projen-java-junit) JUnit component.
Optional
projenrc?🔹 [java.Projenrc](#projen-java-projenrc) Projenrc component.
Optional

Methods

addDependency(spec)🔹

Adds a runtime dependency.

addDependency(spec: string): void

addPlugin(spec, options?)🔹

Adds a build plugin to the pom.

The plug in is also added as a BUILD dep to the project.

addPlugin(spec: string, options?: PluginOptions): Dependency

Returns:

addTestDependency(spec)🔹

Adds a test dependency.

addTestDependency(spec: string): void

class Junit 🔹

Implements JUnit-based testing.

Submodule: java

Extends: Component

Initializer

new java.Junit(project: Project, options: JunitOptions)

class MavenCompile 🔹

Adds the maven-compiler plugin to a POM file and the compile task.

Submodule: java

Extends: Component

Initializer

new java.MavenCompile(project: Project, pom: Pom, options?: MavenCompileOptions)

class MavenPackaging 🔹

Configures a maven project to produce a .jar archive with sources and javadocs.

Submodule: java

Extends: Component

Initializer

new java.MavenPackaging(project: Project, pom: Pom, options?: MavenPackagingOptions)

class MavenSample 🔹

Java code sample.

Submodule: java

Extends: Component

Initializer

new java.MavenSample(project: Project, options: MavenSampleOptions)

class Pom 🔹

A Project Object Model or POM is the fundamental unit of work in Maven.

It is an XML file that contains information about the project and configuration details used by Maven to build the project.

Submodule: java

Extends: Component

Initializer

new java.Pom(project: Project, options: PomOptions)

Properties

Name Type Description
artifactId🔹 string Maven artifact ID.
fileName🔹 string The name of the pom file.
groupId🔹 string Maven group ID.
packaging🔹 string Maven packaging format.
version🔹 string Project version.
description?🔹 string Project description.
Optional
name?🔹 string Project display name.
Optional
url?🔹 string Project URL.
Optional

Methods

addDependency(spec)🔹

Adds a runtime dependency.

addDependency(spec: string): void

addPlugin(spec, options?)🔹

Adds a build plugin to the pom.

The plug in is also added as a BUILD dep to the project.

addPlugin(spec: string, options?: PluginOptions): Dependency

Returns:

addProperty(key, value)🔹

Adds a key/value property to the pom.

addProperty(key: string, value: string): void

addRepository(repository)🔹

Adds a repository to the pom.

addRepository(repository: MavenRepository): void

addTestDependency(spec)🔹

Adds a test dependency.

addTestDependency(spec: string): void

class Projenrc 🔹

Allows writing projenrc files in java.

This will install org.projen/projen as a Maven dependency and will add a synth task which will compile & execute main() from src/main/java/projenrc.java.

Submodule: java

Extends: Component

Initializer

new java.Projenrc(project: Project, pom: Pom, options?: ProjenrcOptions)

Properties

Name Type Description
className🔹 string The name of the java class that includes the projen entrypoint.

class Bundler 🔹

Adds support for bundling JavaScript applications and dependencies into a single file.

In the future, this will also supports bundling websites.

Submodule: javascript

Extends: Component

Initializer

Creates a Bundler.

new javascript.Bundler(project: Project, options?: BundlerOptions)

Properties

Name Type Description
bundleTask🔹 [Task](#projen-task) Gets or creates the singleton “bundle” task of the project.
bundledir🔹 string Root bundle directory.
esbuildVersion?🔹 string The semantic version requirement for esbuild (if defined).
Optional

Methods

addBundle(entrypoint, options)🔹

Adds a task to the project which bundles a specific entrypoint and all of its dependencies into a single javascript output file.

addBundle(entrypoint: string, options: AddBundleOptions): Bundle

Returns:

static of(project)🔹

Returns the Bundler instance associated with a project or undefined if there is no Bundler.

static of(project: Project): Bundler

Returns:

class Eslint 🔹

Represents eslint configuration.

Submodule: javascript

Extends: Component

Initializer

new javascript.Eslint(project: NodeProject, options: EslintOptions)

Properties

Name Type Description
config🔹 any Direct access to the eslint configuration (escape hatch).
ignorePatterns🔹 Array</code> File patterns that should not be linted.
overrides🔹 Array<[javascript.EslintOverride](#projen-javascript-eslintoverride)> eslint overrides.
rules🔹 Map<string, Array></code> eslint rules.

Methods

addExtends(…extendList)🔹

Adds an extends item to the eslint configuration.

addExtends(...extendList: string[]): void

addIgnorePattern(pattern)🔹

Do not lint these files.

addIgnorePattern(pattern: string): void

addOverride(override)🔹

Add an eslint override.

addOverride(override: EslintOverride): void

addPlugins(…plugins)🔹

Adds an eslint plugin.

addPlugins(...plugins: string[]): void

addRules(rules)🔹

Add an eslint rule.

addRules(rules: Map<string, any>): void

allowDevDeps(pattern)🔹

Add a glob file pattern which allows importing dev dependencies.

allowDevDeps(pattern: string): void

static of(project)🔹

Returns the singletone Eslint component of a project or undefined if there is none.

static of(project: Project): Eslint

Returns:

class Jest 🔹

Installs the following npm scripts:.

Submodule: javascript

Initializer

new javascript.Jest(project: NodeProject, options?: JestOptions)

Properties

Name Type Description
config🔹 any Escape hatch.
jestVersion🔹 string

Methods

addIgnorePattern(pattern)🔹

addIgnorePattern(pattern: string): void

addReporter(reporter)🔹

addReporter(reporter: string &#124; json): void

addSnapshotResolver(file)🔹

addSnapshotResolver(file: string): void

addTestMatch(pattern)🔹

Adds a test match pattern.

addTestMatch(pattern: string): void

addWatchIgnorePattern(pattern)🔹

Adds a watch ignore pattern.

addWatchIgnorePattern(pattern: string): void

class NodePackage 🔹

Represents the npm package.json file.

Submodule: javascript

Extends: Component

Initializer

new javascript.NodePackage(project: Project, options?: NodePackageOptions)

Properties

Name Type Description
allowLibraryDependencies🔹 boolean Allow project to take library dependencies.
entrypoint🔹 string The module’s entrypoint (e.g. lib/index.js).
installAndUpdateLockfileCommand🔹 string Renders yarn install or npm install with lockfile update (not frozen).
installCommand🔹 string Returns the command to execute in order to install all dependencies (always frozen).
lockFile🔹 string The name of the lock file.
manifest⚠️ any
npmAccess🔹 [javascript.NpmAccess](#projen-javascript-npmaccess) npm package access level.
npmRegistry🔹 string The npm registry host (e.g. registry.npmjs.org).
npmRegistryUrl🔹 string npm registry (e.g. https://registry.npmjs.org). Use npmRegistryHost to get just the host name.
packageManager🔹 [javascript.NodePackageManager](#projen-javascript-nodepackagemanager) The package manager to use.
packageName🔹 string The name of the npm package.
projenCommand🔹 string The command which executes “projen”.
codeArtifactOptions?🔹 [javascript.CodeArtifactOptions](#projen-javascript-codeartifactoptions) Options for npm packages using AWS CodeArtifact.
Default: undefined
license?🔹 string The SPDX license of this module.
Optional
maxNodeVersion?🔹 string Maximum node version required by this pacakge.
Default: no maximum.
minNodeVersion?🔹 string Minimum node.js version required by this package.
Default: no minimum
npmTokenSecret?🔹 string GitHub secret which contains the NPM token to use when publishing packages.
Optional
scopedPackagesOptions?🔹 Array<[javascript.ScopedPackagesOptions](#projen-javascript-scopedpackagesoptions)> Options for privately hosted scoped packages.
Default: undefined

Methods

addBin(bins)🔹

addBin(bins: Map<string, string>): void

addBundledDeps(…deps)🔹

Defines bundled dependencies.

Bundled dependencies will be added as normal dependencies as well as to the bundledDependencies section of your package.json.

addBundledDeps(...deps: string[]): void

addDeps(…deps)🔹

Defines normal dependencies.

addDeps(...deps: string[]): void

addDevDeps(…deps)🔹

Defines development/test dependencies.

addDevDeps(...deps: string[]): void

addEngine(engine, version)🔹

Adds an engines requirement to your package.

addEngine(engine: string, version: string): void

addField(name, value)🔹

Directly set fields in package.json.

addField(name: string, value: any): void

addKeywords(…keywords)🔹

Adds keywords to package.json (deduplicated).

addKeywords(...keywords: string[]): void

addPackageResolutions(…resolutions)🔹

Defines resolutions for dependencies to change the normally resolved version of a dependency to something else.

addPackageResolutions(...resolutions: string[]): void

addPeerDeps(…deps)🔹

Defines peer dependencies.

When adding peer dependencies, a devDependency will also be added on the pinned version of the declared peer. This will ensure that you are testing your code against the minimum version required from your consumers.

addPeerDeps(...deps: string[]): void

addVersion(version)🔹

Sets the package version.

addVersion(version: string): void

hasScript(name)⚠️

Indicates if a script by the given name is defined.

hasScript(name: string): boolean

Returns:

postSynthesize()🔹

Called after synthesis.

Order is not guaranteed.

postSynthesize(): void

preSynthesize()🔹

Called before synthesis.

preSynthesize(): void

removeScript(name)🔹

Removes the npm script (always successful).

removeScript(name: string): void

renderUpgradePackagesCommand(exclude, include?)🔹

Render a package manager specific command to upgrade all requested dependencies.

renderUpgradePackagesCommand(exclude: Array<string>, include?: Array<string>): string

Returns:

setScript(name, command)🔹

Override the contents of an npm package.json script.

setScript(name: string, command: string): void

class NodeProject 🔹

Node.js project.

Submodule: javascript

Extends: github.GitHubProject

Initializer

new javascript.NodeProject(options: NodeProjectOptions)

Properties

Name Type Description
allowLibraryDependencies⚠️ boolean
artifactsDirectory🔹 string The build output directory.
artifactsJavascriptDirectory🔹 string The location of the npm tarball after build (${artifactsDirectory}/js).
bundler🔹 [javascript.Bundler](#projen-javascript-bundler)
entrypoint⚠️ string
manifest⚠️ any
package🔹 [javascript.NodePackage](#projen-javascript-nodepackage) API for managing the node package.
packageManager⚠️ [javascript.NodePackageManager](#projen-javascript-nodepackagemanager) The package manager to use.
runScriptCommand🔹 string The command to use to run scripts (e.g. yarn run or npm run depends on the package manager).
autoMerge?🔹 [github.AutoMerge](#projen-github-automerge) Component that sets up mergify for merging approved pull requests.
Optional
buildWorkflow?🔹 [build.BuildWorkflow](#projen-build-buildworkflow) The PR build GitHub workflow.
Optional
buildWorkflowJobId?🔹 string The job ID of the build workflow.
Optional
jest?🔹 [javascript.Jest](#projen-javascript-jest) The Jest configuration (if enabled).
Optional
maxNodeVersion?🔹 string Maximum node version required by this pacakge.
Optional
minNodeVersion?🔹 string Minimum node.js version required by this package.
Optional
nodeVersion?🔹 string Optional
npmignore?🔹 [IgnoreFile](#projen-ignorefile) The .npmignore file.
Optional
prettier?🔹 [javascript.Prettier](#projen-javascript-prettier) Optional
publisher?⚠️ [release.Publisher](#projen-release-publisher) Package publisher.
Optional
release?🔹 [release.Release](#projen-release-release) Release management.
Optional
upgradeWorkflow?🔹 [javascript.UpgradeDependencies](#projen-javascript-upgradedependencies) The upgrade workflow.
Optional

Methods

addBins(bins)🔹

addBins(bins: Map<string, string>): void

addBundledDeps(…deps)🔹

Defines bundled dependencies.

Bundled dependencies will be added as normal dependencies as well as to the bundledDependencies section of your package.json.

addBundledDeps(...deps: string[]): void

addCompileCommand(…commands)⚠️

DEPRECATED.

addCompileCommand(...commands: string[]): void

addDeps(…deps)🔹

Defines normal dependencies.

addDeps(...deps: string[]): void

addDevDeps(…deps)🔹

Defines development/test dependencies.

addDevDeps(...deps: string[]): void

addFields(fields)🔹

Directly set fields in package.json.

addFields(fields: Map<string, any>): void

addKeywords(…keywords)🔹

Adds keywords to package.json (deduplicated).

addKeywords(...keywords: string[]): void

addPackageIgnore(pattern)🔹

Exclude these files from the bundled package.

Implemented by project types based on the packaging mechanism. For example, NodeProject delegates this to .npmignore.

addPackageIgnore(pattern: string): void

addPeerDeps(…deps)🔹

Defines peer dependencies.

When adding peer dependencies, a devDependency will also be added on the pinned version of the declared peer. This will ensure that you are testing your code against the minimum version required from your consumers.

addPeerDeps(...deps: string[]): void

addTestCommand(…commands)⚠️

DEPRECATED.

addTestCommand(...commands: string[]): void

hasScript(name)🔹

Indicates if a script by the name name is defined.

hasScript(name: string): boolean

Returns:

removeScript(name)🔹

Removes the npm script (always successful).

removeScript(name: string): void

renderWorkflowSetup(options?)🔹

Returns the set of workflow steps which should be executed to bootstrap a workflow.

renderWorkflowSetup(options?: RenderWorkflowSetupOptions): Array<JobStep>

Returns:

runTaskCommand(task)🔹

Returns the shell command to execute in order to run a task.

This will typically be npx projen TASK.

runTaskCommand(task: Task): string

Returns:

setScript(name, command)🔹

Replaces the contents of an npm package.json script.

setScript(name: string, command: string): void

class NpmConfig 🔹

File representing the local NPM config in .npmrc.

Submodule: javascript

Extends: Component

Initializer

new javascript.NpmConfig(project: NodeProject, options?: NpmConfigOptions)

Methods

addConfig(name, value)🔹

configure a generic property.

addConfig(name: string, value: string): void

addRegistry(url, scope?)🔹

configure a scoped registry.

addRegistry(url: string, scope?: string): void

class Prettier 🔹

Represents prettier configuration.

Submodule: javascript

Extends: Component

Initializer

new javascript.Prettier(project: NodeProject, options: PrettierOptions)

Properties

Name Type Description
overrides🔹 Array<[javascript.PrettierOverride](#projen-javascript-prettieroverride)> Access to the Prettieroverrides to extend those.
settings🔹 [javascript.PrettierSettings](#projen-javascript-prettiersettings) Direct access to the prettier settings.
ignoreFile?🔹 [IgnoreFile](#projen-ignorefile) The .prettierIgnore file.
Optional

Methods

addIgnorePattern(pattern)🔹

Defines Prettier ignore Patterns these patterns will be added to the file .prettierignore.

addIgnorePattern(pattern: string): void

addOverride(override)🔹

Add a prettier override.

addOverride(override: PrettierOverride): void

preSynthesize()🔹

Called before synthesis.

preSynthesize(): void

static of(project)🔹

static of(project: Project): Prettier

Returns:

class Projenrc 🔹

Sets up a javascript project to use TypeScript for projenrc.

Submodule: javascript

Extends: Component

Initializer

new javascript.Projenrc(project: Project, options?: ProjenrcOptions)

class TypescriptConfig 🔹

Submodule: javascript

Initializer

new javascript.TypescriptConfig(project: NodeProject, options: TypescriptConfigOptions)

Properties

Name Type Description
compilerOptions🔹 [javascript.TypeScriptCompilerOptions](#projen-javascript-typescriptcompileroptions)
exclude🔹 Array</code>
file🔹 [JsonFile](#projen-jsonfile)
fileName🔹 string
include🔹 Array</code>

Methods

addExclude(pattern)🔹

addExclude(pattern: string): void

addInclude(pattern)🔹

addInclude(pattern: string): void

class UpgradeDependencies 🔹

Upgrade node project dependencies.

Submodule: javascript

Extends: Component

Initializer

new javascript.UpgradeDependencies(project: NodeProject, options?: UpgradeDependenciesOptions)

Properties

Name Type Description
postUpgradeTask🔹 [Task](#projen-task) A task run after the upgrade task.
upgradeTask🔹 [Task](#projen-task) The upgrade task.
workflows🔹 Array<[github.GithubWorkflow](#projen-github-githubworkflow)> The workflows that execute the upgrades.
containerOptions?🔹 [github.workflows.ContainerOptions](#projen-github-workflows-containeroptions) Container definitions for the upgrade workflow.
Optional

Methods

addPostBuildSteps(…steps)🔹

Add steps to execute a successful build.

addPostBuildSteps(...steps: JobStep[]): void

class UpgradeDependenciesSchedule 🔹

How often to check for new versions and raise pull requests for version upgrades.

Submodule: javascript

Properties

Name Type Description
cron🔹 Array</code>
static DAILY🔹 [javascript.UpgradeDependenciesSchedule](#projen-javascript-upgradedependenciesschedule) At 00:00.
static MONTHLY🔹 [javascript.UpgradeDependenciesSchedule](#projen-javascript-upgradedependenciesschedule) At 00:00 on day-of-month 1.
static NEVER🔹 [javascript.UpgradeDependenciesSchedule](#projen-javascript-upgradedependenciesschedule) Disables automatic upgrades.
static WEEKDAY🔹 [javascript.UpgradeDependenciesSchedule](#projen-javascript-upgradedependenciesschedule) At 00:00 on every day-of-week from Monday through Friday.
static WEEKLY🔹 [javascript.UpgradeDependenciesSchedule](#projen-javascript-upgradedependenciesschedule) At 00:00 on Monday.

Methods

static expressions(cron)🔹

Create a schedule from a raw cron expression.

static expressions(cron: Array<string>): UpgradeDependenciesSchedule

Returns:

class Pip 🔹

Manages dependencies using a requirements.txt file and the pip CLI tool.

Implements: python.IPythonDeps Submodule: python

Extends: Component

Initializer

new python.Pip(project: Project, _options?: PipOptions)

Properties

Name Type Description
installTask🔹 [Task](#projen-task) A task that installs and updates dependencies.

Methods

addDependency(spec)🔹

Adds a runtime dependency.

addDependency(spec: string): void

addDevDependency(spec)🔹

Adds a dev dependency.

addDevDependency(spec: string): void

installDependencies()🔹

Installs dependencies (called during post-synthesis).

installDependencies(): void

class Poetry 🔹

Manage project dependencies, virtual environments, and packaging through the poetry CLI tool.

Implements: python.IPythonDeps, python.IPythonEnv, python.IPythonPackaging Submodule: python

Extends: Component

Initializer

new python.Poetry(project: Project, options: PythonPackagingOptions)

Properties

Name Type Description
installTask🔹 [Task](#projen-task) A task that installs and updates dependencies.
publishTask🔹 [Task](#projen-task) A task that uploads the package to a package repository.
publishTestTask🔹 [Task](#projen-task) A task that uploads the package to the Test PyPI repository.

Methods

addDependency(spec)🔹

Adds a runtime dependency.

addDependency(spec: string): void

addDevDependency(spec)🔹

Adds a dev dependency.

addDevDependency(spec: string): void

installDependencies()🔹

Installs dependencies (called during post-synthesis).

installDependencies(): void

setupEnvironment()🔹

Initializes the virtual environment if it doesn’t exist (called during post-synthesis).

setupEnvironment(): void

class PoetryPyproject 🔹

Represents configuration of a pyproject.toml file for a Poetry project.

Submodule: python

Extends: Component

Initializer

new python.PoetryPyproject(project: Project, options: PoetryPyprojectOptions)

Properties

Name Type Description
file🔹 [TomlFile](#projen-tomlfile)

class Projenrc 🔹

Allows writing projenrc files in python.

This will install projen as a Python dependency and will add a synth task which will run .projenrc.py.

Submodule: python

Extends: Component

Initializer

new python.Projenrc(project: Project, options?: ProjenrcOptions)

class Pytest 🔹

Submodule: python

Extends: Component

Initializer

new python.Pytest(project: Project, options?: PytestOptions)

Properties

Name Type Description
testdir🔹 string

class PytestSample 🔹

Python test code sample.

Submodule: python

Extends: Component

Initializer

new python.PytestSample(project: Project, options: PytestSampleOptions)

class PythonProject 🔹

Python project.

Submodule: python

Extends: github.GitHubProject

Initializer

new python.PythonProject(options: PythonProjectOptions)

Properties

Name Type Description
depsManager🔹 [python.IPythonDeps](#projen-python-ipythondeps) API for managing dependencies.
envManager🔹 [python.IPythonEnv](#projen-python-ipythonenv) API for mangaging the Python runtime environment.
moduleName🔹 string Python module name (the project name, with any hyphens or periods replaced with underscores).
version🔹 string Version of the package for distribution (should follow semver).
packagingManager?🔹 [python.IPythonPackaging](#projen-python-ipythonpackaging) API for managing packaging the project as a library.
Optional
pytest?🔹 [python.Pytest](#projen-python-pytest) Pytest component.
Optional

Methods

addDependency(spec)🔹

Adds a runtime dependency.

addDependency(spec: string): void

addDevDependency(spec)🔹

Adds a dev dependency.

addDevDependency(spec: string): void

postSynthesize()🔹

Called after all components are synthesized.

Order is not guaranteed.

postSynthesize(): void

class PythonSample 🔹

Python code sample.

Submodule: python

Extends: Component

Initializer

new python.PythonSample(project: Project, options: PythonSampleOptions)

class RequirementsFile 🔹

Specifies a list of packages to be installed using pip.

Submodule: python

Extends: FileBase

Initializer

new python.RequirementsFile(project: Project, filePath: string, options: RequirementsFileOptions)

Methods

addPackages(…packages)🔹

Adds the specified packages provided in semver format.

Comment lines (start with #) are ignored.

addPackages(...packages: string[]): void

protected synthesizeContent(resolver)🔹

Implemented by derived classes and returns the contents of the file to emit.

protected synthesizeContent(resolver: IResolver): string

Returns:

class SetupPy 🔹

Python packaging script where package metadata can be placed.

Submodule: python

Extends: FileBase

Initializer

new python.SetupPy(project: Project, options: SetupPyOptions)

Methods

protected synthesizeContent(resolver)🔹

Implemented by derived classes and returns the contents of the file to emit.

protected synthesizeContent(resolver: IResolver): string

Returns:

class Setuptools 🔹

Manages packaging through setuptools with a setup.py script.

Implements: python.IPythonPackaging Submodule: python

Extends: Component

Initializer

new python.Setuptools(project: Project, options: PythonPackagingOptions)

Properties

Name Type Description
publishTask🔹 [Task](#projen-task) A task that uploads the package to a package repository.
publishTestTask🔹 [Task](#projen-task) A task that uploads the package to the Test PyPI repository.

class Venv 🔹

Manages a virtual environment through the Python venv module.

Implements: python.IPythonEnv Submodule: python

Extends: Component

Initializer

new python.Venv(project: Project, options?: VenvOptions)

Methods

setupEnvironment()🔹

Initializes the virtual environment if it doesn’t exist (called during post-synthesis).

setupEnvironment(): void

class Publisher 🔹

Implements GitHub jobs for publishing modules to package managers.

Under the hood, it uses https://github.com/aws/publib

Submodule: release

Extends: Component

Initializer

new release.Publisher(project: Project, options: PublisherOptions)

Properties

Name Type Description
artifactName🔹 string
buildJobId🔹 string
jsiiReleaseVersion⚠️ string
publibVersion🔹 string
condition?🔹 string Optional
static PUBLISH_GIT_TASK_NAME🔹 string

Methods

addGitHubPrePublishingSteps(…steps)🔹

Adds pre publishing steps for the GitHub release job.

addGitHubPrePublishingSteps(...steps: JobStep[]): void

publishToGit(options)🔹

Publish to git.

This includes generating a project-level changelog and release tags.

publishToGit(options: GitPublishOptions): Task

Returns:

publishToGitHubReleases(options)🔹

Creates a GitHub Release.

publishToGitHubReleases(options: GitHubReleasesPublishOptions): void

publishToGo(options?)🔹

Adds a go publishing job.

publishToGo(options?: GoPublishOptions): void

publishToMaven(options?)🔹

Publishes artifacts from java/** to Maven.

publishToMaven(options?: MavenPublishOptions): void

publishToNpm(options?)🔹

Publishes artifacts from js/** to npm.

publishToNpm(options?: NpmPublishOptions): void

publishToNuget(options?)🔹

Publishes artifacts from dotnet/** to NuGet Gallery.

publishToNuget(options?: NugetPublishOptions): void

publishToPyPi(options?)🔹

Publishes wheel artifacts from python to PyPI.

publishToPyPi(options?: PyPiPublishOptions): void

class Release 🔹

Manages releases (currently through GitHub workflows).

By default, no branches are released. To add branches, call addBranch().

Submodule: release

Extends: Component

Initializer

new release.Release(project: GitHubProject, options: ReleaseOptions)

Properties

Name Type Description
artifactsDirectory🔹 string Location of build artifacts.
branches🔹 Array</code> Retrieve all release branch names.
publisher🔹 [release.Publisher](#projen-release-publisher) Package publisher.
static ANTI_TAMPER_CMD🔹 string

Methods

addBranch(branch, options)🔹

Adds a release branch.

It is a git branch from which releases are published. If a project has more than one release branch, we require that majorVersion is also specified for the primary branch in order to ensure branches always release the correct version.

addBranch(branch: string, options: BranchOptions): void

addJobs(jobs)🔹

Adds jobs to all release workflows.

addJobs(jobs: Map<string, Job>): void

preSynthesize()🔹

Called before synthesis.

preSynthesize(): void

static of(project)🔹

Returns the Release component of a project or undefined if the project does not have a Release component.

static of(project: GitHubProject): Release

Returns:

class ReleaseTrigger 🔹

Used to manage release strategies.

This includes release and release artifact automation

Submodule: release

Properties

Name Type Description
isContinuous🔹 boolean Whether or not this is a continuous release.
isManual🔹 boolean Whether or not this is a manual release trigger.
changelogPath?🔹 string Project-level changelog file path.
Optional
gitPushCommand?🔹 string Override git-push command used when releasing manually.
Optional
schedule?🔹 string Cron schedule for releases.
Optional

Methods

static continuous()🔹

Creates a continuous release trigger.

Automated releases will occur on every commit.

static continuous(): ReleaseTrigger

Returns:

static manual(options?)🔹

Creates a manual release trigger.

Use this option if you want totally manual releases.

This will give you a release task that, in addition to the normal release activities will trigger a publish:git task. This task will handle project-level changelog management, release tagging, and pushing these artifacts to origin.

The command used for pushing can be customised by specifying gitPushCommand. Set to an empty string to disable pushing entirely.

Simply run yarn release to trigger a manual release.

static manual(options?: ManualReleaseOptions): ReleaseTrigger

Returns:

static scheduled(options)🔹

Creates a scheduled release trigger.

Automated releases will occur based on the provided cron schedule.

static scheduled(options: ScheduledReleaseOptions): ReleaseTrigger

Returns:

class Projenrc 🔹

Sets up a typescript project to use TypeScript for projenrc.

Submodule: typescript

Extends: Component

Initializer

new typescript.Projenrc(project: TypeScriptProject, options?: ProjenrcOptions)

class TypeScriptAppProject 🔹

TypeScript app.

Submodule: typescript

Extends: typescript.TypeScriptProject

Initializer

new typescript.TypeScriptAppProject(options: TypeScriptProjectOptions)

class TypeScriptLibraryProject ⚠️

Submodule: typescript

Extends: typescript.TypeScriptProject

Initializer

new typescript.TypeScriptLibraryProject(options: TypeScriptProjectOptions)

class TypeScriptProject 🔹

TypeScript project.

Submodule: typescript

Extends: javascript.NodeProject

Initializer

new typescript.TypeScriptProject(options: TypeScriptProjectOptions)

Properties

Name Type Description
docsDirectory🔹 string
libdir🔹 string The directory in which compiled .js files reside.
srcdir🔹 string The directory in which the .ts sources reside.
testdir🔹 string The directory in which tests reside.
tsconfigDev🔹 [javascript.TypescriptConfig](#projen-javascript-typescriptconfig) A typescript configuration file which covers all files (sources, tests, projen).
watchTask🔹 [Task](#projen-task) The “watch” task.
docgen?🔹 boolean Optional
eslint?🔹 [javascript.Eslint](#projen-javascript-eslint) Optional
tsconfig?🔹 [javascript.TypescriptConfig](#projen-javascript-typescriptconfig) Optional
tsconfigEslint?🔹 [javascript.TypescriptConfig](#projen-javascript-typescriptconfig) Optional

class TypedocDocgen 🔹

Adds a simple Typescript documentation generator.

Submodule: typescript

Initializer

new typescript.TypedocDocgen(project: TypeScriptProject)

class DevContainer 🔹

A development environment running VSCode in a container;

used by GitHub codespaces.

Implements: IDevEnvironment Submodule: vscode

Extends: Component

Initializer

new vscode.DevContainer(project: Project, options?: DevContainerOptions)

Properties

Name Type Description
config🔹 any Direct access to the devcontainer configuration (escape hatch).

Methods

addDockerImage(image)🔹

Add a custom Docker image or Dockerfile for the container.

addDockerImage(image: DevEnvironmentDockerImage): void

addPorts(…ports)🔹

Adds ports that should be exposed (forwarded) from the container.

addPorts(...ports: string[]): void

addTasks(…tasks)🔹

Adds tasks to run when the container starts.

Tasks will be run in sequence.

addTasks(...tasks: Task[]): void

addVscodeExtensions(…extensions)🔹

Adds a list of VSCode extensions that should be automatically installed in the container.

addVscodeExtensions(...extensions: string[]): void

class VsCode 🔹

Submodule: vscode

Extends: Component

Initializer

new vscode.VsCode(project: Project)

Properties

Name Type Description
extensions🔹 [vscode.VsCodeRecommendedExtensions](#projen-vscode-vscoderecommendedextensions)
launchConfiguration🔹 [vscode.VsCodeLaunchConfig](#projen-vscode-vscodelaunchconfig)
settings🔹 [vscode.VsCodeSettings](#projen-vscode-vscodesettings)

class VsCodeLaunchConfig 🔹

VSCode launch configuration file (launch.json), useful for enabling in-editor debugger.

Submodule: vscode

Extends: Component

Initializer

new vscode.VsCodeLaunchConfig(vscode: VsCode)

Methods

addConfiguration(cfg)🔹

Adds a VsCodeLaunchConfigurationEntry (e.g. a node.js debugger) to `.vscode/launch.json. Each configuration entry has following mandatory fields: type, request and name. See https://code.visualstudio.com/docs/editor/debugging#_launchjson-attributes for details.

addConfiguration(cfg: VsCodeLaunchConfigurationEntry): void

class VsCodeRecommendedExtensions 🔹

VS Code Workspace recommended extensions Source: https://code.visualstudio.com/docs/editor/extension-marketplace#_workspace-recommended-extensions.

Submodule: vscode

Extends: Component

Initializer

new vscode.VsCodeRecommendedExtensions(vscode: VsCode)

Methods

addRecommendations(…extensions)🔹

Adds a list of VS Code extensions as recommendations for this workspace.

addRecommendations(...extensions: string[]): void

addUnwantedRecommendations(…extensions)🔹

Marks a list of VS Code extensions as unwanted recommendations for this workspace.

VS Code should not be recommend these extensions for users of this workspace.

addUnwantedRecommendations(...extensions: string[]): void

class VsCodeSettings 🔹

VS Code Workspace settings Source: https://code.visualstudio.com/docs/getstarted/settings#_workspace-settings.

Submodule: vscode

Extends: Component

Initializer

new vscode.VsCodeSettings(vscode: VsCode)

Methods

addSetting(setting, value, language?)🔹

Adds a workspace setting.

addSetting(setting: string, value: any, language?: string): void

addSettings(settings, languages?)🔹

Adds a workspace setting.

addSettings(settings: Map<string, any>, languages?: string &#124; Array<string>): void

class NextComponent 🔹

Submodule: web

Extends: Component

Initializer

new web.NextComponent(project: NodeProject, options: NextComponentOptions)

class NextJsProject 🔹

Next.js project without TypeScript.

Submodule: web

Extends: javascript.NodeProject

Initializer

new web.NextJsProject(options: NextJsProjectOptions)