API Reference
Submodules
The following submodules are available:
- awscdk
- build
- cdk
- cdk8s
- cdktf
- circleci
- github
- github.workflows
- gitlab
- java
- javascript
- python
- release
- typescript
- vscode
- web
Constructs
Component
Represents a project component.
Initializers
import { Component } from 'projen'
new Component(scope: IConstruct, id?: string)
Name | Type | Description |
---|---|---|
| constructs.IConstruct | No description. |
| string | No description. |
scope
Required
- Type: constructs.IConstruct
id
Optional
- Type: string
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 { Component } from 'projen'
Component.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.
x
Required
- Type: any
Any object.
isComponent
import { Component } from 'projen'
Component.isComponent(x: any)
Test whether the given construct is a component.
x
Required
- Type: any