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)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
optionsRequired
- Type: AutoDiscoverOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| 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
| Name | Description |
|---|---|
| Checks if x is a construct. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No 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)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
optionsRequired
- Type: Cdk8sDepsOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| 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
| Name | Description |
|---|---|
| Checks if x is a construct. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| number | The major version of the CDK8s (e.g. 1, 2, ...). |
| string | The minimum version of the CDK8s (e.g. 2.0.0). |
| string | The 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)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
optionsRequired
- Type: Cdk8sDepsOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| 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
| Name | Description |
|---|---|
| Checks if x is a construct. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| number | The major version of the CDK8s (e.g. 1, 2, ...). |
| string | The minimum version of the CDK8s (e.g. 2.0.0). |
| string | The 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)
| Name | Type | Description |
|---|---|---|
| | No description. |
optionsRequired
- Type: Cdk8sPythonOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Exclude the matching files from pre-synth cleanup. |
| Adds a .gitignore pattern. |
| Exclude these files from the bundled package. |
| Adds a new task to this project. |
| Prints a "tip" message during synthesis. |
| Marks the provided file(s) as being generated. |
| Called after all components are synthesized. |
| Called before all components are synthesized. |
| Removes a task from a project. |
| Returns the shell command to execute in order to run a task. |
| Synthesize all project files into outdir. |
| Finds a file at the specified relative path within this project and all its subprojects. |
| Finds a json file by name. |
| Finds an object file (like JsonFile, YamlFile, etc.) by name. |
| Finds a file at the specified relative path within this project and removes it. |
| Adds a runtime dependency. |
| 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
addTippublic 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.
- Call "this.preSynthesize()"
- Delete all generated files
- Synthesize all subprojects
- Synthesize all components of this project
- Call "postSynthesize()" for all components of this project
- 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
tryFindJsonFilepublic 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
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a project. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Task | No description. |
| boolean | Whether to commit the managed files by default. |
| projen.Task | No description. |
| projen.Component[] | Returns all the components within this project. |
| projen.Dependencies | Project dependencies. |
| boolean | Whether or not the project is being ejected. |
| projen.FileBase[] | All files in this project. |
| projen.GitAttributesFile | The .gitattributes file for this repository. |
| projen.IgnoreFile | .gitignore. |
| projen.Logger | Logging utilities. |
| string | Project name. |
| string | Absolute output directory of this project. |
| projen.Task | No description. |
| projen.Task | No description. |
| projen.Task | No description. |
| projen.ProjectBuild | Manages the build process of the project. |
| string | The command to use in order to run the projen CLI. |
| projen.Project | The root project. |
| projen.Project[] | Returns all the subprojects within this project. |
| projen.Tasks | Project tasks. |
| projen.Task | No description. |
| projen.Task | This is the "default" task, the one that executes "projen". |
| projen.InitProject | The options used when this project is bootstrapped via projen new. |
| projen.Project | A parent project. |
| projen.ProjectType | No description. |
| projen.github.AutoApprove | Auto approve set up for this project. |
| projen.vscode.DevContainer | Access for .devcontainer.json (used for GitHub Codespaces). |
| projen.github.GitHub | Access all github components. |
| projen.Gitpod | Access for Gitpod. |
| projen.vscode.VsCode | Access all VSCode components. |
| projen.python.IPythonDeps | API for managing dependencies. |
| projen.python.IPythonEnv | API for mangaging the Python runtime environment. |
| string | Python module name (the project name, with any hyphens or periods replaced with underscores). |
| string | Directory where sample tests are located. |
| string | Version of the package for distribution (should follow semver). |
| projen.python.IPythonPackaging | API for managing packaging the project as a library. |
| projen.python.Pytest | Pytest component. |
| string | The CDK8s app entrypoint. |
| | 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).
sampleTestdirRequired
public readonly sampleTestdir: string;
- Type: string
- Default: "tests"
Directory where sample tests are located.
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;
- Type: Cdk8sDeps
Constants
| Name | Type | Description |
|---|---|---|
| string | The 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)
| Name | Type | Description |
|---|---|---|
| | No description. |
optionsRequired
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Exclude the matching files from pre-synth cleanup. |
| Adds a .gitignore pattern. |
| Adds patterns to be ignored by npm. |
| Adds a new task to this project. |
| Prints a "tip" message during synthesis. |
| Marks the provided file(s) as being generated. |
| Called after all components are synthesized. |
| Called before all components are synthesized. |
| Removes a task from a project. |
| Returns the shell command to execute in order to run a task. |
| Synthesize all project files into outdir. |
| Finds a file at the specified relative path within this project and all its subprojects. |
| Finds a json file by name. |
| Finds an object file (like JsonFile, YamlFile, etc.) by name. |
| Finds a file at the specified relative path within this project and removes it. |
| No description. |
| Defines bundled dependencies. |
| DEPRECATED. |
| Defines normal dependencies. |
| Defines development/test dependencies. |
| Directly set fields in package.json. |
| Adds keywords to package.json (deduplicated). |
| Defines peer dependencies. |
| Replaces the contents of multiple npm package.json scripts. |
| DEPRECATED. |
| Indicates if a script by the name name is defined. |
| Removes the npm script (always successful). |
| Returns the set of workflow steps which should be executed to bootstrap a workflow. |
| 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
addTippublic 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.
- Call "this.preSynthesize()"
- Delete all generated files
- Synthesize all subprojects
- Synthesize all components of this project
- Call "postSynthesize()" for all components of this project
- 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
tryFindJsonFilepublic 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
addCompileCommandpublic 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
addTestCommandpublic addTestCommand(commands: ...string[]): void
DEPRECATED.
commandsRequired
- Type: ...string[]
hasScript
hasScriptpublic 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
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a project. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Task | No description. |
| boolean | Whether to commit the managed files by default. |
| projen.Task | No description. |
| projen.Component[] | Returns all the components within this project. |
| projen.Dependencies | Project dependencies. |
| boolean | Whether or not the project is being ejected. |
| projen.FileBase[] | All files in this project. |
| projen.GitAttributesFile | The .gitattributes file for this repository. |
| projen.IgnoreFile | .gitignore. |
| projen.Logger | Logging utilities. |
| string | Project name. |
| string | Absolute output directory of this project. |
| projen.Task | No description. |
| projen.Task | No description. |
| projen.Task | No description. |
| projen.ProjectBuild | Manages the build process of the project. |
| string | The command to use in order to run the projen CLI. |
| projen.Project | The root project. |
| projen.Project[] | Returns all the subprojects within this project. |
| projen.Tasks | Project tasks. |
| projen.Task | No description. |
| projen.Task | This is the "default" task, the one that executes "projen". |
| projen.InitProject | The options used when this project is bootstrapped via projen new. |
| projen.Project | A parent project. |
| projen.ProjectType | No description. |
| projen.github.AutoApprove | Auto approve set up for this project. |
| projen.vscode.DevContainer | Access for .devcontainer.json (used for GitHub Codespaces). |
| projen.github.GitHub | Access all github components. |
| projen.Gitpod | Access for Gitpod. |
| projen.vscode.VsCode | Access all VSCode components. |
| boolean | No description. |
| string | The build output directory. |
| string | The location of the npm tarball after build (${artifactsDirectory}/js). |
| projen.javascript.Bundler | No description. |
| string | No description. |
| any | No description. |
| projen.javascript.NpmConfig | The .npmrc file. |
| projen.javascript.NodePackage | API for managing the node package. |
| projen.javascript.NodePackageManager | The package manager to use. |
| string | The command to use to run scripts (e.g. yarn run or npm run depends on the package manager). |
| projen.github.AutoMerge | Component that sets up mergify for merging approved pull requests. |
| projen.javascript.Biome | No description. |
| projen.build.BuildWorkflow | The PR build GitHub workflow. |
| string | The job ID of the build workflow. |
| projen.javascript.Jest | The Jest configuration (if enabled). |
| string | Maximum node version supported by this package. |
| string | The minimum node version required by this package to function. |
| projen.IgnoreFile | The .npmignore file. |
| projen.javascript.Prettier | No description. |
| projen.release.Publisher | Package publisher. |
| projen.release.Release | Release management. |
| projen.javascript.UpgradeDependencies | The upgrade workflow. |
| string | No description. |
| string | The directory in which compiled .js files reside. |
| string | The directory in which the .ts sources reside. |
| string | The directory in which tests reside. |
| projen.javascript.TypescriptConfig | A typescript configuration file which covers all files (sources, tests, projen). |
| projen.Task | The "watch" task. |
| boolean | No description. |
| projen.javascript.Eslint | No description. |
| projen.javascript.TypescriptConfig | No description. |
| projen.javascript.TypescriptConfig | No description. |
| string | The CDK8s app entrypoint. |
| | 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
allowLibraryDependencies- 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
entrypoint- Deprecated: use
package.entrypoint
public readonly entrypoint: string;
- Type: string
manifestRequired
manifest- 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
packageManager- 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.
biomeOptional
public readonly biome: Biome;
- Type: projen.javascript.Biome
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
publisher- 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;
- Type: Cdk8sDeps
Constants
| Name | Type | Description |
|---|---|---|
| string | The name of the default task (the task executed when projen is run without arguments). |
| string | No 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)
| Name | Type | Description |
|---|---|---|
| | No description. |
optionsRequired
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Exclude the matching files from pre-synth cleanup. |
| Adds a .gitignore pattern. |
| Adds patterns to be ignored by npm. |
| Adds a new task to this project. |
| Prints a "tip" message during synthesis. |
| Marks the provided file(s) as being generated. |
| Called after all components are synthesized. |
| Called before all components are synthesized. |
| Removes a task from a project. |
| Returns the shell command to execute in order to run a task. |
| Synthesize all project files into outdir. |
| Finds a file at the specified relative path within this project and all its subprojects. |
| Finds a json file by name. |
| Finds an object file (like JsonFile, YamlFile, etc.) by name. |
| Finds a file at the specified relative path within this project and removes it. |
| No description. |
| Defines bundled dependencies. |
| DEPRECATED. |
| Defines normal dependencies. |
| Defines development/test dependencies. |
| Directly set fields in package.json. |
| Adds keywords to package.json (deduplicated). |
| Defines peer dependencies. |
| Replaces the contents of multiple npm package.json scripts. |
| DEPRECATED. |
| Indicates if a script by the name name is defined. |
| Removes the npm script (always successful). |
| Returns the set of workflow steps which should be executed to bootstrap a workflow. |
| 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
addTippublic 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.
- Call "this.preSynthesize()"
- Delete all generated files
- Synthesize all subprojects
- Synthesize all components of this project
- Call "postSynthesize()" for all components of this project
- 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
tryFindJsonFilepublic 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
addCompileCommandpublic 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
addTestCommandpublic addTestCommand(commands: ...string[]): void
DEPRECATED.
commandsRequired
- Type: ...string[]
hasScript
hasScriptpublic 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
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a project. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Task | No description. |
| boolean | Whether to commit the managed files by default. |
| projen.Task | No description. |
| projen.Component[] | Returns all the components within this project. |
| projen.Dependencies | Project dependencies. |
| boolean | Whether or not the project is being ejected. |
| projen.FileBase[] | All files in this project. |
| projen.GitAttributesFile | The .gitattributes file for this repository. |
| projen.IgnoreFile | .gitignore. |
| projen.Logger | Logging utilities. |
| string | Project name. |
| string | Absolute output directory of this project. |
| projen.Task | No description. |
| projen.Task | No description. |
| projen.Task | No description. |
| projen.ProjectBuild | Manages the build process of the project. |
| string | The command to use in order to run the projen CLI. |
| projen.Project | The root project. |
| projen.Project[] | Returns all the subprojects within this project. |
| projen.Tasks | Project tasks. |
| projen.Task | No description. |
| projen.Task | This is the "default" task, the one that executes "projen". |
| projen.InitProject | The options used when this project is bootstrapped via projen new. |
| projen.Project | A parent project. |
| projen.ProjectType | No description. |
| projen.github.AutoApprove | Auto approve set up for this project. |
| projen.vscode.DevContainer | Access for .devcontainer.json (used for GitHub Codespaces). |
| projen.github.GitHub | Access all github components. |
| projen.Gitpod | Access for Gitpod. |
| projen.vscode.VsCode | Access all VSCode components. |
| boolean | No description. |
| string | The build output directory. |
| string | The location of the npm tarball after build (${artifactsDirectory}/js). |
| projen.javascript.Bundler | No description. |
| string | No description. |
| any | No description. |
| projen.javascript.NpmConfig | The .npmrc file. |
| projen.javascript.NodePackage | API for managing the node package. |
| projen.javascript.NodePackageManager | The package manager to use. |
| string | The command to use to run scripts (e.g. yarn run or npm run depends on the package manager). |
| projen.github.AutoMerge | Component that sets up mergify for merging approved pull requests. |
| projen.javascript.Biome | No description. |
| projen.build.BuildWorkflow | The PR build GitHub workflow. |
| string | The job ID of the build workflow. |
| projen.javascript.Jest | The Jest configuration (if enabled). |
| string | Maximum node version supported by this package. |
| string | The minimum node version required by this package to function. |
| projen.IgnoreFile | The .npmignore file. |
| projen.javascript.Prettier | No description. |
| projen.release.Publisher | Package publisher. |
| projen.release.Release | Release management. |
| projen.javascript.UpgradeDependencies | The upgrade workflow. |
| string | No description. |
| string | The directory in which compiled .js files reside. |
| string | The directory in which the .ts sources reside. |
| string | The directory in which tests reside. |
| projen.javascript.TypescriptConfig | A typescript configuration file which covers all files (sources, tests, projen). |
| projen.Task | The "watch" task. |
| boolean | No description. |
| projen.javascript.Eslint | No description. |
| projen.javascript.TypescriptConfig | No description. |
| projen.javascript.TypescriptConfig | No description. |
| string | The CDK8s version this app is using. |
| string | The 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
allowLibraryDependencies- 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
entrypoint- Deprecated: use
package.entrypoint
public readonly entrypoint: string;
- Type: string
manifestRequired
manifest- 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
packageManager- 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.
biomeOptional
public readonly biome: Biome;
- Type: projen.javascript.Biome
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
publisher- 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
| Name | Type | Description |
|---|---|---|
| string | The name of the default task (the task executed when projen is run without arguments). |
| string | No 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)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
optionsRequired
- Type: IntegrationTestOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| 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
| Name | Description |
|---|---|
| Checks if x is a construct. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| projen.Task | Synthesizes the integration test and compares against a local copy (runs during build). |
| projen.Task | Deploy the integration test and update the snapshot upon success. |
| projen.Task | Just 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)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
optionsRequired
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| 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
| Name | Description |
|---|---|
| Checks if x is a construct. |
| 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
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| 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
| Name | Type | Description |
|---|---|---|
| string | Test source tree. |
| string | Path to the tsconfig file to use for integration tests. |
| boolean | Automatically 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
| Name | Type | Description |
|---|---|---|
| string | Minimum version of the cdk8s to depend on. |
| string | Minimum version of the cdk8s-cli to depend on. |
| boolean | Use pinned version instead of caret version for cdk8s-cli. |
| boolean | Include cdk8s-plus. |
| string | Minimum version of the cdk8s-plus-XX to depend on. |
| boolean | Use pinned version instead of caret version for cdk8s-plus-17. |
| boolean | Use pinned version instead of caret version for cdk8s. |
| string | Minimum version of the constructs library to depend on. |
| boolean | Use pinned version instead of caret version for constructs. |
| number | 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. |
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
| Name | Type | Description |
|---|---|---|
| string | Minimum version of the cdk8s to depend on. |
| string | Minimum version of the cdk8s-cli to depend on. |
| boolean | Use pinned version instead of caret version for cdk8s-cli. |
| boolean | Include cdk8s-plus. |
| string | Minimum version of the cdk8s-plus-XX to depend on. |
| boolean | Use pinned version instead of caret version for cdk8s-plus-17. |
| boolean | Use pinned version instead of caret version for cdk8s. |
| string | Minimum version of the constructs library to depend on. |
| boolean | Use pinned version instead of caret version for constructs. |
| number | 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. |
| boolean | Add cdk8s-cli only to Node projects. |
| projen.DependencyType | The 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.