github
Submodule
Constructs
AutoApprove
Auto approve pull requests that meet a criteria.
Initializers
import { github } from 'projen'
new github.AutoApprove(github: GitHub, options?: AutoApproveOptions)
Name | Type | Description |
---|---|---|
|
| No description. |
|
| No description. |
github
Required
- Type: GitHub
options
Optional
- Type: AutoApproveOptions
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
Static Functions
Name | Description |
---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { 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
- Type: any
Any object.
isComponent
import { github } from 'projen'
github.AutoApprove.isComponent(x: any)
Test whether the given construct is a component.
x
Required
- Type: any
Properties
Name | Type | Description |
---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| string | No description. |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
project
Required
public readonly project: Project;
- Type: projen.Project
label
Required
public readonly label: string;
- Type: string
AutoMerge
Automatically merge Pull Requests using Mergify.
[!NOTE] GitHub now natively provides the same features, so you don't need Mergify anymore. See
GitHubOptions.mergeQueue
andMergeQueueOptions.autoQueue
.
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.
Initializers
import { github } from 'projen'
new github.AutoMerge(github: GitHub, options?: AutoMergeOptions)
Name | Type | Description |
---|---|---|
|
| No description. |
|
| No description. |
github
Required
- Type: GitHub
options
Optional
- Type: AutoMergeOptions
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Adds conditions to the auto merge rule. |
| 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
- Type: ...string[]
The conditions to add (mergify syntax).
addConditionsLater
public addConditionsLater(later: IAddConditionsLater): void
Adds conditions that will be rendered only during synthesis.
later
Required
- Type: IAddConditionsLater
The later.
Static Functions
Name | Description |
---|---|
| Checks if x is a construct. |
| 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
- Type: any
Any object.
isComponent
import { github } from 'projen'
github.AutoMerge.isComponent(x: any)
Test whether the given construct is a component.
x
Required
- Type: any
Properties
Name | Type | Description |
---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
project
Required
public readonly project: Project;
- Type: projen.Project
AutoQueue
Automatically add pull requests to the merge queue PRs will be merged once they pass required checks.
Initializers
import { github } from 'projen'
new github.AutoQueue(scope: IConstruct, options?: AutoQueueOptions)
Name | Type | Description |
---|---|---|
| constructs.IConstruct | No description. |
|
| No description. |
scope
Required
- Type: constructs.IConstruct
options
Optional
- Type: AutoQueueOptions
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
Static Functions
Name | Description |
---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { github } from 'projen'
github.AutoQueue.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required
- Type: any
Any object.
isComponent
import { github } from 'projen'
github.AutoQueue.isComponent(x: any)
Test whether the given construct is a component.
x
Required
- Type: any
Properties
Name | Type | Description |
---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
project
Required
public readonly project: Project;
- Type: projen.Project
Dependabot
Defines dependabot configuration for node projects.
Since module versions are managed in projen, the versioning strategy will be configured to "lockfile-only" which means that only updates that can be done on the lockfile itself will be proposed.
Initializers
import { github } from 'projen'
new github.Dependabot(github: GitHub, options?: DependabotOptions)
Name | Type | Description |
---|---|---|
|
| No description. |
|
| No description. |
github
Required
- Type: GitHub
options
Optional
- Type: DependabotOptions
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Allows a dependency from automatic updates. |
| Ignores a dependency from automatic updates. |
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.
addAllow
public addAllow(dependencyName: string): void
Allows a dependency from automatic updates.
dependencyName
Required
- Type: string
Use to allow updates for dependencies with matching names, optionally using *
to match zero or more characters.
addIgnore
public addIgnore(dependencyName: string, versions: ...string[]): void
Ignores a dependency from automatic updates.
dependencyName
Required
- Type: string
Use to ignore updates for dependencies with matching names, optionally using *
to match zero or more characters.
versions
Required
- Type: ...string[]
Use to ignore specific versions or ranges of versions.
If
you want to define a range, use the standard pattern for the package
manager (for example: ^1.0.0
for npm, or ~> 2.0
for Bundler).
Static Functions
Name | Description |
---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { github } from 'projen'
github.Dependabot.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required
- Type: any
Any object.
isComponent
import { github } from 'projen'
github.Dependabot.isComponent(x: any)
Test whether the given construct is a component.
x
Required
- Type: any
Properties
Name | Type | Description |
---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| any | The raw dependabot configuration. |
| boolean | Whether or not projen is also upgraded in this config,. |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
project
Required
public readonly project: Project;
- Type: projen.Project
config
Required
public readonly config: any;
- Type: any
The raw dependabot configuration.
ignoresProjen
Required
public readonly ignoresProjen: boolean;
- Type: boolean
Whether or not projen is also upgraded in this config,.
GitHub
Initializers
import { github } from 'projen'
new github.GitHub(project: Project, options?: GitHubOptions)
Name | Type | Description |
---|---|---|
| projen.Project | No description. |
|
| No description. |
project
Required
- Type: projen.Project
options
Optional
- Type: GitHubOptions
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| No description. |
| No description. |
| Adds a workflow to the project. |
| Finds a GitHub workflow by name. |
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.
addDependabot
public addDependabot(options?: DependabotOptions): Dependabot
options
Optional
- Type: DependabotOptions
addPullRequestTemplate
public addPullRequestTemplate(content: ...string[]): PullRequestTemplate
content
Required
- Type: ...string[]
addWorkflow
public addWorkflow(name: string): GithubWorkflow
Adds a workflow to the project.
name
Required
- Type: string
Name of the workflow.
tryFindWorkflow
public tryFindWorkflow(name: string): GithubWorkflow
Finds a GitHub workflow by name.
Returns undefined
if the workflow cannot be found.
name
Required
- Type: string
The name of the GitHub workflow.
Static Functions
Name | Description |
---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
| Returns the GitHub component of a project or undefined if the project does not have a GitHub component. |
isConstruct
import { github } from 'projen'
github.GitHub.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required
- Type: any
Any object.
isComponent
import { github } from 'projen'
github.GitHub.isComponent(x: any)
Test whether the given construct is a component.
x
Required
- Type: any
of
import { github } from 'projen'
github.GitHub.of(project: Project)
Returns the GitHub
component of a project or undefined
if the project does not have a GitHub component.
project
Required
- Type: projen.Project
Properties
Name | Type | Description |
---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
|
| The GitHub Actions provider used to manage the versions of actions used in steps. |
| boolean | Whether downloading from LFS is enabled for this GitHub project. |
|
| GitHub API authentication method used by projen workflows. |
|
| All workflows. |
| boolean | Are workflows enabled? |
|
| The MergeQueue component configured on this repository This is undefined if merge queues are not enabled for this repository. |
|
| The Mergify component configured on this repository This is undefined if Mergify is not enabled for this repository. |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
project
Required
public readonly project: Project;
- Type: projen.Project
actions
Required
public readonly actions: GitHubActionsProvider;
- Type: GitHubActionsProvider
The GitHub Actions provider used to manage the versions of actions used in steps.
downloadLfs
Required
public readonly downloadLfs: boolean;
- Type: boolean
Whether downloading from LFS is enabled for this GitHub project.
projenCredentials
Required
public readonly projenCredentials: GithubCredentials;
- Type: GithubCredentials
GitHub API authentication method used by projen workflows.
workflows
Required
public readonly workflows: GithubWorkflow[];
- Type: GithubWorkflow[]
All workflows.
workflowsEnabled
Required
public readonly workflowsEnabled: boolean;
- Type: boolean
Are workflows enabled?
mergeQueue
Optional
public readonly mergeQueue: MergeQueue;
- Type: MergeQueue
The MergeQueue
component configured on this repository This is undefined
if merge queues are not enabled for this repository.
mergify
Optional
public readonly mergify: Mergify;
- Type: Mergify
The Mergify
component configured on this repository This is undefined
if Mergify is not enabled for this repository.
GitHubProject
GitHub-based project.
Initializers
import { github } from 'projen'
new github.GitHubProject(options: GitHubProjectOptions)
Name | Type | Description |
---|---|---|
|
| No description. |
options
Required
- Type: GitHubProjectOptions
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Exclude the matching files from pre-synth cleanup. |
| Adds a .gitignore pattern. |
| Exclude these files from the bundled package. |
| Adds a new task to this project. |
| Prints a "tip" message during synthesis. |
| Marks the provided file(s) as being generated. |
| Called after all components are synthesized. |
| Called before all components are synthesized. |
| Removes a task from a project. |
| Returns the shell command to execute in order to run a task. |
| Synthesize all project files into outdir . |
| Finds a file at the specified relative path within this project and all its subprojects. |
| Finds a json file by name. |
| Finds an object file (like JsonFile, YamlFile, etc.) by name. |
| Finds a file at the specified relative path within this project and removes it. |
toString
toString
public toString(): string
Returns a string representation of this construct.
addExcludeFromCleanup
addExcludeFromCleanup
public addExcludeFromCleanup(globs: ...string[]): void
Exclude the matching files from pre-synth cleanup.
Can be used when, for example, some source files include the projen marker and we don't want them to be erased during synth.
globs
Required
- Type: ...string[]
The glob patterns to match.
addGitIgnore
addGitIgnore
public addGitIgnore(pattern: string): void
Adds a .gitignore pattern.
pattern
Required
- Type: string
The glob pattern to ignore.
addPackageIgnore
addPackageIgnore
public addPackageIgnore(_pattern: string): void
Exclude these files from the bundled package.
Implemented by project types based on the
packaging mechanism. For example, NodeProject
delegates this to .npmignore
.
_pattern
Required
- Type: string
The glob pattern to exclude.
addTask
addTask
public addTask(name: string, props?: TaskOptions): Task
Adds a new task to this project.
This will fail if the project already has a task with this name.
name
Required
- Type: string
The task name to add.
props
Optional
- Type: projen.TaskOptions
Task properties.
addTip
addTip
public addTip(message: string): void
Prints a "tip" message during synthesis.
message
Required
- Type: string
The message.
annotateGenerated
annotateGenerated
public annotateGenerated(glob: string): void
Marks the provided file(s) as being generated.
This is achieved using the github-linguist attributes. Generated files do not count against the repository statistics and language breakdown.
https://github.com/github/linguist/blob/master/docs/overrides.md
glob
Required
- Type: string
the glob pattern to match (could be a file path).
postSynthesize
postSynthesize
public postSynthesize(): void
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
preSynthesize
public preSynthesize(): void
Called before all components are synthesized.
removeTask
removeTask
public removeTask(name: string): Task
Removes a task from a project.
name
Required
- Type: string
The name of the task to remove.
runTaskCommand
runTaskCommand
public runTaskCommand(task: Task): string
Returns the shell command to execute in order to run a task.
By default, this is npx projen@<version> <task>
task
Required
- Type: projen.Task
The task for which the command is required.
synth
synth
public synth(): void
Synthesize all project files into outdir
.
- Call "this.preSynthesize()"
- Delete all generated files
- Synthesize all subprojects
- Synthesize all components of this project
- Call "postSynthesize()" for all components of this project
- Call "this.postSynthesize()"
tryFindFile
tryFindFile
public tryFindFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and all its subprojects.
filePath
Required
- Type: string
The file path.
If this path is relative, it will be resolved from the root of this project.
tryFindJsonFile
tryFindJsonFile
public tryFindJsonFile(filePath: string): JsonFile
Finds a json file by name.
filePath
Required
- Type: string
The file path.
tryFindObjectFile
tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required
- Type: string
The file path.
tryRemoveFile
tryRemoveFile
public tryRemoveFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and removes it.
filePath
Required
- Type: string
The file path.
If this path is relative, it will be resolved from the root of this project.
Static Functions
Name | Description |
---|---|
| Checks if x is a construct. |
| Test whether the given construct is a project. |
| Find the closest ancestor project for given construct. |
isConstruct
isConstruct
import { github } from 'projen'
github.GitHubProject.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required
- Type: any
Any object.
isProject
isProject
import { github } from 'projen'
github.GitHubProject.isProject(x: any)
Test whether the given construct is a project.
x
Required
- Type: any
of
of
import { github } from 'projen'
github.GitHubProject.of(construct: IConstruct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
construct
Required
- Type: constructs.IConstruct
Properties
Name | Type | Description |
---|---|---|
| constructs.Node | The tree node. |
| projen.Task | No description. |
| boolean | Whether to commit the managed files by default. |
| projen.Task | No description. |
| projen.Component[] | Returns all the components within this project. |
| projen.Dependencies | Project dependencies. |
| boolean | Whether or not the project is being ejected. |
| projen.FileBase[] | All files in this project. |
| projen.GitAttributesFile | The .gitattributes file for this repository. |
| projen.IgnoreFile | .gitignore. |
| projen.Logger | Logging utilities. |
| string | Project name. |
| string | Absolute output directory of this project. |
| projen.Task | No description. |
| projen.Task | No description. |
| projen.Task | No description. |
| projen.ProjectBuild | Manages the build process of the project. |
| string | The command to use in order to run the projen CLI. |
| projen.Project | The root project. |
| projen.Project[] | Returns all the subprojects within this project. |
| projen.Tasks | Project tasks. |
| projen.Task | No description. |
| projen.Task | This is the "default" task, the one that executes "projen". |
| projen.InitProject | The options used when this project is bootstrapped via projen new . |
| projen.Project | A parent project. |
| projen.ProjectType | No description. |
|
| Auto approve set up for this project. |
| projen.vscode.DevContainer | Access for .devcontainer.json (used for GitHub Codespaces). |
|
| Access all github components. |
| projen.Gitpod | Access for Gitpod. |
| projen.vscode.VsCode | Access all VSCode components. |
node
Required
node
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly node: Node;
- Type: constructs.Node
The tree node.
buildTask
Required
buildTask
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly buildTask: Task;
- Type: projen.Task
commitGenerated
Required
commitGenerated
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly commitGenerated: boolean;
- Type: boolean
Whether to commit the managed files by default.
compileTask
Required
compileTask
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly compileTask: Task;
- Type: projen.Task
components
Required
components
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly components: Component[];
- Type: projen.Component[]
Returns all the components within this project.
deps
Required
deps
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly deps: Dependencies;
- Type: projen.Dependencies
Project dependencies.
ejected
Required
ejected
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly ejected: boolean;
- Type: boolean
Whether or not the project is being ejected.
files
Required
files
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly files: FileBase[];
- Type: projen.FileBase[]
All files in this project.
gitattributes
Required
gitattributes
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly gitattributes: GitAttributesFile;
- Type: projen.GitAttributesFile
The .gitattributes file for this repository.
gitignore
Required
gitignore
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly gitignore: IgnoreFile;
- Type: projen.IgnoreFile
.gitignore.
logger
Required
logger
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly logger: Logger;
- Type: projen.Logger
Logging utilities.
name
Required
name
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly name: string;
- Type: string
Project name.
outdir
Required
outdir
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly outdir: string;
- Type: string
Absolute output directory of this project.
packageTask
Required
packageTask
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly packageTask: Task;
- Type: projen.Task
postCompileTask
Required
postCompileTask
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly postCompileTask: Task;
- Type: projen.Task
preCompileTask
Required
preCompileTask
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly preCompileTask: Task;
- Type: projen.Task
projectBuild
Required
projectBuild
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly projectBuild: ProjectBuild;
- Type: projen.ProjectBuild
Manages the build process of the project.
projenCommand
Required
projenCommand
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly projenCommand: string;
- Type: string
The command to use in order to run the projen CLI.
root
Required
root
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly root: Project;
- Type: projen.Project
The root project.
subprojects
Required
subprojects
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly subprojects: Project[];
- Type: projen.Project[]
Returns all the subprojects within this project.
tasks
Required
tasks
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly tasks: Tasks;
- Type: projen.Tasks
Project tasks.
testTask
Required
testTask
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly testTask: Task;
- Type: projen.Task
defaultTask
Optional
defaultTask
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly defaultTask: Task;
- Type: projen.Task
This is the "default" task, the one that executes "projen".
Undefined if the project is being ejected.
initProject
Optional
initProject
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly initProject: InitProject;
- Type: projen.InitProject
The options used when this project is bootstrapped via projen new
.
It includes the original set of options passed to the CLI and also the JSII FQN of the project type.
parent
Optional
parent
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly parent: Project;
- Type: projen.Project
A parent project.
If undefined, this is the root project.
projectType
Required
projectType
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly projectType: ProjectType;
- Type: projen.ProjectType
autoApprove
Optional
autoApprove
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly autoApprove: AutoApprove;
- Type: AutoApprove
Auto approve set up for this project.
devContainer
Optional
devContainer
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly devContainer: DevContainer;
- Type: projen.vscode.DevContainer
Access for .devcontainer.json (used for GitHub Codespaces).
This will be undefined
if devContainer boolean is false
github
Optional
github
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly github: GitHub;
- Type: GitHub
Access all github components.
This will be undefined
for subprojects.
gitpod
Optional
gitpod
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly gitpod: Gitpod;
- Type: projen.Gitpod
Access for Gitpod.
This will be undefined
if gitpod boolean is false
vscode
Optional
vscode
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly vscode: VsCode;
- Type: projen.vscode.VsCode
Access all VSCode components.
This will be undefined
for subprojects.
Constants
Name | Type | Description |
---|---|---|
| string | The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASK
Required
DEFAULT_TASK
- Deprecated: This is a temporary class. At the moment, our base project
types such as
NodeProject
andJavaProject
are derived from this, but we want to be able to use these project types outside of GitHub as well. One of the next steps to address this is to abstract workflows so that different "engines" can be used to implement our CI/CD solutions.
public readonly DEFAULT_TASK: string;
- Type: string
The name of the default task (the task executed when projen
is run without arguments).
Normally this task should synthesize the project files.
GithubWorkflow
Workflow for GitHub.
A workflow is a configurable automated process made up of one or more jobs.
https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
Initializers
import { github } from 'projen'
new github.GithubWorkflow(github: GitHub, name: string, options?: GithubWorkflowOptions)
Name | Type | Description |
---|---|---|
|
| The GitHub component of the project this workflow belongs to. |
| string | The name of the workflow, displayed under the repository's "Actions" tab. |
|
| Additional options to configure the workflow. |
github
Required
- Type: GitHub
The GitHub component of the project this workflow belongs to.
name
Required
- Type: string
The name of the workflow, displayed under the repository's "Actions" tab.
options
Optional
- Type: GithubWorkflowOptions
Additional options to configure the workflow.
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Adds a single job to the workflow. |
| Add jobs to the workflow. |
| Get a single job from the workflow. |
| Add events to triggers the workflow. |
| Removes a single job to the workflow. |
| Updates a single job to the workflow. |
| Updates jobs for this worklow Does a complete replace, it does not try to merge the jobs. |
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.
addJob
public addJob(id: string, job: JobCallingReusableWorkflow | Job): void
Adds a single job to the workflow.
id
Required
- Type: string
The job name (unique within the workflow).
job
Required
- Type: JobCallingReusableWorkflow | Job
The job specification.
addJobs
public addJobs(jobs: {[ key: string ]: JobCallingReusableWorkflow | Job}): void
Add jobs to the workflow.
jobs
Required
- Type: {[ key: string ]: JobCallingReusableWorkflow | Job}
Jobs to add.
getJob
public getJob(id: string): JobCallingReusableWorkflow | Job
Get a single job from the workflow.
id
Required
- Type: string
The job name (unique within the workflow).
on
public on(events: Triggers): void
Add events to triggers the workflow.
events
Required
- Type: Triggers
The event(s) to trigger the workflow.
removeJob
public removeJob(id: string): void
Removes a single job to the workflow.
id
Required
- Type: string
The job name (unique within the workflow).
updateJob
public updateJob(id: string, job: JobCallingReusableWorkflow | Job): void
Updates a single job to the workflow.
id
Required
- Type: string
The job name (unique within the workflow).
job
Required
- Type: JobCallingReusableWorkflow | Job
updateJobs
public updateJobs(jobs: {[ key: string ]: JobCallingReusableWorkflow | Job}): void
Updates jobs for this worklow Does a complete replace, it does not try to merge the jobs.
jobs
Required
- Type: {[ key: string ]: JobCallingReusableWorkflow | Job}
Jobs to update.
Static Functions
Name | Description |
---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { github } from 'projen'
github.GithubWorkflow.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required
- Type: any
Any object.
isComponent
import { github } from 'projen'
github.GithubWorkflow.isComponent(x: any)
Test whether the given construct is a component.
x
Required
- Type: any
Properties
Name | Type | Description |
---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| string | The name of the workflow. |
|
| GitHub API authentication method used by projen workflows. |
|
| The concurrency configuration of the workflow. |
| {[ key: string ]: string} | Additional environment variables to set for the workflow. |
| projen.YamlFile | The workflow YAML file. |
| string | The name for workflow runs generated from the workflow. |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
project
Required
public readonly project: Project;
- Type: projen.Project
name
Required
public readonly name: string;
- Type: string
The name of the workflow.
GitHub displays the names of your workflows under your repository's "Actions" tab.
https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#name
projenCredentials
Required
public readonly projenCredentials: GithubCredentials;
- Type: GithubCredentials
GitHub API authentication method used by projen workflows.
concurrency
Optional
public readonly concurrency: ConcurrencyOptions;
- Type: ConcurrencyOptions
The concurrency configuration of the workflow.
undefined means no concurrency limitations.
env
Optional
public readonly env: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Additional environment variables to set for the workflow.
file
Optional
public readonly file: YamlFile;
- Type: projen.YamlFile
The workflow YAML file.
May not exist if workflowsEnabled
is false on GitHub
.
runName
Optional
public readonly runName: string;
- Type: string
The name for workflow runs generated from the workflow.
GitHub displays the
workflow run name in the list of workflow runs on your repository's
"Actions" tab. If run-name
is omitted or is only whitespace, then the run
name is set to event-specific information for the workflow run. For
example, for a workflow triggered by a push
or pull_request
event, it
is set as the commit message.
This value can include expressions and can reference github
and inputs
contexts.
MergeQueue
Merge pull requests using a merge queue.
Initializers
import { github } from 'projen'
new github.MergeQueue(scope: IConstruct, options?: MergeQueueOptions)
Name | Type | Description |
---|---|---|
| constructs.IConstruct | No description. |
|
| No description. |
scope
Required
- Type: constructs.IConstruct
options
Optional
- Type: MergeQueueOptions
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
Static Functions
Name | Description |
---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { github } from 'projen'
github.MergeQueue.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
x
Required
- Type: any
Any object.
isComponent
import { github } from 'projen'
github.MergeQueue.isComponent(x: any)
Test whether the given construct is a component.
x
Required
- Type: any
Properties
Name | Type | Description |
---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
project
Required
public readonly project: Project;
- Type: projen.Project
Mergify
Initializers
import { github } from 'projen'
new github.Mergify(github: GitHub, options?: MergifyOptions)
Name | Type | Description |
---|---|---|
|
| No description. |
|
| No description. |
github
Required
- Type: GitHub
options
Optional
- Type: MergifyOptions
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| No description. |
| No description. |
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.
addQueue
public addQueue(queue: MergifyQueue): void
queue
Required
- Type: MergifyQueue
addRule
public addRule(rule: MergifyRule): void
rule
Required
- Type: MergifyRule