Auto approve pull requests that meet a criteria.
import { github } from 'projen'
new github.AutoApprove(github: GitHub, options?: AutoApproveOptions)
Name | Type | Description |
---|---|---|
github |
projen.github.GitHub |
No description. |
options |
projen.github.AutoApproveOptions |
No description. |
github
Required options
Optional Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
postSynthesize |
Called after synthesis. |
preSynthesize |
Called before synthesis. |
synthesize |
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.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isComponent |
Test whether the given construct is a component. |
isConstruct
import { github } from 'projen'
github.AutoApprove.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isComponent
import { github } from 'projen'
github.AutoApprove.isComponent(x: any)
Test whether the given construct is a component.
x
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
project |
Project |
No description. |
label |
string |
No description. |
node
Required public readonly node: Node;
The tree node.
project
Required public readonly project: Project;
label
Required public readonly label: string;
Discovers and creates integration tests and lambdas from code in the project’s source and test trees.
import { awscdk } from 'projen'
new awscdk.AutoDiscover(project: Project, options: AutoDiscoverOptions)
Name | Type | Description |
---|---|---|
project |
Project |
No description. |
options |
projen.awscdk.AutoDiscoverOptions |
No description. |
project
Required options
Required Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
postSynthesize |
Called after synthesis. |
preSynthesize |
Called before synthesis. |
synthesize |
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.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isComponent |
Test whether the given construct is a component. |
isConstruct
import { awscdk } from 'projen'
awscdk.AutoDiscover.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isComponent
import { awscdk } from 'projen'
awscdk.AutoDiscover.isComponent(x: any)
Test whether the given construct is a component.
x
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
project |
Project |
No description. |
node
Required public readonly node: Node;
The tree node.
project
Required public readonly project: Project;
Automatically discovers and creates IntegrationTest
s from entry points found in the test tree.
import { cdk8s } from 'projen'
new cdk8s.AutoDiscover(project: Project, options: AutoDiscoverOptions)
Name | Type | Description |
---|---|---|
project |
Project |
No description. |
options |
projen.cdk8s.AutoDiscoverOptions |
No description. |
project
Required options
Required Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
postSynthesize |
Called after synthesis. |
preSynthesize |
Called before synthesis. |
synthesize |
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.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isComponent |
Test whether the given construct is a component. |
isConstruct
import { cdk8s } from 'projen'
cdk8s.AutoDiscover.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isComponent
import { cdk8s } from 'projen'
cdk8s.AutoDiscover.isComponent(x: any)
Test whether the given construct is a component.
x
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
project |
Project |
No description. |
node
Required public readonly node: Node;
The tree node.
project
Required public readonly project: Project;
Base class for auto-discovering and creating project subcomponents.
import { cdk } from 'projen'
new cdk.AutoDiscoverBase(project: Project, options: AutoDiscoverBaseOptions)
Name | Type | Description |
---|---|---|
project |
Project |
No description. |
options |
projen.cdk.AutoDiscoverBaseOptions |
No description. |
project
Required options
Required Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
postSynthesize |
Called after synthesis. |
preSynthesize |
Called before synthesis. |
synthesize |
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.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isComponent |
Test whether the given construct is a component. |
isConstruct
import { cdk } from 'projen'
cdk.AutoDiscoverBase.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isComponent
import { cdk } from 'projen'
cdk.AutoDiscoverBase.isComponent(x: any)
Test whether the given construct is a component.
x
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
project |
Project |
No description. |
entrypoints |
string[] |
Auto-discovered entry points with paths relative to the project directory. |
node
Required public readonly node: Node;
The tree node.
project
Required public readonly project: Project;
entrypoints
Required public readonly entrypoints: string[];
Auto-discovered entry points with paths relative to the project directory.
Sets up mergify to merging approved pull requests.
If buildJob
is specified, the specified GitHub workflow job ID is required
to succeed in order for the PR to be merged.
approvedReviews
specified the number of code review approvals required for
the PR to be merged.
import { github } from 'projen'
new github.AutoMerge(github: GitHub, options?: AutoMergeOptions)
Name | Type | Description |
---|---|---|
github |
projen.github.GitHub |
No description. |
options |
projen.github.AutoMergeOptions |
No description. |
github
Required options
Optional Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
postSynthesize |
Called after synthesis. |
preSynthesize |
Called before synthesis. |
synthesize |
Synthesizes files to the project output directory. |
addConditions |
Adds conditions to the auto merge rule. |
addConditionsLater |
Adds conditions that will be rendered only during synthesis. |
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.
addConditions
public addConditions(conditions: string): void
Adds conditions to the auto merge rule.
conditions
Required The conditions to add (mergify syntax).
addConditionsLater
public addConditionsLater(later: IAddConditionsLater): void
Adds conditions that will be rendered only during synthesis.
later
Required The later.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isComponent |
Test whether the given construct is a component. |
isConstruct
import { github } from 'projen'
github.AutoMerge.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isComponent
import { github } from 'projen'
github.AutoMerge.isComponent(x: any)
Test whether the given construct is a component.
x
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
project |
Project |
No description. |
node
Required public readonly node: Node;
The tree node.
project
Required public readonly project: Project;
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.
import { awscdk } from 'projen'
new awscdk.AwsCdkConstructLibrary(options: AwsCdkConstructLibraryOptions)
Name | Type | Description |
---|---|---|
options |
projen.awscdk.AwsCdkConstructLibraryOptions |
No description. |
options
Required Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
addExcludeFromCleanup |
Exclude the matching files from pre-synth cleanup. |
addGitIgnore |
Adds a .gitignore pattern. |
addPackageIgnore |
Exclude these files from the bundled package. |
addTask |
Adds a new task to this project. |
addTip |
Prints a “tip” message during synthesis. |
annotateGenerated |
Marks the provided file(s) as being generated. |
postSynthesize |
Called after all components are synthesized. |
preSynthesize |
Called before all components are synthesized. |
removeTask |
Removes a task from a project. |
runTaskCommand |
Returns the shell command to execute in order to run a task. |
synth |
Synthesize all project files into outdir . |
tryFindFile |
Finds a file at the specified relative path within this project and all its subprojects. |
tryFindJsonFile |
Finds a json file by name. |
tryFindObjectFile |
Finds an object file (like JsonFile, YamlFile, etc.) by name. |
tryRemoveFile |
Finds a file at the specified relative path within this project and removes it. |
addBins |
No description. |
addBundledDeps |
Defines bundled dependencies. |
addCompileCommand |
DEPRECATED. |
addDeps |
Defines normal dependencies. |
addDevDeps |
Defines development/test dependencies. |
addFields |
Directly set fields in package.json . |
addKeywords |
Adds keywords to package.json (deduplicated). |
addPeerDeps |
Defines peer dependencies. |
addScripts |
Replaces the contents of multiple npm package.json scripts. |
addTestCommand |
DEPRECATED. |
hasScript |
Indicates if a script by the name name is defined. |
removeScript |
Removes the npm script (always successful). |
renderWorkflowSetup |
Returns the set of workflow steps which should be executed to bootstrap a workflow. |
setScript |
Replaces the contents of an npm package.json script. |
addCdkDependencies |
Adds dependencies to AWS CDK modules. |
addCdkTestDependencies |
Adds AWS CDK modules as dev dependencies. |
toString
public toString(): string
Returns a string representation of this construct.
addExcludeFromCleanup
public addExcludeFromCleanup(globs: string): void
Exclude the matching files from pre-synth cleanup.
Can be used when, for example, some source files include the projen marker and we don’t want them to be erased during synth.
globs
Required The glob patterns to match.
addGitIgnore
public addGitIgnore(pattern: string): void
Adds a .gitignore pattern.
pattern
Required The glob pattern to ignore.
addPackageIgnore
public addPackageIgnore(pattern: string): void
Exclude these files from the bundled package.
Implemented by project types based on the
packaging mechanism. For example, NodeProject
delegates this to .npmignore
.
pattern
Required addTask
public addTask(name: string, props?: TaskOptions): Task
Adds a new task to this project.
This will fail if the project already has a task with this name.
name
Required The task name to add.
props
Optional Task properties.
addTip
public addTip(message: string): void
Prints a “tip” message during synthesis.
message
Required The message.
annotateGenerated
public annotateGenerated(glob: string): void
Marks the provided file(s) as being generated.
This is achieved using the github-linguist attributes. Generated files do not count against the repository statistics and language breakdown.
https://github.com/github/linguist/blob/master/docs/overrides.md
glob
Required the glob pattern to match (could be a file path).
postSynthesize
public postSynthesize(): void
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before all components are synthesized.
removeTask
public removeTask(name: string): Task
Removes a task from a project.
name
Required The name of the task to remove.
runTaskCommand
public runTaskCommand(task: Task): string
Returns the shell command to execute in order to run a task.
This will
typically be npx projen TASK
.
task
Required The task for which the command is required.
synth
public synth(): void
Synthesize all project files into outdir
.
tryFindFile
public tryFindFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and all its subprojects.
filePath
Required The file path.
If this path is relative, it will be resolved from the root of this project.
tryFindJsonFile
public tryFindJsonFile(filePath: string): JsonFile
Finds a json file by name.
filePath
Required The file path.
tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required The file path.
tryRemoveFile
public tryRemoveFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and removes it.
filePath
Required The file path.
If this path is relative, it will be resolved from the root of this project.
addBins
public addBins(bins: {[ key: string ]: string}): void
bins
Required addBundledDeps
public addBundledDeps(deps: string): void
Defines bundled dependencies.
Bundled dependencies will be added as normal dependencies as well as to the
bundledDependencies
section of your package.json
.
deps
Required 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
public addCompileCommand(commands: string): void
DEPRECATED.
commands
Required addDeps
public addDeps(deps: string): void
Defines normal dependencies.
deps
Required Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn
add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
addDevDeps
public addDevDeps(deps: string): void
Defines development/test dependencies.
deps
Required Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn
add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
addFields
public addFields(fields: {[ key: string ]: any}): void
Directly set fields in package.json
.
fields
Required The fields to set.
addKeywords
public addKeywords(keywords: string): void
Adds keywords to package.json (deduplicated).
keywords
Required The keywords to add.
addPeerDeps
public addPeerDeps(deps: string): void
Defines peer dependencies.
When adding peer dependencies, a devDependency will also be added on the pinned version of the declared peer. This will ensure that you are testing your code against the minimum version required from your consumers.
deps
Required Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn
add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
addScripts
public addScripts(scripts: {[ key: string ]: string}): void
Replaces the contents of multiple npm package.json scripts.
scripts
Required The scripts to set.
addTestCommand
public addTestCommand(commands: string): void
DEPRECATED.
commands
Required hasScript
public hasScript(name: string): boolean
Indicates if a script by the name name is defined.
name
Required The name of the script.
removeScript
public removeScript(name: string): void
Removes the npm script (always successful).
name
Required The name of the script.
renderWorkflowSetup
public renderWorkflowSetup(options?: RenderWorkflowSetupOptions): JobStep[]
Returns the set of workflow steps which should be executed to bootstrap a workflow.
options
Optional Options.
setScript
public setScript(name: string, command: string): void
Replaces the contents of an npm package.json script.
name
Required The script name.
command
Required The command to execute.
addCdkDependencies
public addCdkDependencies(deps: string): void
Adds dependencies to AWS CDK modules.
Since this is a library project, dependencies will be added as peer dependencies.
deps
Required names of cdk modules (e.g. @aws-cdk/aws-lambda
).
addCdkTestDependencies
public addCdkTestDependencies(deps: string): void
Adds AWS CDK modules as dev dependencies.
deps
Required names of cdk modules (e.g. @aws-cdk/aws-lambda
).
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isProject |
Test whether the given construct is a project. |
of |
Find the closest ancestor project for given construct. |
isConstruct
import { awscdk } from 'projen'
awscdk.AwsCdkConstructLibrary.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isProject
import { awscdk } from 'projen'
awscdk.AwsCdkConstructLibrary.isProject(x: any)
Test whether the given construct is a project.
x
Required of
import { awscdk } from 'projen'
awscdk.AwsCdkConstructLibrary.of(construct: IConstruct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
construct
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
buildTask |
Task |
No description. |
commitGenerated |
boolean |
Whether to commit the managed files by default. |
compileTask |
Task |
No description. |
components |
Component[] |
Returns all the components within this project. |
deps |
Dependencies |
Project dependencies. |
ejected |
boolean |
Whether or not the project is being ejected. |
files |
FileBase[] |
All files in this project. |
gitattributes |
GitAttributesFile |
The .gitattributes file for this repository. |
gitignore |
IgnoreFile |
.gitignore. |
logger |
Logger |
Logging utilities. |
name |
string |
Project name. |
outdir |
string |
Absolute output directory of this project. |
packageTask |
Task |
No description. |
postCompileTask |
Task |
No description. |
preCompileTask |
Task |
No description. |
projectBuild |
ProjectBuild |
Manages the build process of the project. |
projenCommand |
string |
The command to use in order to run the projen CLI. |
root |
Project |
The root project. |
subprojects |
Project[] |
Returns all the subprojects within this project. |
tasks |
Tasks |
Project tasks. |
testTask |
Task |
No description. |
defaultTask |
Task |
This is the “default” task, the one that executes “projen”. |
initProject |
InitProject |
The options used when this project is bootstrapped via projen new . |
parent |
Project |
A parent project. |
projectType |
ProjectType |
No description. |
autoApprove |
projen.github.AutoApprove |
Auto approve set up for this project. |
devContainer |
projen.vscode.DevContainer |
Access for .devcontainer.json (used for GitHub Codespaces). |
github |
projen.github.GitHub |
Access all github components. |
gitpod |
Gitpod |
Access for Gitpod. |
vscode |
projen.vscode.VsCode |
Access all VSCode components. |
allowLibraryDependencies |
boolean |
No description. |
artifactsDirectory |
string |
The build output directory. |
artifactsJavascriptDirectory |
string |
The location of the npm tarball after build (${artifactsDirectory}/js ). |
bundler |
projen.javascript.Bundler |
No description. |
entrypoint |
string |
No description. |
manifest |
any |
No description. |
npmrc |
projen.javascript.NpmConfig |
The .npmrc file. |
package |
projen.javascript.NodePackage |
API for managing the node package. |
packageManager |
projen.javascript.NodePackageManager |
The package manager to use. |
runScriptCommand |
string |
The command to use to run scripts (e.g. yarn run or npm run depends on the package manager). |
autoMerge |
projen.github.AutoMerge |
Component that sets up mergify for merging approved pull requests. |
buildWorkflow |
projen.build.BuildWorkflow |
The PR build GitHub workflow. |
buildWorkflowJobId |
string |
The job ID of the build workflow. |
jest |
projen.javascript.Jest |
The Jest configuration (if enabled). |
maxNodeVersion |
string |
Maximum node version required by this package. |
minNodeVersion |
string |
Minimum node.js version required by this package. |
npmignore |
IgnoreFile |
The .npmignore file. |
prettier |
projen.javascript.Prettier |
No description. |
publisher |
projen.release.Publisher |
Package publisher. |
release |
projen.release.Release |
Release management. |
upgradeWorkflow |
projen.javascript.UpgradeDependencies |
The upgrade workflow. |
docsDirectory |
string |
No description. |
libdir |
string |
The directory in which compiled .js files reside. |
srcdir |
string |
The directory in which the .ts sources reside. |
testdir |
string |
The directory in which tests reside. |
tsconfigDev |
projen.javascript.TypescriptConfig |
A typescript configuration file which covers all files (sources, tests, projen). |
watchTask |
Task |
The “watch” task. |
docgen |
boolean |
No description. |
eslint |
projen.javascript.Eslint |
No description. |
tsconfig |
projen.javascript.TypescriptConfig |
No description. |
tsconfigEslint |
projen.javascript.TypescriptConfig |
No description. |
cdkDeps |
projen.awscdk.AwsCdkDeps |
No description. |
cdkVersion |
string |
The target CDK version for this library. |
version |
string |
No description. |
node
Required public readonly node: Node;
The tree node.
buildTask
Required public readonly buildTask: Task;
commitGenerated
Required public readonly commitGenerated: boolean;
Whether to commit the managed files by default.
compileTask
Required public readonly compileTask: Task;
components
Required public readonly components: Component[];
Returns all the components within this project.
deps
Required public readonly deps: Dependencies;
Project dependencies.
ejected
Required public readonly ejected: boolean;
Whether or not the project is being ejected.
files
Required public readonly files: FileBase[];
All files in this project.
gitattributes
Required public readonly gitattributes: GitAttributesFile;
The .gitattributes file for this repository.
gitignore
Required public readonly gitignore: IgnoreFile;
.gitignore.
logger
Required public readonly logger: Logger;
Logging utilities.
name
Required public readonly name: string;
Project name.
outdir
Required public readonly outdir: string;
Absolute output directory of this project.
packageTask
Required public readonly packageTask: Task;
postCompileTask
Required public readonly postCompileTask: Task;
preCompileTask
Required public readonly preCompileTask: Task;
projectBuild
Required public readonly projectBuild: ProjectBuild;
Manages the build process of the project.
projenCommand
Required public readonly projenCommand: string;
The command to use in order to run the projen CLI.
root
Required public readonly root: Project;
The root project.
subprojects
Required public readonly subprojects: Project[];
Returns all the subprojects within this project.
tasks
Required public readonly tasks: Tasks;
Project tasks.
testTask
Required public readonly testTask: Task;
defaultTask
Optional public readonly defaultTask: Task;
This is the “default” task, the one that executes “projen”.
Undefined if the project is being ejected.
initProject
Optional public readonly initProject: InitProject;
The options used when this project is bootstrapped via projen new
.
It includes the original set of options passed to the CLI and also the JSII FQN of the project type.
parent
Optional public readonly parent: Project;
A parent project.
If undefined, this is the root project.
projectType
Required public readonly projectType: ProjectType;
autoApprove
Optional public readonly autoApprove: AutoApprove;
Auto approve set up for this project.
devContainer
Optional public readonly devContainer: DevContainer;
Access for .devcontainer.json (used for GitHub Codespaces).
This will be undefined
if devContainer boolean is false
github
Optional public readonly github: GitHub;
Access all github components.
This will be undefined
for subprojects.
gitpod
Optional public readonly gitpod: Gitpod;
Access for Gitpod.
This will be undefined
if gitpod boolean is false
vscode
Optional public readonly vscode: VsCode;
Access all VSCode components.
This will be undefined
for subprojects.
allowLibraryDependencies
package.allowLibraryDependencies
public readonly allowLibraryDependencies: boolean;
artifactsDirectory
Required public readonly artifactsDirectory: string;
The build output directory.
An npm tarball will be created under the js
subdirectory. For example, if this is set to dist
(the default), the npm
tarball will be placed under dist/js/boom-boom-1.2.3.tg
.
artifactsJavascriptDirectory
Required public readonly artifactsJavascriptDirectory: string;
The location of the npm tarball after build (${artifactsDirectory}/js
).
bundler
Required public readonly bundler: Bundler;
entrypoint
package.entrypoint
public readonly entrypoint: string;
manifest
package.addField(x, y)
public readonly manifest: any;
npmrc
Required public readonly npmrc: NpmConfig;
The .npmrc file.
package
Required public readonly package: NodePackage;
API for managing the node package.
packageManager
package.packageManager
public readonly packageManager: NodePackageManager;
The package manager to use.
runScriptCommand
Required public readonly runScriptCommand: string;
The command to use to run scripts (e.g. yarn run
or npm run
depends on the package manager).
autoMerge
Optional public readonly autoMerge: AutoMerge;
Component that sets up mergify for merging approved pull requests.
buildWorkflow
Optional public readonly buildWorkflow: BuildWorkflow;
The PR build GitHub workflow.
undefined
if buildWorkflow
is disabled.
buildWorkflowJobId
Optional public readonly buildWorkflowJobId: string;
The job ID of the build workflow.
jest
Optional public readonly jest: Jest;
The Jest configuration (if enabled).
maxNodeVersion
Optional public readonly maxNodeVersion: string;
Maximum node version required by this package.
minNodeVersion
Optional public readonly minNodeVersion: string;
Minimum node.js version required by this package.
npmignore
Optional public readonly npmignore: IgnoreFile;
The .npmignore file.
prettier
Optional public readonly prettier: Prettier;
publisher
release.publisher
.public readonly publisher: Publisher;
Package publisher.
This will be undefined
if the project does not have a
release workflow.
release
Optional public readonly release: Release;
Release management.
upgradeWorkflow
Optional public readonly upgradeWorkflow: UpgradeDependencies;
The upgrade workflow.
docsDirectory
Required public readonly docsDirectory: string;
libdir
Required public readonly libdir: string;
The directory in which compiled .js files reside.
srcdir
Required public readonly srcdir: string;
The directory in which the .ts sources reside.
testdir
Required public readonly testdir: string;
The directory in which tests reside.
tsconfigDev
Required public readonly tsconfigDev: TypescriptConfig;
A typescript configuration file which covers all files (sources, tests, projen).
watchTask
Required public readonly watchTask: Task;
The “watch” task.
docgen
Optional public readonly docgen: boolean;
eslint
Optional public readonly eslint: Eslint;
tsconfig
Optional public readonly tsconfig: TypescriptConfig;
tsconfigEslint
Optional public readonly tsconfigEslint: TypescriptConfig;
cdkDeps
Required public readonly cdkDeps: AwsCdkDeps;
cdkVersion
Required public readonly cdkVersion: string;
The target CDK version for this library.
version
cdkVersion
public readonly version: string;
Name | Type | Description |
---|---|---|
DEFAULT_TASK |
string |
The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASK
Required public readonly DEFAULT_TASK: string;
The name of the default task (the task executed when projen
is run without arguments).
Normally this task should synthesize the project files.
Manages dependencies on the AWS CDK.
import { awscdk } from 'projen'
new awscdk.AwsCdkDeps(project: Project, options: AwsCdkDepsOptions)
Name | Type | Description |
---|---|---|
project |
Project |
No description. |
options |
projen.awscdk.AwsCdkDepsOptions |
No description. |
project
Required options
Required Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
postSynthesize |
Called after synthesis. |
preSynthesize |
Called before synthesis. |
synthesize |
Synthesizes files to the project output directory. |
addV1Dependencies |
Adds dependencies to AWS CDK modules. |
addV1DevDependencies |
Adds AWS CDK modules as dev dependencies. |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
addV1Dependencies
public addV1Dependencies(deps: string): void
Adds dependencies to AWS CDK modules.
The type of dependency is determined by the dependencyType
option.
This method is not supported in CDK v2. Use project.addPeerDeps()
or
project.addDeps()
as appropriate.
deps
Required names of cdk modules (e.g. @aws-cdk/aws-lambda
).
addV1DevDependencies
public addV1DevDependencies(deps: string): void
Adds AWS CDK modules as dev dependencies.
This method is not supported in CDK v2. Use project.addPeerDeps()
or
project.addDeps()
as appropriate.
deps
Required fully qualified names of cdk modules (e.g. @aws-cdk/aws-lambda
).
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isComponent |
Test whether the given construct is a component. |
isConstruct
import { awscdk } from 'projen'
awscdk.AwsCdkDeps.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isComponent
import { awscdk } from 'projen'
awscdk.AwsCdkDeps.isComponent(x: any)
Test whether the given construct is a component.
x
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
project |
Project |
No description. |
cdkDependenciesAsDeps |
boolean |
Whether CDK dependencies are added as normal dependencies (and peer dependencies). |
cdkMajorVersion |
number |
The major version of the AWS CDK (e.g. 1, 2, …). |
cdkMinimumVersion |
string |
The minimum version of the AWS CDK (e.g. 2.0.0 ). |
cdkVersion |
string |
The dependency requirement for AWS CDK (e.g. ^2.0.0 ). |
node
Required public readonly node: Node;
The tree node.
project
Required public readonly project: Project;
cdkDependenciesAsDeps
public readonly cdkDependenciesAsDeps: boolean;
Whether CDK dependencies are added as normal dependencies (and peer dependencies).
cdkMajorVersion
Required public readonly cdkMajorVersion: number;
The major version of the AWS CDK (e.g. 1, 2, …).
cdkMinimumVersion
Required public readonly cdkMinimumVersion: string;
The minimum version of the AWS CDK (e.g. 2.0.0
).
cdkVersion
Required public readonly cdkVersion: string;
The dependency requirement for AWS CDK (e.g. ^2.0.0
).
Manages dependencies on the AWS CDK for Java projects.
import { awscdk } from 'projen'
new awscdk.AwsCdkDepsJava(project: Project, options: AwsCdkDepsOptions)
Name | Type | Description |
---|---|---|
project |
Project |
No description. |
options |
projen.awscdk.AwsCdkDepsOptions |
No description. |
project
Required options
Required Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
postSynthesize |
Called after synthesis. |
preSynthesize |
Called before synthesis. |
synthesize |
Synthesizes files to the project output directory. |
addV1Dependencies |
Adds dependencies to AWS CDK modules. |
addV1DevDependencies |
Adds AWS CDK modules as dev dependencies. |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
addV1Dependencies
public addV1Dependencies(deps: string): void
Adds dependencies to AWS CDK modules.
The type of dependency is determined by the dependencyType
option.
This method is not supported in CDK v2. Use project.addPeerDeps()
or
project.addDeps()
as appropriate.
deps
Required names of cdk modules (e.g. @aws-cdk/aws-lambda
).
addV1DevDependencies
public addV1DevDependencies(deps: string): void
Adds AWS CDK modules as dev dependencies.
This method is not supported in CDK v2. Use project.addPeerDeps()
or
project.addDeps()
as appropriate.
deps
Required fully qualified names of cdk modules (e.g. @aws-cdk/aws-lambda
).
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isComponent |
Test whether the given construct is a component. |
isConstruct
import { awscdk } from 'projen'
awscdk.AwsCdkDepsJava.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isComponent
import { awscdk } from 'projen'
awscdk.AwsCdkDepsJava.isComponent(x: any)
Test whether the given construct is a component.
x
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
project |
Project |
No description. |
cdkDependenciesAsDeps |
boolean |
Whether CDK dependencies are added as normal dependencies (and peer dependencies). |
cdkMajorVersion |
number |
The major version of the AWS CDK (e.g. 1, 2, …). |
cdkMinimumVersion |
string |
The minimum version of the AWS CDK (e.g. 2.0.0 ). |
cdkVersion |
string |
The dependency requirement for AWS CDK (e.g. ^2.0.0 ). |
node
Required public readonly node: Node;
The tree node.
project
Required public readonly project: Project;
cdkDependenciesAsDeps
public readonly cdkDependenciesAsDeps: boolean;
Whether CDK dependencies are added as normal dependencies (and peer dependencies).
cdkMajorVersion
Required public readonly cdkMajorVersion: number;
The major version of the AWS CDK (e.g. 1, 2, …).
cdkMinimumVersion
Required public readonly cdkMinimumVersion: string;
The minimum version of the AWS CDK (e.g. 2.0.0
).
cdkVersion
Required public readonly cdkVersion: string;
The dependency requirement for AWS CDK (e.g. ^2.0.0
).
Manages dependencies on the AWS CDK for Node.js projects.
import { awscdk } from 'projen'
new awscdk.AwsCdkDepsJs(project: Project, options: AwsCdkDepsOptions)
Name | Type | Description |
---|---|---|
project |
Project |
No description. |
options |
projen.awscdk.AwsCdkDepsOptions |
No description. |
project
Required options
Required Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
postSynthesize |
Called after synthesis. |
preSynthesize |
Called before synthesis. |
synthesize |
Synthesizes files to the project output directory. |
addV1Dependencies |
Adds dependencies to AWS CDK modules. |
addV1DevDependencies |
Adds AWS CDK modules as dev dependencies. |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
addV1Dependencies
public addV1Dependencies(deps: string): void
Adds dependencies to AWS CDK modules.
The type of dependency is determined by the dependencyType
option.
This method is not supported in CDK v2. Use project.addPeerDeps()
or
project.addDeps()
as appropriate.
deps
Required names of cdk modules (e.g. @aws-cdk/aws-lambda
).
addV1DevDependencies
public addV1DevDependencies(deps: string): void
Adds AWS CDK modules as dev dependencies.
This method is not supported in CDK v2. Use project.addPeerDeps()
or
project.addDeps()
as appropriate.
deps
Required fully qualified names of cdk modules (e.g. @aws-cdk/aws-lambda
).
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isComponent |
Test whether the given construct is a component. |
isConstruct
import { awscdk } from 'projen'
awscdk.AwsCdkDepsJs.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isComponent
import { awscdk } from 'projen'
awscdk.AwsCdkDepsJs.isComponent(x: any)
Test whether the given construct is a component.
x
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
project |
Project |
No description. |
cdkDependenciesAsDeps |
boolean |
Whether CDK dependencies are added as normal dependencies (and peer dependencies). |
cdkMajorVersion |
number |
The major version of the AWS CDK (e.g. 1, 2, …). |
cdkMinimumVersion |
string |
The minimum version of the AWS CDK (e.g. 2.0.0 ). |
cdkVersion |
string |
The dependency requirement for AWS CDK (e.g. ^2.0.0 ). |
node
Required public readonly node: Node;
The tree node.
project
Required public readonly project: Project;
cdkDependenciesAsDeps
public readonly cdkDependenciesAsDeps: boolean;
Whether CDK dependencies are added as normal dependencies (and peer dependencies).
cdkMajorVersion
Required public readonly cdkMajorVersion: number;
The major version of the AWS CDK (e.g. 1, 2, …).
cdkMinimumVersion
Required public readonly cdkMinimumVersion: string;
The minimum version of the AWS CDK (e.g. 2.0.0
).
cdkVersion
Required public readonly cdkVersion: string;
The dependency requirement for AWS CDK (e.g. ^2.0.0
).
Manages dependencies on the AWS CDK for Python projects.
import { awscdk } from 'projen'
new awscdk.AwsCdkDepsPy(project: Project, options: AwsCdkDepsOptions)
Name | Type | Description |
---|---|---|
project |
Project |
No description. |
options |
projen.awscdk.AwsCdkDepsOptions |
No description. |
project
Required options
Required Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
postSynthesize |
Called after synthesis. |
preSynthesize |
Called before synthesis. |
synthesize |
Synthesizes files to the project output directory. |
addV1Dependencies |
Adds dependencies to AWS CDK modules. |
addV1DevDependencies |
Adds AWS CDK modules as dev dependencies. |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
addV1Dependencies
public addV1Dependencies(deps: string): void
Adds dependencies to AWS CDK modules.
The type of dependency is determined by the dependencyType
option.
This method is not supported in CDK v2. Use project.addPeerDeps()
or
project.addDeps()
as appropriate.
deps
Required names of cdk modules (e.g. @aws-cdk/aws-lambda
).
addV1DevDependencies
public addV1DevDependencies(deps: string): void
Adds AWS CDK modules as dev dependencies.
This method is not supported in CDK v2. Use project.addPeerDeps()
or
project.addDeps()
as appropriate.
deps
Required fully qualified names of cdk modules (e.g. @aws-cdk/aws-lambda
).
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isComponent |
Test whether the given construct is a component. |
isConstruct
import { awscdk } from 'projen'
awscdk.AwsCdkDepsPy.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isComponent
import { awscdk } from 'projen'
awscdk.AwsCdkDepsPy.isComponent(x: any)
Test whether the given construct is a component.
x
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
project |
Project |
No description. |
cdkDependenciesAsDeps |
boolean |
Whether CDK dependencies are added as normal dependencies (and peer dependencies). |
cdkMajorVersion |
number |
The major version of the AWS CDK (e.g. 1, 2, …). |
cdkMinimumVersion |
string |
The minimum version of the AWS CDK (e.g. 2.0.0 ). |
cdkVersion |
string |
The dependency requirement for AWS CDK (e.g. ^2.0.0 ). |
node
Required public readonly node: Node;
The tree node.
project
Required public readonly project: Project;
cdkDependenciesAsDeps
public readonly cdkDependenciesAsDeps: boolean;
Whether CDK dependencies are added as normal dependencies (and peer dependencies).
cdkMajorVersion
Required public readonly cdkMajorVersion: number;
The major version of the AWS CDK (e.g. 1, 2, …).
cdkMinimumVersion
Required public readonly cdkMinimumVersion: string;
The minimum version of the AWS CDK (e.g. 2.0.0
).
cdkVersion
Required public readonly cdkVersion: string;
The dependency requirement for AWS CDK (e.g. ^2.0.0
).
AWS CDK app in Java.
import { awscdk } from 'projen'
new awscdk.AwsCdkJavaApp(options: AwsCdkJavaAppOptions)
Name | Type | Description |
---|---|---|
options |
projen.awscdk.AwsCdkJavaAppOptions |
No description. |
options
Required Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
addExcludeFromCleanup |
Exclude the matching files from pre-synth cleanup. |
addGitIgnore |
Adds a .gitignore pattern. |
addPackageIgnore |
Exclude these files from the bundled package. |
addTask |
Adds a new task to this project. |
addTip |
Prints a “tip” message during synthesis. |
annotateGenerated |
Marks the provided file(s) as being generated. |
postSynthesize |
Called after all components are synthesized. |
preSynthesize |
Called before all components are synthesized. |
removeTask |
Removes a task from a project. |
runTaskCommand |
Returns the shell command to execute in order to run a task. |
synth |
Synthesize all project files into outdir . |
tryFindFile |
Finds a file at the specified relative path within this project and all its subprojects. |
tryFindJsonFile |
Finds a json file by name. |
tryFindObjectFile |
Finds an object file (like JsonFile, YamlFile, etc.) by name. |
tryRemoveFile |
Finds a file at the specified relative path within this project and removes it. |
addDependency |
Adds a runtime dependency. |
addPlugin |
Adds a build plugin to the pom. |
addTestDependency |
Adds a test dependency. |
addCdkDependency |
Adds an AWS CDK module dependencies. |
toString
public toString(): string
Returns a string representation of this construct.
addExcludeFromCleanup
public addExcludeFromCleanup(globs: string): void
Exclude the matching files from pre-synth cleanup.
Can be used when, for example, some source files include the projen marker and we don’t want them to be erased during synth.
globs
Required The glob patterns to match.
addGitIgnore
public addGitIgnore(pattern: string): void
Adds a .gitignore pattern.
pattern
Required The glob pattern to ignore.
addPackageIgnore
public addPackageIgnore(_pattern: string): void
Exclude these files from the bundled package.
Implemented by project types based on the
packaging mechanism. For example, NodeProject
delegates this to .npmignore
.
_pattern
Required The glob pattern to exclude.
addTask
public addTask(name: string, props?: TaskOptions): Task
Adds a new task to this project.
This will fail if the project already has a task with this name.
name
Required The task name to add.
props
Optional Task properties.
addTip
public addTip(message: string): void
Prints a “tip” message during synthesis.
message
Required The message.
annotateGenerated
public annotateGenerated(glob: string): void
Marks the provided file(s) as being generated.
This is achieved using the github-linguist attributes. Generated files do not count against the repository statistics and language breakdown.
https://github.com/github/linguist/blob/master/docs/overrides.md
glob
Required the glob pattern to match (could be a file path).
postSynthesize
public postSynthesize(): void
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before all components are synthesized.
removeTask
public removeTask(name: string): Task
Removes a task from a project.
name
Required The name of the task to remove.
runTaskCommand
public runTaskCommand(task: Task): string
Returns the shell command to execute in order to run a task.
By default, this is npx projen@<version> <task>
task
Required The task for which the command is required.
synth
public synth(): void
Synthesize all project files into outdir
.
tryFindFile
public tryFindFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and all its subprojects.
filePath
Required The file path.
If this path is relative, it will be resolved from the root of this project.
tryFindJsonFile
public tryFindJsonFile(filePath: string): JsonFile
Finds a json file by name.
filePath
Required The file path.
tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required The file path.
tryRemoveFile
public tryRemoveFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and removes it.
filePath
Required The file path.
If this path is relative, it will be resolved from the root of this project.
addDependency
public addDependency(spec: string): void
Adds a runtime dependency.
spec
Required Format <groupId>/<artifactId>@<semver>
.
addPlugin
public addPlugin(spec: string, options?: PluginOptions): Dependency
Adds a build plugin to the pom.
The plug in is also added as a BUILD dep to the project.
spec
Required dependency spec (group/artifact@version
).
options
Optional plugin options.
addTestDependency
public addTestDependency(spec: string): void
Adds a test dependency.
spec
Required Format <groupId>/<artifactId>@<semver>
.
addCdkDependency
public addCdkDependency(modules: string): void
Adds an AWS CDK module dependencies.
modules
Required The list of modules to depend on (e.g. “software.amazon.awscdk/aws-lambda”, “software.amazon.awscdk/aws-iam”, etc).
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isProject |
Test whether the given construct is a project. |
of |
Find the closest ancestor project for given construct. |
isConstruct
import { awscdk } from 'projen'
awscdk.AwsCdkJavaApp.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isProject
import { awscdk } from 'projen'
awscdk.AwsCdkJavaApp.isProject(x: any)
Test whether the given construct is a project.
x
Required of
import { awscdk } from 'projen'
awscdk.AwsCdkJavaApp.of(construct: IConstruct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
construct
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
buildTask |
Task |
No description. |
commitGenerated |
boolean |
Whether to commit the managed files by default. |
compileTask |
Task |
No description. |
components |
Component[] |
Returns all the components within this project. |
deps |
Dependencies |
Project dependencies. |
ejected |
boolean |
Whether or not the project is being ejected. |
files |
FileBase[] |
All files in this project. |
gitattributes |
GitAttributesFile |
The .gitattributes file for this repository. |
gitignore |
IgnoreFile |
.gitignore. |
logger |
Logger |
Logging utilities. |
name |
string |
Project name. |
outdir |
string |
Absolute output directory of this project. |
packageTask |
Task |
No description. |
postCompileTask |
Task |
No description. |
preCompileTask |
Task |
No description. |
projectBuild |
ProjectBuild |
Manages the build process of the project. |
projenCommand |
string |
The command to use in order to run the projen CLI. |
root |
Project |
The root project. |
subprojects |
Project[] |
Returns all the subprojects within this project. |
tasks |
Tasks |
Project tasks. |
testTask |
Task |
No description. |
defaultTask |
Task |
This is the “default” task, the one that executes “projen”. |
initProject |
InitProject |
The options used when this project is bootstrapped via projen new . |
parent |
Project |
A parent project. |
projectType |
ProjectType |
No description. |
autoApprove |
projen.github.AutoApprove |
Auto approve set up for this project. |
devContainer |
projen.vscode.DevContainer |
Access for .devcontainer.json (used for GitHub Codespaces). |
github |
projen.github.GitHub |
Access all github components. |
gitpod |
Gitpod |
Access for Gitpod. |
vscode |
projen.vscode.VsCode |
Access all VSCode components. |
compile |
projen.java.MavenCompile |
Compile component. |
distdir |
string |
Maven artifact output directory. |
packaging |
projen.java.MavenPackaging |
Packaging component. |
pom |
projen.java.Pom |
API for managing pom.xml . |
junit |
projen.java.Junit |
JUnit component. |
projenrc |
projen.java.Projenrc |
Projenrc component. |
cdkConfig |
projen.awscdk.CdkConfig |
The cdk.json file. |
cdkDeps |
projen.awscdk.AwsCdkDeps |
CDK dependency management helper class. |
cdkTasks |
projen.awscdk.CdkTasks |
CDK tasks. |
mainClass |
string |
The full name of the main class of the java app (package.Class). |
mainClassName |
string |
The name of the Java class with the static main() method. |
mainPackage |
string |
The name of the Java package that includes the main class. |
node
Required public readonly node: Node;
The tree node.
buildTask
Required public readonly buildTask: Task;
commitGenerated
Required public readonly commitGenerated: boolean;
Whether to commit the managed files by default.
compileTask
Required public readonly compileTask: Task;
components
Required public readonly components: Component[];
Returns all the components within this project.
deps
Required public readonly deps: Dependencies;
Project dependencies.
ejected
Required public readonly ejected: boolean;
Whether or not the project is being ejected.
files
Required public readonly files: FileBase[];
All files in this project.
gitattributes
Required public readonly gitattributes: GitAttributesFile;
The .gitattributes file for this repository.
gitignore
Required public readonly gitignore: IgnoreFile;
.gitignore.
logger
Required public readonly logger: Logger;
Logging utilities.
name
Required public readonly name: string;
Project name.
outdir
Required public readonly outdir: string;
Absolute output directory of this project.
packageTask
Required public readonly packageTask: Task;
postCompileTask
Required public readonly postCompileTask: Task;
preCompileTask
Required public readonly preCompileTask: Task;
projectBuild
Required public readonly projectBuild: ProjectBuild;
Manages the build process of the project.
projenCommand
Required public readonly projenCommand: string;
The command to use in order to run the projen CLI.
root
Required public readonly root: Project;
The root project.
subprojects
Required public readonly subprojects: Project[];
Returns all the subprojects within this project.
tasks
Required public readonly tasks: Tasks;
Project tasks.
testTask
Required public readonly testTask: Task;
defaultTask
Optional public readonly defaultTask: Task;
This is the “default” task, the one that executes “projen”.
Undefined if the project is being ejected.
initProject
Optional public readonly initProject: InitProject;
The options used when this project is bootstrapped via projen new
.
It includes the original set of options passed to the CLI and also the JSII FQN of the project type.
parent
Optional public readonly parent: Project;
A parent project.
If undefined, this is the root project.
projectType
Required public readonly projectType: ProjectType;
autoApprove
Optional public readonly autoApprove: AutoApprove;
Auto approve set up for this project.
devContainer
Optional public readonly devContainer: DevContainer;
Access for .devcontainer.json (used for GitHub Codespaces).
This will be undefined
if devContainer boolean is false
github
Optional public readonly github: GitHub;
Access all github components.
This will be undefined
for subprojects.
gitpod
Optional public readonly gitpod: Gitpod;
Access for Gitpod.
This will be undefined
if gitpod boolean is false
vscode
Optional public readonly vscode: VsCode;
Access all VSCode components.
This will be undefined
for subprojects.
compile
Required public readonly compile: MavenCompile;
Compile component.
distdir
Required public readonly distdir: string;
Maven artifact output directory.
packaging
Required public readonly packaging: MavenPackaging;
Packaging component.
pom
Required public readonly pom: Pom;
API for managing pom.xml
.
junit
Optional public readonly junit: Junit;
JUnit component.
projenrc
Optional public readonly projenrc: Projenrc;
Projenrc component.
cdkConfig
Required public readonly cdkConfig: CdkConfig;
The cdk.json
file.
cdkDeps
Required public readonly cdkDeps: AwsCdkDeps;
CDK dependency management helper class.
cdkTasks
Required public readonly cdkTasks: CdkTasks;
CDK tasks.
mainClass
Required public readonly mainClass: string;
The full name of the main class of the java app (package.Class).
mainClassName
Required public readonly mainClassName: string;
The name of the Java class with the static main()
method.
mainPackage
Required public readonly mainPackage: string;
The name of the Java package that includes the main class.
Name | Type | Description |
---|---|---|
DEFAULT_TASK |
string |
The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASK
Required public readonly DEFAULT_TASK: string;
The name of the default task (the task executed when projen
is run without arguments).
Normally this task should synthesize the project files.
AWS CDK app in Python.
import { awscdk } from 'projen'
new awscdk.AwsCdkPythonApp(options: AwsCdkPythonAppOptions)
Name | Type | Description |
---|---|---|
options |
projen.awscdk.AwsCdkPythonAppOptions |
No description. |
options
Required Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
addExcludeFromCleanup |
Exclude the matching files from pre-synth cleanup. |
addGitIgnore |
Adds a .gitignore pattern. |
addPackageIgnore |
Exclude these files from the bundled package. |
addTask |
Adds a new task to this project. |
addTip |
Prints a “tip” message during synthesis. |
annotateGenerated |
Marks the provided file(s) as being generated. |
postSynthesize |
Called after all components are synthesized. |
preSynthesize |
Called before all components are synthesized. |
removeTask |
Removes a task from a project. |
runTaskCommand |
Returns the shell command to execute in order to run a task. |
synth |
Synthesize all project files into outdir . |
tryFindFile |
Finds a file at the specified relative path within this project and all its subprojects. |
tryFindJsonFile |
Finds a json file by name. |
tryFindObjectFile |
Finds an object file (like JsonFile, YamlFile, etc.) by name. |
tryRemoveFile |
Finds a file at the specified relative path within this project and removes it. |
addDependency |
Adds a runtime dependency. |
addDevDependency |
Adds a dev dependency. |
toString
public toString(): string
Returns a string representation of this construct.
addExcludeFromCleanup
public addExcludeFromCleanup(globs: string): void
Exclude the matching files from pre-synth cleanup.
Can be used when, for example, some source files include the projen marker and we don’t want them to be erased during synth.
globs
Required The glob patterns to match.
addGitIgnore
public addGitIgnore(pattern: string): void
Adds a .gitignore pattern.
pattern
Required The glob pattern to ignore.
addPackageIgnore
public addPackageIgnore(_pattern: string): void
Exclude these files from the bundled package.
Implemented by project types based on the
packaging mechanism. For example, NodeProject
delegates this to .npmignore
.
_pattern
Required The glob pattern to exclude.
addTask
public addTask(name: string, props?: TaskOptions): Task
Adds a new task to this project.
This will fail if the project already has a task with this name.
name
Required The task name to add.
props
Optional Task properties.
addTip
public addTip(message: string): void
Prints a “tip” message during synthesis.
message
Required The message.
annotateGenerated
public annotateGenerated(glob: string): void
Marks the provided file(s) as being generated.
This is achieved using the github-linguist attributes. Generated files do not count against the repository statistics and language breakdown.
https://github.com/github/linguist/blob/master/docs/overrides.md
glob
Required the glob pattern to match (could be a file path).
postSynthesize
public postSynthesize(): void
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before all components are synthesized.
removeTask
public removeTask(name: string): Task
Removes a task from a project.
name
Required The name of the task to remove.
runTaskCommand
public runTaskCommand(task: Task): string
Returns the shell command to execute in order to run a task.
By default, this is npx projen@<version> <task>
task
Required The task for which the command is required.
synth
public synth(): void
Synthesize all project files into outdir
.
tryFindFile
public tryFindFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and all its subprojects.
filePath
Required The file path.
If this path is relative, it will be resolved from the root of this project.
tryFindJsonFile
public tryFindJsonFile(filePath: string): JsonFile
Finds a json file by name.
filePath
Required The file path.
tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required The file path.
tryRemoveFile
public tryRemoveFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and removes it.
filePath
Required The file path.
If this path is relative, it will be resolved from the root of this project.
addDependency
public addDependency(spec: string): void
Adds a runtime dependency.
spec
Required Format <module>@<semver>
.
addDevDependency
public addDevDependency(spec: string): void
Adds a dev dependency.
spec
Required Format <module>@<semver>
.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isProject |
Test whether the given construct is a project. |
of |
Find the closest ancestor project for given construct. |
isConstruct
import { awscdk } from 'projen'
awscdk.AwsCdkPythonApp.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isProject
import { awscdk } from 'projen'
awscdk.AwsCdkPythonApp.isProject(x: any)
Test whether the given construct is a project.
x
Required of
import { awscdk } from 'projen'
awscdk.AwsCdkPythonApp.of(construct: IConstruct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
construct
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
buildTask |
Task |
No description. |
commitGenerated |
boolean |
Whether to commit the managed files by default. |
compileTask |
Task |
No description. |
components |
Component[] |
Returns all the components within this project. |
deps |
Dependencies |
Project dependencies. |
ejected |
boolean |
Whether or not the project is being ejected. |
files |
FileBase[] |
All files in this project. |
gitattributes |
GitAttributesFile |
The .gitattributes file for this repository. |
gitignore |
IgnoreFile |
.gitignore. |
logger |
Logger |
Logging utilities. |
name |
string |
Project name. |
outdir |
string |
Absolute output directory of this project. |
packageTask |
Task |
No description. |
postCompileTask |
Task |
No description. |
preCompileTask |
Task |
No description. |
projectBuild |
ProjectBuild |
Manages the build process of the project. |
projenCommand |
string |
The command to use in order to run the projen CLI. |
root |
Project |
The root project. |
subprojects |
Project[] |
Returns all the subprojects within this project. |
tasks |
Tasks |
Project tasks. |
testTask |
Task |
No description. |
defaultTask |
Task |
This is the “default” task, the one that executes “projen”. |
initProject |
InitProject |
The options used when this project is bootstrapped via projen new . |
parent |
Project |
A parent project. |
projectType |
ProjectType |
No description. |
autoApprove |
projen.github.AutoApprove |
Auto approve set up for this project. |
devContainer |
projen.vscode.DevContainer |
Access for .devcontainer.json (used for GitHub Codespaces). |
github |
projen.github.GitHub |
Access all github components. |
gitpod |
Gitpod |
Access for Gitpod. |
vscode |
projen.vscode.VsCode |
Access all VSCode components. |
depsManager |
projen.python.IPythonDeps |
API for managing dependencies. |
envManager |
projen.python.IPythonEnv |
API for mangaging the Python runtime environment. |
moduleName |
string |
Python module name (the project name, with any hyphens or periods replaced with underscores). |
version |
string |
Version of the package for distribution (should follow semver). |
packagingManager |
projen.python.IPythonPackaging |
API for managing packaging the project as a library. |
pytest |
projen.python.Pytest |
Pytest component. |
appEntrypoint |
string |
The CDK app entrypoint. |
cdkConfig |
projen.awscdk.CdkConfig |
cdk.json configuration. |
cdkDeps |
projen.awscdk.AwsCdkDeps |
No description. |
cdkTasks |
projen.awscdk.CdkTasks |
Common CDK tasks. |
cdkVersion |
string |
The CDK version this app is using. |
testdir |
string |
The directory in which the python tests reside. |
node
Required public readonly node: Node;
The tree node.
buildTask
Required public readonly buildTask: Task;
commitGenerated
Required public readonly commitGenerated: boolean;
Whether to commit the managed files by default.
compileTask
Required public readonly compileTask: Task;
components
Required public readonly components: Component[];
Returns all the components within this project.
deps
Required public readonly deps: Dependencies;
Project dependencies.
ejected
Required public readonly ejected: boolean;
Whether or not the project is being ejected.
files
Required public readonly files: FileBase[];
All files in this project.
gitattributes
Required public readonly gitattributes: GitAttributesFile;
The .gitattributes file for this repository.
gitignore
Required public readonly gitignore: IgnoreFile;
.gitignore.
logger
Required public readonly logger: Logger;
Logging utilities.
name
Required public readonly name: string;
Project name.
outdir
Required public readonly outdir: string;
Absolute output directory of this project.
packageTask
Required public readonly packageTask: Task;
postCompileTask
Required public readonly postCompileTask: Task;
preCompileTask
Required public readonly preCompileTask: Task;
projectBuild
Required public readonly projectBuild: ProjectBuild;
Manages the build process of the project.
projenCommand
Required public readonly projenCommand: string;
The command to use in order to run the projen CLI.
root
Required public readonly root: Project;
The root project.
subprojects
Required public readonly subprojects: Project[];
Returns all the subprojects within this project.
tasks
Required public readonly tasks: Tasks;
Project tasks.
testTask
Required public readonly testTask: Task;
defaultTask
Optional public readonly defaultTask: Task;
This is the “default” task, the one that executes “projen”.
Undefined if the project is being ejected.
initProject
Optional public readonly initProject: InitProject;
The options used when this project is bootstrapped via projen new
.
It includes the original set of options passed to the CLI and also the JSII FQN of the project type.
parent
Optional public readonly parent: Project;
A parent project.
If undefined, this is the root project.
projectType
Required public readonly projectType: ProjectType;
autoApprove
Optional public readonly autoApprove: AutoApprove;
Auto approve set up for this project.
devContainer
Optional public readonly devContainer: DevContainer;
Access for .devcontainer.json (used for GitHub Codespaces).
This will be undefined
if devContainer boolean is false
github
Optional public readonly github: GitHub;
Access all github components.
This will be undefined
for subprojects.
gitpod
Optional public readonly gitpod: Gitpod;
Access for Gitpod.
This will be undefined
if gitpod boolean is false
vscode
Optional public readonly vscode: VsCode;
Access all VSCode components.
This will be undefined
for subprojects.
depsManager
Required public readonly depsManager: IPythonDeps;
API for managing dependencies.
envManager
Required public readonly envManager: IPythonEnv;
API for mangaging the Python runtime environment.
moduleName
Required public readonly moduleName: string;
Python module name (the project name, with any hyphens or periods replaced with underscores).
version
Required public readonly version: string;
Version of the package for distribution (should follow semver).
packagingManager
Optional public readonly packagingManager: IPythonPackaging;
API for managing packaging the project as a library.
Only applies when the projectType
is LIB.
pytest
Optional public readonly pytest: Pytest;
Pytest component.
appEntrypoint
Required public readonly appEntrypoint: string;
The CDK app entrypoint.
cdkConfig
Required public readonly cdkConfig: CdkConfig;
cdk.json configuration.
cdkDeps
Required public readonly cdkDeps: AwsCdkDeps;
cdkTasks
Required public readonly cdkTasks: CdkTasks;
Common CDK tasks.
cdkVersion
Required public readonly cdkVersion: string;
The CDK version this app is using.
testdir
Required public readonly testdir: string;
The directory in which the python tests reside.
Name | Type | Description |
---|---|---|
DEFAULT_TASK |
string |
The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASK
Required public readonly DEFAULT_TASK: string;
The name of the default task (the task executed when projen
is run without arguments).
Normally this task should synthesize the project files.
AWS CDK app in TypeScript.
import { awscdk } from 'projen'
new awscdk.AwsCdkTypeScriptApp(options: AwsCdkTypeScriptAppOptions)
Name | Type | Description |
---|---|---|
options |
projen.awscdk.AwsCdkTypeScriptAppOptions |
No description. |
options
Required Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
addExcludeFromCleanup |
Exclude the matching files from pre-synth cleanup. |
addGitIgnore |
Adds a .gitignore pattern. |
addPackageIgnore |
Exclude these files from the bundled package. |
addTask |
Adds a new task to this project. |
addTip |
Prints a “tip” message during synthesis. |
annotateGenerated |
Marks the provided file(s) as being generated. |
postSynthesize |
Called after all components are synthesized. |
preSynthesize |
Called before all components are synthesized. |
removeTask |
Removes a task from a project. |
runTaskCommand |
Returns the shell command to execute in order to run a task. |
synth |
Synthesize all project files into outdir . |
tryFindFile |
Finds a file at the specified relative path within this project and all its subprojects. |
tryFindJsonFile |
Finds a json file by name. |
tryFindObjectFile |
Finds an object file (like JsonFile, YamlFile, etc.) by name. |
tryRemoveFile |
Finds a file at the specified relative path within this project and removes it. |
addBins |
No description. |
addBundledDeps |
Defines bundled dependencies. |
addCompileCommand |
DEPRECATED. |
addDeps |
Defines normal dependencies. |
addDevDeps |
Defines development/test dependencies. |
addFields |
Directly set fields in package.json . |
addKeywords |
Adds keywords to package.json (deduplicated). |
addPeerDeps |
Defines peer dependencies. |
addScripts |
Replaces the contents of multiple npm package.json scripts. |
addTestCommand |
DEPRECATED. |
hasScript |
Indicates if a script by the name name is defined. |
removeScript |
Removes the npm script (always successful). |
renderWorkflowSetup |
Returns the set of workflow steps which should be executed to bootstrap a workflow. |
setScript |
Replaces the contents of an npm package.json script. |
addCdkDependency |
Adds an AWS CDK module dependencies. |
toString
public toString(): string
Returns a string representation of this construct.
addExcludeFromCleanup
public addExcludeFromCleanup(globs: string): void
Exclude the matching files from pre-synth cleanup.
Can be used when, for example, some source files include the projen marker and we don’t want them to be erased during synth.
globs
Required The glob patterns to match.
addGitIgnore
public addGitIgnore(pattern: string): void
Adds a .gitignore pattern.
pattern
Required The glob pattern to ignore.
addPackageIgnore
public addPackageIgnore(pattern: string): void
Exclude these files from the bundled package.
Implemented by project types based on the
packaging mechanism. For example, NodeProject
delegates this to .npmignore
.
pattern
Required addTask
public addTask(name: string, props?: TaskOptions): Task
Adds a new task to this project.
This will fail if the project already has a task with this name.
name
Required The task name to add.
props
Optional Task properties.
addTip
public addTip(message: string): void
Prints a “tip” message during synthesis.
message
Required The message.
annotateGenerated
public annotateGenerated(glob: string): void
Marks the provided file(s) as being generated.
This is achieved using the github-linguist attributes. Generated files do not count against the repository statistics and language breakdown.
https://github.com/github/linguist/blob/master/docs/overrides.md
glob
Required the glob pattern to match (could be a file path).
postSynthesize
public postSynthesize(): void
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before all components are synthesized.
removeTask
public removeTask(name: string): Task
Removes a task from a project.
name
Required The name of the task to remove.
runTaskCommand
public runTaskCommand(task: Task): string
Returns the shell command to execute in order to run a task.
This will
typically be npx projen TASK
.
task
Required The task for which the command is required.
synth
public synth(): void
Synthesize all project files into outdir
.
tryFindFile
public tryFindFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and all its subprojects.
filePath
Required The file path.
If this path is relative, it will be resolved from the root of this project.
tryFindJsonFile
public tryFindJsonFile(filePath: string): JsonFile
Finds a json file by name.
filePath
Required The file path.
tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required The file path.
tryRemoveFile
public tryRemoveFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and removes it.
filePath
Required The file path.
If this path is relative, it will be resolved from the root of this project.
addBins
public addBins(bins: {[ key: string ]: string}): void
bins
Required addBundledDeps
public addBundledDeps(deps: string): void
Defines bundled dependencies.
Bundled dependencies will be added as normal dependencies as well as to the
bundledDependencies
section of your package.json
.
deps
Required 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
public addCompileCommand(commands: string): void
DEPRECATED.
commands
Required addDeps
public addDeps(deps: string): void
Defines normal dependencies.
deps
Required Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn
add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
addDevDeps
public addDevDeps(deps: string): void
Defines development/test dependencies.
deps
Required Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn
add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
addFields
public addFields(fields: {[ key: string ]: any}): void
Directly set fields in package.json
.
fields
Required The fields to set.
addKeywords
public addKeywords(keywords: string): void
Adds keywords to package.json (deduplicated).
keywords
Required The keywords to add.
addPeerDeps
public addPeerDeps(deps: string): void
Defines peer dependencies.
When adding peer dependencies, a devDependency will also be added on the pinned version of the declared peer. This will ensure that you are testing your code against the minimum version required from your consumers.
deps
Required Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn
add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
addScripts
public addScripts(scripts: {[ key: string ]: string}): void
Replaces the contents of multiple npm package.json scripts.
scripts
Required The scripts to set.
addTestCommand
public addTestCommand(commands: string): void
DEPRECATED.
commands
Required hasScript
public hasScript(name: string): boolean
Indicates if a script by the name name is defined.
name
Required The name of the script.
removeScript
public removeScript(name: string): void
Removes the npm script (always successful).
name
Required The name of the script.
renderWorkflowSetup
public renderWorkflowSetup(options?: RenderWorkflowSetupOptions): JobStep[]
Returns the set of workflow steps which should be executed to bootstrap a workflow.
options
Optional Options.
setScript
public setScript(name: string, command: string): void
Replaces the contents of an npm package.json script.
name
Required The script name.
command
Required The command to execute.
addCdkDependency
public addCdkDependency(modules: string): void
Adds an AWS CDK module dependencies.
modules
Required The list of modules to depend on.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isProject |
Test whether the given construct is a project. |
of |
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.
x
Required Any object.
isProject
import { awscdk } from 'projen'
awscdk.AwsCdkTypeScriptApp.isProject(x: any)
Test whether the given construct is a project.
x
Required 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.
construct
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
buildTask |
Task |
No description. |
commitGenerated |
boolean |
Whether to commit the managed files by default. |
compileTask |
Task |
No description. |
components |
Component[] |
Returns all the components within this project. |
deps |
Dependencies |
Project dependencies. |
ejected |
boolean |
Whether or not the project is being ejected. |
files |
FileBase[] |
All files in this project. |
gitattributes |
GitAttributesFile |
The .gitattributes file for this repository. |
gitignore |
IgnoreFile |
.gitignore. |
logger |
Logger |
Logging utilities. |
name |
string |
Project name. |
outdir |
string |
Absolute output directory of this project. |
packageTask |
Task |
No description. |
postCompileTask |
Task |
No description. |
preCompileTask |
Task |
No description. |
projectBuild |
ProjectBuild |
Manages the build process of the project. |
projenCommand |
string |
The command to use in order to run the projen CLI. |
root |
Project |
The root project. |
subprojects |
Project[] |
Returns all the subprojects within this project. |
tasks |
Tasks |
Project tasks. |
testTask |
Task |
No description. |
defaultTask |
Task |
This is the “default” task, the one that executes “projen”. |
initProject |
InitProject |
The options used when this project is bootstrapped via projen new . |
parent |
Project |
A parent project. |
projectType |
ProjectType |
No description. |
autoApprove |
projen.github.AutoApprove |
Auto approve set up for this project. |
devContainer |
projen.vscode.DevContainer |
Access for .devcontainer.json (used for GitHub Codespaces). |
github |
projen.github.GitHub |
Access all github components. |
gitpod |
Gitpod |
Access for Gitpod. |
vscode |
projen.vscode.VsCode |
Access all VSCode components. |
allowLibraryDependencies |
boolean |
No description. |
artifactsDirectory |
string |
The build output directory. |
artifactsJavascriptDirectory |
string |
The location of the npm tarball after build (${artifactsDirectory}/js ). |
bundler |
projen.javascript.Bundler |
No description. |
entrypoint |
string |
No description. |
manifest |
any |
No description. |
npmrc |
projen.javascript.NpmConfig |
The .npmrc file. |
package |
projen.javascript.NodePackage |
API for managing the node package. |
packageManager |
projen.javascript.NodePackageManager |
The package manager to use. |
runScriptCommand |
string |
The command to use to run scripts (e.g. yarn run or npm run depends on the package manager). |
autoMerge |
projen.github.AutoMerge |
Component that sets up mergify for merging approved pull requests. |
buildWorkflow |
projen.build.BuildWorkflow |
The PR build GitHub workflow. |
buildWorkflowJobId |
string |
The job ID of the build workflow. |
jest |
projen.javascript.Jest |
The Jest configuration (if enabled). |
maxNodeVersion |
string |
Maximum node version required by this package. |
minNodeVersion |
string |
Minimum node.js version required by this package. |
npmignore |
IgnoreFile |
The .npmignore file. |
prettier |
projen.javascript.Prettier |
No description. |
publisher |
projen.release.Publisher |
Package publisher. |
release |
projen.release.Release |
Release management. |
upgradeWorkflow |
projen.javascript.UpgradeDependencies |
The upgrade workflow. |
docsDirectory |
string |
No description. |
libdir |
string |
The directory in which compiled .js files reside. |
srcdir |
string |
The directory in which the .ts sources reside. |
testdir |
string |
The directory in which tests reside. |
tsconfigDev |
projen.javascript.TypescriptConfig |
A typescript configuration file which covers all files (sources, tests, projen). |
watchTask |
Task |
The “watch” task. |
docgen |
boolean |
No description. |
eslint |
projen.javascript.Eslint |
No description. |
tsconfig |
projen.javascript.TypescriptConfig |
No description. |
tsconfigEslint |
projen.javascript.TypescriptConfig |
No description. |
appEntrypoint |
string |
The CDK app entrypoint. |
cdkConfig |
projen.awscdk.CdkConfig |
cdk.json configuration. |
cdkDeps |
projen.awscdk.AwsCdkDeps |
No description. |
cdkTasks |
projen.awscdk.CdkTasks |
Common CDK tasks. |
cdkVersion |
string |
The CDK version this app is using. |
node
Required public readonly node: Node;
The tree node.
buildTask
Required public readonly buildTask: Task;
commitGenerated
Required public readonly commitGenerated: boolean;
Whether to commit the managed files by default.
compileTask
Required public readonly compileTask: Task;
components
Required public readonly components: Component[];
Returns all the components within this project.
deps
Required public readonly deps: Dependencies;
Project dependencies.
ejected
Required public readonly ejected: boolean;
Whether or not the project is being ejected.
files
Required public readonly files: FileBase[];
All files in this project.
gitattributes
Required public readonly gitattributes: GitAttributesFile;
The .gitattributes file for this repository.
gitignore
Required public readonly gitignore: IgnoreFile;
.gitignore.
logger
Required public readonly logger: Logger;
Logging utilities.
name
Required public readonly name: string;
Project name.
outdir
Required public readonly outdir: string;
Absolute output directory of this project.
packageTask
Required public readonly packageTask: Task;
postCompileTask
Required public readonly postCompileTask: Task;
preCompileTask
Required public readonly preCompileTask: Task;
projectBuild
Required public readonly projectBuild: ProjectBuild;
Manages the build process of the project.
projenCommand
Required public readonly projenCommand: string;
The command to use in order to run the projen CLI.
root
Required public readonly root: Project;
The root project.
subprojects
Required public readonly subprojects: Project[];
Returns all the subprojects within this project.
tasks
Required public readonly tasks: Tasks;
Project tasks.
testTask
Required public readonly testTask: Task;
defaultTask
Optional public readonly defaultTask: Task;
This is the “default” task, the one that executes “projen”.
Undefined if the project is being ejected.
initProject
Optional public readonly initProject: InitProject;
The options used when this project is bootstrapped via projen new
.
It includes the original set of options passed to the CLI and also the JSII FQN of the project type.
parent
Optional public readonly parent: Project;
A parent project.
If undefined, this is the root project.
projectType
Required public readonly projectType: ProjectType;
autoApprove
Optional public readonly autoApprove: AutoApprove;
Auto approve set up for this project.
devContainer
Optional public readonly devContainer: DevContainer;
Access for .devcontainer.json (used for GitHub Codespaces).
This will be undefined
if devContainer boolean is false
github
Optional public readonly github: GitHub;
Access all github components.
This will be undefined
for subprojects.
gitpod
Optional public readonly gitpod: Gitpod;
Access for Gitpod.
This will be undefined
if gitpod boolean is false
vscode
Optional public readonly vscode: VsCode;
Access all VSCode components.
This will be undefined
for subprojects.
allowLibraryDependencies
package.allowLibraryDependencies
public readonly allowLibraryDependencies: boolean;
artifactsDirectory
Required public readonly artifactsDirectory: string;
The build output directory.
An npm tarball will be created under the js
subdirectory. For example, if this is set to dist
(the default), the npm
tarball will be placed under dist/js/boom-boom-1.2.3.tg
.
artifactsJavascriptDirectory
Required public readonly artifactsJavascriptDirectory: string;
The location of the npm tarball after build (${artifactsDirectory}/js
).
bundler
Required public readonly bundler: Bundler;
entrypoint
package.entrypoint
public readonly entrypoint: string;
manifest
package.addField(x, y)
public readonly manifest: any;
npmrc
Required public readonly npmrc: NpmConfig;
The .npmrc file.
package
Required public readonly package: NodePackage;
API for managing the node package.
packageManager
package.packageManager
public readonly packageManager: NodePackageManager;
The package manager to use.
runScriptCommand
Required public readonly runScriptCommand: string;
The command to use to run scripts (e.g. yarn run
or npm run
depends on the package manager).
autoMerge
Optional public readonly autoMerge: AutoMerge;
Component that sets up mergify for merging approved pull requests.
buildWorkflow
Optional public readonly buildWorkflow: BuildWorkflow;
The PR build GitHub workflow.
undefined
if buildWorkflow
is disabled.
buildWorkflowJobId
Optional public readonly buildWorkflowJobId: string;
The job ID of the build workflow.
jest
Optional public readonly jest: Jest;
The Jest configuration (if enabled).
maxNodeVersion
Optional public readonly maxNodeVersion: string;
Maximum node version required by this package.
minNodeVersion
Optional public readonly minNodeVersion: string;
Minimum node.js version required by this package.
npmignore
Optional public readonly npmignore: IgnoreFile;
The .npmignore file.
prettier
Optional public readonly prettier: Prettier;
publisher
release.publisher
.public readonly publisher: Publisher;
Package publisher.
This will be undefined
if the project does not have a
release workflow.
release
Optional public readonly release: Release;
Release management.
upgradeWorkflow
Optional public readonly upgradeWorkflow: UpgradeDependencies;
The upgrade workflow.
docsDirectory
Required public readonly docsDirectory: string;
libdir
Required public readonly libdir: string;
The directory in which compiled .js files reside.
srcdir
Required public readonly srcdir: string;
The directory in which the .ts sources reside.
testdir
Required public readonly testdir: string;
The directory in which tests reside.
tsconfigDev
Required public readonly tsconfigDev: TypescriptConfig;
A typescript configuration file which covers all files (sources, tests, projen).
watchTask
Required public readonly watchTask: Task;
The “watch” task.
docgen
Optional public readonly docgen: boolean;
eslint
Optional public readonly eslint: Eslint;
tsconfig
Optional public readonly tsconfig: TypescriptConfig;
tsconfigEslint
Optional public readonly tsconfigEslint: TypescriptConfig;
appEntrypoint
Required public readonly appEntrypoint: string;
The CDK app entrypoint.
cdkConfig
Required public readonly cdkConfig: CdkConfig;
cdk.json configuration.
cdkDeps
Required public readonly cdkDeps: AwsCdkDeps;
cdkTasks
Required public readonly cdkTasks: CdkTasks;
Common CDK tasks.
cdkVersion
Required public readonly cdkVersion: string;
The CDK version this app is using.
Name | Type | Description |
---|---|---|
DEFAULT_TASK |
string |
The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASK
Required public readonly DEFAULT_TASK: string;
The name of the default task (the task executed when projen
is run without arguments).
Normally this task should synthesize the project files.
import { build } from 'projen'
new build.BuildWorkflow(project: Project, options: BuildWorkflowOptions)
Name | Type | Description |
---|---|---|
project |
Project |
No description. |
options |
projen.build.BuildWorkflowOptions |
No description. |
project
Required options
Required Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
postSynthesize |
Called after synthesis. |
preSynthesize |
Called before synthesis. |
synthesize |
Synthesizes files to the project output directory. |
addPostBuildJob |
Adds another job to the build workflow which is executed after the build job succeeded. |
addPostBuildJobCommands |
Run a sequence of commands as a job within the build workflow which is executed after the build job succeeded. |
addPostBuildJobTask |
Run a task as a job within the build workflow which is executed after the build job succeeded. |
addPostBuildSteps |
Adds steps that are executed after the build. |
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.
addPostBuildJob
public addPostBuildJob(id: string, job: Job): void
Adds another job to the build workflow which is executed after the build job succeeded.
Jobs are executed only if the build did NOT self mutate. If the build self-mutate, the branch will either be updated or the build will fail (in forks), so there is no point in executing the post-build job.
id
Required The id of the new job.
job
Required The job specification.
addPostBuildJobCommands
public addPostBuildJobCommands(id: string, commands: string[], options?: AddPostBuildJobCommandsOptions): void
Run a sequence of commands as a job within the build workflow which is executed after the build job succeeded.
Jobs are executed only if the build did NOT self mutate. If the build self-mutate, the branch will either be updated or the build will fail (in forks), so there is no point in executing the post-build job.
id
Required commands
Required options
Optional Specify tools and other options.
addPostBuildJobTask
public addPostBuildJobTask(task: Task, options?: AddPostBuildJobTaskOptions): void
Run a task as a job within the build workflow which is executed after the build job succeeded.
The job will have access to build artifacts and will install project dependencies in order to be able to run any commands used in the tasks.
Jobs are executed only if the build did NOT self mutate. If the build self-mutate, the branch will either be updated or the build will fail (in forks), so there is no point in executing the post-build job.
task
Required options
Optional Specify tools and other options.
addPostBuildSteps
public addPostBuildSteps(steps: JobStep): void
Adds steps that are executed after the build.
steps
Required The job steps.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isComponent |
Test whether the given construct is a component. |
isConstruct
import { build } from 'projen'
build.BuildWorkflow.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isComponent
import { build } from 'projen'
build.BuildWorkflow.isComponent(x: any)
Test whether the given construct is a component.
x
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
project |
Project |
No description. |
buildJobIds |
string[] |
Returns a list of job IDs that are part of the build. |
node
Required public readonly node: Node;
The tree node.
project
Required public readonly project: Project;
buildJobIds
Required public readonly buildJobIds: string[];
Returns a list of job IDs that are part of the build.
Adds support for bundling JavaScript applications and dependencies into a single file.
In the future, this will also supports bundling websites.
import { javascript } from 'projen'
new javascript.Bundler(project: Project, options?: BundlerOptions)
Name | Type | Description |
---|---|---|
project |
Project |
No description. |
options |
projen.javascript.BundlerOptions |
No description. |
project
Required options
Optional Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
postSynthesize |
Called after synthesis. |
preSynthesize |
Called before synthesis. |
synthesize |
Synthesizes files to the project output directory. |
addBundle |
Adds a task to the project which bundles a specific entrypoint and all of its dependencies into a single javascript output file. |
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.
addBundle
public addBundle(entrypoint: string, options: AddBundleOptions): Bundle
Adds a task to the project which bundles a specific entrypoint and all of its dependencies into a single javascript output file.
entrypoint
Required The relative path of the artifact within the project.
options
Required Bundling options.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isComponent |
Test whether the given construct is a component. |
of |
Returns the Bundler instance associated with a project or undefined if there is no Bundler. |
isConstruct
import { javascript } from 'projen'
javascript.Bundler.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isComponent
import { javascript } from 'projen'
javascript.Bundler.isComponent(x: any)
Test whether the given construct is a component.
x
Required of
import { javascript } from 'projen'
javascript.Bundler.of(project: Project)
Returns the Bundler
instance associated with a project or undefined
if there is no Bundler.
project
Required The project.
Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
project |
Project |
No description. |
bundledir |
string |
Root bundle directory. |
bundleTask |
Task |
Gets or creates the singleton “bundle” task of the project. |
esbuildVersion |
string |
The semantic version requirement for esbuild (if defined). |
node
Required public readonly node: Node;
The tree node.
project
Required public readonly project: Project;
bundledir
Required public readonly bundledir: string;
Root bundle directory.
bundleTask
Required public readonly bundleTask: Task;
Gets or creates the singleton “bundle” task of the project.
If the project doesn’t have a “bundle” task, it will be created and spawned during the pre-compile phase.
esbuildVersion
Optional public readonly esbuildVersion: string;
The semantic version requirement for esbuild
(if defined).
Manages dependencies on the CDK8s.
import { cdk8s } from 'projen'
new cdk8s.Cdk8sDeps(project: Project, options: Cdk8sDepsOptions)
Name | Type | Description |
---|---|---|
project |
Project |
No description. |
options |
projen.cdk8s.Cdk8sDepsOptions |
No description. |
project
Required options
Required Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
postSynthesize |
Called after synthesis. |
preSynthesize |
Called before synthesis. |
synthesize |
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.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isComponent |
Test whether the given construct is a component. |
isConstruct
import { cdk8s } from 'projen'
cdk8s.Cdk8sDeps.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isComponent
import { cdk8s } from 'projen'
cdk8s.Cdk8sDeps.isComponent(x: any)
Test whether the given construct is a component.
x
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
project |
Project |
No description. |
cdk8sMajorVersion |
number |
The major version of the CDK8s (e.g. 1, 2, …). |
cdk8sMinimumVersion |
string |
The minimum version of the CDK8s (e.g. 2.0.0 ). |
cdk8sVersion |
string |
The dependency requirement for CDK8s. |
node
Required public readonly node: Node;
The tree node.
project
Required public readonly project: Project;
cdk8sMajorVersion
Required public readonly cdk8sMajorVersion: number;
The major version of the CDK8s (e.g. 1, 2, …).
cdk8sMinimumVersion
Required public readonly cdk8sMinimumVersion: string;
The minimum version of the CDK8s (e.g. 2.0.0
).
cdk8sVersion
Required public readonly cdk8sVersion: string;
The dependency requirement for CDK8s.
import { cdk8s } from 'projen'
new cdk8s.Cdk8sDepsPy(project: Project, options: Cdk8sDepsOptions)
Name | Type | Description |
---|---|---|
project |
Project |
No description. |
options |
projen.cdk8s.Cdk8sDepsOptions |
No description. |
project
Required options
Required Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
postSynthesize |
Called after synthesis. |
preSynthesize |
Called before synthesis. |
synthesize |
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.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isComponent |
Test whether the given construct is a component. |
isConstruct
import { cdk8s } from 'projen'
cdk8s.Cdk8sDepsPy.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isComponent
import { cdk8s } from 'projen'
cdk8s.Cdk8sDepsPy.isComponent(x: any)
Test whether the given construct is a component.
x
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
project |
Project |
No description. |
cdk8sMajorVersion |
number |
The major version of the CDK8s (e.g. 1, 2, …). |
cdk8sMinimumVersion |
string |
The minimum version of the CDK8s (e.g. 2.0.0 ). |
cdk8sVersion |
string |
The dependency requirement for CDK8s. |
node
Required public readonly node: Node;
The tree node.
project
Required public readonly project: Project;
cdk8sMajorVersion
Required public readonly cdk8sMajorVersion: number;
The major version of the CDK8s (e.g. 1, 2, …).
cdk8sMinimumVersion
Required public readonly cdk8sMinimumVersion: string;
The minimum version of the CDK8s (e.g. 2.0.0
).
cdk8sVersion
Required public readonly cdk8sVersion: string;
The dependency requirement for CDK8s.
CDK8s app in Python.
import { cdk8s } from 'projen'
new cdk8s.Cdk8sPythonApp(options: Cdk8sPythonOptions)
Name | Type | Description |
---|---|---|
options |
projen.cdk8s.Cdk8sPythonOptions |
No description. |
options
Required Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
addExcludeFromCleanup |
Exclude the matching files from pre-synth cleanup. |
addGitIgnore |
Adds a .gitignore pattern. |
addPackageIgnore |
Exclude these files from the bundled package. |
addTask |
Adds a new task to this project. |
addTip |
Prints a “tip” message during synthesis. |
annotateGenerated |
Marks the provided file(s) as being generated. |
postSynthesize |
Called after all components are synthesized. |
preSynthesize |
Called before all components are synthesized. |
removeTask |
Removes a task from a project. |
runTaskCommand |
Returns the shell command to execute in order to run a task. |
synth |
Synthesize all project files into outdir . |
tryFindFile |
Finds a file at the specified relative path within this project and all its subprojects. |
tryFindJsonFile |
Finds a json file by name. |
tryFindObjectFile |
Finds an object file (like JsonFile, YamlFile, etc.) by name. |
tryRemoveFile |
Finds a file at the specified relative path within this project and removes it. |
addDependency |
Adds a runtime dependency. |
addDevDependency |
Adds a dev dependency. |
toString
public toString(): string
Returns a string representation of this construct.
addExcludeFromCleanup
public addExcludeFromCleanup(globs: string): void
Exclude the matching files from pre-synth cleanup.
Can be used when, for example, some source files include the projen marker and we don’t want them to be erased during synth.
globs
Required The glob patterns to match.
addGitIgnore
public addGitIgnore(pattern: string): void
Adds a .gitignore pattern.
pattern
Required The glob pattern to ignore.
addPackageIgnore
public addPackageIgnore(_pattern: string): void
Exclude these files from the bundled package.
Implemented by project types based on the
packaging mechanism. For example, NodeProject
delegates this to .npmignore
.
_pattern
Required The glob pattern to exclude.
addTask
public addTask(name: string, props?: TaskOptions): Task
Adds a new task to this project.
This will fail if the project already has a task with this name.
name
Required The task name to add.
props
Optional Task properties.
addTip
public addTip(message: string): void
Prints a “tip” message during synthesis.
message
Required The message.
annotateGenerated
public annotateGenerated(glob: string): void
Marks the provided file(s) as being generated.
This is achieved using the github-linguist attributes. Generated files do not count against the repository statistics and language breakdown.
https://github.com/github/linguist/blob/master/docs/overrides.md
glob
Required the glob pattern to match (could be a file path).
postSynthesize
public postSynthesize(): void
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before all components are synthesized.
removeTask
public removeTask(name: string): Task
Removes a task from a project.
name
Required The name of the task to remove.
runTaskCommand
public runTaskCommand(task: Task): string
Returns the shell command to execute in order to run a task.
By default, this is npx projen@<version> <task>
task
Required The task for which the command is required.
synth
public synth(): void
Synthesize all project files into outdir
.
tryFindFile
public tryFindFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and all its subprojects.
filePath
Required The file path.
If this path is relative, it will be resolved from the root of this project.
tryFindJsonFile
public tryFindJsonFile(filePath: string): JsonFile
Finds a json file by name.
filePath
Required The file path.
tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required The file path.
tryRemoveFile
public tryRemoveFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and removes it.
filePath
Required The file path.
If this path is relative, it will be resolved from the root of this project.
addDependency
public addDependency(spec: string): void
Adds a runtime dependency.
spec
Required Format <module>@<semver>
.
addDevDependency
public addDevDependency(spec: string): void
Adds a dev dependency.
spec
Required Format <module>@<semver>
.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isProject |
Test whether the given construct is a project. |
of |
Find the closest ancestor project for given construct. |
isConstruct
import { cdk8s } from 'projen'
cdk8s.Cdk8sPythonApp.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isProject
import { cdk8s } from 'projen'
cdk8s.Cdk8sPythonApp.isProject(x: any)
Test whether the given construct is a project.
x
Required of
import { cdk8s } from 'projen'
cdk8s.Cdk8sPythonApp.of(construct: IConstruct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
construct
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
buildTask |
Task |
No description. |
commitGenerated |
boolean |
Whether to commit the managed files by default. |
compileTask |
Task |
No description. |
components |
Component[] |
Returns all the components within this project. |
deps |
Dependencies |
Project dependencies. |
ejected |
boolean |
Whether or not the project is being ejected. |
files |
FileBase[] |
All files in this project. |
gitattributes |
GitAttributesFile |
The .gitattributes file for this repository. |
gitignore |
IgnoreFile |
.gitignore. |
logger |
Logger |
Logging utilities. |
name |
string |
Project name. |
outdir |
string |
Absolute output directory of this project. |
packageTask |
Task |
No description. |
postCompileTask |
Task |
No description. |
preCompileTask |
Task |
No description. |
projectBuild |
ProjectBuild |
Manages the build process of the project. |
projenCommand |
string |
The command to use in order to run the projen CLI. |
root |
Project |
The root project. |
subprojects |
Project[] |
Returns all the subprojects within this project. |
tasks |
Tasks |
Project tasks. |
testTask |
Task |
No description. |
defaultTask |
Task |
This is the “default” task, the one that executes “projen”. |
initProject |
InitProject |
The options used when this project is bootstrapped via projen new . |
parent |
Project |
A parent project. |
projectType |
ProjectType |
No description. |
autoApprove |
projen.github.AutoApprove |
Auto approve set up for this project. |
devContainer |
projen.vscode.DevContainer |
Access for .devcontainer.json (used for GitHub Codespaces). |
github |
projen.github.GitHub |
Access all github components. |
gitpod |
Gitpod |
Access for Gitpod. |
vscode |
projen.vscode.VsCode |
Access all VSCode components. |
depsManager |
projen.python.IPythonDeps |
API for managing dependencies. |
envManager |
projen.python.IPythonEnv |
API for mangaging the Python runtime environment. |
moduleName |
string |
Python module name (the project name, with any hyphens or periods replaced with underscores). |
version |
string |
Version of the package for distribution (should follow semver). |
packagingManager |
projen.python.IPythonPackaging |
API for managing packaging the project as a library. |
pytest |
projen.python.Pytest |
Pytest component. |
appEntrypoint |
string |
The CDK8s app entrypoint. |
cdk8sDeps |
projen.cdk8s.Cdk8sDeps |
No description. |
node
Required public readonly node: Node;
The tree node.
buildTask
Required public readonly buildTask: Task;
commitGenerated
Required public readonly commitGenerated: boolean;
Whether to commit the managed files by default.
compileTask
Required public readonly compileTask: Task;
components
Required public readonly components: Component[];
Returns all the components within this project.
deps
Required public readonly deps: Dependencies;
Project dependencies.
ejected
Required public readonly ejected: boolean;
Whether or not the project is being ejected.
files
Required public readonly files: FileBase[];
All files in this project.
gitattributes
Required public readonly gitattributes: GitAttributesFile;
The .gitattributes file for this repository.
gitignore
Required public readonly gitignore: IgnoreFile;
.gitignore.
logger
Required public readonly logger: Logger;
Logging utilities.
name
Required public readonly name: string;
Project name.
outdir
Required public readonly outdir: string;
Absolute output directory of this project.
packageTask
Required public readonly packageTask: Task;
postCompileTask
Required public readonly postCompileTask: Task;
preCompileTask
Required public readonly preCompileTask: Task;
projectBuild
Required public readonly projectBuild: ProjectBuild;
Manages the build process of the project.
projenCommand
Required public readonly projenCommand: string;
The command to use in order to run the projen CLI.
root
Required public readonly root: Project;
The root project.
subprojects
Required public readonly subprojects: Project[];
Returns all the subprojects within this project.
tasks
Required public readonly tasks: Tasks;
Project tasks.
testTask
Required public readonly testTask: Task;
defaultTask
Optional public readonly defaultTask: Task;
This is the “default” task, the one that executes “projen”.
Undefined if the project is being ejected.
initProject
Optional public readonly initProject: InitProject;
The options used when this project is bootstrapped via projen new
.
It includes the original set of options passed to the CLI and also the JSII FQN of the project type.
parent
Optional public readonly parent: Project;
A parent project.
If undefined, this is the root project.
projectType
Required public readonly projectType: ProjectType;
autoApprove
Optional public readonly autoApprove: AutoApprove;
Auto approve set up for this project.
devContainer
Optional public readonly devContainer: DevContainer;
Access for .devcontainer.json (used for GitHub Codespaces).
This will be undefined
if devContainer boolean is false
github
Optional public readonly github: GitHub;
Access all github components.
This will be undefined
for subprojects.
gitpod
Optional public readonly gitpod: Gitpod;
Access for Gitpod.
This will be undefined
if gitpod boolean is false
vscode
Optional public readonly vscode: VsCode;
Access all VSCode components.
This will be undefined
for subprojects.
depsManager
Required public readonly depsManager: IPythonDeps;
API for managing dependencies.
envManager
Required public readonly envManager: IPythonEnv;
API for mangaging the Python runtime environment.
moduleName
Required public readonly moduleName: string;
Python module name (the project name, with any hyphens or periods replaced with underscores).
version
Required public readonly version: string;
Version of the package for distribution (should follow semver).
packagingManager
Optional public readonly packagingManager: IPythonPackaging;
API for managing packaging the project as a library.
Only applies when the projectType
is LIB.
pytest
Optional public readonly pytest: Pytest;
Pytest component.
appEntrypoint
Required public readonly appEntrypoint: string;
The CDK8s app entrypoint.
cdk8sDeps
Required public readonly cdk8sDeps: Cdk8sDeps;
Name | Type | Description |
---|---|---|
DEFAULT_TASK |
string |
The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASK
Required public readonly DEFAULT_TASK: string;
The name of the default task (the task executed when projen
is run without arguments).
Normally this task should synthesize the project files.
CDK8s app in TypeScript.
import { cdk8s } from 'projen'
new cdk8s.Cdk8sTypeScriptApp(options: Cdk8sTypeScriptAppOptions)
Name | Type | Description |
---|---|---|
options |
projen.cdk8s.Cdk8sTypeScriptAppOptions |
No description. |
options
Required Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
addExcludeFromCleanup |
Exclude the matching files from pre-synth cleanup. |
addGitIgnore |
Adds a .gitignore pattern. |
addPackageIgnore |
Exclude these files from the bundled package. |
addTask |
Adds a new task to this project. |
addTip |
Prints a “tip” message during synthesis. |
annotateGenerated |
Marks the provided file(s) as being generated. |
postSynthesize |
Called after all components are synthesized. |
preSynthesize |
Called before all components are synthesized. |
removeTask |
Removes a task from a project. |
runTaskCommand |
Returns the shell command to execute in order to run a task. |
synth |
Synthesize all project files into outdir . |
tryFindFile |
Finds a file at the specified relative path within this project and all its subprojects. |
tryFindJsonFile |
Finds a json file by name. |
tryFindObjectFile |
Finds an object file (like JsonFile, YamlFile, etc.) by name. |
tryRemoveFile |
Finds a file at the specified relative path within this project and removes it. |
addBins |
No description. |
addBundledDeps |
Defines bundled dependencies. |
addCompileCommand |
DEPRECATED. |
addDeps |
Defines normal dependencies. |
addDevDeps |
Defines development/test dependencies. |
addFields |
Directly set fields in package.json . |
addKeywords |
Adds keywords to package.json (deduplicated). |
addPeerDeps |
Defines peer dependencies. |
addScripts |
Replaces the contents of multiple npm package.json scripts. |
addTestCommand |
DEPRECATED. |
hasScript |
Indicates if a script by the name name is defined. |
removeScript |
Removes the npm script (always successful). |
renderWorkflowSetup |
Returns the set of workflow steps which should be executed to bootstrap a workflow. |
setScript |
Replaces the contents of an npm package.json script. |
toString
public toString(): string
Returns a string representation of this construct.
addExcludeFromCleanup
public addExcludeFromCleanup(globs: string): void
Exclude the matching files from pre-synth cleanup.
Can be used when, for example, some source files include the projen marker and we don’t want them to be erased during synth.
globs
Required The glob patterns to match.
addGitIgnore
public addGitIgnore(pattern: string): void
Adds a .gitignore pattern.
pattern
Required The glob pattern to ignore.
addPackageIgnore
public addPackageIgnore(pattern: string): void
Exclude these files from the bundled package.
Implemented by project types based on the
packaging mechanism. For example, NodeProject
delegates this to .npmignore
.
pattern
Required addTask
public addTask(name: string, props?: TaskOptions): Task
Adds a new task to this project.
This will fail if the project already has a task with this name.
name
Required The task name to add.
props
Optional Task properties.
addTip
public addTip(message: string): void
Prints a “tip” message during synthesis.
message
Required The message.
annotateGenerated
public annotateGenerated(glob: string): void
Marks the provided file(s) as being generated.
This is achieved using the github-linguist attributes. Generated files do not count against the repository statistics and language breakdown.
https://github.com/github/linguist/blob/master/docs/overrides.md
glob
Required the glob pattern to match (could be a file path).
postSynthesize
public postSynthesize(): void
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before all components are synthesized.
removeTask
public removeTask(name: string): Task
Removes a task from a project.
name
Required The name of the task to remove.
runTaskCommand
public runTaskCommand(task: Task): string
Returns the shell command to execute in order to run a task.
This will
typically be npx projen TASK
.
task
Required The task for which the command is required.
synth
public synth(): void
Synthesize all project files into outdir
.
tryFindFile
public tryFindFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and all its subprojects.
filePath
Required The file path.
If this path is relative, it will be resolved from the root of this project.
tryFindJsonFile
public tryFindJsonFile(filePath: string): JsonFile
Finds a json file by name.
filePath
Required The file path.
tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required The file path.
tryRemoveFile
public tryRemoveFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and removes it.
filePath
Required The file path.
If this path is relative, it will be resolved from the root of this project.
addBins
public addBins(bins: {[ key: string ]: string}): void
bins
Required addBundledDeps
public addBundledDeps(deps: string): void
Defines bundled dependencies.
Bundled dependencies will be added as normal dependencies as well as to the
bundledDependencies
section of your package.json
.
deps
Required 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
public addCompileCommand(commands: string): void
DEPRECATED.
commands
Required addDeps
public addDeps(deps: string): void
Defines normal dependencies.
deps
Required Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn
add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
addDevDeps
public addDevDeps(deps: string): void
Defines development/test dependencies.
deps
Required Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn
add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
addFields
public addFields(fields: {[ key: string ]: any}): void
Directly set fields in package.json
.
fields
Required The fields to set.
addKeywords
public addKeywords(keywords: string): void
Adds keywords to package.json (deduplicated).
keywords
Required The keywords to add.
addPeerDeps
public addPeerDeps(deps: string): void
Defines peer dependencies.
When adding peer dependencies, a devDependency will also be added on the pinned version of the declared peer. This will ensure that you are testing your code against the minimum version required from your consumers.
deps
Required Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn
add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
addScripts
public addScripts(scripts: {[ key: string ]: string}): void
Replaces the contents of multiple npm package.json scripts.
scripts
Required The scripts to set.
addTestCommand
public addTestCommand(commands: string): void
DEPRECATED.
commands
Required hasScript
public hasScript(name: string): boolean
Indicates if a script by the name name is defined.
name
Required The name of the script.
removeScript
public removeScript(name: string): void
Removes the npm script (always successful).
name
Required The name of the script.
renderWorkflowSetup
public renderWorkflowSetup(options?: RenderWorkflowSetupOptions): JobStep[]
Returns the set of workflow steps which should be executed to bootstrap a workflow.
options
Optional Options.
setScript
public setScript(name: string, command: string): void
Replaces the contents of an npm package.json script.
name
Required The script name.
command
Required The command to execute.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isProject |
Test whether the given construct is a project. |
of |
Find the closest ancestor project for given construct. |
isConstruct
import { cdk8s } from 'projen'
cdk8s.Cdk8sTypeScriptApp.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isProject
import { cdk8s } from 'projen'
cdk8s.Cdk8sTypeScriptApp.isProject(x: any)
Test whether the given construct is a project.
x
Required of
import { cdk8s } from 'projen'
cdk8s.Cdk8sTypeScriptApp.of(construct: IConstruct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
construct
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
buildTask |
Task |
No description. |
commitGenerated |
boolean |
Whether to commit the managed files by default. |
compileTask |
Task |
No description. |
components |
Component[] |
Returns all the components within this project. |
deps |
Dependencies |
Project dependencies. |
ejected |
boolean |
Whether or not the project is being ejected. |
files |
FileBase[] |
All files in this project. |
gitattributes |
GitAttributesFile |
The .gitattributes file for this repository. |
gitignore |
IgnoreFile |
.gitignore. |
logger |
Logger |
Logging utilities. |
name |
string |
Project name. |
outdir |
string |
Absolute output directory of this project. |
packageTask |
Task |
No description. |
postCompileTask |
Task |
No description. |
preCompileTask |
Task |
No description. |
projectBuild |
ProjectBuild |
Manages the build process of the project. |
projenCommand |
string |
The command to use in order to run the projen CLI. |
root |
Project |
The root project. |
subprojects |
Project[] |
Returns all the subprojects within this project. |
tasks |
Tasks |
Project tasks. |
testTask |
Task |
No description. |
defaultTask |
Task |
This is the “default” task, the one that executes “projen”. |
initProject |
InitProject |
The options used when this project is bootstrapped via projen new . |
parent |
Project |
A parent project. |
projectType |
ProjectType |
No description. |
autoApprove |
projen.github.AutoApprove |
Auto approve set up for this project. |
devContainer |
projen.vscode.DevContainer |
Access for .devcontainer.json (used for GitHub Codespaces). |
github |
projen.github.GitHub |
Access all github components. |
gitpod |
Gitpod |
Access for Gitpod. |
vscode |
projen.vscode.VsCode |
Access all VSCode components. |
allowLibraryDependencies |
boolean |
No description. |
artifactsDirectory |
string |
The build output directory. |
artifactsJavascriptDirectory |
string |
The location of the npm tarball after build (${artifactsDirectory}/js ). |
bundler |
projen.javascript.Bundler |
No description. |
entrypoint |
string |
No description. |
manifest |
any |
No description. |
npmrc |
projen.javascript.NpmConfig |
The .npmrc file. |
package |
projen.javascript.NodePackage |
API for managing the node package. |
packageManager |
projen.javascript.NodePackageManager |
The package manager to use. |
runScriptCommand |
string |
The command to use to run scripts (e.g. yarn run or npm run depends on the package manager). |
autoMerge |
projen.github.AutoMerge |
Component that sets up mergify for merging approved pull requests. |
buildWorkflow |
projen.build.BuildWorkflow |
The PR build GitHub workflow. |
buildWorkflowJobId |
string |
The job ID of the build workflow. |
jest |
projen.javascript.Jest |
The Jest configuration (if enabled). |
maxNodeVersion |
string |
Maximum node version required by this package. |
minNodeVersion |
string |
Minimum node.js version required by this package. |
npmignore |
IgnoreFile |
The .npmignore file. |
prettier |
projen.javascript.Prettier |
No description. |
publisher |
projen.release.Publisher |
Package publisher. |
release |
projen.release.Release |
Release management. |
upgradeWorkflow |
projen.javascript.UpgradeDependencies |
The upgrade workflow. |
docsDirectory |
string |
No description. |
libdir |
string |
The directory in which compiled .js files reside. |
srcdir |
string |
The directory in which the .ts sources reside. |
testdir |
string |
The directory in which tests reside. |
tsconfigDev |
projen.javascript.TypescriptConfig |
A typescript configuration file which covers all files (sources, tests, projen). |
watchTask |
Task |
The “watch” task. |
docgen |
boolean |
No description. |
eslint |
projen.javascript.Eslint |
No description. |
tsconfig |
projen.javascript.TypescriptConfig |
No description. |
tsconfigEslint |
projen.javascript.TypescriptConfig |
No description. |
appEntrypoint |
string |
The CDK8s app entrypoint. |
cdk8sDeps |
projen.cdk8s.Cdk8sDeps |
No description. |
node
Required public readonly node: Node;
The tree node.
buildTask
Required public readonly buildTask: Task;
commitGenerated
Required public readonly commitGenerated: boolean;
Whether to commit the managed files by default.
compileTask
Required public readonly compileTask: Task;
components
Required public readonly components: Component[];
Returns all the components within this project.
deps
Required public readonly deps: Dependencies;
Project dependencies.
ejected
Required public readonly ejected: boolean;
Whether or not the project is being ejected.
files
Required public readonly files: FileBase[];
All files in this project.
gitattributes
Required public readonly gitattributes: GitAttributesFile;
The .gitattributes file for this repository.
gitignore
Required public readonly gitignore: IgnoreFile;
.gitignore.
logger
Required public readonly logger: Logger;
Logging utilities.
name
Required public readonly name: string;
Project name.
outdir
Required public readonly outdir: string;
Absolute output directory of this project.
packageTask
Required public readonly packageTask: Task;
postCompileTask
Required public readonly postCompileTask: Task;
preCompileTask
Required public readonly preCompileTask: Task;
projectBuild
Required public readonly projectBuild: ProjectBuild;
Manages the build process of the project.
projenCommand
Required public readonly projenCommand: string;
The command to use in order to run the projen CLI.
root
Required public readonly root: Project;
The root project.
subprojects
Required public readonly subprojects: Project[];
Returns all the subprojects within this project.
tasks
Required public readonly tasks: Tasks;
Project tasks.
testTask
Required public readonly testTask: Task;
defaultTask
Optional public readonly defaultTask: Task;
This is the “default” task, the one that executes “projen”.
Undefined if the project is being ejected.
initProject
Optional public readonly initProject: InitProject;
The options used when this project is bootstrapped via projen new
.
It includes the original set of options passed to the CLI and also the JSII FQN of the project type.
parent
Optional public readonly parent: Project;
A parent project.
If undefined, this is the root project.
projectType
Required public readonly projectType: ProjectType;
autoApprove
Optional public readonly autoApprove: AutoApprove;
Auto approve set up for this project.
devContainer
Optional public readonly devContainer: DevContainer;
Access for .devcontainer.json (used for GitHub Codespaces).
This will be undefined
if devContainer boolean is false
github
Optional public readonly github: GitHub;
Access all github components.
This will be undefined
for subprojects.
gitpod
Optional public readonly gitpod: Gitpod;
Access for Gitpod.
This will be undefined
if gitpod boolean is false
vscode
Optional public readonly vscode: VsCode;
Access all VSCode components.
This will be undefined
for subprojects.
allowLibraryDependencies
package.allowLibraryDependencies
public readonly allowLibraryDependencies: boolean;
artifactsDirectory
Required public readonly artifactsDirectory: string;
The build output directory.
An npm tarball will be created under the js
subdirectory. For example, if this is set to dist
(the default), the npm
tarball will be placed under dist/js/boom-boom-1.2.3.tg
.
artifactsJavascriptDirectory
Required public readonly artifactsJavascriptDirectory: string;
The location of the npm tarball after build (${artifactsDirectory}/js
).
bundler
Required public readonly bundler: Bundler;
entrypoint
package.entrypoint
public readonly entrypoint: string;
manifest
package.addField(x, y)
public readonly manifest: any;
npmrc
Required public readonly npmrc: NpmConfig;
The .npmrc file.
package
Required public readonly package: NodePackage;
API for managing the node package.
packageManager
package.packageManager
public readonly packageManager: NodePackageManager;
The package manager to use.
runScriptCommand
Required public readonly runScriptCommand: string;
The command to use to run scripts (e.g. yarn run
or npm run
depends on the package manager).
autoMerge
Optional public readonly autoMerge: AutoMerge;
Component that sets up mergify for merging approved pull requests.
buildWorkflow
Optional public readonly buildWorkflow: BuildWorkflow;
The PR build GitHub workflow.
undefined
if buildWorkflow
is disabled.
buildWorkflowJobId
Optional public readonly buildWorkflowJobId: string;
The job ID of the build workflow.
jest
Optional public readonly jest: Jest;
The Jest configuration (if enabled).
maxNodeVersion
Optional public readonly maxNodeVersion: string;
Maximum node version required by this package.
minNodeVersion
Optional public readonly minNodeVersion: string;
Minimum node.js version required by this package.
npmignore
Optional public readonly npmignore: IgnoreFile;
The .npmignore file.
prettier
Optional public readonly prettier: Prettier;
publisher
release.publisher
.public readonly publisher: Publisher;
Package publisher.
This will be undefined
if the project does not have a
release workflow.
release
Optional public readonly release: Release;
Release management.
upgradeWorkflow
Optional public readonly upgradeWorkflow: UpgradeDependencies;
The upgrade workflow.
docsDirectory
Required public readonly docsDirectory: string;
libdir
Required public readonly libdir: string;
The directory in which compiled .js files reside.
srcdir
Required public readonly srcdir: string;
The directory in which the .ts sources reside.
testdir
Required public readonly testdir: string;
The directory in which tests reside.
tsconfigDev
Required public readonly tsconfigDev: TypescriptConfig;
A typescript configuration file which covers all files (sources, tests, projen).
watchTask
Required public readonly watchTask: Task;
The “watch” task.
docgen
Optional public readonly docgen: boolean;
eslint
Optional public readonly eslint: Eslint;
tsconfig
Optional public readonly tsconfig: TypescriptConfig;
tsconfigEslint
Optional public readonly tsconfigEslint: TypescriptConfig;
appEntrypoint
Required public readonly appEntrypoint: string;
The CDK8s app entrypoint.
cdk8sDeps
Required public readonly cdk8sDeps: Cdk8sDeps;
Name | Type | Description |
---|---|---|
DEFAULT_TASK |
string |
The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASK
Required public readonly DEFAULT_TASK: string;
The name of the default task (the task executed when projen
is run without arguments).
Normally this task should synthesize the project files.
Represents cdk.json file.
import { awscdk } from 'projen'
new awscdk.CdkConfig(project: Project, options: CdkConfigOptions)
Name | Type | Description |
---|---|---|
project |
Project |
No description. |
options |
projen.awscdk.CdkConfigOptions |
No description. |
project
Required options
Required Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
postSynthesize |
Called after synthesis. |
preSynthesize |
Called before synthesis. |
synthesize |
Synthesizes files to the project output directory. |
addExcludes |
Add excludes to cdk.json . |
addIncludes |
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
.
patterns
Required The excludes to add.
addIncludes
public addIncludes(patterns: string): void
Add includes to cdk.json
.
patterns
Required The includes to add.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isComponent |
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.
x
Required Any object.
isComponent
import { awscdk } from 'projen'
awscdk.CdkConfig.isComponent(x: any)
Test whether the given construct is a component.
x
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
project |
Project |
No description. |
cdkout |
string |
Name of the cdk.out directory. |
exclude |
string[] |
List of glob patterns to be excluded by CDK. |
include |
string[] |
List of glob patterns to be included by CDK. |
json |
JsonFile |
Represents the JSON file. |
node
Required public readonly node: Node;
The tree node.
project
Required public readonly project: Project;
cdkout
Required public readonly cdkout: string;
Name of the cdk.out directory.
exclude
Required public readonly exclude: string[];
List of glob patterns to be excluded by CDK.
include
Required public readonly include: string[];
List of glob patterns to be included by CDK.
json
Required public readonly json: JsonFile;
Represents the JSON file.
Adds standard AWS CDK tasks to your project.
import { awscdk } from 'projen'
new awscdk.CdkTasks(project: Project)
Name | Type | Description |
---|---|---|
project |
Project |
No description. |
project
Required Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
postSynthesize |
Called after synthesis. |
preSynthesize |
Called before synthesis. |
synthesize |
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.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isComponent |
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.
x
Required Any object.
isComponent
import { awscdk } from 'projen'
awscdk.CdkTasks.isComponent(x: any)
Test whether the given construct is a component.
x
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
project |
Project |
No description. |
deploy |
Task |
Deploys your app. |
destroy |
Task |
Destroys all the stacks. |
diff |
Task |
Diff against production. |
synth |
Task |
Synthesizes your app. |
synthSilent |
Task |
Synthesizes your app and suppresses stdout. |
watch |
Task |
Watch task. |
node
Required public readonly node: Node;
The tree node.
project
Required public readonly project: Project;
deploy
Required public readonly deploy: Task;
Deploys your app.
destroy
Required public readonly destroy: Task;
Destroys all the stacks.
diff
Required public readonly diff: Task;
Diff against production.
synth
Required public readonly synth: Task;
Synthesizes your app.
synthSilent
Required public readonly synthSilent: Task;
Synthesizes your app and suppresses stdout.
watch
Required public readonly watch: Task;
Watch task.
CI for GitLab.
A CI is a configurable automated process made up of one or more stages/jobs.
import { gitlab } from 'projen'
new gitlab.CiConfiguration(project: Project, name: string, options?: CiConfigurationOptions)
Name | Type | Description |
---|---|---|
project |
Project |
No description. |
name |
string |
No description. |
options |
projen.gitlab.CiConfigurationOptions |
No description. |
project
Required name
Required options
Optional Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
postSynthesize |
Called after synthesis. |
preSynthesize |
Called before synthesis. |
synthesize |
Synthesizes files to the project output directory. |
addGlobalVariables |
Add a globally defined variable to the CI configuration. |
addIncludes |
Add additional yml/yaml files to the CI includes. |
addJobs |
Add jobs and their stages to the CI configuration. |
addServices |
Add additional services. |
addStages |
Add stages to the CI configuration if not already present. |
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.
addGlobalVariables
public addGlobalVariables(variables: {[ key: string ]: any}): void
Add a globally defined variable to the CI configuration.
variables
Required The variables to add.
addIncludes
public addIncludes(includes: Include): void
Add additional yml/yaml files to the CI includes.
includes
Required The includes to add.
addJobs
public addJobs(jobs: {[ key: string ]: Job}): void
Add jobs and their stages to the CI configuration.
jobs
Required Jobs to add.
addServices
public addServices(services: Service): void
Add additional services.
services
Required The services to add.
addStages
public addStages(stages: string): void
Add stages to the CI configuration if not already present.
stages
Required stages to add.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isComponent |
Test whether the given construct is a component. |
isConstruct
import { gitlab } from 'projen'
gitlab.CiConfiguration.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isComponent
import { gitlab } from 'projen'
gitlab.CiConfiguration.isComponent(x: any)
Test whether the given construct is a component.
x
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
project |
Project |
No description. |
defaultAfterScript |
string[] |
Defines default scripts that should run after all jobs. |
defaultBeforeScript |
string[] |
Defines default scripts that should run before all jobs. |
defaultTags |
string[] |
Used to select a specific runner from the list of all runners that are available for the project. |
file |
YamlFile |
The workflow YAML file. |
jobs |
{[ key: string ]: projen.gitlab.Job} |
The jobs in the CI configuration. |
name |
string |
The name of the configuration. |
path |
string |
Path to CI file generated by the configuration. |
stages |
string[] |
Groups jobs into stages. |
variables |
{[ key: string ]: string \| number \| projen.gitlab.VariableConfig} |
Global variables that are passed to jobs. |
defaultArtifacts |
projen.gitlab.Artifacts |
Default list of files and directories that should be attached to the job if it succeeds. |
defaultCache |
projen.gitlab.Cache |
A default list of files and directories to cache between jobs. |
defaultImage |
projen.gitlab.Image |
Specifies the default docker image to use globally for all jobs. |
defaultInterruptible |
boolean |
The default behavior for whether a job should be canceled when a newer pipeline starts before the job completes (Default: false). |
defaultRetry |
projen.gitlab.Retry |
How many times a job is retried if it fails. |
defaultTimeout |
string |
A default timeout job written in natural language (Ex. |
pages |
projen.gitlab.Job |
A special job used to upload static sites to Gitlab pages. |
workflow |
projen.gitlab.Workflow |
Used to control pipeline behavior. |
node
Required public readonly node: Node;
The tree node.
project
Required public readonly project: Project;
defaultAfterScript
Required public readonly defaultAfterScript: string[];
Defines default scripts that should run after all jobs.
Can be overriden by the job level afterScript
.
defaultBeforeScript
Required public readonly defaultBeforeScript: string[];
Defines default scripts that should run before all jobs.
Can be overriden by the job level afterScript
.
defaultTags
Required public readonly defaultTags: string[];
Used to select a specific runner from the list of all runners that are available for the project.
file
Required public readonly file: YamlFile;
The workflow YAML file.
jobs
Required public readonly jobs: {[ key: string ]: Job};
The jobs in the CI configuration.
name
Required public readonly name: string;
The name of the configuration.
path
Required public readonly path: string;
Path to CI file generated by the configuration.
stages
Required public readonly stages: string[];
Groups jobs into stages.
All jobs in one stage must complete before next stage is executed. Defaults to [‘build’, ‘test’, ‘deploy’].
variables
Required public readonly variables: {[ key: string ]: string | number | VariableConfig};
Type: {[ key: string ]: string | number | projen.gitlab.VariableConfig} |
Global variables that are passed to jobs.
If the job already has that variable defined, the job-level variable takes precedence.
defaultArtifacts
Optional public readonly defaultArtifacts: Artifacts;
Default list of files and directories that should be attached to the job if it succeeds.
Artifacts are sent to Gitlab where they can be downloaded.
defaultCache
Optional public readonly defaultCache: Cache;
A default list of files and directories to cache between jobs.
You can only use paths that are in the local working copy.
defaultImage
Optional public readonly defaultImage: Image;
Specifies the default docker image to use globally for all jobs.
defaultInterruptible
Optional public readonly defaultInterruptible: boolean;
The default behavior for whether a job should be canceled when a newer pipeline starts before the job completes (Default: false).
defaultRetry
Optional public readonly defaultRetry: Retry;
How many times a job is retried if it fails.
If not defined, defaults to 0 and jobs do not retry.
defaultTimeout
Optional public readonly defaultTimeout: string;
A default timeout job written in natural language (Ex.
one hour, 3600 seconds, 60 minutes).
pages
Optional public readonly pages: Job;
A special job used to upload static sites to Gitlab pages.
Requires a public/
directory
with artifacts.path
pointing to it.
workflow
Optional public readonly workflow: Workflow;
Used to control pipeline behavior.
Circleci Class to manage .circleci/config.yml
. Check projen’s docs for more information.
import { circleci } from 'projen'
new circleci.Circleci(project: Project, options?: CircleCiProps)
Name | Type | Description |
---|---|---|
project |
Project |
No description. |
options |
projen.circleci.CircleCiProps |
No description. |
project
Required options
Optional Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
postSynthesize |
Called after synthesis. |
preSynthesize |
Called before synthesis. |
synthesize |
Synthesizes files to the project output directory. |
addOrb |
Add a Circleci Orb to pipeline. |
addWorkflow |
add new workflow to existing pipeline. |
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.
addOrb
public addOrb(name: string, orb: string): void
Add a Circleci Orb to pipeline.
Will throw error if the orb already exists
name
Required orb
Required addWorkflow
public addWorkflow(workflow: Workflow): void
add new workflow to existing pipeline.
workflow
Required Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isComponent |
Test whether the given construct is a component. |
isConstruct
import { circleci } from 'projen'
circleci.Circleci.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isComponent
import { circleci } from 'projen'
circleci.Circleci.isComponent(x: any)
Test whether the given construct is a component.
x
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
project |
Project |
No description. |
file |
YamlFile |
The yaml file for the Circleci pipeline. |
node
Required public readonly node: Node;
The tree node.
project
Required public readonly project: Project;
file
Required public readonly file: YamlFile;
The yaml file for the Circleci pipeline.
Represents a project component.
import { Component } from 'projen'
new Component(scope: IConstruct, id?: string)
Name | Type | Description |
---|---|---|
scope |
constructs.IConstruct |
No description. |
id |
string |
No description. |
scope
Required id
Optional Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
postSynthesize |
Called after synthesis. |
preSynthesize |
Called before synthesis. |
synthesize |
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.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isComponent |
Test whether the given construct is a component. |
isConstruct
import { Component } from 'projen'
Component.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isComponent
import { Component } from 'projen'
Component.isComponent(x: any)
Test whether the given construct is a component.
x
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
project |
Project |
No description. |
node
Required public readonly node: Node;
The tree node.
project
Required public readonly project: Project;
A multi-language library for CDK constructs.
import { cdk } from 'projen'
new cdk.ConstructLibrary(options: ConstructLibraryOptions)
Name | Type | Description |
---|---|---|
options |
projen.cdk.ConstructLibraryOptions |
No description. |
options
Required Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
addExcludeFromCleanup |
Exclude the matching files from pre-synth cleanup. |
addGitIgnore |
Adds a .gitignore pattern. |
addPackageIgnore |
Exclude these files from the bundled package. |
addTask |
Adds a new task to this project. |
addTip |
Prints a “tip” message during synthesis. |
annotateGenerated |
Marks the provided file(s) as being generated. |
postSynthesize |
Called after all components are synthesized. |
preSynthesize |
Called before all components are synthesized. |
removeTask |
Removes a task from a project. |
runTaskCommand |
Returns the shell command to execute in order to run a task. |
synth |
Synthesize all project files into outdir . |
tryFindFile |
Finds a file at the specified relative path within this project and all its subprojects. |
tryFindJsonFile |
Finds a json file by name. |
tryFindObjectFile |
Finds an object file (like JsonFile, YamlFile, etc.) by name. |
tryRemoveFile |
Finds a file at the specified relative path within this project and removes it. |
addBins |
No description. |
addBundledDeps |
Defines bundled dependencies. |
addCompileCommand |
DEPRECATED. |
addDeps |
Defines normal dependencies. |
addDevDeps |
Defines development/test dependencies. |
addFields |
Directly set fields in package.json . |
addKeywords |
Adds keywords to package.json (deduplicated). |
addPeerDeps |
Defines peer dependencies. |
addScripts |
Replaces the contents of multiple npm package.json scripts. |
addTestCommand |
DEPRECATED. |
hasScript |
Indicates if a script by the name name is defined. |
removeScript |
Removes the npm script (always successful). |
renderWorkflowSetup |
Returns the set of workflow steps which should be executed to bootstrap a workflow. |
setScript |
Replaces the contents of an npm package.json script. |
toString
public toString(): string
Returns a string representation of this construct.
addExcludeFromCleanup
public addExcludeFromCleanup(globs: string): void
Exclude the matching files from pre-synth cleanup.
Can be used when, for example, some source files include the projen marker and we don’t want them to be erased during synth.
globs
Required The glob patterns to match.
addGitIgnore
public addGitIgnore(pattern: string): void
Adds a .gitignore pattern.
pattern
Required The glob pattern to ignore.
addPackageIgnore
public addPackageIgnore(pattern: string): void
Exclude these files from the bundled package.
Implemented by project types based on the
packaging mechanism. For example, NodeProject
delegates this to .npmignore
.
pattern
Required addTask
public addTask(name: string, props?: TaskOptions): Task
Adds a new task to this project.
This will fail if the project already has a task with this name.
name
Required The task name to add.
props
Optional Task properties.
addTip
public addTip(message: string): void
Prints a “tip” message during synthesis.
message
Required The message.
annotateGenerated
public annotateGenerated(glob: string): void
Marks the provided file(s) as being generated.
This is achieved using the github-linguist attributes. Generated files do not count against the repository statistics and language breakdown.
https://github.com/github/linguist/blob/master/docs/overrides.md
glob
Required the glob pattern to match (could be a file path).
postSynthesize
public postSynthesize(): void
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before all components are synthesized.
removeTask
public removeTask(name: string): Task
Removes a task from a project.
name
Required The name of the task to remove.
runTaskCommand
public runTaskCommand(task: Task): string
Returns the shell command to execute in order to run a task.
This will
typically be npx projen TASK
.
task
Required The task for which the command is required.
synth
public synth(): void
Synthesize all project files into outdir
.
tryFindFile
public tryFindFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and all its subprojects.
filePath
Required The file path.
If this path is relative, it will be resolved from the root of this project.
tryFindJsonFile
public tryFindJsonFile(filePath: string): JsonFile
Finds a json file by name.
filePath
Required The file path.
tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required The file path.
tryRemoveFile
public tryRemoveFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and removes it.
filePath
Required The file path.
If this path is relative, it will be resolved from the root of this project.
addBins
public addBins(bins: {[ key: string ]: string}): void
bins
Required addBundledDeps
public addBundledDeps(deps: string): void
Defines bundled dependencies.
Bundled dependencies will be added as normal dependencies as well as to the
bundledDependencies
section of your package.json
.
deps
Required 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
public addCompileCommand(commands: string): void
DEPRECATED.
commands
Required addDeps
public addDeps(deps: string): void
Defines normal dependencies.
deps
Required Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn
add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
addDevDeps
public addDevDeps(deps: string): void
Defines development/test dependencies.
deps
Required Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn
add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
addFields
public addFields(fields: {[ key: string ]: any}): void
Directly set fields in package.json
.
fields
Required The fields to set.
addKeywords
public addKeywords(keywords: string): void
Adds keywords to package.json (deduplicated).
keywords
Required The keywords to add.
addPeerDeps
public addPeerDeps(deps: string): void
Defines peer dependencies.
When adding peer dependencies, a devDependency will also be added on the pinned version of the declared peer. This will ensure that you are testing your code against the minimum version required from your consumers.
deps
Required Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn
add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
addScripts
public addScripts(scripts: {[ key: string ]: string}): void
Replaces the contents of multiple npm package.json scripts.
scripts
Required The scripts to set.
addTestCommand
public addTestCommand(commands: string): void
DEPRECATED.
commands
Required hasScript
public hasScript(name: string): boolean
Indicates if a script by the name name is defined.
name
Required The name of the script.
removeScript
public removeScript(name: string): void
Removes the npm script (always successful).
name
Required The name of the script.
renderWorkflowSetup
public renderWorkflowSetup(options?: RenderWorkflowSetupOptions): JobStep[]
Returns the set of workflow steps which should be executed to bootstrap a workflow.
options
Optional Options.
setScript
public setScript(name: string, command: string): void
Replaces the contents of an npm package.json script.
name
Required The script name.
command
Required The command to execute.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isProject |
Test whether the given construct is a project. |
of |
Find the closest ancestor project for given construct. |
isConstruct
import { cdk } from 'projen'
cdk.ConstructLibrary.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required Any object.
isProject
import { cdk } from 'projen'
cdk.ConstructLibrary.isProject(x: any)
Test whether the given construct is a project.
x
Required of
import { cdk } from 'projen'
cdk.ConstructLibrary.of(construct: IConstruct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
construct
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
buildTask |
Task |
No description. |
commitGenerated |
boolean |
Whether to commit the managed files by default. |
compileTask |
Task |
No description. |
components |
Component[] |
Returns all the components within this project. |
deps |
Dependencies |
Project dependencies. |
ejected |
boolean |
Whether or not the project is being ejected. |
files |
FileBase[] |
All files in this project. |
gitattributes |
GitAttributesFile |
The .gitattributes file for this repository. |
gitignore |
IgnoreFile |
.gitignore. |
logger |
Logger |
Logging utilities. |
name |
string |
Project name. |
outdir |
string |
Absolute output directory of this project. |
packageTask |
Task |
No description. |
postCompileTask |
Task |
No description. |
preCompileTask |
Task |
No description. |
projectBuild |
ProjectBuild |
Manages the build process of the project. |
projenCommand |
string |
The command to use in order to run the projen CLI. |
root |
Project |
The root project. |
subprojects |
Project[] |
Returns all the subprojects within this project. |
tasks |
Tasks |
Project tasks. |
testTask |
Task |
No description. |
defaultTask |
Task |
This is the “default” task, the one that executes “projen”. |
initProject |
InitProject |
The options used when this project is bootstrapped via projen new . |
parent |
Project |
A parent project. |
projectType |
ProjectType |
No description. |
autoApprove |
projen.github.AutoApprove |
Auto approve set up for this project. |
devContainer |
projen.vscode.DevContainer |
Access for .devcontainer.json (used for GitHub Codespaces). |
github |
projen.github.GitHub |
Access all github components. |
gitpod |
Gitpod |
Access for Gitpod. |
vscode |
projen.vscode.VsCode |
Access all VSCode components. |
allowLibraryDependencies |
boolean |
No description. |
artifactsDirectory |
string |
The build output directory. |
artifactsJavascriptDirectory |
string |
The location of the npm tarball after build (${artifactsDirectory}/js ). |
bundler |
projen.javascript.Bundler |
No description. |
entrypoint |
string |
No description. |
manifest |
any |
No description. |
npmrc |
projen.javascript.NpmConfig |
The .npmrc file. |
package |
projen.javascript.NodePackage |
API for managing the node package. |
packageManager |
projen.javascript.NodePackageManager |
The package manager to use. |
runScriptCommand |
string |
The command to use to run scripts (e.g. yarn run or npm run depends on the package manager). |
autoMerge |
projen.github.AutoMerge |
Component that sets up mergify for merging approved pull requests. |
buildWorkflow |
projen.build.BuildWorkflow |
The PR build GitHub workflow. |
buildWorkflowJobId |
string |
The job ID of the build workflow. |
jest |
projen.javascript.Jest |
The Jest configuration (if enabled). |
maxNodeVersion |
string |
Maximum node version required by this package. |
minNodeVersion |
string |
Minimum node.js version required by this package. |
npmignore |
IgnoreFile |
The .npmignore file. |
prettier |
projen.javascript.Prettier |
No description. |
publisher |
projen.release.Publisher |
Package publisher. |
release |
projen.release.Release |
Release management. |
upgradeWorkflow |
projen.javascript.UpgradeDependencies |
The upgrade workflow. |
docsDirectory |
string |
No description. |
libdir |
string |
The directory in which compiled .js files reside. |
srcdir |
string |
The directory in which the .ts sources reside. |
testdir |
string |
The directory in which tests reside. |
tsconfigDev |
projen.javascript.TypescriptConfig |
A typescript configuration file which covers all files (sources, tests, projen). |
watchTask |
Task |
The “watch” task. |
docgen |
boolean |
No description. |
eslint |
projen.javascript.Eslint |
No description. |
tsconfig |
projen.javascript.TypescriptConfig |
No description. |
tsconfigEslint |
projen.javascript.TypescriptConfig |
No description. |
node
Required public readonly node: Node;
The tree node.
buildTask
Required public readonly buildTask: Task;
commitGenerated
Required public readonly commitGenerated: boolean;
Whether to commit the managed files by default.
compileTask
Required public readonly compileTask: Task;
components
Required public readonly components: Component[];
Returns all the components within this project.
deps
Required public readonly deps: Dependencies;
Project dependencies.
ejected
Required public readonly ejected: boolean;
Whether or not the project is being ejected.
files
Required public readonly files: FileBase[];
All files in this project.
gitattributes
Required public readonly gitattributes: GitAttributesFile;
The .gitattributes file for this repository.
gitignore
Required public readonly gitignore: IgnoreFile;
.gitignore.
logger
Required public readonly logger: Logger;
Logging utilities.
name
Required public readonly name: string;
Project name.
outdir
Required public readonly outdir: string;
Absolute output directory of this project.
packageTask
Required public readonly packageTask: Task;
postCompileTask
Required public readonly postCompileTask: Task;
preCompileTask
Required public readonly preCompileTask: Task;
projectBuild
Required public readonly projectBuild: ProjectBuild;
Manages the build process of the project.
projenCommand
Required public readonly projenCommand: string;
The command to use in order to run the projen CLI.
root
Required public readonly root: Project;
The root project.
subprojects
Required public readonly subprojects: Project[];
Returns all the subprojects within this project.
tasks
Required public readonly tasks: Tasks;
Project tasks.
testTask
Required public readonly testTask: Task;
defaultTask
Optional public readonly defaultTask: Task;
This is the “default” task, the one that executes “projen”.
Undefined if the project is being ejected.
initProject
Optional public readonly initProject: InitProject;
The options used when this project is bootstrapped via projen new
.
It includes the original set of options passed to the CLI and also the JSII FQN of the project type.
parent
Optional public readonly parent: Project;
A parent project.
If undefined, this is the root project.
projectType
Required public readonly projectType: ProjectType;
autoApprove
Optional public readonly autoApprove: AutoApprove;
Auto approve set up for this project.
devContainer
Optional public readonly devContainer: DevContainer;
Access for .devcontainer.json (used for GitHub Codespaces).
This will be undefined
if devContainer boolean is false
github
Optional public readonly github: GitHub;
Access all github components.
This will be undefined
for subprojects.
gitpod
Optional public readonly gitpod: Gitpod;
Access for Gitpod.
This will be undefined
if gitpod boolean is false
vscode
Optional public readonly vscode: VsCode;
Access all VSCode components.
This will be undefined
for subprojects.
allowLibraryDependencies
package.allowLibraryDependencies
public readonly allowLibraryDependencies: boolean;
artifactsDirectory
Required public readonly artifactsDirectory: string;
The build output directory.
An npm tarball will be created under the js
subdirectory. For example, if this is set to dist
(the default), the npm
tarball will be placed under dist/js/boom-boom-1.2.3.tg
.
artifactsJavascriptDirectory
Required public readonly artifactsJavascriptDirectory: string;
The location of the npm tarball after build (${artifactsDirectory}/js
).
bundler
Required public readonly bundler: Bundler;
entrypoint
package.entrypoint
public readonly entrypoint: string;
manifest
package.addField(x, y)
public readonly manifest: any;
npmrc
Required public readonly npmrc: NpmConfig;
The .npmrc file.
package
Required public readonly package: NodePackage;
API for managing the node package.
packageManager
package.packageManager
public readonly packageManager: NodePackageManager;
The package manager to use.
runScriptCommand
Required public readonly runScriptCommand: string;
The command to use to run scripts (e.g. yarn run
or npm run
depends on the package manager).
autoMerge
Optional public readonly autoMerge: AutoMerge;
Component that sets up mergify for merging approved pull requests.
buildWorkflow
Optional public readonly buildWorkflow: BuildWorkflow;
The PR build GitHub workflow.
undefined
if buildWorkflow
is disabled.
buildWorkflowJobId
Optional public readonly buildWorkflowJobId: string;
The job ID of the build workflow.
jest
Optional public readonly jest: Jest;
The Jest configuration (if enabled).
maxNodeVersion
Optional public readonly maxNodeVersion: string;
Maximum node version required by this package.
minNodeVersion
Optional public readonly minNodeVersion: string;
Minimum node.js version required by this package.
npmignore
Optional public readonly npmignore: IgnoreFile;
The .npmignore file.
prettier
Optional public readonly prettier: Prettier;
publisher
release.publisher
.public readonly publisher: Publisher;
Package publisher.
This will be undefined
if the project does not have a
release workflow.
release
Optional public readonly release: Release;
Release management.
upgradeWorkflow
Optional public readonly upgradeWorkflow: UpgradeDependencies;
The upgrade workflow.
docsDirectory
Required public readonly docsDirectory: string;
libdir
Required public readonly libdir: string;
The directory in which compiled .js files reside.
srcdir
Required public readonly srcdir: string;
The directory in which the .ts sources reside.
testdir
Required public readonly testdir: string;
The directory in which tests reside.
tsconfigDev
Required public readonly tsconfigDev: TypescriptConfig;
A typescript configuration file which covers all files (sources, tests, projen).
watchTask
Required public readonly watchTask: Task;
The “watch” task.
docgen
Optional public readonly docgen: boolean;
eslint
Optional public readonly eslint: Eslint;
tsconfig
Optional public readonly tsconfig: TypescriptConfig;
tsconfigEslint
Optional public readonly tsconfigEslint: TypescriptConfig;
Name | Type | Description |
---|---|---|
DEFAULT_TASK |
string |
The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASK
Required public readonly DEFAULT_TASK: string;
The name of the default task (the task executed when projen
is run without arguments).
Normally this task should synthesize the project files.
import { awscdk } from 'projen'
new awscdk.ConstructLibraryAws(options: AwsCdkConstructLibraryOptions)
Name | Type | Description |
---|---|---|
options |
projen.awscdk.AwsCdkConstructLibraryOptions |
No description. |
options
Required Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
addExcludeFromCleanup |
Exclude the matching files from pre-synth cleanup. |
addGitIgnore |
Adds a .gitignore pattern. |
addPackageIgnore |
Exclude these files from the bundled package. |
addTask |
Adds a new task to this project. |
addTip |
Prints a “tip” message during synthesis. |
annotateGenerated |
Marks the provided file(s) as being generated. |
postSynthesize |
Called after all components are synthesized. |
preSynthesize |
Called before all components are synthesized. |
removeTask |
Removes a task from a project. |
runTaskCommand |
Returns the shell command to execute in order to run a task. |
synth |
Synthesize all project files into outdir . |
tryFindFile |
Finds a file at the specified relative path within this project and all its subprojects. |
tryFindJsonFile |
Finds a json file by name. |
tryFindObjectFile |
Finds an object file (like JsonFile, YamlFile, etc.) by name. |
tryRemoveFile |
Finds a file at the specified relative path within this project and removes it. |
addBins |
No description. |
addBundledDeps |
Defines bundled dependencies. |
addCompileCommand |
DEPRECATED. |
addDeps |
Defines normal dependencies. |
addDevDeps |
Defines development/test dependencies. |
addFields |
Directly set fields in package.json . |
addKeywords |
Adds keywords to package.json (deduplicated). |
addPeerDeps |
Defines peer dependencies. |
addScripts |
Replaces the contents of multiple npm package.json scripts. |
addTestCommand |
DEPRECATED. |
hasScript |
Indicates if a script by the name name is defined. |
removeScript |
Removes the npm script (always successful). |
renderWorkflowSetup |
Returns the set of workflow steps which should be executed to bootstrap a workflow. |
setScript |
Replaces the contents of an npm package.json script. |
addCdkDependencies |
Adds dependencies to AWS CDK modules. |
addCdkTestDependencies |
Adds AWS CDK modules as dev dependencies. |
toString
public toString(): string
Returns a string representation of this construct.
addExcludeFromCleanup
public addExcludeFromCleanup(globs: string): void
Exclude the matching files from pre-synth cleanup.
Can be used when, for example, some source files include the projen marker and we don’t want them to be erased during synth.
globs
Required The glob patterns to match.
addGitIgnore
public addGitIgnore(pattern: string): void
Adds a .gitignore pattern.
pattern
Required The glob pattern to ignore.
addPackageIgnore
public addPackageIgnore(pattern: string): void
Exclude these files from the bundled package.
Implemented by project types based on the
packaging mechanism. For example, NodeProject
delegates this to .npmignore
.
pattern
Required addTask
public addTask(name: string, props?: TaskOptions): Task
Adds a new task to this project.
This will fail if the project already has a task with this name.
name
Required The task name to add.
props
Optional Task properties.
addTip
public addTip(message: string): void
Prints a “tip” message during synthesis.
message
Required The message.
annotateGenerated
public annotateGenerated(glob: string): void
Marks the provided file(s) as being generated.
This is achieved using the github-linguist attributes. Generated files do not count against the repository statistics and language breakdown.
https://github.com/github/linguist/blob/master/docs/overrides.md
glob
Required the glob pattern to match (could be a file path).
postSynthesize
public postSynthesize(): void
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before all components are synthesized.
removeTask
public removeTask(name: string): Task
Removes a task from a project.
name
Required The name of the task to remove.
runTaskCommand
public runTaskCommand(task: Task): string
Returns the shell command to execute in order to run a task.
This will
typically be npx projen TASK
.
task
Required The task for which the command is required.
synth
public synth(): void
Synthesize all project files into outdir
.
tryFindFile
public tryFindFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and all its subprojects.
filePath
Required The file path.
If this path is relative, it will be resolved from the root of this project.
tryFindJsonFile
public tryFindJsonFile(filePath: string): JsonFile
Finds a json file by name.
filePath
Required The file path.
tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required The file path.
tryRemoveFile
public tryRemoveFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and removes it.
filePath
Required The file path.
If this path is relative, it will be resolved from the root of this project.
addBins
public addBins(bins: {[ key: string ]: string}): void
bins
Required addBundledDeps
public addBundledDeps(deps: string): void
Defines bundled dependencies.
Bundled dependencies will be added as normal dependencies as well as to the
bundledDependencies
section of your package.json
.
deps
Required 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
public addCompileCommand(commands: string): void
DEPRECATED.
commands
Required addDeps
public addDeps(deps: string): void
Defines normal dependencies.
deps
Required Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn
add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
addDevDeps
public addDevDeps(deps: string): void
Defines development/test dependencies.
deps
Required Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn
add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
addFields
public addFields(fields: {[ key: string ]: any}): void
Directly set fields in package.json
.
fields
Required The fields to set.
addKeywords
public addKeywords(keywords: string): void
Adds keywords to package.json (deduplicated).
keywords
Required The keywords to add.
addPeerDeps
public addPeerDeps(deps: string): void
Defines peer dependencies.
When adding peer dependencies, a devDependency will also be added on the pinned version of the declared peer. This will ensure that you are testing your code against the minimum version required from your consumers.
deps
Required Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn
add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
addScripts
public addScripts(scripts: {[ key: string ]: string}): void
Replaces the contents of multiple npm package.json scripts.
scripts
Required The scripts to set.
addTestCommand
public addTestCommand(commands: string): void
DEPRECATED.
commands
Required hasScript
public hasScript(name: string): boolean
Indicates if a script by the name name is defined.
name
Required The name of the script.
removeScript
public removeScript(name: string): void
Removes the npm script (always successful).
name
Required The name of the script.
renderWorkflowSetup
public renderWorkflowSetup(options?: RenderWorkflowSetupOptions): JobStep[]
Returns the set of workflow steps which should be executed to bootstrap a workflow.
options
Optional Options.
setScript
public setScript(name: string, command: string): void
Replaces the contents of an npm package.json script.
name
Required The script name.
command
Required The command to execute.
addCdkDependencies
public addCdkDependencies(deps: string): void
Adds dependencies to AWS CDK modules.
Since this is a library project, dependencies will be added as peer dependencies.
deps
Required names of cdk modules (e.g. @aws-cdk/aws-lambda
).
addCdkTestDependencies
public addCdkTestDependencies(deps: string): void
Adds AWS CDK modules as dev dependencies.
deps
Required names of cdk modules (e.g. @aws-cdk/aws-lambda
).
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isProject |
Test whether the given construct is a project. |
of |
Find the closest ancestor project for given construct. |
isConstruct
import { 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.
x
Required Any object.
isProject
import { awscdk } from 'projen'
awscdk.ConstructLibraryAws.isProject(x: any)
Test whether the given construct is a project.
x
Required of
import { 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.
construct
Required Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
buildTask |
Task |
No description. |
commitGenerated |
boolean |
Whether to commit the managed files by default. |
compileTask |
Task |
No description. |
components |
Component[] |
Returns all the components within this project. |
deps |
Dependencies |
Project dependencies. |
ejected |
boolean |
Whether or not the project is being ejected. |
files |
FileBase[] |
All files in this project. |
gitattributes |
GitAttributesFile |
The .gitattributes file for this repository. |
gitignore |
IgnoreFile |
.gitignore. |
logger |
Logger |
Logging utilities. |
name |
string |
Project name. |
outdir |
string |
Absolute output directory of this project. |
packageTask |
Task |
No description. |
postCompileTask |
Task |
No description. |
preCompileTask |
Task |
No description. |
projectBuild |
ProjectBuild |
Manages the build process of the project. |
projenCommand |
string |
The command to use in order to run the projen CLI. |
root |
Project |
The root project. |
subprojects |
Project[] |
Returns all the subprojects within this project. |
tasks |
Tasks |
Project tasks. |
testTask |
Task |
No description. |
defaultTask |
Task |
This is the “default” task, the one that executes “projen”. |
initProject |
InitProject |
The options used when this project is bootstrapped via projen new . |
parent |
Project |
A parent project. |
projectType |
ProjectType |
No description. |
autoApprove |
projen.github.AutoApprove |
Auto approve set up for this project. |
devContainer |
projen.vscode.DevContainer |
Access for .devcontainer.json (used for GitHub Codespaces). |
github |
projen.github.GitHub |
Access all github components. |
gitpod |
Gitpod |
Access for Gitpod. |
vscode |
projen.vscode.VsCode |
Access all VSCode components. |
allowLibraryDependencies |
boolean |
No description. |
artifactsDirectory |
string |
The build output directory. |
artifactsJavascriptDirectory |
string |
The location of the npm tarball after build (${artifactsDirectory}/js ). |
bundler |
projen.javascript.Bundler |
No description. |
entrypoint |
string |
No description. |
manifest |
any |
No description. |
npmrc |
projen.javascript.NpmConfig |
The .npmrc file. |
package |
projen.javascript.NodePackage |
API for managing the node package. |
packageManager |
projen.javascript.NodePackageManager |
The package manager to use. |
runScriptCommand |
string |
The command to use to run scripts (e.g. yarn run or npm run depends on the package manager). |
autoMerge |
projen.github.AutoMerge |
Component that sets up mergify for merging approved pull requests. |
buildWorkflow |
projen.build.BuildWorkflow |
The PR build GitHub workflow. |
buildWorkflowJobId |
string |
The job ID of the build workflow. |
jest |
projen.javascript.Jest |
The Jest configuration (if enabled). |
maxNodeVersion |
string |
Maximum node version required by this package. |
minNodeVersion |
string |
Minimum node.js version required by this package. |
npmignore |
IgnoreFile |
The .npmignore file. |
prettier |
projen.javascript.Prettier |
No description. |
publisher |
projen.release.Publisher |
Package publisher. |
release |
projen.release.Release |
Release management. |
upgradeWorkflow |
projen.javascript.UpgradeDependencies |
The upgrade workflow. |
docsDirectory |
string |
No description. |
libdir |
string |
The directory in which compiled .js files reside. |
srcdir |
string |
The directory in which the .ts sources reside. |
testdir |
string |
The directory in which tests reside. |
tsconfigDev |
projen.javascript.TypescriptConfig |
A typescript configuration file which covers all files (sources, tests, projen). |
watchTask |
Task |
The “watch” task. |
docgen |
boolean |
No description. |
eslint |
projen.javascript.Eslint |
No description. |
tsconfig |
projen.javascript.TypescriptConfig |
No description. |
tsconfigEslint |
projen.javascript.TypescriptConfig |
No description. |
cdkDeps |
projen.awscdk.AwsCdkDeps |
No description. |
cdkVersion |
string |
The target CDK version for this library. |
version |
string |
No description. |
node
AwsCdkConstructLibrary
public readonly node: Node;
The tree node.
buildTask
AwsCdkConstructLibrary
public readonly buildTask: Task;
commitGenerated
AwsCdkConstructLibrary
public readonly commitGenerated: boolean;
Whether to commit the managed files by default.
compileTask
AwsCdkConstructLibrary
public readonly compileTask: Task;
components
AwsCdkConstructLibrary
public readonly components: Component[];
Returns all the components within this project.
deps
AwsCdkConstructLibrary
public readonly deps: Dependencies;
Project dependencies.
ejected
AwsCdkConstructLibrary
public readonly ejected: boolean;
Whether or not the project is being ejected.
files
AwsCdkConstructLibrary
public readonly files: FileBase[];
All files in this project.
gitattributes
AwsCdkConstructLibrary
public readonly gitattributes: GitAttributesFile;
The .gitattributes file for this repository.
gitignore
AwsCdkConstructLibrary
public readonly gitignore: IgnoreFile;
.gitignore.
logger
AwsCdkConstructLibrary
public readonly logger: Logger;
Logging utilities.
name
AwsCdkConstructLibrary
public readonly name: string;
Project name.
outdir
AwsCdkConstructLibrary
public readonly outdir: string;
Absolute output directory of this project.
packageTask
AwsCdkConstructLibrary
public readonly packageTask: Task;
postCompileTask
AwsCdkConstructLibrary
public readonly postCompileTask: Task;
preCompileTask
AwsCdkConstructLibrary
public readonly preCompileTask: Task;
projectBuild
AwsCdkConstructLibrary
public readonly projectBuild: ProjectBuild;
Manages the build process of the project.
projenCommand
AwsCdkConstructLibrary
public readonly projenCommand: string;
The command to use in order to run the projen CLI.
root
AwsCdkConstructLibrary
public readonly root: Project;
The root project.
subprojects
AwsCdkConstructLibrary
public readonly subprojects: Project[];
Returns all the subprojects within this project.
tasks
AwsCdkConstructLibrary
public readonly tasks: Tasks;
Project tasks.
testTask
AwsCdkConstructLibrary
public readonly testTask: Task;
defaultTask
AwsCdkConstructLibrary
public readonly defaultTask: Task;
This is the “default” task, the one that executes “projen”.
Undefined if the project is being ejected.
initProject
AwsCdkConstructLibrary
public readonly initProject: InitProject;
The options used when this project is bootstrapped via projen new
.
It includes the original set of options passed to the CLI and also the JSII FQN of the project type.
parent
AwsCdkConstructLibrary
public readonly parent: Project;
A parent project.
If undefined, this is the root project.
projectType
AwsCdkConstructLibrary
public readonly projectType: ProjectType;
autoApprove
AwsCdkConstructLibrary
public readonly autoApprove: AutoApprove;
Auto approve set up for this project.
devContainer
AwsCdkConstructLibrary
public readonly devContainer: DevContainer;
Access for .devcontainer.json (used for GitHub Codespaces).
This will be undefined
if devContainer boolean is false
github
AwsCdkConstructLibrary
public readonly github: GitHub;
Access all github components.
This will be undefined
for subprojects.
gitpod
AwsCdkConstructLibrary
public readonly gitpod: Gitpod;
Access for Gitpod.
This will be undefined
if gitpod boolean is false
vscode
AwsCdkConstructLibrary
public readonly vscode: VsCode;
Access all VSCode components.
This will be undefined
for subprojects.
allowLibraryDependencies
package.allowLibraryDependencies
public readonly allowLibraryDependencies: boolean;
artifactsDirectory
AwsCdkConstructLibrary
public readonly artifactsDirectory: string;
The build output directory.
An npm tarball will be created under the js
subdirectory. For example, if this is set to dist
(the default), the npm
tarball will be placed under dist/js/boom-boom-1.2.3.tg
.
artifactsJavascriptDirectory
AwsCdkConstructLibrary
public readonly artifactsJavascriptDirectory: string;
The location of the npm tarball after build (${artifactsDirectory}/js
).
bundler
AwsCdkConstructLibrary
public readonly bundler: Bundler;
entrypoint
package.entrypoint
public readonly entrypoint: string;
manifest
package.addField(x, y)
public readonly manifest: any;
npmrc
AwsCdkConstructLibrary
public readonly npmrc: NpmConfig;
The .npmrc file.
package
AwsCdkConstructLibrary
public readonly package: NodePackage;
API for managing the node package.
packageManager
package.packageManager
public readonly packageManager: NodePackageManager;
The package manager to use.
runScriptCommand
AwsCdkConstructLibrary
public readonly runScriptCommand: string;
The command to use to run scripts (e.g. yarn run
or npm run
depends on the package manager).
autoMerge
AwsCdkConstructLibrary
public readonly autoMerge: AutoMerge;
Component that sets up mergify for merging approved pull requests.
buildWorkflow
AwsCdkConstructLibrary
public readonly buildWorkflow: BuildWorkflow;
The PR build GitHub workflow.
undefined
if buildWorkflow
is disabled.
buildWorkflowJobId
AwsCdkConstructLibrary
public readonly buildWorkflowJobId: string;
The job ID of the build workflow.
jest
AwsCdkConstructLibrary
public readonly jest: Jest;
The Jest configuration (if enabled).
maxNodeVersion
AwsCdkConstructLibrary
public readonly maxNodeVersion: string;
Maximum node version required by this package.
minNodeVersion
AwsCdkConstructLibrary
public readonly minNodeVersion: string;
Minimum node.js version required by this package.
npmignore
AwsCdkConstructLibrary
public readonly npmignore: IgnoreFile;
The .npmignore file.
prettier
AwsCdkConstructLibrary
public readonly prettier: Prettier;
publisher
release.publisher
.public readonly publisher: Publisher;
Package publisher.
This will be undefined
if the project does not have a
release workflow.
release
AwsCdkConstructLibrary
public readonly release: Release;
Release management.
upgradeWorkflow
AwsCdkConstructLibrary
public readonly upgradeWorkflow: UpgradeDependencies;
The upgrade workflow.
docsDirectory
AwsCdkConstructLibrary
public readonly docsDirectory: string;
libdir
AwsCdkConstructLibrary
public readonly libdir: string;
The directory in which compiled .js files reside.
srcdir
AwsCdkConstructLibrary
public readonly srcdir: string;
The directory in which the .ts sources reside.
testdir
AwsCdkConstructLibrary
public readonly testdir: string;
The directory in which tests reside.
tsconfigDev
AwsCdkConstructLibrary
public readonly tsconfigDev: TypescriptConfig;
A typescript configuration file which covers all files (sources, tests, projen).
watchTask
AwsCdkConstructLibrary
public readonly watchTask: Task;
The “watch” task.
docgen
AwsCdkConstructLibrary
public readonly docgen: boolean;
eslint
AwsCdkConstructLibrary
public readonly eslint: Eslint;
tsconfig
AwsCdkConstructLibrary
public readonly tsconfig: TypescriptConfig;
tsconfigEslint
AwsCdkConstructLibrary
public readonly tsconfigEslint: TypescriptConfig;
cdkDeps
AwsCdkConstructLibrary
public readonly cdkDeps: AwsCdkDeps;
cdkVersion
AwsCdkConstructLibrary
public readonly cdkVersion: string;
The target CDK version for this library.
version
cdkVersion
public readonly version: string;
Name | Type | Description |
---|---|---|
DEFAULT_TASK |
string |
The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASK
AwsCdkConstructLibrary
public readonly DEFAULT_TASK: string;
The name of the default task (the task executed when projen
is run without arguments).
Normally this task should synthesize the project files.
CDK8s construct library project.
A multi-language (jsii) construct library which vends constructs designed to use within the CDK for Kubernetes (CDK8s), with a friendly workflow and automatic publishing to the construct catalog.
import { cdk8s } from 'projen'
new cdk8s.ConstructLibraryCdk8s(options: ConstructLibraryCdk8sOptions)
Name | Type | Description |
---|---|---|
options |
projen.cdk8s.ConstructLibraryCdk8sOptions |
No description. |
options
Required Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
addExcludeFromCleanup |
Exclude the matching files from pre-synth cleanup. |
addGitIgnore |
Adds a .gitignore pattern. |
addPackageIgnore |
Exclude these files from the bundled package. |
addTask |
Adds a new task to this project. |
addTip |
Prints a “tip” message during synthesis. |
annotateGenerated |
Marks the provided file(s) as being generated. |
postSynthesize |
Called after all components are synthesized. |
preSynthesize |
Called before all components are synthesized. |
removeTask |
Removes a task from a project. |
runTaskCommand |
Returns the shell command to execute in order to run a task. |
synth |
Synthesize all project files into outdir . |
tryFindFile |
Finds a file at the specified relative path within this project and all its subprojects. |
tryFindJsonFile |
Finds a json file by name. |
tryFindObjectFile |
Finds an object file (like JsonFile, YamlFile, etc.) by name. |
tryRemoveFile |
Finds a file at the specified relative path within this project and removes it. |
addBins |
No description. |
addBundledDeps |
Defines bundled dependencies. |
addCompileCommand |
DEPRECATED. |
addDeps |
Defines normal dependencies. |
addDevDeps |
Defines development/test dependencies. |
addFields |
Directly set fields in package.json . |
addKeywords |
Adds keywords to package.json (deduplicated). |
addPeerDeps |
Defines peer dependencies. |
addScripts |
Replaces the contents of multiple npm package.json scripts. |
addTestCommand |
DEPRECATED. |
hasScript |
Indicates if a script by the name name is defined. |
removeScript |
Removes the npm script (always successful). |
renderWorkflowSetup |
Returns the set of workflow steps which should be executed to bootstrap a workflow. |
setScript |
Replaces the contents of an npm package.json script. |
toString
public toString(): string
Returns a string representation of this construct.
addExcludeFromCleanup
public addExcludeFromCleanup(globs: string): void
Exclude the matching files from pre-synth cleanup.
Can be used when, for example, some source files include the projen marker and we don’t want them to be erased during synth.
globs
Required The glob patterns to match.
addGitIgnore
public addGitIgnore(pattern: string): void
Adds a .gitignore pattern.
pattern
Required The glob pattern to ignore.
addPackageIgnore
public addPackageIgnore(pattern: string): void
Exclude these files from the bundled package.
Implemented by project types based on the
packaging mechanism. For example, NodeProject
delegates this to .npmignore
.
pattern
Required addTask
public addTask(name: string, props?: TaskOptions): Task
Adds a new task to this project.
This will fail if the project already has a task with this name.
name
Required The task name to add.
props
Optional Task properties.
addTip
public addTip(message: string): void
Prints a “tip” message during synthesis.
message
Required The message.
annotateGenerated
public annotateGenerated(glob: string): void
Marks the provided file(s) as being generated.
This is achieved using the github-linguist attributes. Generated files do not count against the repository statistics and language breakdown.
https://github.com/github/linguist/blob/master/docs/overrides.md
glob
Required the glob pattern to match (could be a file path).
postSynthesize
public postSynthesize(): void
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before all components are synthesized.
removeTask
public removeTask(name: string): Task
Removes a task from a project.
name
Required The name of the task to remove.
runTaskCommand
public runTaskCommand(task: Task): string
Returns the shell command to execute in order to run a task.
This will
typically be npx projen TASK
.
task
Required The task for which the command is required.
synth
public synth(): void
Synthesize all project files into outdir
.
tryFindFile
public tryFindFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and all its subprojects.
filePath
Required The file path.
If this path is relative, it will be resolved from the root of this project.
tryFindJsonFile
public tryFindJsonFile(filePath: string): JsonFile
Finds a json file by name.
filePath
Required The file path.
tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required The file path.
tryRemoveFile
public tryRemoveFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and removes it.
filePath
Required The file path.
If this path is relative, it will be resolved from the root of this project.
addBins
public addBins(bins: {[ key: string ]: string}): void
bins
Required addBundledDeps
public addBundledDeps(deps: string): void
Defines bundled dependencies.
Bundled dependencies will be added as normal dependencies as well as to the
bundledDependencies
section of your package.json
.
deps
Required 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
public addCompileCommand(commands: string): void
DEPRECATED.
commands
Required addDeps
public addDeps(deps: string): void
Defines normal dependencies.
deps
Required Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn
add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
addDevDeps
public addDevDeps(deps: string): void
Defines development/test dependencies.
deps
Required Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn
add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
addFields
public addFields(fields: {[ key: string ]: any}): void
Directly set fields in package.json
.
fields
Required The fields to set.
addKeywords
public addKeywords(keywords: string): void
Adds keywords to package.json (deduplicated).
keywords
Required The keywords to add.
addPeerDeps
public addPeerDeps(deps: string): void
Defines peer dependencies.
When adding peer dependencies, a devDependency will also be added on the pinned version of the declared peer. This will ensure that you are testing your code against the minimum version required from your consumers.
deps
Required Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn
add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
addScripts
public addScripts(scripts: {[ key: string ]: string}): void
Replaces the contents of multiple npm package.json scripts.
scripts
Required The scripts to set.
addTestCommand
public addTestCommand(commands: string): void
DEPRECATED.
commands
Required hasScript
public hasScript(name: string): boolean
Indicates if a script by the name name is defined.
name
Required The name of the script.
removeScript
public removeScript(name: string): void
Removes the npm script (always successful).
name
Required The name of the script.