Skip to main content

cdk8s Submodule

Constructs

AutoDiscover

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

Initializers

import { cdk8s } from 'projen'

new cdk8s.AutoDiscover(project: Project, options: AutoDiscoverOptions)
NameTypeDescription
project
projen.ProjectNo description.
options
AutoDiscoverOptions
No description.

projectRequired
  • Type: projen.Project

optionsRequired

Methods

NameDescription
toString
Returns a string representation of this construct.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
synthesize
Synthesizes files to the project output directory.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

synthesize
public synthesize(): void

Synthesizes files to the project output directory.

Static Functions

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.

isConstruct
import { cdk8s } from 'projen'

cdk8s.AutoDiscover.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isComponent
import { cdk8s } from 'projen'

cdk8s.AutoDiscover.isComponent(x: any)

Test whether the given construct is a component.

xRequired
  • Type: any

Properties

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired
public readonly project: Project;
  • Type: projen.Project

Cdk8sDeps

Manages dependencies on the CDK8s.

Initializers

import { cdk8s } from 'projen'

new cdk8s.Cdk8sDeps(project: Project, options: Cdk8sDepsOptions)
NameTypeDescription
project
projen.ProjectNo description.
options
Cdk8sDepsOptions
No description.

projectRequired
  • Type: projen.Project

optionsRequired

Methods

NameDescription
toString
Returns a string representation of this construct.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
synthesize
Synthesizes files to the project output directory.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

synthesize
public synthesize(): void

Synthesizes files to the project output directory.

Static Functions

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.

isConstruct
import { cdk8s } from 'projen'

cdk8s.Cdk8sDeps.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isComponent
import { cdk8s } from 'projen'

cdk8s.Cdk8sDeps.isComponent(x: any)

Test whether the given construct is a component.

xRequired
  • Type: any

Properties

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.
cdk8sMajorVersion
numberThe major version of the CDK8s (e.g. 1, 2, ...).
cdk8sMinimumVersion
stringThe minimum version of the CDK8s (e.g. 2.0.0).
cdk8sVersion
stringThe dependency requirement for CDK8s.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired
public readonly project: Project;
  • Type: projen.Project

cdk8sMajorVersionRequired
public readonly cdk8sMajorVersion: number;
  • Type: number

The major version of the CDK8s (e.g. 1, 2, ...).


cdk8sMinimumVersionRequired
public readonly cdk8sMinimumVersion: string;
  • Type: string

The minimum version of the CDK8s (e.g. 2.0.0).


cdk8sVersionRequired
public readonly cdk8sVersion: string;
  • Type: string

The dependency requirement for CDK8s.


Cdk8sDepsPy

Initializers

import { cdk8s } from 'projen'

new cdk8s.Cdk8sDepsPy(project: Project, options: Cdk8sDepsOptions)
NameTypeDescription
project
projen.ProjectNo description.
options
Cdk8sDepsOptions
No description.

projectRequired
  • Type: projen.Project

optionsRequired

Methods

NameDescription
toString
Returns a string representation of this construct.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
synthesize
Synthesizes files to the project output directory.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

synthesize
public synthesize(): void

Synthesizes files to the project output directory.

Static Functions

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.

isConstruct
import { cdk8s } from 'projen'

cdk8s.Cdk8sDepsPy.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isComponent
import { cdk8s } from 'projen'

cdk8s.Cdk8sDepsPy.isComponent(x: any)

Test whether the given construct is a component.

xRequired
  • Type: any

Properties

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.
cdk8sMajorVersion
numberThe major version of the CDK8s (e.g. 1, 2, ...).
cdk8sMinimumVersion
stringThe minimum version of the CDK8s (e.g. 2.0.0).
cdk8sVersion
stringThe dependency requirement for CDK8s.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired
public readonly project: Project;
  • Type: projen.Project

cdk8sMajorVersionRequired
public readonly cdk8sMajorVersion: number;
  • Type: number

The major version of the CDK8s (e.g. 1, 2, ...).


cdk8sMinimumVersionRequired
public readonly cdk8sMinimumVersion: string;
  • Type: string

The minimum version of the CDK8s (e.g. 2.0.0).


cdk8sVersionRequired
public readonly cdk8sVersion: string;
  • Type: string

The dependency requirement for CDK8s.


Cdk8sPythonApp

CDK8s app in Python.

Initializers

import { cdk8s } from 'projen'

new cdk8s.Cdk8sPythonApp(options: Cdk8sPythonOptions)
NameTypeDescription
options
Cdk8sPythonOptions
No description.

optionsRequired

Methods

NameDescription
toString
Returns a string representation of this construct.
addExcludeFromCleanup
Exclude the matching files from pre-synth cleanup.
addGitIgnore
Adds a .gitignore pattern.
addPackageIgnore
Exclude these files from the bundled package.
addTask
Adds a new task to this project.
addTip
Prints a "tip" message during synthesis.
annotateGenerated
Marks the provided file(s) as being generated.
postSynthesize
Called after all components are synthesized.
preSynthesize
Called before all components are synthesized.
removeTask
Removes a task from a project.
runTaskCommand
Returns the shell command to execute in order to run a task.
synth
Synthesize all project files into outdir.
tryFindFile
Finds a file at the specified relative path within this project and all its subprojects.
tryFindJsonFile
Finds a json file by name.
tryFindObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
tryRemoveFile
Finds a file at the specified relative path within this project and removes it.
addDependency
Adds a runtime dependency.
addDevDependency
Adds a dev dependency.

toString
public toString(): string

Returns a string representation of this construct.

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

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.

globsRequired
  • Type: ...string[]

The glob patterns to match.


addGitIgnore
public addGitIgnore(pattern: string): void

Adds a .gitignore pattern.

patternRequired
  • Type: string

The glob pattern to ignore.


addPackageIgnore
public addPackageIgnore(_pattern: string): void

Exclude these files from the bundled package.

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

_patternRequired
  • Type: string

The glob pattern to exclude.


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

Adds a new task to this project.

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

nameRequired
  • Type: string

The task name to add.


propsOptional
  • Type: projen.TaskOptions

Task properties.


addTip
public addTip(message: string): void

Prints a "tip" message during synthesis.

messageRequired
  • Type: string

The message.


annotateGenerated
public annotateGenerated(glob: string): void

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.

https://github.com/github/linguist/blob/master/docs/overrides.md

globRequired
  • Type: string

the glob pattern to match (could be a file path).


postSynthesize
public postSynthesize(): void

Called after all components are synthesized.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before all components are synthesized.

removeTask
public removeTask(name: string): Task

Removes a task from a project.

nameRequired
  • Type: string

The name of the task to remove.


runTaskCommand
public runTaskCommand(task: Task): string

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

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

taskRequired
  • Type: projen.Task

The task for which the command is required.


synth
public synth(): void

Synthesize all project files into outdir.

  1. Call "this.preSynthesize()"
  2. Delete all generated files
  3. Synthesize all subprojects
  4. Synthesize all components of this project
  5. Call "postSynthesize()" for all components of this project
  6. Call "this.postSynthesize()"
tryFindFile
public tryFindFile(filePath: string): FileBase

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

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


tryFindJsonFile
public tryFindJsonFile(filePath: string): JsonFile

Finds a json file by name.

filePathRequired
  • Type: string

The file path.


tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile

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

filePathRequired
  • Type: string

The file path.


tryRemoveFile
public tryRemoveFile(filePath: string): FileBase

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

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


addDependency
public addDependency(spec: string): void

Adds a runtime dependency.

specRequired
  • Type: string

Format <module>@<semver>.


addDevDependency
public addDevDependency(spec: string): void

Adds a dev dependency.

specRequired
  • Type: string

Format <module>@<semver>.


Static Functions

NameDescription
isConstruct
Checks if x is a construct.
isProject
Test whether the given construct is a project.
of
Find the closest ancestor project for given construct.

isConstruct
import { cdk8s } from 'projen'

cdk8s.Cdk8sPythonApp.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isProject
import { cdk8s } from 'projen'

cdk8s.Cdk8sPythonApp.isProject(x: any)

Test whether the given construct is a project.

xRequired
  • Type: any

of
import { cdk8s } from 'projen'

cdk8s.Cdk8sPythonApp.of(construct: IConstruct)

Find the closest ancestor project for given construct.

When given a project, this it the project itself.

constructRequired
  • Type: constructs.IConstruct

Properties

NameTypeDescription
node
constructs.NodeThe tree node.
buildTask
projen.TaskNo description.
commitGenerated
booleanWhether to commit the managed files by default.
compileTask
projen.TaskNo description.
components
projen.Component[]Returns all the components within this project.
deps
projen.DependenciesProject dependencies.
ejected
booleanWhether or not the project is being ejected.
files
projen.FileBase[]All files in this project.
gitattributes
projen.GitAttributesFileThe .gitattributes file for this repository.
gitignore
projen.IgnoreFile.gitignore.
logger
projen.LoggerLogging utilities.
name
stringProject name.
outdir
stringAbsolute output directory of this project.
packageTask
projen.TaskNo description.
postCompileTask
projen.TaskNo description.
preCompileTask
projen.TaskNo description.
projectBuild
projen.ProjectBuildManages the build process of the project.
projenCommand
stringThe command to use in order to run the projen CLI.
root
projen.ProjectThe root project.
subprojects
projen.Project[]Returns all the subprojects within this project.
tasks
projen.TasksProject tasks.
testTask
projen.TaskNo description.
defaultTask
projen.TaskThis is the "default" task, the one that executes "projen".
initProject
projen.InitProjectThe options used when this project is bootstrapped via projen new.
parent
projen.ProjectA parent project.
projectType
projen.ProjectTypeNo description.
autoApprove
projen.github.AutoApproveAuto approve set up for this project.
devContainer
projen.vscode.DevContainerAccess for .devcontainer.json (used for GitHub Codespaces).
github
projen.github.GitHubAccess all github components.
gitpod
projen.GitpodAccess for Gitpod.
vscode
projen.vscode.VsCodeAccess all VSCode components.
depsManager
projen.python.IPythonDepsAPI for managing dependencies.
envManager
projen.python.IPythonEnvAPI for mangaging the Python runtime environment.
moduleName
stringPython module name (the project name, with any hyphens or periods replaced with underscores).
version
stringVersion of the package for distribution (should follow semver).
packagingManager
projen.python.IPythonPackagingAPI for managing packaging the project as a library.
pytest
projen.python.PytestPytest component.
appEntrypoint
stringThe CDK8s app entrypoint.
cdk8sDeps
Cdk8sDeps
No description.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


buildTaskRequired
public readonly buildTask: Task;
  • Type: projen.Task

commitGeneratedRequired
public readonly commitGenerated: boolean;
  • Type: boolean

Whether to commit the managed files by default.


compileTaskRequired
public readonly compileTask: Task;
  • Type: projen.Task

componentsRequired
public readonly components: Component[];
  • Type: projen.Component[]

Returns all the components within this project.


depsRequired
public readonly deps: Dependencies;
  • Type: projen.Dependencies

Project dependencies.


ejectedRequired
public readonly ejected: boolean;
  • Type: boolean

Whether or not the project is being ejected.


filesRequired
public readonly files: FileBase[];
  • Type: projen.FileBase[]

All files in this project.


gitattributesRequired
public readonly gitattributes: GitAttributesFile;
  • Type: projen.GitAttributesFile

The .gitattributes file for this repository.


gitignoreRequired
public readonly gitignore: IgnoreFile;
  • Type: projen.IgnoreFile

.gitignore.


loggerRequired
public readonly logger: Logger;
  • Type: projen.Logger

Logging utilities.


nameRequired
public readonly name: string;
  • Type: string

Project name.


outdirRequired
public readonly outdir: string;
  • Type: string

Absolute output directory of this project.


packageTaskRequired
public readonly packageTask: Task;
  • Type: projen.Task

postCompileTaskRequired
public readonly postCompileTask: Task;
  • Type: projen.Task

preCompileTaskRequired
public readonly preCompileTask: Task;
  • Type: projen.Task

projectBuildRequired
public readonly projectBuild: ProjectBuild;
  • Type: projen.ProjectBuild

Manages the build process of the project.


projenCommandRequired
public readonly projenCommand: string;
  • Type: string

The command to use in order to run the projen CLI.


rootRequired
public readonly root: Project;
  • Type: projen.Project

The root project.


subprojectsRequired
public readonly subprojects: Project[];
  • Type: projen.Project[]

Returns all the subprojects within this project.


tasksRequired
public readonly tasks: Tasks;
  • Type: projen.Tasks

Project tasks.


testTaskRequired
public readonly testTask: Task;
  • Type: projen.Task

defaultTaskOptional
public readonly defaultTask: Task;
  • Type: projen.Task

This is the "default" task, the one that executes "projen".

Undefined if the project is being ejected.


initProjectOptional
public readonly initProject: InitProject;
  • Type: projen.InitProject

The options used when this project is bootstrapped via projen new.

It includes the original set of options passed to the CLI and also the JSII FQN of the project type.


parentOptional
public readonly parent: Project;
  • Type: projen.Project

A parent project.

If undefined, this is the root project.


projectTypeRequired
public readonly projectType: ProjectType;
  • Type: projen.ProjectType

autoApproveOptional
public readonly autoApprove: AutoApprove;
  • Type: projen.github.AutoApprove

Auto approve set up for this project.


devContainerOptional
public readonly devContainer: DevContainer;
  • Type: projen.vscode.DevContainer

Access for .devcontainer.json (used for GitHub Codespaces).

This will be undefined if devContainer boolean is false


githubOptional
public readonly github: GitHub;
  • Type: projen.github.GitHub

Access all github components.

This will be undefined for subprojects.


gitpodOptional
public readonly gitpod: Gitpod;
  • Type: projen.Gitpod

Access for Gitpod.

This will be undefined if gitpod boolean is false


vscodeOptional
public readonly vscode: VsCode;
  • Type: projen.vscode.VsCode

Access all VSCode components.

This will be undefined for subprojects.


depsManagerRequired
public readonly depsManager: IPythonDeps;
  • Type: projen.python.IPythonDeps

API for managing dependencies.


envManagerRequired
public readonly envManager: IPythonEnv;
  • Type: projen.python.IPythonEnv

API for mangaging the Python runtime environment.


moduleNameRequired
public readonly moduleName: string;
  • Type: string

Python module name (the project name, with any hyphens or periods replaced with underscores).


versionRequired
public readonly version: string;
  • Type: string

Version of the package for distribution (should follow semver).


packagingManagerOptional
public readonly packagingManager: IPythonPackaging;
  • Type: projen.python.IPythonPackaging

API for managing packaging the project as a library.

Only applies when the projectType is LIB.


pytestOptional
public readonly pytest: Pytest;
  • Type: projen.python.Pytest

Pytest component.


appEntrypointRequired
public readonly appEntrypoint: string;
  • Type: string

The CDK8s app entrypoint.


cdk8sDepsRequired
public readonly cdk8sDeps: Cdk8sDeps;

Constants

NameTypeDescription
DEFAULT_TASK
stringThe name of the default task (the task executed when projen is run without arguments).

DEFAULT_TASKRequired
public readonly DEFAULT_TASK: string;
  • Type: string

The name of the default task (the task executed when projen is run without arguments).

Normally this task should synthesize the project files.


Cdk8sTypeScriptApp

CDK8s app in TypeScript.

Initializers

import { cdk8s } from 'projen'

new cdk8s.Cdk8sTypeScriptApp(options: Cdk8sTypeScriptAppOptions)
NameTypeDescription
options
Cdk8sTypeScriptAppOptions
No description.

optionsRequired

Methods

NameDescription
toString
Returns a string representation of this construct.
addExcludeFromCleanup
Exclude the matching files from pre-synth cleanup.
addGitIgnore
Adds a .gitignore pattern.
addPackageIgnore
Adds patterns to be ignored by npm.
addTask
Adds a new task to this project.
addTip
Prints a "tip" message during synthesis.
annotateGenerated
Marks the provided file(s) as being generated.
postSynthesize
Called after all components are synthesized.
preSynthesize
Called before all components are synthesized.
removeTask
Removes a task from a project.
runTaskCommand
Returns the shell command to execute in order to run a task.
synth
Synthesize all project files into outdir.
tryFindFile
Finds a file at the specified relative path within this project and all its subprojects.
tryFindJsonFile
Finds a json file by name.
tryFindObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
tryRemoveFile
Finds a file at the specified relative path within this project and removes it.
addBins
No description.
addBundledDeps
Defines bundled dependencies.
addCompileCommand
DEPRECATED.
addDeps
Defines normal dependencies.
addDevDeps
Defines development/test dependencies.
addFields
Directly set fields in package.json.
addKeywords
Adds keywords to package.json (deduplicated).
addPeerDeps
Defines peer dependencies.
addScripts
Replaces the contents of multiple npm package.json scripts.
addTestCommand
DEPRECATED.
hasScript
Indicates if a script by the name name is defined.
removeScript
Removes the npm script (always successful).
renderWorkflowSetup
Returns the set of workflow steps which should be executed to bootstrap a workflow.
setScript
Replaces the contents of an npm package.json script.

toString
public toString(): string

Returns a string representation of this construct.

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

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.

globsRequired
  • Type: ...string[]

The glob patterns to match.


addGitIgnore
public addGitIgnore(pattern: string): void

Adds a .gitignore pattern.

patternRequired
  • Type: string

The glob pattern to ignore.


addPackageIgnore
public addPackageIgnore(pattern: string): void

Adds patterns to be ignored by npm.

patternRequired
  • Type: string

The pattern to ignore.


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

Adds a new task to this project.

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

nameRequired
  • Type: string

The task name to add.


propsOptional
  • Type: projen.TaskOptions

Task properties.


addTip
public addTip(message: string): void

Prints a "tip" message during synthesis.

messageRequired
  • Type: string

The message.


annotateGenerated
public annotateGenerated(glob: string): void

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.

https://github.com/github/linguist/blob/master/docs/overrides.md

globRequired
  • Type: string

the glob pattern to match (could be a file path).


postSynthesize
public postSynthesize(): void

Called after all components are synthesized.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before all components are synthesized.

removeTask
public removeTask(name: string): Task

Removes a task from a project.

nameRequired
  • Type: string

The name of the task to remove.


runTaskCommand
public runTaskCommand(task: Task): string

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

This will typically be npx projen TASK.

taskRequired
  • Type: projen.Task

The task for which the command is required.


synth
public synth(): void

Synthesize all project files into outdir.

  1. Call "this.preSynthesize()"
  2. Delete all generated files
  3. Synthesize all subprojects
  4. Synthesize all components of this project
  5. Call "postSynthesize()" for all components of this project
  6. Call "this.postSynthesize()"
tryFindFile
public tryFindFile(filePath: string): FileBase

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

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


tryFindJsonFile
public tryFindJsonFile(filePath: string): JsonFile

Finds a json file by name.

filePathRequired
  • Type: string

The file path.


tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile

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

filePathRequired
  • Type: string

The file path.


tryRemoveFile
public tryRemoveFile(filePath: string): FileBase

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

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


addBins
public addBins(bins: {[ key: string ]: string}): void
binsRequired
  • Type: {[ key: string ]: string}

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

Defines bundled dependencies.

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

depsRequired
  • Type: ...string[]

Names modules to install.

By default, the the dependency will be installed in the next npx projen run and the version will be recorded in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax: module@^7.


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

DEPRECATED.

commandsRequired
  • Type: ...string[]

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

Defines normal dependencies.

depsRequired
  • Type: ...string[]

Names modules to install.

By default, the the dependency will be installed in the next npx projen run and the version will be recorded in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax: module@^7.


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

Defines development/test dependencies.

depsRequired
  • Type: ...string[]

Names modules to install.

By default, the the dependency will be installed in the next npx projen run and the version will be recorded in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax: module@^7.


addFields
public addFields(fields: {[ key: string ]: any}): void

Directly set fields in package.json.

fieldsRequired
  • Type: {[ key: string ]: any}

The fields to set.


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

Adds keywords to package.json (deduplicated).

keywordsRequired
  • Type: ...string[]

The keywords to add.


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

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.

depsRequired
  • Type: ...string[]

Names modules to install.

By default, the the dependency will be installed in the next npx projen run and the version will be recorded in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax: module@^7.


addScripts
public addScripts(scripts: {[ key: string ]: string}): void

Replaces the contents of multiple npm package.json scripts.

scriptsRequired
  • Type: {[ key: string ]: string}

The scripts to set.


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

DEPRECATED.

commandsRequired
  • Type: ...string[]

hasScript
public hasScript(name: string): boolean

Indicates if a script by the name name is defined.

nameRequired
  • Type: string

The name of the script.


removeScript
public removeScript(name: string): void

Removes the npm script (always successful).

nameRequired
  • Type: string

The name of the script.


renderWorkflowSetup
public renderWorkflowSetup(options?: RenderWorkflowSetupOptions): JobStep[]

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

optionsOptional
  • Type: projen.javascript.RenderWorkflowSetupOptions

Options.


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

Replaces the contents of an npm package.json script.

nameRequired
  • Type: string

The script name.


commandRequired
  • Type: string

The command to execute.


Static Functions

NameDescription
isConstruct
Checks if x is a construct.
isProject
Test whether the given construct is a project.
of
Find the closest ancestor project for given construct.

isConstruct
import { cdk8s } from 'projen'

cdk8s.Cdk8sTypeScriptApp.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isProject
import { cdk8s } from 'projen'

cdk8s.Cdk8sTypeScriptApp.isProject(x: any)

Test whether the given construct is a project.

xRequired
  • Type: any

of
import { cdk8s } from 'projen'

cdk8s.Cdk8sTypeScriptApp.of(construct: IConstruct)

Find the closest ancestor project for given construct.

When given a project, this it the project itself.

constructRequired
  • Type: constructs.IConstruct

Properties

NameTypeDescription
node
constructs.NodeThe tree node.
buildTask
projen.TaskNo description.
commitGenerated
booleanWhether to commit the managed files by default.
compileTask
projen.TaskNo description.
components
projen.Component[]Returns all the components within this project.
deps
projen.DependenciesProject dependencies.
ejected
booleanWhether or not the project is being ejected.
files
projen.FileBase[]All files in this project.
gitattributes
projen.GitAttributesFileThe .gitattributes file for this repository.
gitignore
projen.IgnoreFile.gitignore.
logger
projen.LoggerLogging utilities.
name
stringProject name.
outdir
stringAbsolute output directory of this project.
packageTask
projen.TaskNo description.
postCompileTask
projen.TaskNo description.
preCompileTask
projen.TaskNo description.
projectBuild
projen.ProjectBuildManages the build process of the project.
projenCommand
stringThe command to use in order to run the projen CLI.
root
projen.ProjectThe root project.
subprojects
projen.Project[]Returns all the subprojects within this project.
tasks
projen.TasksProject tasks.
testTask
projen.TaskNo description.
defaultTask
projen.TaskThis is the "default" task, the one that executes "projen".
initProject
projen.InitProjectThe options used when this project is bootstrapped via projen new.
parent
projen.ProjectA parent project.
projectType
projen.ProjectTypeNo description.
autoApprove
projen.github.AutoApproveAuto approve set up for this project.
devContainer
projen.vscode.DevContainerAccess for .devcontainer.json (used for GitHub Codespaces).
github
projen.github.GitHubAccess all github components.
gitpod
projen.GitpodAccess for Gitpod.
vscode
projen.vscode.VsCodeAccess all VSCode components.
allowLibraryDependencies
booleanNo description.
artifactsDirectory
stringThe build output directory.
artifactsJavascriptDirectory
stringThe location of the npm tarball after build (${artifactsDirectory}/js).
bundler
projen.javascript.BundlerNo description.
entrypoint
stringNo description.
manifest
anyNo description.
npmrc
projen.javascript.NpmConfigThe .npmrc file.
package
projen.javascript.NodePackageAPI for managing the node package.
packageManager
projen.javascript.NodePackageManagerThe package manager to use.
runScriptCommand
stringThe command to use to run scripts (e.g. yarn run or npm run depends on the package manager).
autoMerge
projen.github.AutoMergeComponent that sets up mergify for merging approved pull requests.
buildWorkflow
projen.build.BuildWorkflowThe PR build GitHub workflow.
buildWorkflowJobId
stringThe job ID of the build workflow.
jest
projen.javascript.JestThe Jest configuration (if enabled).
maxNodeVersion
stringMaximum node version supported by this package.
minNodeVersion
stringThe minimum node version required by this package to function.
npmignore
projen.IgnoreFileThe .npmignore file.
prettier
projen.javascript.PrettierNo description.
publisher
projen.release.PublisherPackage publisher.
release
projen.release.ReleaseRelease management.
upgradeWorkflow
projen.javascript.UpgradeDependenciesThe upgrade workflow.
docsDirectory
stringNo description.
libdir
stringThe directory in which compiled .js files reside.
srcdir
stringThe directory in which the .ts sources reside.
testdir
stringThe directory in which tests reside.
tsconfigDev
projen.javascript.TypescriptConfigA typescript configuration file which covers all files (sources, tests, projen).
watchTask
projen.TaskThe "watch" task.
docgen
booleanNo description.
eslint
projen.javascript.EslintNo description.
tsconfig
projen.javascript.TypescriptConfigNo description.
tsconfigEslint
projen.javascript.TypescriptConfigNo description.
appEntrypoint
stringThe CDK8s app entrypoint.
cdk8sDeps
Cdk8sDeps
No description.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


buildTaskRequired
public readonly buildTask: Task;
  • Type: projen.Task

commitGeneratedRequired
public readonly commitGenerated: boolean;
  • Type: boolean

Whether to commit the managed files by default.


compileTaskRequired
public readonly compileTask: Task;
  • Type: projen.Task

componentsRequired
public readonly components: Component[];
  • Type: projen.Component[]

Returns all the components within this project.


depsRequired
public readonly deps: Dependencies;
  • Type: projen.Dependencies

Project dependencies.


ejectedRequired
public readonly ejected: boolean;
  • Type: boolean

Whether or not the project is being ejected.


filesRequired
public readonly files: FileBase[];
  • Type: projen.FileBase[]

All files in this project.


gitattributesRequired
public readonly gitattributes: GitAttributesFile;
  • Type: projen.GitAttributesFile

The .gitattributes file for this repository.


gitignoreRequired
public readonly gitignore: IgnoreFile;
  • Type: projen.IgnoreFile

.gitignore.


loggerRequired
public readonly logger: Logger;
  • Type: projen.Logger

Logging utilities.


nameRequired
public readonly name: string;
  • Type: string

Project name.


outdirRequired
public readonly outdir: string;
  • Type: string

Absolute output directory of this project.


packageTaskRequired
public readonly packageTask: Task;
  • Type: projen.Task

postCompileTaskRequired
public readonly postCompileTask: Task;
  • Type: projen.Task

preCompileTaskRequired
public readonly preCompileTask: Task;
  • Type: projen.Task

projectBuildRequired
public readonly projectBuild: ProjectBuild;
  • Type: projen.ProjectBuild

Manages the build process of the project.


projenCommandRequired
public readonly projenCommand: string;
  • Type: string

The command to use in order to run the projen CLI.


rootRequired
public readonly root: Project;
  • Type: projen.Project

The root project.


subprojectsRequired
public readonly subprojects: Project[];
  • Type: projen.Project[]

Returns all the subprojects within this project.


tasksRequired
public readonly tasks: Tasks;
  • Type: projen.Tasks

Project tasks.


testTaskRequired
public readonly testTask: Task;
  • Type: projen.Task

defaultTaskOptional
public readonly defaultTask: Task;
  • Type: projen.Task

This is the "default" task, the one that executes "projen".

Undefined if the project is being ejected.


initProjectOptional
public readonly initProject: InitProject;
  • Type: projen.InitProject

The options used when this project is bootstrapped via projen new.

It includes the original set of options passed to the CLI and also the JSII FQN of the project type.


parentOptional
public readonly parent: Project;
  • Type: projen.Project

A parent project.

If undefined, this is the root project.


projectTypeRequired
public readonly projectType: ProjectType;
  • Type: projen.ProjectType

autoApproveOptional
public readonly autoApprove: AutoApprove;
  • Type: projen.github.AutoApprove

Auto approve set up for this project.


devContainerOptional
public readonly devContainer: DevContainer;
  • Type: projen.vscode.DevContainer

Access for .devcontainer.json (used for GitHub Codespaces).

This will be undefined if devContainer boolean is false


githubOptional
public readonly github: GitHub;
  • Type: projen.github.GitHub

Access all github components.

This will be undefined for subprojects.


gitpodOptional
public readonly gitpod: Gitpod;
  • Type: projen.Gitpod

Access for Gitpod.

This will be undefined if gitpod boolean is false


vscodeOptional
public readonly vscode: VsCode;
  • Type: projen.vscode.VsCode

Access all VSCode components.

This will be undefined for subprojects.


allowLibraryDependenciesRequired
  • Deprecated: use package.allowLibraryDependencies
public readonly allowLibraryDependencies: boolean;
  • Type: boolean

artifactsDirectoryRequired
public readonly artifactsDirectory: string;
  • Type: string

The build output directory.

An npm tarball will be created under the js subdirectory. For example, if this is set to dist (the default), the npm tarball will be placed under dist/js/boom-boom-1.2.3.tg.


artifactsJavascriptDirectoryRequired
public readonly artifactsJavascriptDirectory: string;
  • Type: string

The location of the npm tarball after build (${artifactsDirectory}/js).


bundlerRequired
public readonly bundler: Bundler;
  • Type: projen.javascript.Bundler

entrypointRequired
  • Deprecated: use package.entrypoint
public readonly entrypoint: string;
  • Type: string

manifestRequired
  • Deprecated: use package.addField(x, y)
public readonly manifest: any;
  • Type: any

npmrcRequired
public readonly npmrc: NpmConfig;
  • Type: projen.javascript.NpmConfig

The .npmrc file.


packageRequired
public readonly package: NodePackage;
  • Type: projen.javascript.NodePackage

API for managing the node package.


packageManagerRequired
  • Deprecated: use package.packageManager
public readonly packageManager: NodePackageManager;
  • Type: projen.javascript.NodePackageManager

The package manager to use.


runScriptCommandRequired
public readonly runScriptCommand: string;
  • Type: string

The command to use to run scripts (e.g. yarn run or npm run depends on the package manager).


autoMergeOptional
public readonly autoMerge: AutoMerge;
  • Type: projen.github.AutoMerge

Component that sets up mergify for merging approved pull requests.


buildWorkflowOptional
public readonly buildWorkflow: BuildWorkflow;
  • Type: projen.build.BuildWorkflow

The PR build GitHub workflow.

undefined if buildWorkflow is disabled.


buildWorkflowJobIdOptional
public readonly buildWorkflowJobId: string;
  • Type: string

The job ID of the build workflow.


jestOptional
public readonly jest: Jest;
  • Type: projen.javascript.Jest

The Jest configuration (if enabled).


maxNodeVersionOptional
public readonly maxNodeVersion: string;
  • Type: string

Maximum node version supported by this package.

The value indicates the package is incompatible with newer versions.


minNodeVersionOptional
public readonly minNodeVersion: string;
  • Type: string

The minimum node version required by this package to function.

This value indicates the package is incompatible with older versions.


npmignoreOptional
public readonly npmignore: IgnoreFile;
  • Type: projen.IgnoreFile

The .npmignore file.


prettierOptional
public readonly prettier: Prettier;
  • Type: projen.javascript.Prettier

publisherOptional
  • Deprecated: use release.publisher.
public readonly publisher: Publisher;
  • Type: projen.release.Publisher

Package publisher.

This will be undefined if the project does not have a release workflow.


releaseOptional
public readonly release: Release;
  • Type: projen.release.Release

Release management.


upgradeWorkflowOptional
public readonly upgradeWorkflow: UpgradeDependencies;
  • Type: projen.javascript.UpgradeDependencies

The upgrade workflow.


docsDirectoryRequired
public readonly docsDirectory: string;
  • Type: string

libdirRequired
public readonly libdir: string;
  • Type: string

The directory in which compiled .js files reside.


srcdirRequired
public readonly srcdir: string;
  • Type: string

The directory in which the .ts sources reside.


testdirRequired
public readonly testdir: string;
  • Type: string

The directory in which tests reside.


tsconfigDevRequired
public readonly tsconfigDev: TypescriptConfig;
  • Type: projen.javascript.TypescriptConfig

A typescript configuration file which covers all files (sources, tests, projen).


watchTaskRequired
public readonly watchTask: Task;
  • Type: projen.Task

The "watch" task.


docgenOptional
public readonly docgen: boolean;
  • Type: boolean

eslintOptional
public readonly eslint: Eslint;
  • Type: projen.javascript.Eslint

tsconfigOptional
public readonly tsconfig: TypescriptConfig;
  • Type: projen.javascript.TypescriptConfig

tsconfigEslintOptional
public readonly tsconfigEslint: TypescriptConfig;
  • Type: projen.javascript.TypescriptConfig

appEntrypointRequired
public readonly appEntrypoint: string;
  • Type: string

The CDK8s app entrypoint.


cdk8sDepsRequired
public readonly cdk8sDeps: Cdk8sDeps;

Constants

NameTypeDescription
DEFAULT_TASK
stringThe name of the default task (the task executed when projen is run without arguments).
DEFAULT_TS_JEST_TRANFORM_PATTERN
stringNo description.

DEFAULT_TASKRequired
public readonly DEFAULT_TASK: string;
  • Type: string

The name of the default task (the task executed when projen is run without arguments).

Normally this task should synthesize the project files.


DEFAULT_TS_JEST_TRANFORM_PATTERNRequired
public readonly DEFAULT_TS_JEST_TRANFORM_PATTERN: string;
  • Type: string

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.

Initializers

import { cdk8s } from 'projen'

new cdk8s.ConstructLibraryCdk8s(options: ConstructLibraryCdk8sOptions)
NameTypeDescription
options
ConstructLibraryCdk8sOptions
No description.

optionsRequired

Methods

NameDescription
toString
Returns a string representation of this construct.
addExcludeFromCleanup
Exclude the matching files from pre-synth cleanup.
addGitIgnore
Adds a .gitignore pattern.
addPackageIgnore
Adds patterns to be ignored by npm.
addTask
Adds a new task to this project.
addTip
Prints a "tip" message during synthesis.
annotateGenerated
Marks the provided file(s) as being generated.
postSynthesize
Called after all components are synthesized.
preSynthesize
Called before all components are synthesized.
removeTask
Removes a task from a project.
runTaskCommand
Returns the shell command to execute in order to run a task.
synth
Synthesize all project files into outdir.
tryFindFile
Finds a file at the specified relative path within this project and all its subprojects.
tryFindJsonFile
Finds a json file by name.
tryFindObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
tryRemoveFile
Finds a file at the specified relative path within this project and removes it.
addBins
No description.
addBundledDeps
Defines bundled dependencies.
addCompileCommand
DEPRECATED.
addDeps
Defines normal dependencies.
addDevDeps
Defines development/test dependencies.
addFields
Directly set fields in package.json.
addKeywords
Adds keywords to package.json (deduplicated).
addPeerDeps
Defines peer dependencies.
addScripts
Replaces the contents of multiple npm package.json scripts.
addTestCommand
DEPRECATED.
hasScript
Indicates if a script by the name name is defined.
removeScript
Removes the npm script (always successful).
renderWorkflowSetup
Returns the set of workflow steps which should be executed to bootstrap a workflow.
setScript
Replaces the contents of an npm package.json script.

toString
public toString(): string

Returns a string representation of this construct.

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

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.

globsRequired
  • Type: ...string[]

The glob patterns to match.


addGitIgnore
public addGitIgnore(pattern: string): void

Adds a .gitignore pattern.

patternRequired
  • Type: string

The glob pattern to ignore.


addPackageIgnore
public addPackageIgnore(pattern: string): void

Adds patterns to be ignored by npm.

patternRequired
  • Type: string

The pattern to ignore.


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

Adds a new task to this project.

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

nameRequired
  • Type: string

The task name to add.


propsOptional
  • Type: projen.TaskOptions

Task properties.


addTip
public addTip(message: string): void

Prints a "tip" message during synthesis.

messageRequired
  • Type: string

The message.


annotateGenerated
public annotateGenerated(glob: string): void

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.

https://github.com/github/linguist/blob/master/docs/overrides.md

globRequired
  • Type: string

the glob pattern to match (could be a file path).


postSynthesize
public postSynthesize(): void

Called after all components are synthesized.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before all components are synthesized.

removeTask
public removeTask(name: string): Task

Removes a task from a project.

nameRequired
  • Type: string

The name of the task to remove.


runTaskCommand
public runTaskCommand(task: Task): string

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

This will typically be npx projen TASK.

taskRequired
  • Type: projen.Task

The task for which the command is required.


synth
public synth(): void

Synthesize all project files into outdir.

  1. Call "this.preSynthesize()"
  2. Delete all generated files
  3. Synthesize all subprojects
  4. Synthesize all components of this project
  5. Call "postSynthesize()" for all components of this project
  6. Call "this.postSynthesize()"
tryFindFile
public tryFindFile(filePath: string): FileBase

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

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


tryFindJsonFile
public tryFindJsonFile(filePath: string): JsonFile

Finds a json file by name.

filePathRequired
  • Type: string

The file path.


tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile

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

filePathRequired
  • Type: string

The file path.


tryRemoveFile
public tryRemoveFile(filePath: string): FileBase

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

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


addBins
public addBins(bins: {[ key: string ]: string}): void
binsRequired
  • Type: {[ key: string ]: string}

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

Defines bundled dependencies.

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

depsRequired
  • Type: ...string[]

Names modules to install.

By default, the the dependency will be installed in the next npx projen run and the version will be recorded in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax: module@^7.


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

DEPRECATED.

commandsRequired
  • Type: ...string[]

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

Defines normal dependencies.

depsRequired
  • Type: ...string[]

Names modules to install.

By default, the the dependency will be installed in the next npx projen run and the version will be recorded in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax: module@^7.


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

Defines development/test dependencies.

depsRequired
  • Type: ...string[]

Names modules to install.

By default, the the dependency will be installed in the next npx projen run and the version will be recorded in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax: module@^7.


addFields
public addFields(fields: {[ key: string ]: any}): void

Directly set fields in package.json.

fieldsRequired
  • Type: {[ key: string ]: any}

The fields to set.


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

Adds keywords to package.json (deduplicated).

keywordsRequired
  • Type: ...string[]

The keywords to add.


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

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.

depsRequired
  • Type: ...string[]

Names modules to install.

By default, the the dependency will be installed in the next npx projen run and the version will be recorded in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax: module@^7.


addScripts
public addScripts(scripts: {[ key: string ]: string}): void

Replaces the contents of multiple npm package.json scripts.

scriptsRequired
  • Type: {[ key: string ]: string}

The scripts to set.


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

DEPRECATED.

commandsRequired
  • Type: ...string[]

hasScript
public hasScript(name: string): boolean

Indicates if a script by the name name is defined.

nameRequired
  • Type: string

The name of the script.


removeScript
public removeScript(name: string): void

Removes the npm script (always successful).

nameRequired
  • Type: string

The name of the script.


renderWorkflowSetup
public renderWorkflowSetup(options?: RenderWorkflowSetupOptions): JobStep[]

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

optionsOptional
  • Type: projen.javascript.RenderWorkflowSetupOptions

Options.


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

Replaces the contents of an npm package.json script.

nameRequired
  • Type: string

The script name.


commandRequired
  • Type: string

The command to execute.


Static Functions

NameDescription
isConstruct
Checks if x is a construct.
isProject
Test whether the given construct is a project.
of
Find the closest ancestor project for given construct.

isConstruct
import { cdk8s } from 'projen'

cdk8s.ConstructLibraryCdk8s.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isProject
import { cdk8s } from 'projen'

cdk8s.ConstructLibraryCdk8s.isProject(x: any)

Test whether the given construct is a project.

xRequired
  • Type: any

of
import { cdk8s } from 'projen'

cdk8s.ConstructLibraryCdk8s.of(construct: IConstruct)

Find the closest ancestor project for given construct.

When given a project, this it the project itself.

constructRequired
  • Type: constructs.IConstruct

Properties

NameTypeDescription
node
constructs.NodeThe tree node.
buildTask
projen.TaskNo description.
commitGenerated
booleanWhether to commit the managed files by default.
compileTask
projen.TaskNo description.
components
projen.Component[]Returns all the components within this project.
deps
projen.DependenciesProject dependencies.
ejected
booleanWhether or not the project is being ejected.
files
projen.FileBase[]All files in this project.
gitattributes
projen.GitAttributesFileThe .gitattributes file for this repository.
gitignore
projen.IgnoreFile.gitignore.
logger
projen.LoggerLogging utilities.
name
stringProject name.
outdir
stringAbsolute output directory of this project.
packageTask
projen.TaskNo description.
postCompileTask
projen.TaskNo description.
preCompileTask
projen.TaskNo description.
projectBuild
projen.ProjectBuildManages the build process of the project.
projenCommand
stringThe command to use in order to run the projen CLI.
root
projen.ProjectThe root project.
subprojects
projen.Project[]Returns all the subprojects within this project.
tasks
projen.TasksProject tasks.
testTask
projen.TaskNo description.
defaultTask
projen.TaskThis is the "default" task, the one that executes "projen".
initProject
projen.InitProjectThe options used when this project is bootstrapped via projen new.
parent
projen.ProjectA parent project.
projectType
projen.ProjectTypeNo description.
autoApprove
projen.github.AutoApproveAuto approve set up for this project.
devContainer
projen.vscode.DevContainerAccess for .devcontainer.json (used for GitHub Codespaces).
github
projen.github.GitHubAccess all github components.
gitpod
projen.GitpodAccess for Gitpod.
vscode
projen.vscode.VsCodeAccess all VSCode components.
allowLibraryDependencies
booleanNo description.
artifactsDirectory
stringThe build output directory.
artifactsJavascriptDirectory
stringThe location of the npm tarball after build (${artifactsDirectory}/js).
bundler
projen.javascript.BundlerNo description.
entrypoint
stringNo description.
manifest
anyNo description.
npmrc
projen.javascript.NpmConfigThe .npmrc file.
package
projen.javascript.NodePackageAPI for managing the node package.
packageManager
projen.javascript.NodePackageManagerThe package manager to use.
runScriptCommand
stringThe command to use to run scripts (e.g. yarn run or npm run depends on the package manager).
autoMerge
projen.github.AutoMergeComponent that sets up mergify for merging approved pull requests.
buildWorkflow
projen.build.BuildWorkflowThe PR build GitHub workflow.
buildWorkflowJobId
stringThe job ID of the build workflow.
jest
projen.javascript.JestThe Jest configuration (if enabled).
maxNodeVersion
stringMaximum node version supported by this package.
minNodeVersion
stringThe minimum node version required by this package to function.
npmignore
projen.IgnoreFileThe .npmignore file.
prettier
projen.javascript.PrettierNo description.
publisher
projen.release.PublisherPackage publisher.
release
projen.release.ReleaseRelease management.
upgradeWorkflow
projen.javascript.UpgradeDependenciesThe upgrade workflow.
docsDirectory
stringNo description.
libdir
stringThe directory in which compiled .js files reside.
srcdir
stringThe directory in which the .ts sources reside.
testdir
stringThe directory in which tests reside.
tsconfigDev
projen.javascript.TypescriptConfigA typescript configuration file which covers all files (sources, tests, projen).
watchTask
projen.TaskThe "watch" task.
docgen
booleanNo description.
eslint
projen.javascript.EslintNo description.
tsconfig
projen.javascript.TypescriptConfigNo description.
tsconfigEslint
projen.javascript.TypescriptConfigNo description.
cdk8sVersion
stringThe CDK8s version this app is using.
constructsVersion
stringThe constructs version this app is using.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


buildTaskRequired
public readonly buildTask: Task;
  • Type: projen.Task

commitGeneratedRequired
public readonly commitGenerated: boolean;
  • Type: boolean

Whether to commit the managed files by default.


compileTaskRequired
public readonly compileTask: Task;
  • Type: projen.Task

componentsRequired
public readonly components: Component[];
  • Type: projen.Component[]

Returns all the components within this project.


depsRequired
public readonly deps: Dependencies;
  • Type: projen.Dependencies

Project dependencies.


ejectedRequired
public readonly ejected: boolean;
  • Type: boolean

Whether or not the project is being ejected.


filesRequired
public readonly files: FileBase[];
  • Type: projen.FileBase[]

All files in this project.


gitattributesRequired
public readonly gitattributes: GitAttributesFile;
  • Type: projen.GitAttributesFile

The .gitattributes file for this repository.


gitignoreRequired
public readonly gitignore: IgnoreFile;
  • Type: projen.IgnoreFile

.gitignore.


loggerRequired
public readonly logger: Logger;
  • Type: projen.Logger

Logging utilities.


nameRequired
public readonly name: string;
  • Type: string

Project name.


outdirRequired
public readonly outdir: string;
  • Type: string

Absolute output directory of this project.


packageTaskRequired
public readonly packageTask: Task;
  • Type: projen.Task

postCompileTaskRequired
public readonly postCompileTask: Task;
  • Type: projen.Task

preCompileTaskRequired
public readonly preCompileTask: Task;
  • Type: projen.Task

projectBuildRequired
public readonly projectBuild: ProjectBuild;
  • Type: projen.ProjectBuild

Manages the build process of the project.


projenCommandRequired
public readonly projenCommand: string;
  • Type: string

The command to use in order to run the projen CLI.


rootRequired
public readonly root: Project;
  • Type: projen.Project

The root project.


subprojectsRequired
public readonly subprojects: Project[];
  • Type: projen.Project[]

Returns all the subprojects within this project.


tasksRequired
public readonly tasks: Tasks;
  • Type: projen.Tasks

Project tasks.


testTaskRequired
public readonly testTask: Task;
  • Type: projen.Task

defaultTaskOptional
public readonly defaultTask: Task;
  • Type: projen.Task

This is the "default" task, the one that executes "projen".

Undefined if the project is being ejected.


initProjectOptional
public readonly initProject: InitProject;
  • Type: projen.InitProject

The options used when this project is bootstrapped via projen new.

It includes the original set of options passed to the CLI and also the JSII FQN of the project type.


parentOptional
public readonly parent: Project;
  • Type: projen.Project

A parent project.

If undefined, this is the root project.


projectTypeRequired
public readonly projectType: ProjectType;
  • Type: projen.ProjectType

autoApproveOptional
public readonly autoApprove: AutoApprove;
  • Type: projen.github.AutoApprove

Auto approve set up for this project.


devContainerOptional
public readonly devContainer: DevContainer;
  • Type: projen.vscode.DevContainer

Access for .devcontainer.json (used for GitHub Codespaces).

This will be undefined if devContainer boolean is false


githubOptional
public readonly github: GitHub;
  • Type: projen.github.GitHub

Access all github components.

This will be undefined for subprojects.


gitpodOptional
public readonly gitpod: Gitpod;
  • Type: projen.Gitpod

Access for Gitpod.

This will be undefined if gitpod boolean is false


vscodeOptional
public readonly vscode: VsCode;
  • Type: projen.vscode.VsCode

Access all VSCode components.

This will be undefined for subprojects.


allowLibraryDependenciesRequired
  • Deprecated: use package.allowLibraryDependencies
public readonly allowLibraryDependencies: boolean;
  • Type: boolean

artifactsDirectoryRequired
public readonly artifactsDirectory: string;
  • Type: string

The build output directory.

An npm tarball will be created under the js subdirectory. For example, if this is set to dist (the default), the npm tarball will be placed under dist/js/boom-boom-1.2.3.tg.


artifactsJavascriptDirectoryRequired
public readonly artifactsJavascriptDirectory: string;
  • Type: string

The location of the npm tarball after build (${artifactsDirectory}/js).


bundlerRequired
public readonly bundler: Bundler;
  • Type: projen.javascript.Bundler

entrypointRequired
  • Deprecated: use package.entrypoint
public readonly entrypoint: string;
  • Type: string

manifestRequired
  • Deprecated: use package.addField(x, y)
public readonly manifest: any;
  • Type: any

npmrcRequired
public readonly npmrc: NpmConfig;
  • Type: projen.javascript.NpmConfig

The .npmrc file.


packageRequired
public readonly package: NodePackage;
  • Type: projen.javascript.NodePackage

API for managing the node package.


packageManagerRequired
  • Deprecated: use package.packageManager
public readonly packageManager: NodePackageManager;
  • Type: projen.javascript.NodePackageManager

The package manager to use.


runScriptCommandRequired
public readonly runScriptCommand: string;
  • Type: string

The command to use to run scripts (e.g. yarn run or npm run depends on the package manager).


autoMergeOptional
public readonly autoMerge: AutoMerge;
  • Type: projen.github.AutoMerge

Component that sets up mergify for merging approved pull requests.


buildWorkflowOptional
public readonly buildWorkflow: BuildWorkflow;
  • Type: projen.build.BuildWorkflow

The PR build GitHub workflow.

undefined if buildWorkflow is disabled.


buildWorkflowJobIdOptional
public readonly buildWorkflowJobId: string;
  • Type: string

The job ID of the build workflow.


jestOptional
public readonly jest: Jest;
  • Type: projen.javascript.Jest

The Jest configuration (if enabled).


maxNodeVersionOptional
public readonly maxNodeVersion: string;
  • Type: string

Maximum node version supported by this package.

The value indicates the package is incompatible with newer versions.


minNodeVersionOptional
public readonly minNodeVersion: string;
  • Type: string

The minimum node version required by this package to function.

This value indicates the package is incompatible with older versions.


npmignoreOptional
public readonly npmignore: IgnoreFile;
  • Type: projen.IgnoreFile

The .npmignore file.


prettierOptional
public readonly prettier: Prettier;
  • Type: projen.javascript.Prettier

publisherOptional
  • Deprecated: use release.publisher.
public readonly publisher: Publisher;
  • Type: projen.release.Publisher

Package publisher.

This will be undefined if the project does not have a release workflow.


releaseOptional
public readonly release: Release;
  • Type: projen.release.Release

Release management.


upgradeWorkflowOptional
public readonly upgradeWorkflow: UpgradeDependencies;
  • Type: projen.javascript.UpgradeDependencies

The upgrade workflow.


docsDirectoryRequired
public readonly docsDirectory: string;
  • Type: string

libdirRequired
public readonly libdir: string;
  • Type: string

The directory in which compiled .js files reside.


srcdirRequired
public readonly srcdir: string;
  • Type: string

The directory in which the .ts sources reside.


testdirRequired
public readonly testdir: string;
  • Type: string

The directory in which tests reside.


tsconfigDevRequired
public readonly tsconfigDev: TypescriptConfig;
  • Type: projen.javascript.TypescriptConfig

A typescript configuration file which covers all files (sources, tests, projen).


watchTaskRequired
public readonly watchTask: Task;
  • Type: projen.Task

The "watch" task.


docgenOptional
public readonly docgen: boolean;
  • Type: boolean

eslintOptional
public readonly eslint: Eslint;
  • Type: projen.javascript.Eslint

tsconfigOptional
public readonly tsconfig: TypescriptConfig;
  • Type: projen.javascript.TypescriptConfig

tsconfigEslintOptional
public readonly tsconfigEslint: TypescriptConfig;
  • Type: projen.javascript.TypescriptConfig

cdk8sVersionRequired
public readonly cdk8sVersion: string;
  • Type: string

The CDK8s version this app is using.


constructsVersionRequired
public readonly constructsVersion: string;
  • Type: string

The constructs version this app is using.


Constants

NameTypeDescription
DEFAULT_TASK
stringThe name of the default task (the task executed when projen is run without arguments).
DEFAULT_TS_JEST_TRANFORM_PATTERN
stringNo description.

DEFAULT_TASKRequired
public readonly DEFAULT_TASK: string;
  • Type: string

The name of the default task (the task executed when projen is run without arguments).

Normally this task should synthesize the project files.


DEFAULT_TS_JEST_TRANFORM_PATTERNRequired
public readonly DEFAULT_TS_JEST_TRANFORM_PATTERN: string;
  • Type: string

IntegrationTest

CDK8S integration test.

Initializers

import { cdk8s } from 'projen'

new cdk8s.IntegrationTest(project: Project, options: IntegrationTestOptions)
NameTypeDescription
project
projen.ProjectNo description.
options
IntegrationTestOptions
No description.

projectRequired
  • Type: projen.Project

optionsRequired

Methods

NameDescription
toString
Returns a string representation of this construct.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
synthesize
Synthesizes files to the project output directory.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

synthesize
public synthesize(): void

Synthesizes files to the project output directory.

Static Functions

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.

isConstruct
import { cdk8s } from 'projen'

cdk8s.IntegrationTest.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isComponent
import { cdk8s } from 'projen'

cdk8s.IntegrationTest.isComponent(x: any)

Test whether the given construct is a component.

xRequired
  • Type: any

Properties

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.
assertTask
projen.TaskSynthesizes the integration test and compares against a local copy (runs during build).
deployTask
projen.TaskDeploy the integration test and update the snapshot upon success.
snapshotTask
projen.TaskJust update snapshot (without deployment).

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired
public readonly project: Project;
  • Type: projen.Project

assertTaskRequired
public readonly assertTask: Task;
  • Type: projen.Task

Synthesizes the integration test and compares against a local copy (runs during build).


deployTaskRequired
public readonly deployTask: Task;
  • Type: projen.Task

Deploy the integration test and update the snapshot upon success.


snapshotTaskRequired
public readonly snapshotTask: Task;
  • Type: projen.Task

Just update snapshot (without deployment).


IntegrationTestAutoDiscover

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

Initializers

import { cdk8s } from 'projen'

new cdk8s.IntegrationTestAutoDiscover(project: Project, options: IntegrationTestAutoDiscoverOptions)
NameTypeDescription
project
projen.ProjectNo description.
options
IntegrationTestAutoDiscoverOptions
No description.

projectRequired
  • Type: projen.Project

optionsRequired

Methods

NameDescription
toString
Returns a string representation of this construct.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
synthesize
Synthesizes files to the project output directory.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

synthesize
public synthesize(): void

Synthesizes files to the project output directory.

Static Functions

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.

isConstruct
import { cdk8s } from 'projen'

cdk8s.IntegrationTestAutoDiscover.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isComponent
import { cdk8s } from 'projen'

cdk8s.IntegrationTestAutoDiscover.isComponent(x: any)

Test whether the given construct is a component.

xRequired
  • Type: any

Properties

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.
entrypoints
string[]Auto-discovered entry points with paths relative to the project directory.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired
public readonly project: Project;
  • Type: projen.Project

entrypointsRequired
public readonly entrypoints: string[];
  • Type: string[]

Auto-discovered entry points with paths relative to the project directory.


Structs

AutoDiscoverOptions

Options for AutoDiscover.

Initializer

import { cdk8s } from 'projen'

const autoDiscoverOptions: cdk8s.AutoDiscoverOptions = { ... }

Properties

NameTypeDescription
testdir
stringTest source tree.
tsconfigPath
stringPath to the tsconfig file to use for integration tests.
integrationTestAutoDiscover
booleanAutomatically discover integration tests.

testdirRequired
public readonly testdir: string;
  • Type: string

Test source tree.


tsconfigPathRequired
public readonly tsconfigPath: string;
  • Type: string

Path to the tsconfig file to use for integration tests.


integrationTestAutoDiscoverOptional
public readonly integrationTestAutoDiscover: boolean;
  • Type: boolean
  • Default: true

Automatically discover integration tests.


Cdk8sDepsCommonOptions

Options for Cdk8sDeps.

Initializer

import { cdk8s } from 'projen'

const cdk8sDepsCommonOptions: cdk8s.Cdk8sDepsCommonOptions = { ... }

Properties

NameTypeDescription
cdk8sVersion
stringMinimum version of the cdk8s to depend on.
cdk8sCliVersion
stringMinimum version of the cdk8s-cli to depend on.
cdk8sCliVersionPinning
booleanUse pinned version instead of caret version for cdk8s-cli.
cdk8sPlus
booleanInclude cdk8s-plus.
cdk8sPlusVersion
stringMinimum version of the cdk8s-plus-XX to depend on.
cdk8sPlusVersionPinning
booleanUse pinned version instead of caret version for cdk8s-plus-17.
cdk8sVersionPinning
booleanUse pinned version instead of caret version for cdk8s.
constructsVersion
stringMinimum version of the constructs library to depend on.
constructsVersionPinning
booleanUse pinned version instead of caret version for constructs.
k8sMinorVersion
numberThe cdk8s-plus library depends of Kubernetes minor version For example, cdk8s-plus-22 targets kubernetes version 1.22.0 cdk8s-plus-21 targets kubernetes version 1.21.0.

cdk8sVersionRequired
public readonly cdk8sVersion: string;
  • Type: string
  • Default: "2.3.33"

Minimum version of the cdk8s to depend on.


cdk8sCliVersionOptional
public readonly cdk8sCliVersion: string;
  • Type: string
  • Default: "2.0.28"

Minimum version of the cdk8s-cli to depend on.


cdk8sCliVersionPinningOptional
public readonly cdk8sCliVersionPinning: boolean;
  • Type: boolean
  • Default: false

Use pinned version instead of caret version for cdk8s-cli.

You can use this to prevent yarn to mix versions for your CDK8s package and to prevent auto-updates. If you use experimental features this will let you define the moment you include breaking changes.


cdk8sPlusOptional
public readonly cdk8sPlus: boolean;
  • Type: boolean
  • Default: true

Include cdk8s-plus.


cdk8sPlusVersionOptional
public readonly cdk8sPlusVersion: string;
  • Type: string
  • Default: "2.0.0-rc.26"

Minimum version of the cdk8s-plus-XX to depend on.


cdk8sPlusVersionPinningOptional
public readonly cdk8sPlusVersionPinning: boolean;
  • Type: boolean
  • Default: false

Use pinned version instead of caret version for cdk8s-plus-17.

You can use this to prevent yarn to mix versions for your CDK8s package and to prevent auto-updates. If you use experimental features this will let you define the moment you include breaking changes.


cdk8sVersionPinningOptional
public readonly cdk8sVersionPinning: boolean;
  • Type: boolean
  • Default: false

Use pinned version instead of caret version for cdk8s.

You can use this to prevent yarn to mix versions for your CDK8s package and to prevent auto-updates. If you use experimental features this will let you define the moment you include breaking changes.


constructsVersionOptional
public readonly constructsVersion: string;
  • Type: string
  • Default: "10.1.42"

Minimum version of the constructs library to depend on.


constructsVersionPinningOptional
public readonly constructsVersionPinning: boolean;
  • Type: boolean
  • Default: false

Use pinned version instead of caret version for constructs.

You can use this to prevent yarn to mix versions for your consructs package and to prevent auto-updates. If you use experimental features this will let you define the moment you include breaking changes.


k8sMinorVersionOptional
public readonly k8sMinorVersion: number;
  • Type: number
  • Default: 22

The cdk8s-plus library depends of Kubernetes minor version For example, cdk8s-plus-22 targets kubernetes version 1.22.0 cdk8s-plus-21 targets kubernetes version 1.21.0.


Cdk8sDepsOptions

Initializer

import { cdk8s } from 'projen'

const cdk8sDepsOptions: cdk8s.Cdk8sDepsOptions = { ... }

Properties

NameTypeDescription
cdk8sVersion
stringMinimum version of the cdk8s to depend on.
cdk8sCliVersion
stringMinimum version of the cdk8s-cli to depend on.
cdk8sCliVersionPinning
booleanUse pinned version instead of caret version for cdk8s-cli.
cdk8sPlus
booleanInclude cdk8s-plus.
cdk8sPlusVersion
stringMinimum version of the cdk8s-plus-XX to depend on.
cdk8sPlusVersionPinning
booleanUse pinned version instead of caret version for cdk8s-plus-17.
cdk8sVersionPinning
booleanUse pinned version instead of caret version for cdk8s.
constructsVersion
stringMinimum version of the constructs library to depend on.
constructsVersionPinning
booleanUse pinned version instead of caret version for constructs.
k8sMinorVersion
numberThe cdk8s-plus library depends of Kubernetes minor version For example, cdk8s-plus-22 targets kubernetes version 1.22.0 cdk8s-plus-21 targets kubernetes version 1.21.0.
cdk8sCliDependency
booleanAdd cdk8s-cli only to Node projects.
dependencyType
projen.DependencyTypeThe type of dependency to use for runtime CDK8s and constructs modules.

cdk8sVersionRequired
public readonly cdk8sVersion: string;
  • Type: string
  • Default: "2.3.33"

Minimum version of the cdk8s to depend on.


cdk8sCliVersionOptional
public readonly cdk8sCliVersion: string;
  • Type: string
  • Default: "2.0.28"

Minimum version of the cdk8s-cli to depend on.


cdk8sCliVersionPinningOptional
public readonly cdk8sCliVersionPinning: boolean;
  • Type: boolean
  • Default: false

Use pinned version instead of caret version for cdk8s-cli.

You can use this to prevent yarn to mix versions for your CDK8s package and to prevent auto-updates. If you use experimental features this will let you define the moment you include breaking changes.


cdk8sPlusOptional
public readonly cdk8sPlus: boolean;
  • Type: boolean
  • Default: true

Include cdk8s-plus.


cdk8sPlusVersionOptional
public readonly cdk8sPlusVersion: string;
  • Type: string
  • Default: "2.0.0-rc.26"

Minimum version of the cdk8s-plus-XX to depend on.


cdk8sPlusVersionPinningOptional
public readonly cdk8sPlusVersionPinning: boolean;
  • Type: boolean
  • Default: false

Use pinned version instead of caret version for cdk8s-plus-17.

You can use this to prevent yarn to mix versions for your CDK8s package and to prevent auto-updates. If you use experimental features this will let you define the moment you include breaking changes.


cdk8sVersionPinningOptional
public readonly cdk8sVersionPinning: boolean;
  • Type: boolean
  • Default: false

Use pinned version instead of caret version for cdk8s.

You can use this to prevent yarn to mix versions for your CDK8s package and to prevent auto-updates. If you use experimental features this will let you define the moment you include breaking changes.


constructsVersionOptional
public readonly constructsVersion: string;
  • Type: string
  • Default: "10.1.42"

Minimum version of the constructs library to depend on.


constructsVersionPinningOptional
public readonly constructsVersionPinning: boolean;
  • Type: boolean
  • Default: false

Use pinned version instead of caret version for constructs.

You can use this to prevent yarn to mix versions for your consructs package and to prevent auto-updates. If you use experimental features this will let you define the moment you include breaking changes.


k8sMinorVersionOptional
public readonly k8sMinorVersion: number;
  • Type: number
  • Default: 22

The cdk8s-plus library depends of Kubernetes minor version For example, cdk8s-plus-22 targets kubernetes version 1.22.0 cdk8s-plus-21 targets kubernetes version 1.21.0.


cdk8sCliDependencyRequired
public readonly cdk8sCliDependency: boolean;
  • Type: boolean
  • Default: false

Add cdk8s-cli only to Node projects.


dependencyTypeRequired
public readonly dependencyType: DependencyType;
  • Type: projen.DependencyType

The type of dependency to use for runtime CDK8s and constructs modules.

For libraries, use peer dependencies and for apps use runtime dependencies.


Cdk8sPackageNames

Initializer

import { cdk8s } from 'projen'

const cdk8sPackageNames: cdk8s.Cdk8sPackageNames = { ... }

Properties

NameTypeDescription
cdk8s
stringFully qualified name of the core framework package.
cdk8sPlus
stringFully qualified name of the cdk9s-plus-XX library package.
constructs
stringFully qualified name of the constructs library package.
cdk8sClient
stringFully qualified name of the client package.

cdk8sRequired
public readonly cdk8s: string;
  • Type: string

Fully qualified name of the core framework package.


cdk8sPlusRequired
public readonly cdk8sPlus: string;
  • Type: string

Fully qualified name of the cdk9s-plus-XX library package.


constructsRequired
public readonly constructs: string;
  • Type: string

Fully qualified name of the constructs library package.


cdk8sClientOptional
public readonly cdk8sClient: string;
  • Type: string

Fully qualified name of the client package.

Used only on Node projects


Cdk8sPythonOptions

Options for Cdk8sPythonApp.

Initializer

import { cdk8s } from 'projen'

const cdk8sPythonOptions: cdk8s.Cdk8sPythonOptions = { ... }

Properties

NameTypeDescription
name
stringThis is the name of your project.
commitGenerated
booleanWhether to commit the managed files by default.
gitIgnoreOptions
projen.IgnoreFileOptionsConfiguration options for .gitignore file.
gitOptions
projen.GitOptionsConfiguration options for git.
logging
projen.LoggerOptionsConfigure logging options such as verbosity.
outdir
stringThe root directory of the project.
parent
projen.ProjectThe parent project, if this project is part of a bigger project.
projenCommand
stringThe shell command to use in order to run the projen CLI.
projenrcJson
booleanGenerate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation.
projenrcJsonOptions
projen.ProjenrcJsonOptionsOptions for .projenrc.json.
renovatebot
booleanUse renovatebot to handle dependency upgrades.
renovatebotOptions
projen.RenovatebotOptionsOptions for renovatebot.
autoApproveOptions
projen.github.AutoApproveOptionsEnable and configure the 'auto approve' workflow.
autoMerge
booleanEnable automatic merging on GitHub.
autoMergeOptions
projen.github.AutoMergeOptionsConfigure options for automatic merging on GitHub.
clobber
booleanAdd a clobber task which resets the repo to origin.
devContainer
booleanAdd a VSCode development environment (used for GitHub Codespaces).
github
booleanEnable GitHub integration.
githubOptions
projen.github.GitHubOptionsOptions for GitHub integration.
gitpod
booleanAdd a Gitpod development environment.
mergify
booleanWhether mergify should be enabled on this repository or not.
mergifyOptions
projen.github.MergifyOptionsOptions for mergify.
projectType
projen.ProjectTypeWhich type of project this is (library/app).
projenCredentials
projen.github.GithubCredentialsChoose a method of providing GitHub API access for projen workflows.
projenTokenSecret
stringThe name of a secret which includes a GitHub Personal Access Token to be used by projen workflows.
readme
projen.SampleReadmePropsThe README setup.
stale
booleanAuto-close of stale issues and pull request.
staleOptions
projen.github.StaleOptionsAuto-close stale issues and pull requests.
vscode
booleanEnable VSCode integration.
authorEmail
stringAuthor's e-mail.
authorName
stringAuthor's name.
version
stringVersion of the package.
classifiers
string[]A list of PyPI trove classifiers that describe the project.
description
stringA short description of the package.
homepage
stringA URL to the website of the project.
license
stringLicense of this package as an SPDX identifier.
packageName
stringPackage name.
poetryOptions
projen.python.PoetryPyprojectOptionsWithoutDepsAdditional options to set for poetry if using poetry.
setupConfig
{[ key: string ]: any}Additional fields to pass in the setup() function if using setuptools.
pythonExec
stringPath to the python executable to use.
moduleName
stringName of the python package as used in imports and filenames.
deps
string[]List of runtime dependencies for this project.
devDeps
string[]List of dev dependencies for this project.
pip
booleanUse pip with a requirements.txt file to track project dependencies.
poetry
booleanUse poetry to manage your project dependencies, virtual environment, and (optional) packaging/publishing.
projenrcJs
booleanUse projenrc in javascript.
projenrcJsOptions
projen.javascript.ProjenrcOptionsOptions related to projenrc in JavaScript.
projenrcPython
booleanUse projenrc in Python.
projenrcPythonOptions
projen.python.ProjenrcOptionsOptions related to projenrc in python.
projenrcTs
booleanUse projenrc in TypeScript.
projenrcTsOptions
projen.typescript.ProjenrcTsOptionsOptions related to projenrc in TypeScript.
pytest
booleanInclude pytest tests.
pytestOptions
projen.python.PytestOptionspytest options.
sample
booleanInclude sample code and test if the relevant directories don't exist.
setuptools
booleanUse setuptools with a setup.py script for packaging and publishing.
venv
booleanUse venv to manage a virtual environment for installing dependencies inside.
venvOptions
projen.python.VenvOptionsVenv options.
cdk8sVersion
stringMinimum version of the cdk8s to depend on.
cdk8sCliVersion
stringMinimum version of the cdk8s-cli to depend on.
cdk8sCliVersionPinning
booleanUse pinned version instead of caret version for cdk8s-cli.
cdk8sPlus
booleanInclude cdk8s-plus.
cdk8sPlusVersion
stringMinimum version of the cdk8s-plus-XX to depend on.
cdk8sPlusVersionPinning
booleanUse pinned version instead of caret version for cdk8s-plus-17.
cdk8sVersionPinning
booleanUse pinned version instead of caret version for cdk8s.
constructsVersion
stringMinimum version of the constructs library to depend on.
constructsVersionPinning
booleanUse pinned version instead of caret version for constructs.
k8sMinorVersion
numberThe cdk8s-plus library depends of Kubernetes minor version For example, cdk8s-plus-22 targets kubernetes version 1.22.0 cdk8s-plus-21 targets kubernetes version 1.21.0.
appEntrypoint
stringThe CDK8s app's entrypoint.
cdk8sImports
string[]Import additional specs.
k8sSpecVersion
stringImport a specific Kubernetes spec version.

nameRequired
public readonly name: string;
  • Type: string
  • Default: $BASEDIR

This is the name of your project.


commitGeneratedOptional
public readonly commitGenerated: boolean;
  • Type: boolean
  • Default: true

Whether to commit the managed files by default.


gitIgnoreOptionsOptional
public readonly gitIgnoreOptions: IgnoreFileOptions;
  • Type: projen.IgnoreFileOptions

Configuration options for .gitignore file.


gitOptionsOptional
public readonly gitOptions: GitOptions;
  • Type: projen.GitOptions

Configuration options for git.


loggingOptional
public readonly logging: LoggerOptions;
  • Type: projen.LoggerOptions
  • Default: {}

Configure logging options such as verbosity.


outdirOptional
public readonly outdir: string;
  • Type: string
  • Default: "."

The root directory of the project.

Relative to this directory, all files are synthesized.

If this project has a parent, this directory is relative to the parent directory and it cannot be the same as the parent or any of it's other subprojects.


parentOptional
public readonly parent: Project;
  • Type: projen.Project

The parent project, if this project is part of a bigger project.


projenCommandOptional
public readonly projenCommand: string;
  • Type: string
  • Default: "npx projen"

The shell command to use in order to run the projen CLI.

Can be used to customize in special environments.


projenrcJsonOptional
public readonly projenrcJson: boolean;
  • Type: boolean
  • Default: false

Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation.


projenrcJsonOptionsOptional
public readonly projenrcJsonOptions: ProjenrcJsonOptions;
  • Type: projen.ProjenrcJsonOptions
  • Default: default options

Options for .projenrc.json.


renovatebotOptional
public readonly renovatebot: boolean;
  • Type: boolean
  • Default: false

Use renovatebot to handle dependency upgrades.


renovatebotOptionsOptional
public readonly renovatebotOptions: RenovatebotOptions;
  • Type: projen.RenovatebotOptions
  • Default: default options

Options for renovatebot.


autoApproveOptionsOptional
public readonly autoApproveOptions: AutoApproveOptions;
  • Type: projen.github.AutoApproveOptions
  • Default: auto approve is disabled

Enable and configure the 'auto approve' workflow.


autoMergeOptional
public readonly autoMerge: boolean;
  • Type: boolean
  • Default: true

Enable automatic merging on GitHub.

Has no effect if github.mergify is set to false.


autoMergeOptionsOptional
public readonly autoMergeOptions: AutoMergeOptions;
  • Type: projen.github.AutoMergeOptions
  • Default: see defaults in AutoMergeOptions

Configure options for automatic merging on GitHub.

Has no effect if github.mergify or autoMerge is set to false.


clobberOptional
public readonly clobber: boolean;
  • Type: boolean
  • Default: true, but false for subprojects

Add a clobber task which resets the repo to origin.


devContainerOptional
public readonly devContainer: boolean;
  • Type: boolean
  • Default: false

Add a VSCode development environment (used for GitHub Codespaces).


githubOptional
public readonly github: boolean;
  • Type: boolean
  • Default: true

Enable GitHub integration.

Enabled by default for root projects. Disabled for non-root projects.


githubOptionsOptional
public readonly githubOptions: GitHubOptions;
  • Type: projen.github.GitHubOptions
  • Default: see GitHubOptions

Options for GitHub integration.


gitpodOptional
public readonly gitpod: boolean;
  • Type: boolean
  • Default: false

Add a Gitpod development environment.


mergifyOptional
  • Deprecated: use githubOptions.mergify instead
public readonly mergify: boolean;
  • Type: boolean
  • Default: true

Whether mergify should be enabled on this repository or not.


mergifyOptionsOptional
  • Deprecated: use githubOptions.mergifyOptions instead
public readonly mergifyOptions: MergifyOptions;
  • Type: projen.github.MergifyOptions
  • Default: default options

Options for mergify.


projectTypeOptional
  • Deprecated: no longer supported at the base project level
public readonly projectType: ProjectType;
  • Type: projen.ProjectType
  • Default: ProjectType.UNKNOWN

Which type of project this is (library/app).


projenCredentialsOptional
public readonly projenCredentials: GithubCredentials;
  • Type: projen.github.GithubCredentials
  • Default: use a personal access token named PROJEN_GITHUB_TOKEN

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


projenTokenSecretOptional
  • Deprecated: use projenCredentials
public readonly projenTokenSecret: string;
  • Type: string
  • Default: "PROJEN_GITHUB_TOKEN"

The name of a secret which includes a GitHub Personal Access Token to be used by projen workflows.

This token needs to have the repo, workflows and packages scope.


readmeOptional
public readonly readme: SampleReadmeProps;
  • Type: projen.SampleReadmeProps
  • Default: { filename: 'README.md', contents: '# replace this' }

The README setup.


Example

"{ filename: 'readme.md', contents: '# title' }"
staleOptional
public readonly stale: boolean;
  • Type: boolean
  • Default: false

Auto-close of stale issues and pull request.

See staleOptions for options.


staleOptionsOptional
public readonly staleOptions: StaleOptions;
  • Type: projen.github.StaleOptions
  • Default: see defaults in StaleOptions

Auto-close stale issues and pull requests.

To disable set stale to false.


vscodeOptional
public readonly vscode: boolean;
  • Type: boolean
  • Default: true

Enable VSCode integration.

Enabled by default for root projects. Disabled for non-root projects.


authorEmailRequired
public readonly authorEmail: string;
  • Type: string
  • Default: $GIT_USER_EMAIL

Author's e-mail.


authorNameRequired
public readonly authorName: string;
  • Type: string
  • Default: $GIT_USER_NAME

Author's name.


versionRequired
public readonly version: string;
  • Type: string
  • Default: "0.1.0"

Version of the package.


classifiersOptional
public readonly classifiers: string[];
  • Type: string[]

A list of PyPI trove classifiers that describe the project.

https://pypi.org/classifiers/


descriptionOptional
public readonly description: string;
  • Type: string

A short description of the package.


homepageOptional
public readonly homepage: string;
  • Type: string

A URL to the website of the project.


licenseOptional
public readonly license: string;
  • Type: string

License of this package as an SPDX identifier.


packageNameOptional
public readonly packageName: string;
  • Type: string

Package name.


poetryOptionsOptional
public readonly poetryOptions: PoetryPyprojectOptionsWithoutDeps;
  • Type: projen.python.PoetryPyprojectOptionsWithoutDeps

Additional options to set for poetry if using poetry.


setupConfigOptional
public readonly setupConfig: {[ key: string ]: any};
  • Type: {[ key: string ]: any}

Additional fields to pass in the setup() function if using setuptools.


pythonExecOptional
public readonly pythonExec: string;
  • Type: string
  • Default: "python"

Path to the python executable to use.


moduleNameRequired
public readonly moduleName: string;
  • Type: string
  • Default: $PYTHON_MODULE_NAME

Name of the python package as used in imports and filenames.

Must only consist of alphanumeric characters and underscores.


depsOptional
public readonly deps: string[];
  • Type: string[]
  • Default: []

List of runtime dependencies for this project.

Dependencies use the format: <module>@<semver>

Additional dependencies can be added via project.addDependency().


devDepsOptional
public readonly devDeps: string[];
  • Type: string[]
  • Default: []

List of dev dependencies for this project.

Dependencies use the format: <module>@<semver>

Additional dependencies can be added via project.addDevDependency().


pipOptional</