vscode
Submodule
Constructs
DevContainer
- Implements: IDevContainerEnvironment
A development environment running VSCode in a container;
used by GitHub codespaces.
Initializers
import { vscode } from 'projen'
new vscode.DevContainer(project: Project, options?: DevContainerOptions)
Name | Type | Description |
---|---|---|
| projen.Project | No description. |
|
| No description. |
project
Required
- Type: projen.Project
options
Optional
- Type: DevContainerOptions
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Add a custom Docker image or Dockerfile for the container. |
| Adds a list of VSCode features that should be automatically installed in the container. |
| Adds ports that should be exposed (forwarded) from the container. |
| Adds tasks to run when the container starts. |
| Adds a list of VSCode extensions that should be automatically installed in the container. |
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.
addDockerImage
public addDockerImage(image: DevEnvironmentDockerImage): void
Add a custom Docker image or Dockerfile for the container.
image
Required
- Type: projen.DevEnvironmentDockerImage
addFeatures
public addFeatures(features: ...DevContainerFeature[]): void
Adds a list of VSCode features that should be automatically installed in the container.
features
Required
- Type: ...DevContainerFeature[]
featureName and version(optional default: latest).
addPorts
public addPorts(ports: ...string[]): void
Adds ports that should be exposed (forwarded) from the container.
ports
Required
- Type: ...string[]
The new ports.
addTasks
public addTasks(tasks: ...Task[]): void
Adds tasks to run when the container starts.
Tasks will be run in sequence.
tasks
Required
- Type: ...projen.Task[]
The new tasks.
addVscodeExtensions
public addVscodeExtensions(extensions: ...string[]): void
Adds a list of VSCode extensions that should be automatically installed in the container.
extensions
Required
- Type: ...string[]
The extension IDs.
Static Functions
Name | Description |
---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { vscode } from 'projen'
vscode.DevContainer.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 { vscode } from 'projen'
vscode.DevContainer.isComponent(x: any)
Test whether the given construct is a component.
x
Required
- Type: any
Properties
Name | Type | Description |
---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| any | Direct access to the devcontainer configuration (escape hatch). |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
project
Required
public readonly project: Project;
- Type: projen.Project
config
Required
public readonly config: any;
- Type: any
Direct access to the devcontainer configuration (escape hatch).
VsCode
Initializers
import { vscode } from 'projen'
new vscode.VsCode(project: Project)
Name | Type | Description |
---|---|---|
| projen.Project | No description. |