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. |
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 { 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.
xRequired
- Type: any
Any object.
isComponent
import { awscdk } from 'projen'
awscdk.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
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. |
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. |
| 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.
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.
addCdkDependencies
addCdkDependenciespublic addCdkDependencies(deps: ...string[]): void
Adds dependencies to AWS CDK modules.
Since this is a library project, dependencies will be added as peer dependencies.
depsRequired
- Type: ...string[]
names of cdk modules (e.g. @aws-cdk/aws-lambda).
addCdkTestDependencies
addCdkTestDependenciespublic addCdkTestDependencies(deps: ...string[]): void
Adds AWS CDK modules as dev dependencies.
depsRequired
- 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.
xRequired
- Type: any
Any object.
isProject
import { awscdk } from 'projen'
awscdk.AwsCdkConstructLibrary.isProject(x: any)
Test whether the given construct is a project.
xRequired
- 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.
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. |
| | No description. |
| string | The target CDK version for this library. |
| string | 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
cdkDepsRequired
public readonly cdkDeps: AwsCdkDeps;
- Type: AwsCdkDeps
cdkVersionRequired
public readonly cdkVersion: string;
- Type: string
The target CDK version for this library.
versionRequired
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_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
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. |
projectRequired
- Type: projen.Project
optionsRequired
- 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.
depsRequired
- 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.
depsRequired
- 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.
xRequired
- Type: any
Any object.
isComponent
import { awscdk } from 'projen'
awscdk.AwsCdkDeps.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 | The dependency requirement for the CDK CLI (e.g. '^2.3.4'). |
| 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). |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
cdkCliVersionRequired
public readonly cdkCliVersion: string;
- Type: string
The dependency requirement for the CDK CLI (e.g. '^2.3.4').
Will return ^2 if the version was unspecified by the user.
cdkDependenciesAsDepsRequired
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).
cdkMajorVersionRequired
public readonly cdkMajorVersion: number;
- Type: number
The major version of the AWS CDK (e.g. 1, 2, ...).
cdkMinimumVersionRequired
public readonly cdkMinimumVersion: string;
- Type: string
The minimum version of the AWS CDK (e.g. 2.0.0).
cdkVersionRequired
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. |
projectRequired
- Type: projen.Project
optionsRequired
- 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.
depsRequired
- 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.
depsRequired
- 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.
xRequired
- Type: any
Any object.
isComponent
import { awscdk } from 'projen'
awscdk.AwsCdkDepsJava.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 | The dependency requirement for the CDK CLI (e.g. '^2.3.4'). |
| 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). |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
cdkCliVersionRequired
public readonly cdkCliVersion: string;
- Type: string
The dependency requirement for the CDK CLI (e.g. '^2.3.4').
Will return ^2 if the version was unspecified by the user.
cdkDependenciesAsDepsRequired
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).
cdkMajorVersionRequired
public readonly cdkMajorVersion: number;
- Type: number
The major version of the AWS CDK (e.g. 1, 2, ...).
cdkMinimumVersionRequired
public readonly cdkMinimumVersion: string;
- Type: string
The minimum version of the AWS CDK (e.g. 2.0.0).
cdkVersionRequired
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. |
projectRequired
- Type: projen.Project
optionsRequired
- 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.
depsRequired
- 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.
depsRequired
- 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.
xRequired
- Type: any
Any object.
isComponent
import { awscdk } from 'projen'
awscdk.AwsCdkDepsJs.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 | The dependency requirement for the CDK CLI (e.g. '^2.3.4'). |
| 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). |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
cdkCliVersionRequired
public readonly cdkCliVersion: string;
- Type: string
The dependency requirement for the CDK CLI (e.g. '^2.3.4').
Will return ^2 if the version was unspecified by the user.
cdkDependenciesAsDepsRequired
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).
cdkMajorVersionRequired
public readonly cdkMajorVersion: number;
- Type: number
The major version of the AWS CDK (e.g. 1, 2, ...).
cdkMinimumVersionRequired
public readonly cdkMinimumVersion: string;
- Type: string
The minimum version of the AWS CDK (e.g. 2.0.0).
cdkVersionRequired
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. |
projectRequired
- Type: projen.Project
optionsRequired
- 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.
depsRequired
- 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.
depsRequired
- 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.
xRequired
- Type: any
Any object.
isComponent
import { awscdk } from 'projen'
awscdk.AwsCdkDepsPy.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 | The dependency requirement for the CDK CLI (e.g. '^2.3.4'). |
| 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). |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
cdkCliVersionRequired
public readonly cdkCliVersion: string;
- Type: string
The dependency requirement for the CDK CLI (e.g. '^2.3.4').
Will return ^2 if the version was unspecified by the user.
cdkDependenciesAsDepsRequired
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).
cdkMajorVersionRequired
public readonly cdkMajorVersion: number;
- Type: number
The major version of the AWS CDK (e.g. 1, 2, ...).
cdkMinimumVersionRequired
public readonly cdkMinimumVersion: string;
- Type: string
The minimum version of the AWS CDK (e.g. 2.0.0).
cdkVersionRequired
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. |
optionsRequired
- 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.
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 <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.
specRequired
- Type: string
dependency spec (group/artifact@version).
optionsOptional
- Type: projen.java.PluginOptions
plugin options.
addTestDependency
public addTestDependency(spec: string): void
Adds a test dependency.
specRequired
- Type: string
Format <groupId>/<artifactId>@<semver>.
addCdkDependency
addCdkDependencypublic addCdkDependency(modules: ...string[]): void
Adds an AWS CDK module dependencies.
modulesRequired
- 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.
xRequired
- Type: any
Any object.
isProject
import { awscdk } from 'projen'
awscdk.AwsCdkJavaApp.isProject(x: any)
Test whether the given construct is a project.
xRequired
- 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.
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.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. |
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.
compileRequired
public readonly compile: MavenCompile;
- Type: projen.java.MavenCompile
Compile component.
distdirRequired
public readonly distdir: string;
- Type: string
Maven artifact output directory.
packagingRequired
public readonly packaging: MavenPackaging;
- Type: projen.java.MavenPackaging
Packaging component.
pomRequired
public readonly pom: Pom;
- Type: projen.java.Pom
API for managing pom.xml.
junitOptional
public readonly junit: Junit;
- Type: projen.java.Junit
JUnit component.
projenrcOptional
public readonly projenrc: Projenrc;
- Type: projen.java.Projenrc
Projenrc component.
cdkConfigRequired
public readonly cdkConfig: CdkConfig;
- Type: CdkConfig
The cdk.json file.
cdkDepsRequired
public readonly cdkDeps: AwsCdkDeps;
- Type: AwsCdkDeps
CDK dependency management helper class.
cdkTasksRequired
public readonly cdkTasks: CdkTasks;
- Type: CdkTasks
CDK tasks.
mainClassRequired
public readonly mainClass: string;
- Type: string
The full name of the main class of the java app (package.Class).
mainClassNameRequired
public readonly mainClassName: string;
- Type: string
The name of the Java class with the static main() method.
mainPackageRequired
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_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.
AwsCdkPythonApp
AWS CDK app in Python.
Initializers
import { awscdk } from 'projen'
new awscdk.AwsCdkPythonApp(options: AwsCdkPythonAppOptions)
| Name | Type | Description |
|---|---|---|
| | No description. |
optionsRequired
- 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.
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 { 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.
xRequired
- Type: any
Any object.
isProject
import { awscdk } from 'projen'
awscdk.AwsCdkPythonApp.isProject(x: any)
Test whether the given construct is a project.
xRequired
- 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.
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 | 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. |
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
The directory in which the python sample tests reside.
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 CDK app entrypoint.
cdkConfigRequired
public readonly cdkConfig: CdkConfig;
- Type: CdkConfig
cdk.json configuration.
cdkDepsRequired
public readonly cdkDeps: AwsCdkDeps;
- Type: AwsCdkDeps
cdkTasksRequired
public readonly cdkTasks: CdkTasks;
- Type: CdkTasks
Common CDK tasks.
cdkVersionRequired
public readonly cdkVersion: string;
- Type: string
The CDK version this app is using.
testdirRequired
testdir- Deprecated: Use
sampleTestdirinstead.
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_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.
AwsCdkTypeScriptApp
AWS CDK app in TypeScript.
Initializers
import { awscdk } from 'projen'
new awscdk.AwsCdkTypeScriptApp(options: AwsCdkTypeScriptAppOptions)
| 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. |
| 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.
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.
addCdkDependency
public addCdkDependency(modules: ...string[]): void
Adds an AWS CDK module dependencies.
modulesRequired
- Type: ...string[]
The list of modules to depend on.
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.AwsCdkTypeScriptApp.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 { awscdk } from 'projen'
awscdk.AwsCdkTypeScriptApp.isProject(x: any)
Test whether the given construct is a project.
xRequired
- Type: any
of
import { awscdk } from 'projen'
awscdk.AwsCdkTypeScriptApp.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 CDK app entrypoint. |
| | cdk.json configuration. |
| | No description. |
| | Common CDK tasks. |
| string | The CDK 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
appEntrypointRequired
public readonly appEntrypoint: string;
- Type: string
The CDK app entrypoint.
cdkConfigRequired
public readonly cdkConfig: CdkConfig;
- Type: CdkConfig
cdk.json configuration.
cdkDepsRequired
public readonly cdkDeps: AwsCdkDeps;
- Type: AwsCdkDeps
cdkTasksRequired
public readonly cdkTasks: CdkTasks;
- Type: CdkTasks
Common CDK tasks.
cdkVersionRequired
public readonly cdkVersion: string;
- Type: string
The CDK 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
CdkConfig
Represents cdk.json file.
Initializers
import { awscdk } from 'projen'
new awscdk.CdkConfig(project: Project, options: CdkConfigOptions)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
optionsRequired
- Type: CdkConfigOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Add excludes to cdk.json. |
| Add includes to cdk.json. |
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.
addExcludes
public addExcludes(patterns: ...string[]): void
Add excludes to cdk.json.
patternsRequired
- Type: ...string[]
The excludes to add.
addIncludes
public addIncludes(patterns: ...string[]): void
Add includes to cdk.json.
patternsRequired
- Type: ...string[]
The includes to add.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { awscdk } from 'projen'
awscdk.CdkConfig.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 { awscdk } from 'projen'
awscdk.CdkConfig.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 | Name of the cdk.out directory. |
| {[ key: string ]: any} | The context to write to cdk.json. |
| string[] | List of glob patterns to be excluded by CDK. |
| string[] | List of glob patterns to be included by CDK. |
| projen.JsonFile | Represents the JSON file. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
cdkoutRequired
public readonly cdkout: string;
- Type: string
Name of the cdk.out directory.
contextRequired
public readonly context: {[ key: string ]: any};
- Type: {[ key: string ]: any}
The context to write to cdk.json.
excludeRequired
public readonly exclude: string[];
- Type: string[]
List of glob patterns to be excluded by CDK.
includeRequired
public readonly include: string[];
- Type: string[]
List of glob patterns to be included by CDK.
jsonRequired
public readonly json: JsonFile;
- Type: projen.JsonFile
Represents the JSON file.
CdkTasks
Adds standard AWS CDK tasks to your project.
Initializers
import { awscdk } from 'projen'
new awscdk.CdkTasks(project: Project)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
projectRequired
- Type: projen.Project
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.CdkTasks.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 { awscdk } from 'projen'
awscdk.CdkTasks.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 | Deploys your app. |
| projen.Task | Destroys all the stacks. |
| projen.Task | Diff against production. |
| projen.Task | Synthesizes your app. |
| projen.Task | Synthesizes your app and suppresses stdout. |
| projen.Task | Watch task. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
deployRequired
public readonly deploy: Task;
- Type: projen.Task
Deploys your app.
destroyRequired
public readonly destroy: Task;
- Type: projen.Task
Destroys all the stacks.
diffRequired
public readonly diff: Task;
- Type: projen.Task
Diff against production.
synthRequired
public readonly synth: Task;
- Type: projen.Task
Synthesizes your app.
synthSilentRequired
public readonly synthSilent: Task;
- Type: projen.Task
Synthesizes your app and suppresses stdout.
watchRequired
public readonly watch: Task;
- Type: projen.Task
Watch task.
ConstructLibraryAws
Initializers
import { awscdk } from 'projen'
new awscdk.ConstructLibraryAws(options: AwsCdkConstructLibraryOptions)
| 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. |
| Adds dependencies to AWS CDK modules. |
| Adds AWS CDK modules as dev dependencies. |
toString
toStringpublic toString(): string
Returns a string representation of this construct.
addExcludeFromCleanup
addExcludeFromCleanuppublic 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
addGitIgnorepublic addGitIgnore(pattern: string): void
Adds a .gitignore pattern.
patternRequired
- Type: string
The glob pattern to ignore.
addPackageIgnore
addPackageIgnorepublic addPackageIgnore(pattern: string): void
Adds patterns to be ignored by npm.
patternRequired
- Type: string
The pattern to ignore.
addTask
addTaskpublic 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
annotateGeneratedpublic 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
postSynthesizepublic postSynthesize(): void
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
preSynthesizepublic preSynthesize(): void
Called before all components are synthesized.
removeTask
removeTaskpublic removeTask(name: string): Task
Removes a task from a project.
nameRequired
- Type: string
The name of the task to remove.
runTaskCommand
runTaskCommandpublic 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
synthpublic 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
tryFindFilepublic 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
tryFindObjectFilepublic tryFindObjectFile(filePath: string): ObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePathRequired
- Type: string
The file path.
tryRemoveFile
tryRemoveFilepublic 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
addBinspublic addBins(bins: {[ key: string ]: string}): void
binsRequired
- Type: {[ key: string ]: string}
addBundledDeps
addBundledDepspublic 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
addDepspublic 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
addDevDepspublic 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
addFieldspublic addFields(fields: {[ key: string ]: any}): void
Directly set fields in package.json.
fieldsRequired
- Type: {[ key: string ]: any}
The fields to set.
addKeywords
addKeywordspublic addKeywords(keywords: ...string[]): void
Adds keywords to package.json (deduplicated).
keywordsRequired
- Type: ...string[]
The keywords to add.
addPeerDeps
addPeerDepspublic 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
addScriptspublic 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
removeScriptpublic removeScript(name: string): void
Removes the npm script (always successful).
nameRequired
- Type: string
The name of the script.
renderWorkflowSetup
renderWorkflowSetuppublic 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
setScriptpublic 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.
addCdkDependencies
addCdkDependenciespublic addCdkDependencies(deps: ...string[]): void
Adds dependencies to AWS CDK modules.
Since this is a library project, dependencies will be added as peer dependencies.
depsRequired
- Type: ...string[]
names of cdk modules (e.g. @aws-cdk/aws-lambda).
addCdkTestDependencies
addCdkTestDependenciespublic addCdkTestDependencies(deps: ...string[]): void
Adds AWS CDK modules as dev dependencies.
depsRequired
- 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
isConstructimport { awscdk } from 'projen'
awscdk.ConstructLibraryAws.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
isProjectimport { awscdk } from 'projen'
awscdk.ConstructLibraryAws.isProject(x: any)
Test whether the given construct is a project.
xRequired
- Type: any
of
ofimport { awscdk } from 'projen'
awscdk.ConstructLibraryAws.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. |
| | No description. |
| string | The target CDK version for this library. |
| string | No description. |
nodeRequired
node- Deprecated: use
AwsCdkConstructLibrary
public readonly node: Node;
- Type: constructs.Node
The tree node.
buildTaskRequired
buildTask- Deprecated: use
AwsCdkConstructLibrary
public readonly buildTask: Task;
- Type: projen.Task
commitGeneratedRequired
commitGenerated- Deprecated: use
AwsCdkConstructLibrary
public readonly commitGenerated: boolean;
- Type: boolean
Whether to commit the managed files by default.
compileTaskRequired
compileTask- Deprecated: use
AwsCdkConstructLibrary
public readonly compileTask: Task;
- Type: projen.Task
componentsRequired
components- Deprecated: use
AwsCdkConstructLibrary
public readonly components: Component[];
- Type: projen.Component[]
Returns all the components within this project.
depsRequired
deps- Deprecated: use
AwsCdkConstructLibrary
public readonly deps: Dependencies;
- Type: projen.Dependencies
Project dependencies.
ejectedRequired
ejected- Deprecated: use
AwsCdkConstructLibrary
public readonly ejected: boolean;
- Type: boolean
Whether or not the project is being ejected.
filesRequired
files- Deprecated: use
AwsCdkConstructLibrary
public readonly files: FileBase[];
- Type: projen.FileBase[]
All files in this project.
gitattributesRequired
gitattributes- Deprecated: use
AwsCdkConstructLibrary
public readonly gitattributes: GitAttributesFile;
- Type: projen.GitAttributesFile
The .gitattributes file for this repository.
gitignoreRequired
gitignore- Deprecated: use
AwsCdkConstructLibrary
public readonly gitignore: IgnoreFile;
- Type: projen.IgnoreFile
.gitignore.
loggerRequired
logger- Deprecated: use
AwsCdkConstructLibrary
public readonly logger: Logger;
- Type: projen.Logger
Logging utilities.
nameRequired
name- Deprecated: use
AwsCdkConstructLibrary
public readonly name: string;
- Type: string
Project name.
outdirRequired
outdir- Deprecated: use
AwsCdkConstructLibrary
public readonly outdir: string;
- Type: string
Absolute output directory of this project.
packageTaskRequired
packageTask- Deprecated: use
AwsCdkConstructLibrary
public readonly packageTask: Task;
- Type: projen.Task
postCompileTaskRequired
postCompileTask- Deprecated: use
AwsCdkConstructLibrary
public readonly postCompileTask: Task;
- Type: projen.Task
preCompileTaskRequired
preCompileTask- Deprecated: use
AwsCdkConstructLibrary
public readonly preCompileTask: Task;
- Type: projen.Task
projectBuildRequired
projectBuild- Deprecated: use
AwsCdkConstructLibrary
public readonly projectBuild: ProjectBuild;
- Type: projen.ProjectBuild
Manages the build process of the project.
projenCommandRequired
projenCommand- Deprecated: use
AwsCdkConstructLibrary
public readonly projenCommand: string;
- Type: string
The command to use in order to run the projen CLI.
rootRequired
root- Deprecated: use
AwsCdkConstructLibrary
public readonly root: Project;
- Type: projen.Project
The root project.
subprojectsRequired
subprojects- Deprecated: use
AwsCdkConstructLibrary
public readonly subprojects: Project[];
- Type: projen.Project[]
Returns all the subprojects within this project.
tasksRequired
tasks- Deprecated: use
AwsCdkConstructLibrary
public readonly tasks: Tasks;
- Type: projen.Tasks
Project tasks.
testTaskRequired
testTask- Deprecated: use
AwsCdkConstructLibrary
public readonly testTask: Task;
- Type: projen.Task
defaultTaskOptional
defaultTask- Deprecated: use
AwsCdkConstructLibrary
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
initProject- Deprecated: use
AwsCdkConstructLibrary
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
parent- Deprecated: use
AwsCdkConstructLibrary
public readonly parent: Project;
- Type: projen.Project
A parent project.
If undefined, this is the root project.
projectTypeRequired
projectType- Deprecated: use
AwsCdkConstructLibrary
public readonly projectType: ProjectType;
- Type: projen.ProjectType
autoApproveOptional
autoApprove- Deprecated: use
AwsCdkConstructLibrary
public readonly autoApprove: AutoApprove;
- Type: projen.github.AutoApprove
Auto approve set up for this project.
devContainerOptional
devContainer- Deprecated: use
AwsCdkConstructLibrary
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
github