Extends the {@link TypeScriptCompilerOptions} interface with the {@link plugins} property for configuring Language Service Plugins and ts-patch plugins.
import { TypeScriptCompilerPlugins } from '@functionless/projen'
const typeScriptCompilerPlugins: TypeScriptCompilerPlugins = { ... }| Name | Type | Description |
|---|---|---|
plugins |
TypeScriptPlugin[] |
A list of Language Service and ts-patch plugins to run as part of TypeScript compilation. |
public readonly plugins: TypeScriptPlugin[];- Type: TypeScriptPlugin[]
A list of Language Service and ts-patch plugins to run as part of TypeScript compilation.
Configures a Language Service or Transformer Plugin to run as part of TypeScript compilation.
https://github.com/microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin
import { TypeScriptPlugin } from '@functionless/projen'
const typeScriptPlugin: TypeScriptPlugin = { ... }| Name | Type | Description |
|---|---|---|
name |
string |
Name of a NPM module that implements the TypeScript Language Service Plugin interface. |
transform |
string |
Path to a module implementing the ts-patch Transformer Plugin interface. |
public readonly name: string;- Type: string
Name of a NPM module that implements the TypeScript Language Service Plugin interface.
It must be the name of a NPM module and cannot be a path to an individual JS file.
Valid:
{
name: "@functionless/language-service"
}Invalid:
{
name: "@functionless/language-service/lib/plugin"
}https://github.com/microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin
public readonly transform: string;- Type: string
Path to a module implementing the ts-patch Transformer Plugin interface.
Example:
{
transform: "functionless/lib/compile"
}Component that configures a TypeScript project to use Functionless by adding the necessary dependencies and setting up ts-patch.
import { Functionless } from '@functionless/projen'
new Functionless(tsProject: TypeScriptProject)| Name | Type | Description |
|---|---|---|
tsProject |
projen.typescript.TypeScriptProject |
No description. |
- Type: projen.typescript.TypeScriptProject
| Name | Description |
|---|---|
postSynthesize |
Called after synthesis. |
preSynthesize |
Called before synthesis. |
synthesize |
Synthesizes files to the project output directory. |
public postSynthesize(): voidCalled after synthesis.
Order is not guaranteed.
public preSynthesize(): voidCalled before synthesis.
public synthesize(): voidSynthesizes files to the project output directory.
| Name | Type | Description |
|---|---|---|
project |
projen.Project |
No description. |
swcrc |
projen.JsonFile |
No description. |
tsProject |
projen.typescript.TypeScriptProject |
No description. |
public readonly project: Project;- Type: projen.Project
public readonly swcrc: JsonFile;- Type: projen.JsonFile
public readonly tsProject: TypeScriptProject;- Type: projen.typescript.TypeScriptProject
| Name | Type | Description |
|---|---|---|
coreDependency |
string |
No description. |
dependencies |
string[] |
No description. |
devDependencies |
string[] |
No description. |
languageServiceDependency |
string |
No description. |
public readonly coreDependency: string;- Type: string
public readonly dependencies: string[];- Type: string[]
public readonly devDependencies: string[];- Type: string[]
public readonly languageServiceDependency: string;- Type: string
Project that wraps an AwsCdkTypeScriptProject and adds configures Functionless.
import { FunctionlessProject } from '@functionless/projen'
new FunctionlessProject(options: AwsCdkTypeScriptAppOptions)| Name | Type | Description |
|---|---|---|
options |
projen.awscdk.AwsCdkTypeScriptAppOptions |
No description. |
- Type: projen.awscdk.AwsCdkTypeScriptAppOptions
| Name | Description |
|---|---|
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. |
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. |
public addExcludeFromCleanup(globs: string): voidExclude 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.
- Type: string
The glob patterns to match.
public addGitIgnore(pattern: string): voidAdds a .gitignore pattern.
- Type: string
The glob pattern to ignore.
public addPackageIgnore(pattern: string): voidExclude these files from the bundled package.
Implemented by project types based on the
packaging mechanism. For example, NodeProject delegates this to .npmignore.
- Type: string
public addTask(name: string, props?: TaskOptions): TaskAdds a new task to this project.
This will fail if the project already has a task with this name.
- Type: string
The task name to add.
- Type: projen.TaskOptions
Task properties.
public addTip(message: string): voidPrints a "tip" message during synthesis.
- Type: string
The message.
public annotateGenerated(glob: string): voidMarks 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
- Type: string
the glob pattern to match (could be a file path).
public postSynthesize(): voidCalled after all components are synthesized.
Order is not guaranteed.
public preSynthesize(): voidCalled before all components are synthesized.
public removeTask(name: string): TaskRemoves a task from a project.
- Type: string
The name of the task to remove.
public runTaskCommand(task: Task): stringReturns the shell command to execute in order to run a task.
This will
typically be npx projen TASK.
- Type: projen.Task
The task for which the command is required.
public synth(): voidSynthesize all project files into outdir.
- Call "this.preSynthesize()"
- Delete all generated files
- Synthesize all sub-projects
- Synthesize all components of this project
- Call "postSynthesize()" for all components of this project
- Call "this.postSynthesize()"
public tryFindFile(filePath: string): FileBaseFinds a file at the specified relative path within this project and all its subprojects.
- Type: string
The file path.
If this path is relative, it will be resolved from the root of this project.
public tryFindJsonFile(filePath: string): JsonFileFinds a json file by name.
- Type: string
The file path.
public tryFindObjectFile(filePath: string): ObjectFileFinds an object file (like JsonFile, YamlFile, etc.) by name.
- Type: string
The file path.
public tryRemoveFile(filePath: string): FileBaseFinds a file at the specified relative path within this project and removes it.
- Type: string
The file path.
If this path is relative, it will be resolved from the root of this project.
public addBins(bins: {[ key: string ]: string}): void- Type: {[ key: string ]: string}
public addBundledDeps(deps: string): voidDefines bundled dependencies.
Bundled dependencies will be added as normal dependencies as well as to the
bundledDependencies section of your package.json.
- Type: string
Names modules to install.
By default, the the dependency will
be installed in the next npx projen run and the version will be recorded
in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax:
module@^7.
public addCompileCommand(commands: string): voidDEPRECATED.
- Type: string
public addDeps(deps: string): voidDefines normal dependencies.
- Type: string
Names modules to install.
By default, the the dependency will
be installed in the next npx projen run and the version will be recorded
in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax:
module@^7.
public addDevDeps(deps: string): voidDefines development/test dependencies.
- Type: string
Names modules to install.
By default, the the dependency will
be installed in the next npx projen run and the version will be recorded
in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax:
module@^7.
public addFields(fields: {[ key: string ]: any}): voidDirectly set fields in package.json.
- Type: {[ key: string ]: any}
The fields to set.
public addKeywords(keywords: string): voidAdds keywords to package.json (deduplicated).
- Type: string
The keywords to add.
public addPeerDeps(deps: string): voidDefines 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.
- Type: string
Names modules to install.
By default, the the dependency will
be installed in the next npx projen run and the version will be recorded
in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax:
module@^7.
public addTestCommand(commands: string): voidDEPRECATED.
- Type: string
public hasScript(name: string): booleanIndicates if a script by the name name is defined.
- Type: string
The name of the script.
public removeScript(name: string): voidRemoves the npm script (always successful).
- Type: string
The name of the script.
public renderWorkflowSetup(options?: RenderWorkflowSetupOptions): JobStep[]Returns the set of workflow steps which should be executed to bootstrap a workflow.
- Type: projen.javascript.RenderWorkflowSetupOptions
Options.
public setScript(name: string, command: string): voidReplaces the contents of an npm package.json script.
- Type: string
The script name.
- Type: string
The command to execute.
public addCdkDependency(modules: string): voidAdds an AWS CDK module dependencies.
- Type: string
The list of modules to depend on.
| Name | Type | Description |
|---|---|---|
buildTask |
projen.Task |
No description. |
commitGenerated |
boolean |
Whether to commit the managed files by default. |
compileTask |
projen.Task |
No description. |
components |
projen.Component[] |
Returns all the components within this project. |
deps |
projen.Dependencies |
Project dependencies. |
ejected |
boolean |
Whether or not the project is being ejected. |
files |
projen.FileBase[] |
All files in this project. |
gitattributes |
projen.GitAttributesFile |
The .gitattributes file for this repository. |
gitignore |
projen.IgnoreFile |
.gitignore. |
logger |
projen.Logger |
Logging utilities. |
name |
string |
Project name. |
outdir |
string |
Absolute output directory of this project. |
packageTask |
projen.Task |
No description. |
postCompileTask |
projen.Task |
No description. |
preCompileTask |
projen.Task |
No description. |
projectBuild |
projen.ProjectBuild |
Manages the build process of the project. |
projenCommand |
string |
The command to use in order to run the projen CLI. |
root |
projen.Project |
The root project. |
tasks |
projen.Tasks |
Project tasks. |
testTask |
projen.Task |
No description. |
defaultTask |
projen.Task |
This is the "default" task, the one that executes "projen". |
initProject |
projen.InitProject |
The options used when this project is bootstrapped via projen new. |
parent |
projen.Project |
A parent project. |
projectType |
projen.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 |
projen.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. |
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 pacakge. |
minNodeVersion |
string |
Minimum node.js version required by this package. |
npmignore |
projen.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 |
projen.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. |
public readonly buildTask: Task;- Type: projen.Task
public readonly commitGenerated: boolean;- Type: boolean
Whether to commit the managed files by default.
public readonly compileTask: Task;- Type: projen.Task
public readonly components: Component[];- Type: projen.Component[]
Returns all the components within this project.
public readonly deps: Dependencies;- Type: projen.Dependencies
Project dependencies.
public readonly ejected: boolean;- Type: boolean
Whether or not the project is being ejected.
public readonly files: FileBase[];- Type: projen.FileBase[]
All files in this project.
public readonly gitattributes: GitAttributesFile;- Type: projen.GitAttributesFile
The .gitattributes file for this repository.
public readonly gitignore: IgnoreFile;- Type: projen.IgnoreFile
.gitignore.
public readonly logger: Logger;- Type: projen.Logger
Logging utilities.
public readonly name: string;- Type: string
Project name.
public readonly outdir: string;- Type: string
Absolute output directory of this project.
public readonly packageTask: Task;- Type: projen.Task
public readonly postCompileTask: Task;- Type: projen.Task
public readonly preCompileTask: Task;- Type: projen.Task
public readonly projectBuild: ProjectBuild;- Type: projen.ProjectBuild
Manages the build process of the project.
public readonly projenCommand: string;- Type: string
The command to use in order to run the projen CLI.
public readonly root: Project;- Type: projen.Project
The root project.
public readonly tasks: Tasks;- Type: projen.Tasks
Project tasks.
public readonly testTask: Task;- Type: projen.Task
public readonly defaultTask: Task;- Type: projen.Task
This is the "default" task, the one that executes "projen".
Undefined if the project is being ejected.
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.
public readonly parent: Project;- Type: projen.Project
A parent project.
If undefined, this is the root project.
public readonly projectType: ProjectType;- Type: projen.ProjectType
public readonly autoApprove: AutoApprove;- Type: projen.github.AutoApprove
Auto approve set up for this project.
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
public readonly github: GitHub;- Type: projen.github.GitHub
Access all github components.
This will be undefined for subprojects.
public readonly gitpod: Gitpod;- Type: projen.Gitpod
Access for Gitpod.
This will be undefined if gitpod boolean is false
public readonly vscode: VsCode;- Type: projen.vscode.VsCode
Access all VSCode components.
This will be undefined for subprojects.
- Deprecated: use
package.allowLibraryDependencies
public readonly allowLibraryDependencies: boolean;- Type: boolean
public readonly artifactsDirectory: string;- Type: string
The build output directory.
An npm tarball will be created under the js
subdirectory. For example, if this is set to dist (the default), the npm
tarball will be placed under dist/js/boom-boom-1.2.3.tg.
public readonly artifactsJavascriptDirectory: string;- Type: string
The location of the npm tarball after build (${artifactsDirectory}/js).
public readonly bundler: Bundler;- Type: projen.javascript.Bundler
- Deprecated: use
package.entrypoint
public readonly entrypoint: string;- Type: string
- Deprecated: use
package.addField(x, y)
public readonly manifest: any;- Type: any
public readonly package: NodePackage;- Type: projen.javascript.NodePackage
API for managing the node package.
- Deprecated: use
package.packageManager
public readonly packageManager: NodePackageManager;- Type: projen.javascript.NodePackageManager
The package manager to use.
public readonly runScriptCommand: string;- Type: string
The command to use to run scripts (e.g. yarn run or npm run depends on the package manager).
public readonly autoMerge: AutoMerge;- Type: projen.github.AutoMerge
Component that sets up mergify for merging approved pull requests.
public readonly buildWorkflow: BuildWorkflow;- Type: projen.build.BuildWorkflow
The PR build GitHub workflow.
undefined if buildWorkflow is disabled.
public readonly buildWorkflowJobId: string;- Type: string
The job ID of the build workflow.
public readonly jest: Jest;- Type: projen.javascript.Jest
The Jest configuration (if enabled).
public readonly maxNodeVersion: string;- Type: string
Maximum node version required by this pacakge.
public readonly minNodeVersion: string;- Type: string
Minimum node.js version required by this package.
public readonly npmignore: IgnoreFile;- Type: projen.IgnoreFile
The .npmignore file.
public readonly prettier: Prettier;- Type: projen.javascript.Prettier
- Deprecated: use
release.publisher.
public readonly publisher: Publisher;- Type: projen.release.Publisher
Package publisher.
This will be undefined if the project does not have a
release workflow.
public readonly release: Release;- Type: projen.release.Release
Release management.
public readonly upgradeWorkflow: UpgradeDependencies;- Type: projen.javascript.UpgradeDependencies
The upgrade workflow.
public readonly docsDirectory: string;- Type: string
public readonly libdir: string;- Type: string
The directory in which compiled .js files reside.
public readonly srcdir: string;- Type: string
The directory in which the .ts sources reside.
public readonly testdir: string;- Type: string
The directory in which tests reside.
public readonly tsconfigDev: TypescriptConfig;- Type: projen.javascript.TypescriptConfig
A typescript configuration file which covers all files (sources, tests, projen).
public readonly watchTask: Task;- Type: projen.Task
The "watch" task.
public readonly docgen: boolean;- Type: boolean
public readonly eslint: Eslint;- Type: projen.javascript.Eslint
public readonly tsconfig: TypescriptConfig;- Type: projen.javascript.TypescriptConfig
public readonly tsconfigEslint: TypescriptConfig;- Type: projen.javascript.TypescriptConfig
public readonly appEntrypoint: string;- Type: string
The CDK app entrypoint.
public readonly cdkConfig: CdkConfig;- Type: projen.awscdk.CdkConfig
cdk.json configuration.
public readonly cdkDeps: AwsCdkDeps;- Type: projen.awscdk.AwsCdkDeps
public readonly cdkTasks: CdkTasks;- Type: projen.awscdk.CdkTasks
Common CDK tasks.
public readonly cdkVersion: string;- Type: 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). |
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.