awscdk
Submodule
Constructs
AutoDiscover
Discovers and creates integration tests and lambdas from code in the project's source and test trees.
Initializers
import { awscdk } from 'projen'
new awscdk.AutoDiscover(project: Project, options: AutoDiscoverOptions)
Name | Type | Description |
---|---|---|
| projen.Project | No description. |
|
| No description. |
project
Required
- Type: projen.Project
options
Required
- 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 { awscdk } from 'projen'
awscdk.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.
x
Required
- Type: any
Any object.
isComponent
import { awscdk } from 'projen'
awscdk.AutoDiscover.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. |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
project
Required
public readonly project: Project;
- Type: projen.Project
AwsCdkConstructLibrary
AWS CDK construct library project.
A multi-language (jsii) construct library which vends constructs designed to use within the AWS CDK with a friendly workflow and automatic publishing to the construct catalog.
Initializers
import { awscdk } from 'projen'
new awscdk.AwsCdkConstructLibrary(options: AwsCdkConstructLibraryOptions)
Name | Type | Description |
---|---|---|
|
| No description. |
options
Required
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. |
| Adds dependencies to AWS CDK modules. |
| Adds AWS CDK modules as dev dependencies. |
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.
globs
Required
- Type: ...string[]
The glob patterns to match.
addGitIgnore
public addGitIgnore(pattern: string): void
Adds a .gitignore pattern.
pattern
Required
- Type: string
The glob pattern to ignore.
addPackageIgnore
public addPackageIgnore(pattern: string): void
Adds patterns to be ignored by npm.
pattern
Required
- 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.
name
Required
- Type: string
The task name to add.
props
Optional
- Type: projen.TaskOptions
Task properties.
addTip
addTip
public addTip(message: string): void
Prints a "tip" message during synthesis.
message
Required
- 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
glob
Required
- 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.
name
Required
- 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
.
task
Required
- 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.
filePath
Required
- Type: string
The file path.
If this path is relative, it will be resolved from the root of this project.
tryFindJsonFile
tryFindJsonFile
public tryFindJsonFile(filePath: string): JsonFile
Finds a json file by name.
filePath
Required
- Type: string
The file path.
tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required
- 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.
filePath
Required
- 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
bins
Required
- 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
.
deps
Required
- 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
addCompileCommand
public addCompileCommand(commands: ...string[]): void
DEPRECATED.
commands
Required
- Type: ...string[]
addDeps
public addDeps(deps: ...string[]): void
Defines normal dependencies.
deps
Required
- 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.
deps
Required
- 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
.
fields
Required
- Type: {[ key: string ]: any}
The fields to set.
addKeywords
public addKeywords(keywords: ...string[]): void
Adds keywords to package.json (deduplicated).
keywords
Required
- 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.
deps
Required
- 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.
scripts
Required
- Type: {[ key: string ]: string}
The scripts to set.
addTestCommand
addTestCommand
public addTestCommand(commands: ...string[]): void
DEPRECATED.
commands
Required
- Type: ...string[]
hasScript
hasScript
public hasScript(name: string): boolean
Indicates if a script by the name name is defined.
name
Required
- Type: string
The name of the script.
removeScript
public removeScript(name: string): void
Removes the npm script (always successful).
name
Required
- 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.
options
Optional
- Type: projen.javascript.RenderWorkflowSetupOptions
Options.
setScript
public setScript(name: string, command: string): void
Replaces the contents of an npm package.json script.
name
Required
- Type: string
The script name.
command
Required
- Type: string
The command to execute.
addCdkDependencies
addCdkDependencies
public addCdkDependencies(deps: ...string[]): void
Adds dependencies to AWS CDK modules.
Since this is a library project, dependencies will be added as peer dependencies.
deps
Required
- Type: ...string[]
names of cdk modules (e.g. @aws-cdk/aws-lambda
).
addCdkTestDependencies
addCdkTestDependencies
public addCdkTestDependencies(deps: ...string[]): void
Adds AWS CDK modules as dev dependencies.
deps
Required
- Type: ...string[]
names of cdk modules (e.g. @aws-cdk/aws-lambda
).
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 { awscdk } from 'projen'
awscdk.AwsCdkConstructLibrary.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.
isProject
import { awscdk } from 'projen'
awscdk.AwsCdkConstructLibrary.isProject(x: any)
Test whether the given construct is a project.
x
Required
- Type: any
of
import { awscdk } from 'projen'
awscdk.AwsCdkConstructLibrary.of(construct: IConstruct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
construct
Required
- 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.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. |
|
| No description. |
| string | The target CDK version for this library. |
| string | No description. |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
buildTask
Required
public readonly buildTask: Task;
- Type: projen.Task
commitGenerated
Required
public readonly commitGenerated: boolean;
- Type: boolean
Whether to commit the managed files by default.
compileTask
Required
public readonly compileTask: Task;
- Type: projen.Task
components
Required
public readonly components: Component[];
- Type: projen.Component[]
Returns all the components within this project.
deps
Required
public readonly deps: Dependencies;
- Type: projen.Dependencies
Project dependencies.
ejected
Required
public readonly ejected: boolean;
- Type: boolean
Whether or not the project is being ejected.
files
Required
public readonly files: FileBase[];
- Type: projen.FileBase[]
All files in this project.
gitattributes
Required
public readonly gitattributes: GitAttributesFile;
- Type: projen.GitAttributesFile
The .gitattributes file for this repository.
gitignore
Required
public readonly gitignore: IgnoreFile;
- Type: projen.IgnoreFile
.gitignore.
logger
Required
public readonly logger: Logger;
- Type: projen.Logger
Logging utilities.
name
Required
public readonly name: string;
- Type: string
Project name.
outdir
Required
public readonly outdir: string;
- Type: string
Absolute output directory of this project.
packageTask
Required
public readonly packageTask: Task;
- Type: projen.Task
postCompileTask
Required
public readonly postCompileTask: Task;
- Type: projen.Task
preCompileTask
Required
public readonly preCompileTask: Task;
- Type: projen.Task
projectBuild
Required
public readonly projectBuild: ProjectBuild;
- Type: projen.ProjectBuild
Manages the build process of the project.
projenCommand
Required
public readonly projenCommand: string;
- Type: string
The command to use in order to run the projen CLI.
root
Required
public readonly root: Project;
- Type: projen.Project
The root project.
subprojects
Required
public readonly subprojects: Project[];
- Type: projen.Project[]
Returns all the subprojects within this project.
tasks
Required
public readonly tasks: Tasks;
- Type: projen.Tasks
Project tasks.
testTask
Required
public readonly testTask: Task;
- Type: projen.Task
defaultTask
Optional
public readonly defaultTask: Task;
- Type: projen.Task
This is the "default" task, the one that executes "projen".
Undefined if the project is being ejected.
initProject
Optional
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.
parent
Optional
public readonly parent: Project;
- Type: projen.Project
A parent project.
If undefined, this is the root project.
projectType
Required
public readonly projectType: ProjectType;
- Type: projen.ProjectType
autoApprove
Optional
public readonly autoApprove: AutoApprove;
- Type: projen.github.AutoApprove
Auto approve set up for this project.
devContainer
Optional
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
github
Optional
public readonly github: GitHub;
- Type: projen.github.GitHub
Access all github components.
This will be undefined
for subprojects.
gitpod
Optional
public readonly gitpod: Gitpod;
- Type: projen.Gitpod
Access for Gitpod.
This will be undefined
if gitpod boolean is false
vscode
Optional
public readonly vscode: VsCode;
- Type: projen.vscode.VsCode
Access all VSCode components.
This will be undefined
for subprojects.
allowLibraryDependencies
Required
allowLibraryDependencies
- Deprecated: use
package.allowLibraryDependencies
public readonly allowLibraryDependencies: boolean;
- Type: boolean
artifactsDirectory
Required
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
.
artifactsJavascriptDirectory
Required
public readonly artifactsJavascriptDirectory: string;
- Type: string
The location of the npm tarball after build (${artifactsDirectory}/js
).
bundler
Required
public readonly bundler: Bundler;
- Type: projen.javascript.Bundler
entrypoint
Required
entrypoint
- Deprecated: use
package.entrypoint
public readonly entrypoint: string;
- Type: string
manifest
Required
manifest
- Deprecated: use
package.addField(x, y)
public readonly manifest: any;
- Type: any
npmrc
Required
public readonly npmrc: NpmConfig;
- Type: projen.javascript.NpmConfig
The .npmrc file.
package
Required
public readonly package: NodePackage;
- Type: projen.javascript.NodePackage
API for managing the node package.
packageManager
Required
packageManager
- Deprecated: use
package.packageManager
public readonly packageManager: NodePackageManager;
- Type: projen.javascript.NodePackageManager
The package manager to use.
runScriptCommand
Required
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).
autoMerge
Optional
public readonly autoMerge: AutoMerge;
- Type: projen.github.AutoMerge
Component that sets up mergify for merging approved pull requests.
buildWorkflow
Optional
public readonly buildWorkflow: BuildWorkflow;
- Type: projen.build.BuildWorkflow
The PR build GitHub workflow.
undefined
if buildWorkflow
is disabled.
buildWorkflowJobId
Optional
public readonly buildWorkflowJobId: string;
- Type: string
The job ID of the build workflow.
jest
Optional
public readonly jest: Jest;
- Type: projen.javascript.Jest
The Jest configuration (if enabled).
maxNodeVersion
Optional
public readonly maxNodeVersion: string;
- Type: string
Maximum node version supported by this package.
The value indicates the package is incompatible with newer versions.
minNodeVersion
Optional
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.
npmignore
Optional
public readonly npmignore: IgnoreFile;
- Type: projen.IgnoreFile
The .npmignore file.
prettier
Optional
public readonly prettier: Prettier;
- Type: projen.javascript.Prettier
publisher
Optional
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.
release
Optional
public readonly release: Release;
- Type: projen.release.Release
Release management.
upgradeWorkflow
Optional
public readonly upgradeWorkflow: UpgradeDependencies;
- Type: projen.javascript.UpgradeDependencies
The upgrade workflow.
docsDirectory
Required
public readonly docsDirectory: string;
- Type: string
libdir
Required
public readonly libdir: string;
- Type: string
The directory in which compiled .js files reside.
srcdir
Required
public readonly srcdir: string;
- Type: string
The directory in which the .ts sources reside.
testdir
Required
public readonly testdir: string;
- Type: string
The directory in which tests reside.
tsconfigDev
Required
public readonly tsconfigDev: TypescriptConfig;
- Type: projen.javascript.TypescriptConfig
A typescript configuration file which covers all files (sources, tests, projen).
watchTask
Required
public readonly watchTask: Task;
- Type: projen.Task
The "watch" task.
docgen
Optional
public readonly docgen: boolean;
- Type: boolean
eslint
Optional
public readonly eslint: Eslint;
- Type: projen.javascript.Eslint
tsconfig
Optional
public readonly tsconfig: TypescriptConfig;
- Type: projen.javascript.TypescriptConfig
tsconfigEslint
Optional
public readonly tsconfigEslint: TypescriptConfig;
- Type: projen.javascript.TypescriptConfig
cdkDeps
Required
public readonly cdkDeps: AwsCdkDeps;
- Type: AwsCdkDeps
cdkVersion
Required
public readonly cdkVersion: string;
- Type: string
The target CDK version for this library.
version
Required
version
- Deprecated: use
cdkVersion
public readonly version: string;
- Type: string
Constants
Name | Type | Description |
---|---|---|
| string | The name of the default task (the task executed when projen is run without arguments). |
| string | No description. |
DEFAULT_TASK
Required
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_PATTERN
Required
public readonly DEFAULT_TS_JEST_TRANFORM_PATTERN: string;
- Type: string
AwsCdkDeps
Manages dependencies on the AWS CDK.
Initializers
import { awscdk } from 'projen'
new awscdk.AwsCdkDeps(project: Project, options: AwsCdkDepsOptions)
Name | Type | Description |
---|---|---|
| projen.Project | No description. |
|
| No description. |
project
Required
- Type: projen.Project
options
Required
- Type: AwsCdkDepsOptions
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Adds dependencies to AWS CDK modules. |
| Adds AWS CDK modules as dev dependencies. |
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.
addV1Dependencies
public addV1Dependencies(deps: ...string[]): void
Adds dependencies to AWS CDK modules.
The type of dependency is determined by the dependencyType
option.
This method is not supported in CDK v2. Use project.addPeerDeps()
or
project.addDeps()
as appropriate.
deps
Required
- Type: ...string[]
names of cdk modules (e.g. @aws-cdk/aws-lambda
).
addV1DevDependencies
public addV1DevDependencies(deps: ...string[]): void
Adds AWS CDK modules as dev dependencies.
This method is not supported in CDK v2. Use project.addPeerDeps()
or
project.addDeps()
as appropriate.
deps
Required
- Type: ...string[]
fully qualified names of cdk modules (e.g. @aws-cdk/aws-lambda
).
Static Functions
Name | Description |
---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { awscdk } from 'projen'
awscdk.AwsCdkDeps.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 { awscdk } from 'projen'
awscdk.AwsCdkDeps.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. |
| boolean | Whether CDK dependencies are added as normal dependencies (and peer dependencies). |
| number | The major version of the AWS CDK (e.g. 1, 2, ...). |
| string | The minimum version of the AWS CDK (e.g. 2.0.0 ). |
| string | The dependency requirement for AWS CDK (e.g. ^2.0.0 ). |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
project
Required
public readonly project: Project;
- Type: projen.Project
cdkDependenciesAsDeps
Required
cdkDependenciesAsDeps
- Deprecated: Not used for CDK 2.x
public readonly cdkDependenciesAsDeps: boolean;
- Type: boolean
Whether CDK dependencies are added as normal dependencies (and peer dependencies).
cdkMajorVersion
Required
public readonly cdkMajorVersion: number;
- Type: number
The major version of the AWS CDK (e.g. 1, 2, ...).
cdkMinimumVersion
Required
public readonly cdkMinimumVersion: string;
- Type: string
The minimum version of the AWS CDK (e.g. 2.0.0
).
cdkVersion
Required
public readonly cdkVersion: string;
- Type: string
The dependency requirement for AWS CDK (e.g. ^2.0.0
).
AwsCdkDepsJava
Manages dependencies on the AWS CDK for Java projects.
Initializers
import { awscdk } from 'projen'
new awscdk.AwsCdkDepsJava(project: Project, options: AwsCdkDepsOptions)
Name | Type | Description |
---|---|---|
| projen.Project | No description. |
|
| No description. |
project
Required
- Type: projen.Project
options
Required
- Type: AwsCdkDepsOptions
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Adds dependencies to AWS CDK modules. |
| Adds AWS CDK modules as dev dependencies. |
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.
addV1Dependencies
public addV1Dependencies(deps: ...string[]): void
Adds dependencies to AWS CDK modules.
The type of dependency is determined by the dependencyType
option.
This method is not supported in CDK v2. Use project.addPeerDeps()
or
project.addDeps()
as appropriate.
deps
Required
- Type: ...string[]
names of cdk modules (e.g. @aws-cdk/aws-lambda
).
addV1DevDependencies
public addV1DevDependencies(deps: ...string[]): void
Adds AWS CDK modules as dev dependencies.
This method is not supported in CDK v2. Use project.addPeerDeps()
or
project.addDeps()
as appropriate.
deps
Required
- Type: ...string[]
fully qualified names of cdk modules (e.g. @aws-cdk/aws-lambda
).
Static Functions
Name | Description |
---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { awscdk } from 'projen'
awscdk.AwsCdkDepsJava.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 { awscdk } from 'projen'
awscdk.AwsCdkDepsJava.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. |
| boolean | Whether CDK dependencies are added as normal dependencies (and peer dependencies). |
| number | The major version of the AWS CDK (e.g. 1, 2, ...). |
| string | The minimum version of the AWS CDK (e.g. 2.0.0 ). |
| string | The dependency requirement for AWS CDK (e.g. ^2.0.0 ). |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
project
Required
public readonly project: Project;
- Type: projen.Project
cdkDependenciesAsDeps
Required
cdkDependenciesAsDeps
- Deprecated: Not used for CDK 2.x
public readonly cdkDependenciesAsDeps: boolean;
- Type: boolean
Whether CDK dependencies are added as normal dependencies (and peer dependencies).
cdkMajorVersion
Required
public readonly cdkMajorVersion: number;
- Type: number
The major version of the AWS CDK (e.g. 1, 2, ...).
cdkMinimumVersion
Required
public readonly cdkMinimumVersion: string;
- Type: string
The minimum version of the AWS CDK (e.g. 2.0.0
).
cdkVersion
Required
public readonly cdkVersion: string;
- Type: string
The dependency requirement for AWS CDK (e.g. ^2.0.0
).
AwsCdkDepsJs
Manages dependencies on the AWS CDK for Node.js projects.
Initializers
import { awscdk } from 'projen'
new awscdk.AwsCdkDepsJs(project: Project, options: AwsCdkDepsOptions)
Name | Type | Description |
---|---|---|
| projen.Project | No description. |
|
| No description. |
project
Required
- Type: projen.Project
options
Required
- Type: AwsCdkDepsOptions
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Adds dependencies to AWS CDK modules. |
| Adds AWS CDK modules as dev dependencies. |
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.
addV1Dependencies
public addV1Dependencies(deps: ...string[]): void
Adds dependencies to AWS CDK modules.
The type of dependency is determined by the dependencyType
option.
This method is not supported in CDK v2. Use project.addPeerDeps()
or
project.addDeps()
as appropriate.
deps
Required
- Type: ...string[]
names of cdk modules (e.g. @aws-cdk/aws-lambda
).
addV1DevDependencies
public addV1DevDependencies(deps: ...string[]): void
Adds AWS CDK modules as dev dependencies.
This method is not supported in CDK v2. Use project.addPeerDeps()
or
project.addDeps()
as appropriate.
deps
Required
- Type: ...string[]
fully qualified names of cdk modules (e.g. @aws-cdk/aws-lambda
).
Static Functions
Name | Description |
---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { awscdk } from 'projen'
awscdk.AwsCdkDepsJs.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 { awscdk } from 'projen'
awscdk.AwsCdkDepsJs.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. |
| boolean | Whether CDK dependencies are added as normal dependencies (and peer dependencies). |
| number | The major version of the AWS CDK (e.g. 1, 2, ...). |
| string | The minimum version of the AWS CDK (e.g. 2.0.0 ). |
| string | The dependency requirement for AWS CDK (e.g. ^2.0.0 ). |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
project
Required
public readonly project: Project;
- Type: projen.Project
cdkDependenciesAsDeps
Required
cdkDependenciesAsDeps
- Deprecated: Not used for CDK 2.x
public readonly cdkDependenciesAsDeps: boolean;
- Type: boolean
Whether CDK dependencies are added as normal dependencies (and peer dependencies).
cdkMajorVersion
Required
public readonly cdkMajorVersion: number;
- Type: number
The major version of the AWS CDK (e.g. 1, 2, ...).
cdkMinimumVersion
Required
public readonly cdkMinimumVersion: string;
- Type: string
The minimum version of the AWS CDK (e.g. 2.0.0
).
cdkVersion
Required
public readonly cdkVersion: string;
- Type: string
The dependency requirement for AWS CDK (e.g. ^2.0.0
).
AwsCdkDepsPy
Manages dependencies on the AWS CDK for Python projects.
Initializers
import { awscdk } from 'projen'
new awscdk.AwsCdkDepsPy(project: Project, options: AwsCdkDepsOptions)
Name | Type | Description |
---|---|---|
| projen.Project | No description. |
|
| No description. |
project
Required
- Type: projen.Project
options
Required
- Type: AwsCdkDepsOptions
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Adds dependencies to AWS CDK modules. |
| Adds AWS CDK modules as dev dependencies. |
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.
addV1Dependencies
public addV1Dependencies(deps: ...string[]): void
Adds dependencies to AWS CDK modules.
The type of dependency is determined by the dependencyType
option.
This method is not supported in CDK v2. Use project.addPeerDeps()
or
project.addDeps()
as appropriate.
deps
Required
- Type: ...string[]
names of cdk modules (e.g. @aws-cdk/aws-lambda
).
addV1DevDependencies
public addV1DevDependencies(deps: ...string[]): void
Adds AWS CDK modules as dev dependencies.
This method is not supported in CDK v2. Use project.addPeerDeps()
or
project.addDeps()
as appropriate.
deps
Required
- Type: ...string[]
fully qualified names of cdk modules (e.g. @aws-cdk/aws-lambda
).
Static Functions
Name | Description |
---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { awscdk } from 'projen'
awscdk.AwsCdkDepsPy.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 { awscdk } from 'projen'
awscdk.AwsCdkDepsPy.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. |
| boolean | Whether CDK dependencies are added as normal dependencies (and peer dependencies). |
| number | The major version of the AWS CDK (e.g. 1, 2, ...). |
| string | The minimum version of the AWS CDK (e.g. 2.0.0 ). |
| string | The dependency requirement for AWS CDK (e.g. ^2.0.0 ). |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
project
Required
public readonly project: Project;
- Type: projen.Project
cdkDependenciesAsDeps
Required
cdkDependenciesAsDeps
- Deprecated: Not used for CDK 2.x
public readonly cdkDependenciesAsDeps: boolean;
- Type: boolean
Whether CDK dependencies are added as normal dependencies (and peer dependencies).
cdkMajorVersion
Required
public readonly cdkMajorVersion: number;
- Type: number
The major version of the AWS CDK (e.g. 1, 2, ...).
cdkMinimumVersion
Required
public readonly cdkMinimumVersion: string;
- Type: string
The minimum version of the AWS CDK (e.g. 2.0.0
).
cdkVersion
Required
public readonly cdkVersion: string;
- Type: string
The dependency requirement for AWS CDK (e.g. ^2.0.0
).
AwsCdkJavaApp
AWS CDK app in Java.
Initializers
import { awscdk } from 'projen'
new awscdk.AwsCdkJavaApp(options: AwsCdkJavaAppOptions)
Name | Type | Description |
---|---|---|
|
| No description. |
options
Required
- Type: AwsCdkJavaAppOptions
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 build plugin to the pom. |
| Adds a test dependency. |
| Adds an AWS CDK module dependencies. |
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.
globs
Required
- Type: ...string[]
The glob patterns to match.
addGitIgnore
public addGitIgnore(pattern: string): void
Adds a .gitignore pattern.
pattern
Required
- 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
.
_pattern
Required
- 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.
name
Required
- Type: string
The task name to add.
props
Optional
- Type: projen.TaskOptions
Task properties.
addTip
addTip
public addTip(message: string): void
Prints a "tip" message during synthesis.
message
Required
- 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
glob
Required
- 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.
name
Required
- 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>
task
Required
- 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.
filePath
Required
- Type: string
The file path.
If this path is relative, it will be resolved from the root of this project.
tryFindJsonFile
tryFindJsonFile
public tryFindJsonFile(filePath: string): JsonFile
Finds a json file by name.
filePath
Required
- Type: string
The file path.
tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required
- 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.
filePath
Required
- 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.
spec
Required
- Type: string
Format <groupId>/<artifactId>@<semver>
.
addPlugin
public addPlugin(spec: string, options?: PluginOptions): Dependency
Adds a build plugin to the pom.
The plug in is also added as a BUILD dep to the project.
spec
Required
- Type: string
dependency spec (group/artifact@version
).
options
Optional
- Type: projen.java.PluginOptions
plugin options.
addTestDependency
public addTestDependency(spec: string): void
Adds a test dependency.
spec
Required
- Type: string
Format <groupId>/<artifactId>@<semver>
.
addCdkDependency
addCdkDependency
public addCdkDependency(modules: ...string[]): void
Adds an AWS CDK module dependencies.
modules
Required
- Type: ...string[]
The list of modules to depend on (e.g. "software.amazon.awscdk/aws-lambda", "software.amazon.awscdk/aws-iam", etc).
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 { awscdk } from 'projen'
awscdk.AwsCdkJavaApp.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.
isProject
import { awscdk } from 'projen'
awscdk.AwsCdkJavaApp.isProject(x: any)
Test whether the given construct is a project.
x
Required
- Type: any
of
import { awscdk } from 'projen'
awscdk.AwsCdkJavaApp.of(construct: IConstruct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
construct
Required
- 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.java.MavenCompile | Compile component. |
| string | Maven artifact output directory. |
| projen.java.MavenPackaging | Packaging component. |
| projen.java.Pom | API for managing pom.xml . |
| projen.java.Junit | JUnit component. |
| projen.java.Projenrc | Projenrc component. |
|
| The cdk.json file. |
|
| CDK dependency management helper class. |
|
| CDK tasks. |
| string | The full name of the main class of the java app (package.Class). |
| string | The name of the Java class with the static main() method. |
| string | The name of the Java package that includes the main class. |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
buildTask
Required
public readonly buildTask: Task;
- Type: projen.Task
commitGenerated
Required
public readonly commitGenerated: boolean;
- Type: boolean
Whether to commit the managed files by default.
compileTask
Required
public readonly compileTask: Task;
- Type: projen.Task
components
Required
public readonly components: Component[];
- Type: projen.Component[]
Returns all the components within this project.
deps
Required
public readonly deps: Dependencies;
- Type: projen.Dependencies
Project dependencies.
ejected
Required
public readonly ejected: boolean;
- Type: boolean
Whether or not the project is being ejected.
files
Required
public readonly files: FileBase[];
- Type: projen.FileBase[]
All files in this project.
gitattributes
Required
public readonly gitattributes: GitAttributesFile;
- Type: projen.GitAttributesFile
The .gitattributes file for this repository.
gitignore
Required
public readonly gitignore: IgnoreFile;
- Type: projen.IgnoreFile
.gitignore.
logger
Required
public readonly logger: Logger;
- Type: projen.Logger
Logging utilities.
name
Required
public readonly name: string;
- Type: string
Project name.
outdir
Required
public readonly outdir: string;
- Type: string
Absolute output directory of this project.
packageTask
Required
public readonly packageTask: Task;
- Type: projen.Task
postCompileTask
Required
public readonly postCompileTask: Task;
- Type: projen.Task
preCompileTask
Required
public readonly preCompileTask: Task;
- Type: projen.Task
projectBuild
Required
public readonly projectBuild: ProjectBuild;
- Type: projen.ProjectBuild
Manages the build process of the project.
projenCommand
Required
public readonly projenCommand: string;
- Type: string
The command to use in order to run the projen CLI.
root
Required
public readonly root: Project;
- Type: projen.Project
The root project.
subprojects
Required
public readonly subprojects: Project[];
- Type: projen.Project[]
Returns all the subprojects within this project.
tasks
Required
public readonly tasks: Tasks;
- Type: projen.Tasks
Project tasks.
testTask
Required
public readonly testTask: Task;
- Type: projen.Task
defaultTask
Optional
public readonly defaultTask: Task;
- Type: projen.Task
This is the "default" task, the one that executes "projen".
Undefined if the project is being ejected.
initProject
Optional
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.
parent
Optional
public readonly parent: Project;
- Type: projen.Project
A parent project.
If undefined, this is the root project.
projectType
Required
public readonly projectType: ProjectType;
- Type: projen.ProjectType
autoApprove
Optional
public readonly autoApprove: AutoApprove;
- Type: projen.github.AutoApprove
Auto approve set up for this project.
devContainer
Optional
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
github
Optional
public readonly github: GitHub;
- Type: projen.github.GitHub
Access all github components.
This will be undefined
for subprojects.
gitpod
Optional
public readonly gitpod: Gitpod;
- Type: projen.Gitpod
Access for Gitpod.
This will be undefined
if gitpod boolean is false
vscode
Optional
public readonly vscode: VsCode;
- Type: projen.vscode.VsCode
Access all VSCode components.
This will be undefined
for subprojects.
compile
Required
public readonly compile: MavenCompile;
- Type: projen.java.MavenCompile
Compile component.
distdir
Required
public readonly distdir: string;
- Type: string
Maven artifact output directory.
packaging
Required
public readonly packaging: MavenPackaging;
- Type: projen.java.MavenPackaging
Packaging component.
pom
Required
public readonly pom: Pom;
- Type: projen.java.Pom
API for managing pom.xml
.
junit
Optional
public readonly junit: Junit;
- Type: projen.java.Junit
JUnit component.
projenrc
Optional
public readonly projenrc: Projenrc;
- Type: projen.java.Projenrc
Projenrc component.
cdkConfig
Required
public readonly cdkConfig: CdkConfig;
- Type: CdkConfig
The cdk.json
file.
cdkDeps
Required
public readonly cdkDeps: AwsCdkDeps;
- Type: AwsCdkDeps
CDK dependency management helper class.
cdkTasks
Required
public readonly cdkTasks: CdkTasks;
- Type: CdkTasks
CDK tasks.
mainClass
Required
public readonly mainClass: string;
- Type: string
The full name of the main class of the java app (package.Class).
mainClassName
Required
public readonly mainClassName: string;
- Type: string
The name of the Java class with the static main()
method.
mainPackage
Required
public readonly mainPackage: string;
- Type: string
The name of the Java package that includes the main class.
Constants
Name | Type | Description |
---|---|---|
| string | The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASK
Required
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.
AwsCdkPythonApp
AWS CDK app in Python.
Initializers
import { awscdk } from 'projen'
new awscdk.AwsCdkPythonApp(options: AwsCdkPythonAppOptions)
Name | Type | Description |
---|---|---|
|
| No description. |
options
Required
- Type: AwsCdkPythonAppOptions
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.
globs
Required
- Type: ...string[]
The glob patterns to match.
addGitIgnore
public addGitIgnore(pattern: string): void
Adds a .gitignore pattern.
pattern
Required
- 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
.
_pattern
Required
- 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.
name
Required
- Type: string
The task name to add.
props
Optional
- Type: projen.TaskOptions
Task properties.
addTip
addTip
public addTip(message: string): void
Prints a "tip" message during synthesis.
message
Required
- 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
glob
Required
- 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.
name
Required
- 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>
task
Required
- 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.
filePath
Required
- Type: string
The file path.
If this path is relative, it will be resolved from the root of this project.
tryFindJsonFile
tryFindJsonFile
public tryFindJsonFile(filePath: string): JsonFile
Finds a json file by name.
filePath
Required
- Type: string
The file path.
tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required
- 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.
filePath
Required
- 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.
spec
Required
- Type: string
Format <module>@<semver>
.
addDevDependency
public addDevDependency(spec: string): void
Adds a dev dependency.
spec
Required
- 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 { awscdk } from 'projen'
awscdk.AwsCdkPythonApp.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.
isProject
import { awscdk } from 'projen'
awscdk.AwsCdkPythonApp.isProject(x: any)
Test whether the given construct is a project.
x
Required
- Type: any
of
import { awscdk } from 'projen'
awscdk.AwsCdkPythonApp.of(construct: IConstruct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
construct
Required
- 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 | The directory in which the python sample tests reside. |
| 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 CDK app entrypoint. |
|
| cdk.json configuration. |
|
| No description. |
|
| Common CDK tasks. |
| string | The CDK version this app is using. |
| string | The directory in which the python tests reside. |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
buildTask
Required
public readonly buildTask: Task;
- Type: projen.Task
commitGenerated
Required
public readonly commitGenerated: boolean;
- Type: boolean
Whether to commit the managed files by default.
compileTask
Required
public readonly compileTask: Task;
- Type: projen.Task
components
Required
public readonly components: Component[];
- Type: projen.Component[]
Returns all the components within this project.
deps
Required
public readonly deps: Dependencies;
- Type: projen.Dependencies
Project dependencies.
ejected
Required
public readonly ejected: boolean;
- Type: boolean
Whether or not the project is being ejected.
files
Required
public readonly files: FileBase[];
- Type: projen.FileBase[]
All files in this project.
gitattributes
Required
public readonly gitattributes: GitAttributesFile;
- Type: projen.GitAttributesFile
The .gitattributes file for this repository.
gitignore
Required
public readonly gitignore: IgnoreFile;
- Type: projen.IgnoreFile
.gitignore.
logger
Required
public readonly logger: Logger;
- Type: projen.Logger
Logging utilities.
name
Required
public readonly name: string;
- Type: string
Project name.
outdir
Required
public readonly outdir: string;
- Type: string
Absolute output directory of this project.
packageTask
Required
public readonly packageTask: Task;
- Type: projen.Task
postCompileTask
Required
public readonly postCompileTask: Task;
- Type: projen.Task
preCompileTask
Required
public readonly preCompileTask: Task;
- Type: projen.Task
projectBuild
Required
public readonly projectBuild: ProjectBuild;
- Type: projen.ProjectBuild
Manages the build process of the project.
projenCommand
Required
public readonly projenCommand: string;
- Type: string
The command to use in order to run the projen CLI.
root
Required
public readonly root: Project;
- Type: projen.Project
The root project.
subprojects
Required
public readonly subprojects: Project[];
- Type: projen.Project[]
Returns all the subprojects within this project.
tasks
Required
public readonly tasks: Tasks;
- Type: projen.Tasks
Project tasks.
testTask
Required
public readonly testTask: Task;
- Type: projen.Task
defaultTask
Optional
public readonly defaultTask: Task;
- Type: projen.Task
This is the "default" task, the one that executes "projen".
Undefined if the project is being ejected.
initProject
Optional
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.
parent
Optional
public readonly parent: Project;
- Type: projen.Project
A parent project.
If undefined, this is the root project.
projectType
Required
public readonly projectType: ProjectType;
- Type: projen.ProjectType
autoApprove
Optional
public readonly autoApprove: AutoApprove;
- Type: projen.github.AutoApprove
Auto approve set up for this project.
devContainer
Optional
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
github
Optional
public readonly github: GitHub;
- Type: projen.github.GitHub
Access all github components.
This will be undefined
for subprojects.
gitpod
Optional
public readonly gitpod: Gitpod;
- Type: projen.Gitpod
Access for Gitpod.
This will be undefined
if gitpod boolean is false
vscode
Optional
public readonly vscode: VsCode;
- Type: projen.vscode.VsCode
Access all VSCode components.
This will be undefined
for subprojects.
depsManager
Required
public readonly depsManager: IPythonDeps;
- Type: projen.python.IPythonDeps
API for managing dependencies.
envManager
Required
public readonly envManager: IPythonEnv;
- Type: projen.python.IPythonEnv
API for mangaging the Python runtime environment.
moduleName
Required
public readonly moduleName: string;
- Type: string
Python module name (the project name, with any hyphens or periods replaced with underscores).
sampleTestdir
Required
public readonly sampleTestdir: string;
- Type: string
The directory in which the python sample tests reside.
version
Required
public readonly version: string;
- Type: string
Version of the package for distribution (should follow semver).
packagingManager
Optional
public readonly packagingManager: IPythonPackaging;
- Type: projen.python.IPythonPackaging
API for managing packaging the project as a library.
Only applies when the projectType
is LIB.
pytest
Optional
public readonly pytest: Pytest;
- Type: projen.python.Pytest
Pytest component.
appEntrypoint
Required
public readonly appEntrypoint: string;
- Type: string
The CDK app entrypoint.
cdkConfig
Required
public readonly cdkConfig: CdkConfig;
- Type: CdkConfig
cdk.json configuration.
cdkDeps
Required
public readonly cdkDeps: AwsCdkDeps;
- Type: AwsCdkDeps
cdkTasks
Required
public readonly cdkTasks: CdkTasks;
- Type: CdkTasks
Common CDK tasks.
cdkVersion
Required
public readonly cdkVersion: string;
- Type: string
The CDK version this app is using.
testdir
Required
testdir
- Deprecated: Use
sampleTestdir
instead.
public readonly testdir: string;
- Type: string
The directory in which the python tests reside.
Constants
Name | Type | Description |
---|---|---|
| string | The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASK
Required
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.
AwsCdkTypeScriptApp
AWS CDK app in TypeScript.
Initializers
import { awscdk } from 'projen'
new awscdk.AwsCdkTypeScriptApp(options: AwsCdkTypeScriptAppOptions)
Name | Type | Description |
---|---|---|
|
| No description. |
options
Required
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. |
| Adds an AWS CDK module dependencies. |
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.
globs
Required
- Type: ...string[]
The glob patterns to match.
addGitIgnore
public addGitIgnore(pattern: string): void
Adds a .gitignore pattern.
pattern
Required
- Type: string
The glob pattern to ignore.
addPackageIgnore
public addPackageIgnore(pattern: string): void
Adds patterns to be ignored by npm.
pattern
Required
- 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.
name
Required
- Type: string
The task name to add.
props
Optional
- Type: projen.TaskOptions
Task properties.
addTip
addTip
public addTip(message: string): void
Prints a "tip" message during synthesis.
message
Required
- 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
glob
Required
- 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.
name
Required
- 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
.
task
Required
- 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.
filePath
Required
- Type: string
The file path.
If this path is relative, it will be resolved from the root of this project.
tryFindJsonFile
tryFindJsonFile
public tryFindJsonFile(filePath: string): JsonFile
Finds a json file by name.
filePath
Required
- Type: string
The file path.
tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required
- 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.
filePath
Required
- 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
bins
Required
- 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
.
deps
Required
- 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
addCompileCommand
public addCompileCommand(commands: ...string[]): void
DEPRECATED.
commands
Required
- Type: ...string[]
addDeps
public addDeps(deps: ...string[]): void
Defines normal dependencies.
deps
Required
- 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.
deps
Required
- 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
.
fields
Required
- Type: {[ key: string ]: any}
The fields to set.
addKeywords
public addKeywords(keywords: ...string[]): void
Adds keywords to package.json (deduplicated).
keywords
Required
- 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.
deps
Required
- 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.
scripts
Required
- Type: {[ key: string ]: string}
The scripts to set.
addTestCommand
addTestCommand
public addTestCommand(commands: ...string[]): void
DEPRECATED.
commands
Required
- Type: ...string[]
hasScript
hasScript
public hasScript(name: string): boolean
Indicates if a script by the name name is defined.
name
Required
- Type: string
The name of the script.
removeScript
public removeScript(name: string): void
Removes the npm script (always successful).