javascript Submodule
Constructs
Biome
Biome component.
Initializers
import { javascript } from 'projen'
new javascript.Biome(project: NodeProject, options?: BiomeOptions)
| Name | Type | Description |
|---|---|---|
| | No description. |
| | No description. |
projectRequired
- Type: NodeProject
optionsOptional
- Type: BiomeOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Applies one or more mixins to this construct. |
| Runs biome once, right after the project is first created, so the generated code is linted and formatted immediately. |
| Called after synthesis. |
| Called before synthesis. |
| Called once, right after synthesize(), only when the project is created for the first time. |
| Synthesizes files to the project output directory. |
| Add a file pattern to biome. |
| Add a biome override to set rules for a specific file pattern. |
| Expand the linting rules applied. |
toString
public toString(): string
Returns a string representation of this construct.
with
public with(mixins: ...IMixin[]): IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
mixinsRequired
- Type: ...constructs.IMixin[]
The mixins to apply.
postProjectCreation
public postProjectCreation(_initProject: InitProject): void
Runs biome once, right after the project is first created, so the generated code is linted and formatted immediately.
_initProjectRequired
- Type: projen.InitProject
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
projectCreation
public projectCreation(initProject: InitProject): void
Called once, right after synthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
Use it for deterministic, one-off file generation. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
addFilePattern
public addFilePattern(pattern: string): void
Add a file pattern to biome.
Use ! or !! to ignore a file pattern.
https://biomejs.dev/guides/configure-biome/#control-files-via-configuration
patternRequired
- Type: string
Biome glob pattern.
addOverride
public addOverride(override: OverridePattern): void
Add a biome override to set rules for a specific file pattern.
overrideRequired
- Type: OverridePattern
Override object.
expandLinterRules
public expandLinterRules(rules: Rules): void
Expand the linting rules applied.
Use undefined to remove the rule or group.
https://biomejs.dev/reference/configuration/#linterrulesgroup
Example
biome.expandLintingRules({
style: undefined,
suspicious: {
noExplicitAny: undefined,
noDuplicateCase: "info",
}
})
rulesRequired
- Type: Rules
Rules to apply.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
| No description. |
isConstruct
import { javascript } from 'projen'
javascript.Biome.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { javascript } from 'projen'
javascript.Biome.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
of
import { javascript } from 'projen'
javascript.Biome.of(project: Project)
projectRequired
- Type: projen.Project
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| projen.JsonFile | Biome configuration file content. |
| projen.Task | Biome task. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
fileRequired
public readonly file: JsonFile;
- Type: projen.JsonFile
Biome configuration file content.
taskRequired
public readonly task: Task;
- Type: projen.Task
Biome task.
Bundler
Adds support for bundling JavaScript applications and dependencies into a single file.
In the future, this will also supports bundling websites.
Initializers
import { javascript } from 'projen'
new javascript.Bundler(project: Project, options?: BundlerOptions)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
optionsOptional
- Type: BundlerOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Applies one or more mixins to this construct. |
| Called once, right after postSynthesize(), only when the project is created for the first time. |
| Called after synthesis. |
| Called before synthesis. |
| Called once, right after synthesize(), only when the project is created for the first time. |
| Synthesizes files to the project output directory. |
| 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.
with
public with(mixins: ...IMixin[]): IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
mixinsRequired
- Type: ...constructs.IMixin[]
The mixins to apply.
postProjectCreation
public postProjectCreation(initProject: InitProject): void
Called once, right after postSynthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST.
Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate
feedback on their new project. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
projectCreation
public projectCreation(initProject: InitProject): void
Called once, right after synthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
Use it for deterministic, one-off file generation. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
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.
entrypointRequired
- Type: string
The relative path of the artifact within the project.
optionsRequired
- Type: AddBundleOptions
Bundling options.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
| 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.
xRequired
- Type: any
Any object.
isComponent
import { javascript } from 'projen'
javascript.Bundler.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
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.
projectRequired
- Type: projen.Project
The project.
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| string | Root bundle directory. |
| projen.Task | Gets or creates the singleton "bundle" task of the project. |
| string | The semantic version requirement for esbuild (if defined). |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
bundledirRequired
public readonly bundledir: string;
- Type: string
Root bundle directory.
bundleTaskRequired
public readonly bundleTask: Task;
- Type: projen.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.
esbuildVersionOptional
public readonly esbuildVersion: string;
- Type: string
The semantic version requirement for esbuild (if defined).
Eslint
Represents eslint configuration.
Initializers
import { javascript } from 'projen'
new javascript.Eslint(project: NodeProject, options: EslintOptions)
| Name | Type | Description |
|---|---|---|
| | No description. |
| | No description. |
projectRequired
- Type: NodeProject
optionsRequired
- Type: EslintOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Applies one or more mixins to this construct. |
| Runs eslint once, right after the project is first created, so the generated code is linted (and auto-fixed) immediately. |
| Called after synthesis. |
| Called before synthesis. |
| Called once, right after synthesize(), only when the project is created for the first time. |
| Synthesizes files to the project output directory. |
| Adds an extends item to the eslint configuration. |
| Do not lint these files. |
| Add a file, glob pattern or directory with source files to lint (e.g. [ "src" ]). |
| Add an eslint override. |
| Adds an eslint plugin. |
| Add an eslint rule. |
| Allow files matching these patterns to be linted with the typescript-eslint "default project" when they are not included by any tsconfig.json. |
| Add a glob file pattern which allows importing dev dependencies. |
toString
public toString(): string
Returns a string representation of this construct.
with
public with(mixins: ...IMixin[]): IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
mixinsRequired
- Type: ...constructs.IMixin[]
The mixins to apply.
postProjectCreation
public postProjectCreation(_initProject: InitProject): void
Runs eslint once, right after the project is first created, so the generated code is linted (and auto-fixed) immediately.
_initProjectRequired
- Type: projen.InitProject
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
projectCreation
public projectCreation(initProject: InitProject): void
Called once, right after synthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
Use it for deterministic, one-off file generation. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
addExtends
public addExtends(extendList: ...string[]): void
Adds an extends item to the eslint configuration.
extendListRequired
- Type: ...string[]
The list of "extends" to add.
addIgnorePattern
public addIgnorePattern(pattern: string): void
Do not lint these files.
patternRequired
- Type: string
addLintPattern
public addLintPattern(pattern: string): void
Add a file, glob pattern or directory with source files to lint (e.g. [ "src" ]).
patternRequired
- Type: string
addOverride
public addOverride(override: EslintOverride): void
Add an eslint override.
overrideRequired
- Type: EslintOverride
addPlugins
public addPlugins(plugins: ...string[]): void
Adds an eslint plugin.
pluginsRequired
- Type: ...string[]
The names of plugins to add.
addRules
public addRules(rules: {[ key: string ]: any}): void
Add an eslint rule.
rulesRequired
- Type: {[ key: string ]: any}
allowDefaultProjectFiles
public allowDefaultProjectFiles(patterns: ...string[]): void
Allow files matching these patterns to be linted with the typescript-eslint "default project" when they are not included by any tsconfig.json.
Only has an effect when the project service is enabled (see
EslintOptions.projectService). This is typically used for loose files
that live outside src/test (e.g. .projenrc.ts).
https://typescript-eslint.io/packages/parser/#allowdefaultproject
patternsRequired
- Type: ...string[]
glob patterns, relative to the project root.
allowDevDeps
public allowDevDeps(pattern: string): void
Add a glob file pattern which allows importing dev dependencies.
patternRequired
- Type: string
glob pattern.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
| Returns the singleton Eslint component of a project or undefined if there is none. |
isConstruct
import { javascript } from 'projen'
javascript.Eslint.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { javascript } from 'projen'
javascript.Eslint.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
of
import { javascript } from 'projen'
javascript.Eslint.of(project: Project)
Returns the singleton Eslint component of a project or undefined if there is none.
projectRequired
- Type: projen.Project
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| any | Direct access to the eslint configuration (escape hatch). |
| projen.Task | eslint task. |
| projen.ObjectFile | The underlying config file. |
| string[] | File patterns that should not be linted. |
| string[] | Returns an immutable copy of the lintPatterns being used by this eslint configuration. |
| | eslint overrides. |
| {[ key: string ]: any} | eslint rules. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
configRequired
public readonly config: any;
- Type: any
Direct access to the eslint configuration (escape hatch).
eslintTaskRequired
public readonly eslintTask: Task;
- Type: projen.Task
eslint task.
fileRequired
public readonly file: ObjectFile;
- Type: projen.ObjectFile
The underlying config file.
ignorePatternsRequired
public readonly ignorePatterns: string[];
- Type: string[]
File patterns that should not be linted.
lintPatternsRequired
public readonly lintPatterns: string[];
- Type: string[]
Returns an immutable copy of the lintPatterns being used by this eslint configuration.
overridesRequired
public readonly overrides: EslintOverride[];
- Type: EslintOverride[]
eslint overrides.
rulesRequired
public readonly rules: {[ key: string ]: any};
- Type: {[ key: string ]: any}
eslint rules.
Jest
Installs the following npm scripts:.
test, intended for testing locally and in CI. Will update snapshots unless updateSnapshot: UpdateSnapshot: NEVER is set.
test:watch, intended for automatically rerunning tests when files change.test:update, intended for testing locally and updating snapshots to match the latest unit under test. Only available whenupdateSnapshot: UpdateSnapshot: NEVER.
Initializers
import { javascript } from 'projen'
new javascript.Jest(scope: IConstruct, options?: JestOptions)
| Name | Type | Description |
|---|---|---|
| constructs.IConstruct | No description. |
| | No description. |
scopeRequired
- Type: constructs.IConstruct
optionsOptional
- Type: JestOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Applies one or more mixins to this construct. |
| Called once, right after postSynthesize(), only when the project is created for the first time. |
| Called after synthesis. |
| Called before synthesis. |
| Called once, right after synthesize(), only when the project is created for the first time. |
| Synthesizes files to the project output directory. |
| No description. |
| Adds one or more moduleNameMapper entries to Jest's configuration. |
| Adds one or more modulePaths to Jest's configuration. |
| No description. |
| Adds one or more roots to Jest's configuration. |
| Adds a a setup file to Jest's setupFiles configuration. |
| Adds a a setup file to Jest's setupFilesAfterEnv configuration. |
| No description. |
| Adds a test match pattern. |
| Adds a watch ignore pattern. |
| Build standard test match patterns for a directory. |
toString
public toString(): string
Returns a string representation of this construct.
with
public with(mixins: ...IMixin[]): IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
mixinsRequired
- Type: ...constructs.IMixin[]
The mixins to apply.
postProjectCreation
public postProjectCreation(initProject: InitProject): void
Called once, right after postSynthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST.
Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate
feedback on their new project. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
projectCreation
public projectCreation(initProject: InitProject): void
Called once, right after synthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
Use it for deterministic, one-off file generation. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
addIgnorePattern
public addIgnorePattern(pattern: string): void
patternRequired
- Type: string
addModuleNameMappers
public addModuleNameMappers(moduleNameMapperAdditions: {[ key: string ]: string | string[]}): void
Adds one or more moduleNameMapper entries to Jest's configuration.
Will overwrite if the same key is used as a pre-existing one.
moduleNameMapperAdditionsRequired
- Type: {[ key: string ]: string | string[]}
A map from regular expressions to module names or to arrays of module names that allow to stub out resources, like images or styles with a single module.
addModulePaths
public addModulePaths(modulePaths: ...string[]): void
Adds one or more modulePaths to Jest's configuration.
modulePathsRequired
- Type: ...string[]
An array of absolute paths to additional locations to search when resolving modules *.
addReporter
public addReporter(reporter: JestReporter): void
reporterRequired
- Type: JestReporter
addRoots
public addRoots(roots: ...string[]): void
Adds one or more roots to Jest's configuration.
rootsRequired
- Type: ...string[]
A list of paths to directories that Jest should use to search for files in.
addSetupFile
public addSetupFile(file: string): void
Adds a a setup file to Jest's setupFiles configuration.
fileRequired
- Type: string
File path to setup file.
addSetupFileAfterEnv
public addSetupFileAfterEnv(file: string): void
Adds a a setup file to Jest's setupFilesAfterEnv configuration.
fileRequired
- Type: string
File path to setup file.
addSnapshotResolver
public addSnapshotResolver(file: string): void
fileRequired
- Type: string
addTestMatch
public addTestMatch(pattern: string): void
Adds a test match pattern.
patternRequired
- Type: string
glob pattern to match for tests.
addWatchIgnorePattern
public addWatchIgnorePattern(pattern: string): void
Adds a watch ignore pattern.
patternRequired
- Type: string
The pattern (regular expression).
discoverTestMatchPatternsForDirs
public discoverTestMatchPatternsForDirs(dirs: string[], options?: JestDiscoverTestMatchPatternsForDirsOptions): void
Build standard test match patterns for a directory.
dirsRequired
- Type: string[]
The directories to add test matches for.
Matches any folder if not specified or an empty array.
optionsOptional
Options for building test match patterns.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
| Returns the singleton Jest component of a project or undefined if there is none. |
isConstruct
import { javascript } from 'projen'
javascript.Jest.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { javascript } from 'projen'
javascript.Jest.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
of
import { javascript } from 'projen'
javascript.Jest.of(project: Project)
Returns the singleton Jest component of a project or undefined if there is none.
projectRequired
- Type: projen.Project
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| | No description. |
| any | Escape hatch. |
| string | Jest version, including @ symbol, like @^29. |
| projen.JsonFile | Jest config file. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: NodeProject;
- Type: NodeProject
configRequired
public readonly config: any;
- Type: any
Escape hatch.
jestVersionRequired
public readonly jestVersion: string;
- Type: string
Jest version, including @ symbol, like @^29.
fileOptional
public readonly file: JsonFile;
- Type: projen.JsonFile
Jest config file.
undefined if settings are written to package.json
LicenseChecker
Enforces allowed licenses used by dependencies.
Initializers
import { javascript } from 'projen'
new javascript.LicenseChecker(scope: Construct, options: LicenseCheckerOptions)
| Name | Type | Description |
|---|---|---|
| constructs.Construct | No description. |
| | No description. |
scopeRequired
- Type: constructs.Construct
optionsRequired
- Type: LicenseCheckerOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Applies one or more mixins to this construct. |
| Called once, right after postSynthesize(), only when the project is created for the first time. |
| Called after synthesis. |
| Called before synthesis. |
| Called once, right after synthesize(), only when the project is created for the first time. |
| Synthesizes files to the project output directory. |
toString
public toString(): string
Returns a string representation of this construct.
with
public with(mixins: ...IMixin[]): IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
mixinsRequired
- Type: ...constructs.IMixin[]
The mixins to apply.
postProjectCreation
public postProjectCreation(initProject: InitProject): void
Called once, right after postSynthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST.
Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate
feedback on their new project. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
projectCreation
public projectCreation(initProject: InitProject): void
Called once, right after synthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
Use it for deterministic, one-off file generation. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
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 { javascript } from 'projen'
javascript.LicenseChecker.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { javascript } from 'projen'
javascript.LicenseChecker.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| projen.Task | No description. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
taskRequired
public readonly task: Task;
- Type: projen.Task
NodePackage
Represents the npm package.json file.
Initializers
import { javascript } from 'projen'
new javascript.NodePackage(project: Project, options?: NodePackageOptions)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
optionsOptional
- Type: NodePackageOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Applies one or more mixins to this construct. |
| Called once, right after postSynthesize(), only when the project is created for the first time. |
| Called after synthesis. |
| Called before synthesis. |
| Called once, right after synthesize(), only when the project is created for the first time. |
| Synthesizes files to the project output directory. |
| Allows the given dependency (package) names to run lifecycle install scripts (preinstall, install, postinstall, prepare), in addition to any already allowed via the allowScripts option or previous calls. |
| No description. |
| Defines bundled dependencies. |
| Defines normal dependencies. |
| Defines development/test dependencies. |
| Adds an engines requirement to your package. |
| Directly set fields in package.json. |
| Adds keywords to package.json (deduplicated). |
| Defines resolutions for dependencies to change the normally resolved version of a dependency to something else. |
| Defines peer dependencies. |
| Sets the package version. |
| Removes the given dependency (package) names from the allowScripts allowlist, whether they were added via the allowScripts option, a project type default, or a previous call to addAllowedScripts. |
| Removes an npm script (always successful). |
| Add a npm package.json script. |
| Attempt to resolve the currently installed version for a given dependency. |
toString
public toString(): string
Returns a string representation of this construct.
with
public with(mixins: ...IMixin[]): IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
mixinsRequired
- Type: ...constructs.IMixin[]
The mixins to apply.
postProjectCreation
public postProjectCreation(initProject: InitProject): void
Called once, right after postSynthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST.
Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate
feedback on their new project. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
projectCreation
public projectCreation(initProject: InitProject): void
Called once, right after synthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
Use it for deterministic, one-off file generation. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
addAllowedScripts
public addAllowedScripts(packages: ...string[]): void
Allows the given dependency (package) names to run lifecycle install scripts (preinstall, install, postinstall, prepare), in addition to any already allowed via the allowScripts option or previous calls.
Useful for project types that want to allowlist a package by default
while still letting consumers add further packages via allowScripts.
packagesRequired
- Type: ...string[]
The dependency (package) names to allow.
addBin
public addBin(bins: {[ key: string ]: string}): void
binsRequired
- Type: {[ key: string ]: string}
addBundledDeps
public addBundledDeps(deps: ...string[]): void
Defines bundled dependencies.
Bundled dependencies will be added as normal dependencies as well as to the
bundledDependencies section of your package.json.
depsRequired
- Type: ...string[]
Names modules to install.
By default, the the dependency will
be installed in the next pnpm projen run and the version will be recorded
in your package.json file. You can upgrade manually or using pnpm add/update. If you wish to specify a version range use this syntax:
module@^7.
addDeps
public addDeps(deps: ...string[]): void
Defines normal dependencies.
depsRequired
- Type: ...string[]
Names modules to install.
By default, the the dependency will
be installed in the next pnpm projen run and the version will be recorded
in your package.json file. You can upgrade manually or using pnpm add/update. If you wish to specify a version range use this syntax:
module@^7.
addDevDeps
public addDevDeps(deps: ...string[]): void
Defines development/test dependencies.
depsRequired
- Type: ...string[]
Names modules to install.
By default, the the dependency will
be installed in the next pnpm projen run and the version will be recorded
in your package.json file. You can upgrade manually or using pnpm add/update. If you wish to specify a version range use this syntax:
module@^7.
addEngine
public addEngine(engine: string, version: string): void
Adds an engines requirement to your package.
engineRequired
- Type: string
The engine (e.g. node).
versionRequired
- Type: string
The semantic version requirement (e.g. ^10).
addField
public addField(name: string, value: any): void
Directly set fields in package.json.
nameRequired
- Type: string
field name.
valueRequired
- Type: any
field value.
addKeywords
public addKeywords(keywords: ...string[]): void
Adds keywords to package.json (deduplicated).
keywordsRequired
- Type: ...string[]
The keywords to add.
addPackageResolutions
public addPackageResolutions(resolutions: ...string[]): void
Defines resolutions for dependencies to change the normally resolved version of a dependency to something else.
resolutionsRequired
- Type: ...string[]
Names resolutions to be added.
Specify a version or
range with this syntax:
module@^7
addPeerDeps
public addPeerDeps(deps: ...string[]): void
Defines peer dependencies.
When adding peer dependencies, a devDependency will also be added on the pinned version of the declared peer. This will ensure that you are testing your code against the minimum version required from your consumers.
depsRequired
- Type: ...string[]
Names modules to install.
By default, the the dependency will
be installed in the next pnpm projen run and the version will be recorded
in your package.json file. You can upgrade manually or using pnpm add/update. If you wish to specify a version range use this syntax:
module@^7.
addVersion
public addVersion(version: string): void
Sets the package version.
versionRequired
- Type: string
Package version.
removeAllowedScripts
public removeAllowedScripts(packages: ...string[]): void
Removes the given dependency (package) names from the allowScripts allowlist, whether they were added via the allowScripts option, a project type default, or a previous call to addAllowedScripts.
packagesRequired
- Type: ...string[]
The dependency (package) names to remove.
removeScript
public removeScript(name: string): void
Removes an npm script (always successful).
nameRequired
- Type: string
The name of the script.
setScript
public setScript(name: string, command: string): void
Add a npm package.json script.
nameRequired
- Type: string
The script name.
commandRequired
- Type: string
The command to execute.
tryResolveDependencyVersion
public tryResolveDependencyVersion(dependencyName: string): string
Attempt to resolve the currently installed version for a given dependency.
dependencyNameRequired
- Type: string
Dependency to resolve for.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
| Returns the NodePackage instance associated with a project or undefined if there is no NodePackage. |
isConstruct
import { javascript } from 'projen'
javascript.NodePackage.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { javascript } from 'projen'
javascript.NodePackage.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
of
import { javascript } from 'projen'
javascript.NodePackage.of(project: Project)
Returns the NodePackage instance associated with a project or undefined if there is no NodePackage.
projectRequired
- Type: projen.Project
The project.
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| boolean | Allow project to take library dependencies. |
| string | The module's entrypoint (e.g. lib/index.js). |
| string | The command prefix to use when executing binary commands for this package manager (e.g. npx, pnpm exec, yarn, bunx). |
| projen.JsonFile | The package.json file. |
| string | Renders pnpm install or npm install with lockfile update (not frozen). |
| projen.Task | The task for installing project dependencies (frozen). |
| string | Returns the command to execute in order to install all dependencies (always frozen). |
| projen.Task | The task for installing project dependencies (non-frozen). |
| string | The name of the lock file. |
| any | No description. |
| | npm package access level. |
| boolean | Should provenance statements be generated when package is published. |
| string | The npm registry host (e.g. registry.npmjs.org). |
| string | npm registry (e.g. https://registry.npmjs.org). Use npmRegistryHost to get just the host name. |
| | The package manager to use. |
| string | The name of the npm package. |
| string | The version of Bun to use if using Bun as a package manager. |
| | Options for npm packages using AWS CodeArtifact. |
| string | The SPDX license of this module. |
| string | Maximum node version supported by this package. |
| string | The minimum node version required by this package to function. |
| string | GitHub secret which contains the NPM token to use when publishing packages. |
| string | The version of PNPM to use if using PNPM as a package manager. |
| | Options for privately hosted scoped packages. |
| string | The version of Yarn to use if using Yarn as a package manager. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
allowLibraryDependenciesRequired
public readonly allowLibraryDependencies: boolean;
- Type: boolean
Allow project to take library dependencies.
entrypointRequired
public readonly entrypoint: string;
- Type: string
The module's entrypoint (e.g. lib/index.js).
execCommandRequired
public readonly execCommand: string;
- Type: string
The command prefix to use when executing binary commands for this package manager (e.g. npx, pnpm exec, yarn, bunx).
fileRequired
public readonly file: JsonFile;
- Type: projen.JsonFile
The package.json file.
installAndUpdateLockfileCommandRequired
public readonly installAndUpdateLockfileCommand: string;
- Type: string
Renders pnpm install or npm install with lockfile update (not frozen).
installCiTaskRequired
public readonly installCiTask: Task;
- Type: projen.Task
The task for installing project dependencies (frozen).
installCommandRequired
public readonly installCommand: string;
- Type: string
Returns the command to execute in order to install all dependencies (always frozen).
installTaskRequired
public readonly installTask: Task;
- Type: projen.Task
The task for installing project dependencies (non-frozen).
lockFileRequired
public readonly lockFile: string;
- Type: string
The name of the lock file.
manifestRequired
manifest- Deprecated: use
addField(x, y)
public readonly manifest: any;
- Type: any
npmAccessRequired
public readonly npmAccess: NpmAccess;
- Type: NpmAccess
npm package access level.
npmProvenanceRequired
public readonly npmProvenance: boolean;
- Type: boolean
Should provenance statements be generated when package is published.
npmRegistryRequired
public readonly npmRegistry: string;
- Type: string
The npm registry host (e.g. registry.npmjs.org).
npmRegistryUrlRequired
public readonly npmRegistryUrl: string;
- Type: string
npm registry (e.g. https://registry.npmjs.org). Use npmRegistryHost to get just the host name.
packageManagerRequired
public readonly packageManager: NodePackageManager;
- Type: NodePackageManager
The package manager to use.
packageNameRequired
public readonly packageName: string;
- Type: string
The name of the npm package.
bunVersionOptional
public readonly bunVersion: string;
- Type: string
The version of Bun to use if using Bun as a package manager.
codeArtifactOptionsOptional
public readonly codeArtifactOptions: CodeArtifactOptions;
- Type: CodeArtifactOptions
- Default: undefined
Options for npm packages using AWS CodeArtifact.
This is required if publishing packages to, or installing scoped packages from AWS CodeArtifact
licenseOptional
public readonly license: string;
- Type: string
The SPDX license of this module.
undefined if this package is not licensed.
maxNodeVersionOptional
public readonly maxNodeVersion: string;
- Type: string
Maximum node version supported by this package.
The value indicates the package is incompatible with newer versions.
minNodeVersionOptional
public readonly minNodeVersion: string;
- Type: string
The minimum node version required by this package to function.
This value indicates the package is incompatible with older versions.
npmTokenSecretOptional
public readonly npmTokenSecret: string;
- Type: string
GitHub secret which contains the NPM token to use when publishing packages.
pnpmVersionOptional
public readonly pnpmVersion: string;
- Type: string
The version of PNPM to use if using PNPM as a package manager.
scopedPackagesOptionsOptional
public readonly scopedPackagesOptions: ScopedPackagesOptions[];
- Type: ScopedPackagesOptions[]
- Default: undefined
Options for privately hosted scoped packages.
yarnVersionOptional
public readonly yarnVersion: string;
- Type: string
The version of Yarn to use if using Yarn as a package manager.
NodeProject
Node.js project.
Initializers
import { javascript } from 'projen'
new javascript.NodeProject(options: NodeProjectOptions)
| Name | Type | Description |
|---|---|---|
| | No description. |
optionsRequired
- Type: NodeProjectOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Applies one or more mixins to this construct. |
| Exclude the matching files from pre-synth cleanup. |
| Adds a .gitignore pattern. |
| Adds patterns to be ignored by npm. |
| Adds a new task to this project. |
| 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 an object file (like JsonFile, YamlFile, etc.) by name. |
| Finds a file at the specified relative path within this project and removes it. |
| No description. |
| Defines bundled dependencies. |
| Defines normal dependencies. |
| Defines development/test dependencies. |
| Directly set fields in package.json. |
| Adds keywords to package.json (deduplicated). |
| Defines peer dependencies. |
| Replaces the contents of multiple npm package.json scripts. |
| Removes the npm script (always successful). |
| Returns the set of workflow steps which should be executed to bootstrap a workflow. |
| Replaces the contents of an npm package.json script. |
toString
public toString(): string
Returns a string representation of this construct.
with
public with(mixins: ...IMixin[]): IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
mixinsRequired
- Type: ...constructs.IMixin[]
The mixins to apply.
addExcludeFromCleanup
public addExcludeFromCleanup(globs: ...string[]): void
Exclude the matching files from pre-synth cleanup.
Can be used when, for example, some source files include the projen marker and we don't want them to be erased during synth.
globsRequired
- Type: ...string[]
The glob patterns to match.
addGitIgnore
public addGitIgnore(pattern: string): void
Adds a .gitignore pattern.
patternRequired
- Type: string
The glob pattern to ignore.
addPackageIgnore
public addPackageIgnore(pattern: string): void
Adds patterns to be ignored by npm.
patternRequired
- Type: string
The pattern to ignore.
addTask
public addTask(name: string, props?: TaskOptions): Task
Adds a new task to this project.
This will fail if the project already has a task with this name.
nameRequired
- Type: string
The task name to add.
propsOptional
- Type: projen.TaskOptions
Task properties.
annotateGenerated
public annotateGenerated(glob: string): void
Marks the provided file(s) as being generated.
This is achieved using the github-linguist attributes. Generated files do not count against the repository statistics and language breakdown.
https://github.com/github/linguist/blob/master/docs/overrides.md
globRequired
- Type: string
the glob pattern to match (could be a file path).
postSynthesize
public postSynthesize(): void
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before all components are synthesized.
removeTask
public removeTask(name: string): Task
Removes a task from a project.
nameRequired
- Type: string
The name of the task to remove.
runTaskCommand
public runTaskCommand(task: Task): string
Returns the shell command to execute in order to run a task.
This will
typically be pnpm projen TASK.
taskRequired
- Type: projen.Task
The task for which the command is required.
synth
public synth(): void
Synthesize all project files into outdir.
- Call "this.preSynthesize()"
- Delete all generated files
- Synthesize all subprojects
- Synthesize all components of this project
- Call "projectCreation()" for all components, only if the project is being created for the first time
- Call "postSynthesize()" for all components of this project
- Call "this.postSynthesize()"
- Call "postProjectCreation()" for all components, only if the project is being created for the first time
tryFindFile
public tryFindFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and all its subprojects.
filePathRequired
- Type: string
The file path.
If this path is relative, it will be resolved from the root of this project.
tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePathRequired
- Type: string
The file path.
tryRemoveFile
public tryRemoveFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and removes it.
filePathRequired
- Type: string
The file path.
If this path is relative, it will be resolved from the root of this project.
addBins
public addBins(bins: {[ key: string ]: string}): void
binsRequired
- Type: {[ key: string ]: string}
addBundledDeps
public addBundledDeps(deps: ...string[]): void
Defines bundled dependencies.
Bundled dependencies will be added as normal dependencies as well as to the
bundledDependencies section of your package.json.
depsRequired
- Type: ...string[]
Names modules to install.
By default, the the dependency will
be installed in the next pnpm projen run and the version will be recorded
in your package.json file. You can upgrade manually or using pnpm add/update. If you wish to specify a version range use this syntax:
module@^7.
addDeps
public addDeps(deps: ...string[]): void
Defines normal dependencies.
depsRequired
- Type: ...string[]
Names modules to install.
By default, the the dependency will
be installed in the next pnpm projen run and the version will be recorded
in your package.json file. You can upgrade manually or using pnpm add/update. If you wish to specify a version range use this syntax:
module@^7.
addDevDeps
public addDevDeps(deps: ...string[]): void
Defines development/test dependencies.
depsRequired
- Type: ...string[]
Names modules to install.
By default, the the dependency will
be installed in the next pnpm projen run and the version will be recorded
in your package.json file. You can upgrade manually or using pnpm add/update. If you wish to specify a version range use this syntax:
module@^7.
addFields
public addFields(fields: {[ key: string ]: any}): void
Directly set fields in package.json.
fieldsRequired
- Type: {[ key: string ]: any}
The fields to set.
addKeywords
public addKeywords(keywords: ...string[]): void
Adds keywords to package.json (deduplicated).
keywordsRequired
- Type: ...string[]
The keywords to add.
addPeerDeps
public addPeerDeps(deps: ...string[]): void
Defines peer dependencies.
When adding peer dependencies, a devDependency will also be added on the pinned version of the declared peer. This will ensure that you are testing your code against the minimum version required from your consumers.
depsRequired
- Type: ...string[]
Names modules to install.
By default, the the dependency will
be installed in the next pnpm projen run and the version will be recorded
in your package.json file. You can upgrade manually or using pnpm add/update. If you wish to specify a version range use this syntax:
module@^7.
addScripts
public addScripts(scripts: {[ key: string ]: string}): void
Replaces the contents of multiple npm package.json scripts.
scriptsRequired
- Type: {[ key: string ]: string}
The scripts to set.
removeScript
public removeScript(name: string): void
Removes the npm script (always successful).
nameRequired
- Type: string
The name of the script.
renderWorkflowSetup
public renderWorkflowSetup(options?: RenderWorkflowSetupOptions): JobStep[]
Returns the set of workflow steps which should be executed to bootstrap a workflow.
optionsOptional
Options.
setScript
public setScript(name: string, command: string): void
Replaces the contents of an npm package.json script.
nameRequired
- Type: string
The script name.
commandRequired
- Type: string
The command to execute.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a project. |
| Find the closest ancestor project for given construct. |
isConstruct
import { javascript } from 'projen'
javascript.NodeProject.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isProject
import { javascript } from 'projen'
javascript.NodeProject.isProject(x: any)
Test whether the given construct is a project.
xRequired
- Type: any
of
import { javascript } from 'projen'
javascript.NodeProject.of(construct: IConstruct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
constructRequired
- Type: constructs.IConstruct
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Task | No description. |
| boolean | Whether to commit the managed files by default. |
| projen.Task | No description. |
| projen.Component[] | Returns all the components within this project. |
| projen.Dependencies | Project dependencies. |
| boolean | Whether or not the project is being ejected. |
| projen.FileBase[] | All files in this project. |
| projen.GitAttributesFile | The .gitattributes file for this repository. |
| projen.IgnoreFile | .gitignore. |
| projen.Logger | Logging utilities. |
| string | Project name. |
| string | Absolute output directory of this project. |
| projen.Task | No description. |
| projen.Task | No description. |
| projen.Task | No description. |
| projen.ProjectBuild | Manages the build process of the project. |
| string | The command to use in order to run the projen CLI. |
| projen.Project | The root project. |
| projen.Project[] | Returns all the subprojects within this project. |
| projen.Tasks | Project tasks. |
| projen.Task | No description. |
| projen.Task | This is the "default" task, the one that executes "projen". |
| projen.InitProject | The options used when this project is bootstrapped via projen new. |
| projen.Project | A parent project. |
| projen.github.AutoApprove | Auto approve set up for this project. |
| projen.vscode.DevContainer | Access for .devcontainer.json (used for GitHub Codespaces). |
| projen.github.GitHub | Access all github components. |
| projen.Gitpod | Access for Gitpod. |
| projen.vscode.VsCode | Access all VSCode components. |
| string | The build output directory. |
| string | The location of the npm tarball after build (${artifactsDirectory}/js). |
| | No description. |
| | The .npmrc file. |
| | API for managing the node package. |
| string | The command to use to run scripts (e.g. yarn run or npm run depends on the package manager). |
| projen.github.AutoMerge | Component that sets up mergify for merging approved pull requests. |
| | No description. |
| projen.build.BuildWorkflow | The PR build GitHub workflow. |
| string | The job ID of the build workflow. |
| | The Jest configuration (if enabled). |
| string | Maximum node version supported by this package. |
| string | The minimum node version required by this package to function. |
| projen.IgnoreFile | The .npmignore file. |
| | No description. |
| projen.release.Release | Release management. |
| | The upgrade workflow. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
buildTaskRequired
public readonly buildTask: Task;
- Type: projen.Task
commitGeneratedRequired
public readonly commitGenerated: boolean;
- Type: boolean
Whether to commit the managed files by default.
compileTaskRequired
public readonly compileTask: Task;
- Type: projen.Task
componentsRequired
public readonly components: Component[];
- Type: projen.Component[]
Returns all the components within this project.
depsRequired
public readonly deps: Dependencies;
- Type: projen.Dependencies
Project dependencies.
ejectedRequired
public readonly ejected: boolean;
- Type: boolean
Whether or not the project is being ejected.
filesRequired
public readonly files: FileBase[];
- Type: projen.FileBase[]
All files in this project.
gitattributesRequired
public readonly gitattributes: GitAttributesFile;
- Type: projen.GitAttributesFile
The .gitattributes file for this repository.
gitignoreRequired
public readonly gitignore: IgnoreFile;
- Type: projen.IgnoreFile
.gitignore.
loggerRequired
public readonly logger: Logger;
- Type: projen.Logger
Logging utilities.
nameRequired
public readonly name: string;
- Type: string
Project name.
outdirRequired
public readonly outdir: string;
- Type: string
Absolute output directory of this project.
packageTaskRequired
public readonly packageTask: Task;
- Type: projen.Task
postCompileTaskRequired
public readonly postCompileTask: Task;
- Type: projen.Task
preCompileTaskRequired
public readonly preCompileTask: Task;
- Type: projen.Task
projectBuildRequired
public readonly projectBuild: ProjectBuild;
- Type: projen.ProjectBuild
Manages the build process of the project.
projenCommandRequired
public readonly projenCommand: string;
- Type: string
The command to use in order to run the projen CLI.
rootRequired
public readonly root: Project;
- Type: projen.Project
The root project.
subprojectsRequired
public readonly subprojects: Project[];
- Type: projen.Project[]
Returns all the subprojects within this project.
tasksRequired
public readonly tasks: Tasks;
- Type: projen.Tasks
Project tasks.
testTaskRequired
public readonly testTask: Task;
- Type: projen.Task
defaultTaskOptional
public readonly defaultTask: Task;
- Type: projen.Task
This is the "default" task, the one that executes "projen".
Undefined if the project is being ejected.
initProjectOptional
initProject- Deprecated: use the
initProjectargument passed toComponent.projectCreation()instead.
public readonly initProject: InitProject;
- Type: projen.InitProject
The options used when this project is bootstrapped via projen new.
It includes the original set of options passed to the CLI and also the JSII FQN of the project type.
parentOptional
public readonly parent: Project;
- Type: projen.Project
A parent project.
If undefined, this is the root project.
autoApproveOptional
public readonly autoApprove: AutoApprove;
- Type: projen.github.AutoApprove
Auto approve set up for this project.
devContainerOptional
public readonly devContainer: DevContainer;
- Type: projen.vscode.DevContainer
Access for .devcontainer.json (used for GitHub Codespaces).
This will be undefined if devContainer boolean is false
githubOptional
public readonly github: GitHub;
- Type: projen.github.GitHub
Access all github components.
This will be undefined for subprojects.
gitpodOptional
public readonly gitpod: Gitpod;
- Type: projen.Gitpod
Access for Gitpod.
This will be undefined if gitpod boolean is false
vscodeOptional
public readonly vscode: VsCode;
- Type: projen.vscode.VsCode
Access all VSCode components.
This will be undefined for subprojects.
artifactsDirectoryRequired
public readonly artifactsDirectory: string;
- Type: string
The build output directory.
An npm tarball will be created under the js
subdirectory. For example, if this is set to dist (the default), the npm
tarball will be placed under dist/js/boom-boom-1.2.3.tg.
artifactsJavascriptDirectoryRequired
public readonly artifactsJavascriptDirectory: string;
- Type: string
The location of the npm tarball after build (${artifactsDirectory}/js).
bundlerRequired
public readonly bundler: Bundler;
- Type: Bundler
npmrcRequired
public readonly npmrc: NpmConfig;
- Type: NpmConfig
The .npmrc file.
packageRequired
public readonly package: NodePackage;
- Type: NodePackage
API for managing the node package.
runScriptCommandRequired
public readonly runScriptCommand: string;
- Type: string
The command to use to run scripts (e.g. yarn run or npm run depends on the package manager).
autoMergeOptional
public readonly autoMerge: AutoMerge;
- Type: projen.github.AutoMerge
Component that sets up mergify for merging approved pull requests.
biomeOptional
public readonly biome: Biome;
- Type: Biome
buildWorkflowOptional
public readonly buildWorkflow: BuildWorkflow;
- Type: projen.build.BuildWorkflow
The PR build GitHub workflow.
undefined if buildWorkflow is disabled.
buildWorkflowJobIdOptional
public readonly buildWorkflowJobId: string;
- Type: string
The job ID of the build workflow.
jestOptional
public readonly jest: Jest;
- Type: Jest
The Jest configuration (if enabled).
maxNodeVersionOptional
public readonly maxNodeVersion: string;
- Type: string
Maximum node version supported by this package.
The value indicates the package is incompatible with newer versions.
minNodeVersionOptional
public readonly minNodeVersion: string;
- Type: string
The minimum node version required by this package to function.
This value indicates the package is incompatible with older versions.
npmignoreOptional
public readonly npmignore: IgnoreFile;
- Type: projen.IgnoreFile
The .npmignore file.
prettierOptional
public readonly prettier: Prettier;
- Type: Prettier
releaseOptional
public readonly release: Release;
- Type: projen.release.Release
Release management.
upgradeWorkflowOptional
public readonly upgradeWorkflow: UpgradeDependencies;
- Type: UpgradeDependencies
The upgrade workflow.
Constants
| Name | Type | Description |
|---|---|---|
| string | The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASKRequired
public readonly DEFAULT_TASK: string;
- Type: string
The name of the default task (the task executed when projen is run without arguments).
Normally this task should synthesize the project files.
NpmConfig
File representing the local NPM config in .npmrc.
Initializers
import { javascript } from 'projen'
new javascript.NpmConfig(project: NodeProject, options?: NpmConfigOptions)
| Name | Type | Description |
|---|---|---|
| | No description. |
| | No description. |
projectRequired
- Type: NodeProject
optionsOptional
- Type: NpmConfigOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Applies one or more mixins to this construct. |
| Called once, right after postSynthesize(), only when the project is created for the first time. |
| Called after synthesis. |
| Called before synthesis. |
| Called once, right after synthesize(), only when the project is created for the first time. |
| Synthesizes files to the project output directory. |
| configure a generic property. |
| configure a scoped registry. |
toString
public toString(): string
Returns a string representation of this construct.
with
public with(mixins: ...IMixin[]): IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
mixinsRequired
- Type: ...constructs.IMixin[]
The mixins to apply.
postProjectCreation
public postProjectCreation(initProject: InitProject): void
Called once, right after postSynthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST.
Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate
feedback on their new project. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
projectCreation
public projectCreation(initProject: InitProject): void
Called once, right after synthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
Use it for deterministic, one-off file generation. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
addConfig
public addConfig(name: string, value: string): void
configure a generic property.
nameRequired
- Type: string
the name of the property.
valueRequired
- Type: string
the value of the property.
addRegistry
public addRegistry(url: string, scope?: string): void
configure a scoped registry.
urlRequired
- Type: string
the URL of the registry to use.
scopeOptional
- Type: string
the scope the registry is used for;
leave empty for the default registry
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { javascript } from 'projen'
javascript.NpmConfig.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { javascript } from 'projen'
javascript.NpmConfig.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
PnpmWorkspaceYaml
Represents a pnpm-workspace.yaml file.
Initializers
import { javascript } from 'projen'
new javascript.PnpmWorkspaceYaml(project: Project, options?: PnpmWorkspaceYamlOptions)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
optionsOptional
- Type: PnpmWorkspaceYamlOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Applies one or more mixins to this construct. |
| Called once, right after postSynthesize(), only when the project is created for the first time. |
| Called after synthesis. |
| Called before synthesis. |
| Called once, right after synthesize(), only when the project is created for the first time. |
| Synthesizes files to the project output directory. |
toString
public toString(): string
Returns a string representation of this construct.
with
public with(mixins: ...IMixin[]): IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
mixinsRequired
- Type: ...constructs.IMixin[]
The mixins to apply.
postProjectCreation
public postProjectCreation(initProject: InitProject): void
Called once, right after postSynthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST.
Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate
feedback on their new project. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
projectCreation
public projectCreation(initProject: InitProject): void
Called once, right after synthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
Use it for deterministic, one-off file generation. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
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. |
| Returns the PnpmWorkspaceYaml instance associated with a project or undefined if there is none. |
isConstruct
import { javascript } from 'projen'
javascript.PnpmWorkspaceYaml.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { javascript } from 'projen'
javascript.PnpmWorkspaceYaml.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
of
import { javascript } from 'projen'
javascript.PnpmWorkspaceYaml.of(project: Project)
Returns the PnpmWorkspaceYaml instance associated with a project or undefined if there is none.
projectRequired
- Type: projen.Project
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
Prettier
Represents prettier configuration.
Initializers
import { javascript } from 'projen'
new javascript.Prettier(project: NodeProject, options: PrettierOptions)
| Name | Type | Description |
|---|---|---|
| | No description. |
| | No description. |
projectRequired
- Type: NodeProject
optionsRequired
- Type: PrettierOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Applies one or more mixins to this construct. |
| Called once, right after postSynthesize(), only when the project is created for the first time. |
| Called after synthesis. |
| Called before synthesis. |
| Called once, right after synthesize(), only when the project is created for the first time. |
| Synthesizes files to the project output directory. |
| Defines Prettier ignore Patterns these patterns will be added to the file .prettierignore. |
| Add a prettier override. |
toString
public toString(): string
Returns a string representation of this construct.
with
public with(mixins: ...IMixin[]): IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
mixinsRequired
- Type: ...constructs.IMixin[]
The mixins to apply.
postProjectCreation
public postProjectCreation(initProject: InitProject): void
Called once, right after postSynthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST.
Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate
feedback on their new project. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
projectCreation
public projectCreation(initProject: InitProject): void
Called once, right after synthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
Use it for deterministic, one-off file generation. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
addIgnorePattern
public addIgnorePattern(pattern: string): void
Defines Prettier ignore Patterns these patterns will be added to the file .prettierignore.
patternRequired
- Type: string
filepatterns so exclude from prettier formatting.
addOverride
public addOverride(override: PrettierOverride): void
Add a prettier override.
https://prettier.io/docs/en/configuration.html#configuration-overrides
overrideRequired
- Type: PrettierOverride
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
| No description. |
isConstruct
import { javascript } from 'projen'
javascript.Prettier.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { javascript } from 'projen'
javascript.Prettier.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
of
import { javascript } from 'projen'
javascript.Prettier.of(project: Project)
projectRequired
- Type: projen.Project
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| | Returns all Prettier overrides. |
| | Direct access to the prettier settings. |
| projen.IgnoreFile | The .prettierIgnore file. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
overridesRequired
public readonly overrides: PrettierOverride[];
- Type: PrettierOverride[]
Returns all Prettier overrides.
settingsRequired
public readonly settings: PrettierSettings;
- Type: PrettierSettings
Direct access to the prettier settings.
ignoreFileOptional
public readonly ignoreFile: IgnoreFile;
- Type: projen.IgnoreFile
The .prettierIgnore file.
Projenrc
A projenrc file written in JavaScript.
This component can be instantiated in any type of project and has no expectations around the project's main language.
Initializers
import { javascript } from 'projen'
new javascript.Projenrc(project: Project, options?: ProjenrcOptions)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
optionsOptional
- Type: ProjenrcOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Applies one or more mixins to this construct. |
| Called once, right after postSynthesize(), only when the project is created for the first time. |
| Called after synthesis. |
| Called before synthesis. |
| Called once, right after synthesize(), only when the project is created for the first time. |
| Synthesizes files to the project output directory. |
toString
public toString(): string
Returns a string representation of this construct.
with
public with(mixins: ...IMixin[]): IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
mixinsRequired
- Type: ...constructs.IMixin[]
The mixins to apply.
postProjectCreation
public postProjectCreation(initProject: InitProject): void
Called once, right after postSynthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST.
Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate
feedback on their new project. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
projectCreation
public projectCreation(initProject: InitProject): void
Called once, right after synthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
Use it for deterministic, one-off file generation. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
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. |
| Returns the Projenrc instance associated with a project or undefined if there is no Projenrc. |
isConstruct
import { javascript } from 'projen'
javascript.Projenrc.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { javascript } from 'projen'
javascript.Projenrc.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
of
import { javascript } from 'projen'
javascript.Projenrc.of(project: Project)
Returns the Projenrc instance associated with a project or undefined if there is no Projenrc.
projectRequired
- Type: projen.Project
The project.
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| string | The path of the projenrc file. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
filePathRequired
public readonly filePath: string;
- Type: string
The path of the projenrc file.
TypescriptConfig
Initializers
import { javascript } from 'projen'
new javascript.TypescriptConfig(project: Project, options: TypescriptConfigOptions)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
optionsRequired
- Type: TypescriptConfigOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Applies one or more mixins to this construct. |
| Called once, right after postSynthesize(), only when the project is created for the first time. |
| Called after synthesis. |
| Called before synthesis. |
| Called once, right after synthesize(), only when the project is created for the first time. |
| Synthesizes files to the project output directory. |
| Add an exclude pattern to the exclude array of the TSConfig. |
| Extend from base TypescriptConfig instance. |
| Add an include pattern to the include array of the TSConfig. |
| Remove an exclude pattern from the exclude array of the TSConfig. |
| Remove an include pattern from the include array of the TSConfig. |
| Resolve valid TypeScript extends paths relative to this config. |
toString
public toString(): string
Returns a string representation of this construct.
with
public with(mixins: ...IMixin[]): IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
mixinsRequired
- Type: ...constructs.IMixin[]
The mixins to apply.
postProjectCreation
public postProjectCreation(initProject: InitProject): void
Called once, right after postSynthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST.
Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate
feedback on their new project. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
projectCreation
public projectCreation(initProject: InitProject): void
Called once, right after synthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
Use it for deterministic, one-off file generation. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
addExclude
public addExclude(pattern: string): void
Add an exclude pattern to the exclude array of the TSConfig.
patternRequired
- Type: string
The pattern to add.
addExtends
public addExtends(value: TypescriptConfig): void
Extend from base TypescriptConfig instance.
valueRequired
- Type: TypescriptConfig
Base TypescriptConfig instance.
addInclude
public addInclude(pattern: string): void
Add an include pattern to the include array of the TSConfig.
patternRequired
- Type: string
The pattern to add.
removeExclude
public removeExclude(pattern: string): void
Remove an exclude pattern from the exclude array of the TSConfig.
patternRequired
- Type: string
The pattern to remove.
removeInclude
public removeInclude(pattern: string): void
Remove an include pattern from the include array of the TSConfig.
patternRequired
- Type: string
The pattern to remove.
resolveExtendsPath
public resolveExtendsPath(configPath: string): string
Resolve valid TypeScript extends paths relative to this config.
configPathRequired
- Type: string
Path to resolve against.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { javascript } from 'projen'
javascript.TypescriptConfig.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { javascript } from 'projen'
javascript.TypescriptConfig.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| string[] | No description. |
| string[] | Array of base tsconfig.json paths. Any absolute paths are resolved relative to this instance, while any relative paths are used as is. |
| projen.JsonFile | No description. |
| string | No description. |
| string[] | No description. |
| | No description. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
excludeRequired
public readonly exclude: string[];
- Type: string[]
extendsRequired
public readonly extends: string[];
- Type: string[]
Array of base tsconfig.json paths. Any absolute paths are resolved relative to this instance, while any relative paths are used as is.
fileRequired
public readonly file: JsonFile;
- Type: projen.JsonFile
fileNameRequired
public readonly fileName: string;
- Type: string
includeRequired
public readonly include: string[];
- Type: string[]
compilerOptionsOptional
public readonly compilerOptions: TypeScriptCompilerOptions;
UpgradeDependencies
Upgrade node project dependencies.
Initializers
import { javascript } from 'projen'
new javascript.UpgradeDependencies(project: NodeProject, options?: UpgradeDependenciesOptions)
| Name | Type | Description |
|---|---|---|
| | No description. |
| | No description. |
projectRequired
- Type: NodeProject
optionsOptional
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Applies one or more mixins to this construct. |
| Called once, right after postSynthesize(), only when the project is created for the first time. |
| Called after synthesis. |
| Called before synthesis. |
| Called once, right after synthesize(), only when the project is created for the first time. |
| Synthesizes files to the project output directory. |
| Add steps to execute a successful build. |
toString
public toString(): string
Returns a string representation of this construct.
with
public with(mixins: ...IMixin[]): IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
mixinsRequired
- Type: ...constructs.IMixin[]
The mixins to apply.
postProjectCreation
public postProjectCreation(initProject: InitProject): void
Called once, right after postSynthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST.
Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate
feedback on their new project. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
projectCreation
public projectCreation(initProject: InitProject): void
Called once, right after synthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
Use it for deterministic, one-off file generation. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
addPostBuildSteps
public addPostBuildSteps(steps: ...JobStep[]): void
Add steps to execute a successful build.
stepsRequired
- Type: ...projen.github.workflows.JobStep[]
workflow steps.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { javascript } from 'projen'
javascript.UpgradeDependencies.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { javascript } from 'projen'
javascript.UpgradeDependencies.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| | No description. |
| projen.Task | A task run after the upgrade task. |
| projen.Task | The upgrade task. |
| projen.github.GithubWorkflow[] | The workflows that execute the upgrades. |
| projen.github.workflows.ContainerOptions | Container definitions for the upgrade workflow. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: NodeProject;
- Type: NodeProject
postUpgradeTaskRequired
public readonly postUpgradeTask: Task;
- Type: projen.Task
A task run after the upgrade task.
upgradeTaskRequired
public readonly upgradeTask: Task;
- Type: projen.Task
The upgrade task.
workflowsRequired
public readonly workflows: GithubWorkflow[];
- Type: projen.github.GithubWorkflow[]
The workflows that execute the upgrades.
One workflow per branch.
containerOptionsOptional
public readonly containerOptions: ContainerOptions;
- Type: projen.github.workflows.ContainerOptions
Container definitions for the upgrade workflow.
Yarnrc
Initializers
import { javascript } from 'projen'
new javascript.Yarnrc(project: Project, options?: YarnrcOptions)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
optionsOptional
- Type: YarnrcOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Applies one or more mixins to this construct. |
| Called once, right after postSynthesize(), only when the project is created for the first time. |
| Called after synthesis. |
| Called before synthesis. |
| Called once, right after synthesize(), only when the project is created for the first time. |
| Synthesizes files to the project output directory. |
toString
public toString(): string
Returns a string representation of this construct.
with
public with(mixins: ...IMixin[]): IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
mixinsRequired
- Type: ...constructs.IMixin[]
The mixins to apply.
postProjectCreation
public postProjectCreation(initProject: InitProject): void
Called once, right after postSynthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST.
Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate
feedback on their new project. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
projectCreation
public projectCreation(initProject: InitProject): void
Called once, right after synthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
Use it for deterministic, one-off file generation. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
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 { javascript } from 'projen'
javascript.Yarnrc.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { javascript } from 'projen'
javascript.Yarnrc.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
Structs
AddBundleOptions
Options for addBundle().
Initializer
import { javascript } from 'projen'
const addBundleOptions: javascript.AddBundleOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | You can mark a file or a package as external to exclude it from your build. |
| boolean | Include a source map in the bundle. |
| boolean | In addition to the bundle:xyz task, creates bundle:xyz:watch task which will invoke the same esbuild command with the --watch flag. |
| string | esbuild platform. |
| string | esbuild target. |
| string | Use this to insert an arbitrary string at the beginning of generated JavaScript files. |
| | The charset to use for esbuild's output. |
| {[ key: string ]: string} | Replace global identifiers with constant expressions. |
| {[ key: string ]: string | boolean} | Build arguments to pass into esbuild. |
| boolean | Mark the output file as executable. |
| string | Use this to insert an arbitrary string at the end of generated JavaScript files. |
| string | Output format for the generated JavaScript files. |
| string[] | This option allows you to automatically replace a global variable with an import from another file. |
| boolean | Whether to preserve the original name values even in minified code. |
| {[ key: string ]: string} | Map of file extensions (without dot) and loaders to use for this file type. |
| | Log level for esbuild. |
| string[] | How to determine the entry point for modules. |
| boolean | This option tells esbuild to write out a JSON file relative to output directory with metadata about the build. |
| boolean | Whether to minify files when bundling. |
| string | Bundler output path relative to the asset's output directory. |
| | Source map mode to be used when bundling. |
| boolean | Whether to include original source code in source maps when bundling. |
| string | The path of the tsconfig.json file to use for bundling. |
externalsOptional
public readonly externals: string[];
- Type: string[]
- Default: []
You can mark a file or a package as external to exclude it from your build.
Instead of being bundled, the import will be preserved (using require for the iife and cjs formats and using import for the esm format) and will be evaluated at run time instead.
This has several uses. First of all, it can be used to trim unnecessary code from your bundle for a code path that you know will never be executed. For example, a package may contain code that only runs in node but you will only be using that package in the browser. It can also be used to import code in node at run time from a package that cannot be bundled. For example, the fsevents package contains a native extension, which esbuild doesn't support.
sourcemapOptional
public readonly sourcemap: boolean;
- Type: boolean
- Default: false
Include a source map in the bundle.
watchTaskOptional
public readonly watchTask: boolean;
- Type: boolean
- Default: true
In addition to the bundle:xyz task, creates bundle:xyz:watch task which will invoke the same esbuild command with the --watch flag.
This can be used to continusouly watch for changes.
platformRequired
public readonly platform: string;
- Type: string
esbuild platform.
Example
"node"
targetRequired
public readonly target: string;
- Type: string
esbuild target.
Example
"node12"
bannerOptional
public readonly banner: string;
- Type: string
- Default: no comments are passed
Use this to insert an arbitrary string at the beginning of generated JavaScript files.
This is similar to footer which inserts at the end instead of the beginning.
This is commonly used to insert comments:
charsetOptional
public readonly charset: Charset;
- Type: Charset
- Default: Charset.ASCII
The charset to use for esbuild's output.
By default esbuild's output is ASCII-only. Any non-ASCII characters are escaped
using backslash escape sequences. Using escape sequences makes the generated output
slightly bigger, and also makes it harder to read. If you would like for esbuild to print
the original characters without using escape sequences, use Charset.UTF8.
defineOptional
public readonly define: {[ key: string ]: string};
- Type: {[ key: string ]: string}
- Default: no replacements are made
Replace global identifiers with constant expressions.
For example, { 'process.env.DEBUG': 'true' }.
Another example, { 'process.env.API_KEY': JSON.stringify('xxx-xxxx-xxx') }.
esbuildArgsOptional
public readonly esbuildArgs: {[ key: string ]: string | boolean};
- Type: {[ key: string ]: string | boolean}
- Default: no additional esbuild arguments are passed
Build arguments to pass into esbuild.
For example, to add the --log-limit flag:
project.bundler.addBundle("./src/hello.ts", {
platform: "node",
target: "node22",
sourcemap: true,
format: "esm",
esbuildArgs: {
"--log-limit": "0",
},
});
executableOptional
public readonly executable: boolean;
- Type: boolean
- Default: false
Mark the output file as executable.
footerOptional
public readonly footer: string;
- Type: string
- Default: no comments are passed
Use this to insert an arbitrary string at the end of generated JavaScript files.
This is similar to banner which inserts at the beginning instead of the end.
This is commonly used to insert comments
formatOptional
public readonly format: string;
- Type: string
- Default: undefined
Output format for the generated JavaScript files.
There are currently three possible values that can be configured: "iife", "cjs", and "esm".
If not set (undefined), esbuild picks an output format for you based on platform:
"cjs"ifplatformis"node""iife"ifplatformis"browser""esm"ifplatformis"neutral"
Note: If making a bundle to run under node with ESM, set format to "esm" instead of setting platform to "neutral".
injectOptional
public readonly inject: string[];
- Type: string[]
- Default: no code is injected
This option allows you to automatically replace a global variable with an import from another file.
keepNamesOptional
public readonly keepNames: boolean;
- Type: boolean
- Default: false
Whether to preserve the original name values even in minified code.
In JavaScript the name property on functions and classes defaults to a
nearby identifier in the source code.
However, minification renames symbols to reduce code size and bundling
sometimes need to rename symbols to avoid collisions. That changes value of
the name property for many of these cases. This is usually fine because
the name property is normally only used for debugging. However, some
frameworks rely on the name property for registration and binding purposes.
If this is the case, you can enable this option to preserve the original
name values even in minified code.
loadersOptional
public readonly loaders: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Map of file extensions (without dot) and loaders to use for this file type.
Loaders are appended to the esbuild command by --loader:.extension=loader
logLevelOptional
public readonly logLevel: BundleLogLevel;
- Type: BundleLogLevel
- Default: LogLevel.WARNING
Log level for esbuild.
This is also propagated to the package manager and applies to its specific install command.
mainFieldsOptional
public readonly mainFields: string[];
- Type: string[]
- Default: []
How to determine the entry point for modules.
Try ['module', 'main'] to default to ES module versions.
metafileOptional
public readonly metafile: boolean;
- Type: boolean
- Default: false
This option tells esbuild to write out a JSON file relative to output directory with metadata about the build.
The metadata in this JSON file follows this schema (specified using TypeScript syntax):
{
outputs: {
[path: string]: {
bytes: number
inputs: {
[path: string]: { bytesInOutput: number }
}
imports: { path: string }[]
exports: string[]
}
}
}
This data can then be analyzed by other tools. For example, bundle buddy can consume esbuild's metadata format and generates a treemap visualization of the modules in your bundle and how much space each one takes up.
minifyOptional
public readonly minify: boolean;
- Type: boolean
- Default: false
Whether to minify files when bundling.
outfileOptional
public readonly outfile: string;
- Type: string
- Default: "index.js"
Bundler output path relative to the asset's output directory.
sourceMapModeOptional
public readonly sourceMapMode: SourceMapMode;
- Type: SourceMapMode
- Default: SourceMapMode.DEFAULT
Source map mode to be used when bundling.
sourcesContentOptional
public readonly sourcesContent: boolean;
- Type: boolean
- Default: true
Whether to include original source code in source maps when bundling.
tsconfigPathOptional
public readonly tsconfigPath: string;
- Type: string
- Default: "tsconfig.json"
The path of the tsconfig.json file to use for bundling.
AuditOptions
Options for security audit configuration.
Initializer
import { javascript } from 'projen'
const auditOptions: javascript.AuditOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | Minimum vulnerability level to check for during audit. |
| boolean | Only audit production dependencies. |
| string | When to run the audit task. |
levelOptional
public readonly level: string;
- Type: string
- Default: "high"
Minimum vulnerability level to check for during audit.
prodOnlyOptional
public readonly prodOnly: boolean;
- Type: boolean
- Default: false
Only audit production dependencies.
When false, both production and development dependencies are audited. This is recommended as build dependencies can also contain security vulnerabilities.
runOnOptional
public readonly runOn: string;
- Type: string
- Default: "build"
When to run the audit task.
"build": Run during every build (default)
- "release": Only run during release workflow
- "manual": Create the task but don't run it automatically
BiomeOptions
Initializer
import { javascript } from 'projen'
const biomeOptions: javascript.BiomeOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| boolean | Enable code assist with recommended actions. |
| | Full Biome configuration. |
| boolean | Enable code formatter with recommended settings. |
| boolean | Automatically ignore all generated files. |
| boolean | Enable linting with recommended rules. |
| boolean | Should arrays be merged or overwritten when creating Biome configuration. |
| string | Version of Biome to use. |
assistOptional
public readonly assist: boolean;
- Type: boolean
- Default: true
Enable code assist with recommended actions.
biomeConfigOptional
public readonly biomeConfig: BiomeConfiguration;
- Type: BiomeConfiguration
Full Biome configuration.
This configuration dictates the final outcome if value is set.
For example, if the linter is disabled at the top-level, it can be enabled with biomeConfig.linter.enabled.
formatterOptional
public readonly formatter: boolean;
- Type: boolean
- Default: true
Enable code formatter with recommended settings.
ignoreGeneratedFilesOptional
public readonly ignoreGeneratedFiles: boolean;
- Type: boolean
- Default: true
Automatically ignore all generated files.
This prevents Biome from trying to format or lint files that are marked as generated, which would fail since generated files are typically read-only.
linterOptional
public readonly linter: boolean;
- Type: boolean
- Default: true
Enable linting with recommended rules.
mergeArraysInConfigurationOptional
public readonly mergeArraysInConfiguration: boolean;
- Type: boolean
- Default: true
Should arrays be merged or overwritten when creating Biome configuration.
By default arrays are merged and duplicate values are removed
versionOptional
public readonly version: string;
- Type: string
- Default: "^2.5"
Version of Biome to use.
BuildWorkflowOptions
Build workflow options for NodeProject.
Initializer
import { javascript } from 'projen'
const buildWorkflowOptions: javascript.BuildWorkflowOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| {[ key: string ]: string} | Build environment variables. |
| string | Name of the buildfile (e.g. "build" becomes "build.yml"). |
| projen.github.workflows.JobPermissions | Permissions granted to the build job To limit job permissions for contents, the desired permissions have to be explicitly set, e.g.: { contents: JobPermission.NONE }. |
| projen.github.workflows.JobStep[] | Steps to execute before the build. |
| projen.github.workflows.Triggers | Build workflow triggers. |
| boolean | Automatically update files modified during builds to pull-request branches. |
| boolean | Perform a mutable (non-frozen) install during builds. |
| string[] | Github Runner selection labels. |
| projen.GroupRunnerOptions | Github Runner Group selection options. |
envOptional
public readonly env: {[ key: string ]: string};
- Type: {[ key: string ]: string}
- Default: {}
Build environment variables.
nameOptional
public readonly name: string;
- Type: string
- Default: "build"
Name of the buildfile (e.g. "build" becomes "build.yml").
permissionsOptional
public readonly permissions: JobPermissions;
- Type: projen.github.workflows.JobPermissions
- Default:
{ contents: JobPermission.WRITE }
Permissions granted to the build job To limit job permissions for contents, the desired permissions have to be explicitly set, e.g.: { contents: JobPermission.NONE }.
preBuildStepsOptional
public readonly preBuildSteps: JobStep[];
- Type: projen.github.workflows.JobStep[]
- Default: []
Steps to execute before the build.
workflowTriggersOptional
public readonly workflowTriggers: Triggers;
- Type: projen.github.workflows.Triggers
- Default: "{ pullRequest: {}, workflowDispatch: {} }"
Build workflow triggers.
mutableBuildOptional
public readonly mutableBuild: boolean;
- Type: boolean
- Default: true
Automatically update files modified during builds to pull-request branches.
This means that any files synthesized by projen or e.g. test snapshots will always be up-to-date before a PR is merged.
Implies that PR builds do not have anti-tamper checks.
mutableInstallOptional
public readonly mutableInstall: boolean;
- Type: boolean
- Default: value of
mutableBuild
Perform a mutable (non-frozen) install during builds.
This will update the
package lockfile during installs, which is useful when build steps modify
dependencies. Set to false to use frozen lockfile installs even when
mutableBuild is enabled.
runsOnOptional
public readonly runsOn: string[];
- Type: string[]
- Default: ["ubuntu-latest"]
Github Runner selection labels.
runsOnGroupOptional
public readonly runsOnGroup: GroupRunnerOptions;
- Type: projen.GroupRunnerOptions
Github Runner Group selection options.
Bundle
Initializer
import { javascript } from 'projen'
const bundle: javascript.Bundle = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| projen.Task | The task that produces this bundle. |
| string | Base directory containing the output file (relative to project root). |
| string | Location of the output file (relative to project root). |
| projen.Task | The "watch" task for this bundle. |
bundleTaskRequired
public readonly bundleTask: Task;
- Type: projen.Task
The task that produces this bundle.
outdirRequired
public readonly outdir: string;
- Type: string
Base directory containing the output file (relative to project root).
outfileRequired
public readonly outfile: string;
- Type: string
Location of the output file (relative to project root).
watchTaskOptional
public readonly watchTask: Task;
- Type: projen.Task
The "watch" task for this bundle.
BundlerOptions
Options for Bundler.
Initializer
import { javascript } from 'projen'
const bundlerOptions: javascript.BundlerOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | Output directory for all bundles. |
| string | The semantic version requirement for esbuild. |
| {[ key: string ]: string} | Map of file extensions (without dot) and loaders to use for this file type. |
| | Choose which phase (if any) to add the bundle command to. |
assetsDirOptional
public readonly assetsDir: string;
- Type: string
- Default: "assets"
Output directory for all bundles.
esbuildVersionOptional
public readonly esbuildVersion: string;
- Type: string
- Default: no specific version (implies latest)
The semantic version requirement for esbuild.
loadersOptional
public readonly loaders: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Map of file extensions (without dot) and loaders to use for this file type.
Loaders are appended to the esbuild command by --loader:.extension=loader
runBundleTaskOptional
public readonly runBundleTask: RunBundleTask;
- Type: RunBundleTask
- Default: RunBundleTask.PRE_COMPILE
Choose which phase (if any) to add the bundle command to.
Note: If using addBundle() with the bundleCompiledResults, this option
must be set to RunBundleTask.POST_COMPILE or RunBundleTask.MANUAL.
[AddBundleOptions.bundleCompiledResults *](AddBundleOptions.bundleCompiledResults *)
BundlingOptions
Options for bundling.
Initializer
import { javascript } from 'projen'
const bundlingOptions: javascript.BundlingOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | You can mark a file or a package as external to exclude it from your build. |
| boolean | Include a source map in the bundle. |
| boolean | In addition to the bundle:xyz task, creates bundle:xyz:watch task which will invoke the same esbuild command with the --watch flag. |
externalsOptional
public readonly externals: string[];
- Type: string[]
- Default: []
You can mark a file or a package as external to exclude it from your build.
Instead of being bundled, the import will be preserved (using require for the iife and cjs formats and using import for the esm format) and will be evaluated at run time instead.
This has several uses. First of all, it can be used to trim unnecessary code from your bundle for a code path that you know will never be executed. For example, a package may contain code that only runs in node but you will only be using that package in the browser. It can also be used to import code in node at run time from a package that cannot be bundled. For example, the fsevents package contains a native extension, which esbuild doesn't support.
sourcemapOptional
public readonly sourcemap: boolean;
- Type: boolean
- Default: false
Include a source map in the bundle.
watchTaskOptional
public readonly watchTask: boolean;
- Type: boolean
- Default: true
In addition to the bundle:xyz task, creates bundle:xyz:watch task which will invoke the same esbuild command with the --watch flag.
This can be used to continusouly watch for changes.
CodeArtifactOptions
Options for publishing npm packages to AWS CodeArtifact.
Initializer
import { javascript } from 'projen'
const codeArtifactOptions: javascript.CodeArtifactOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | GitHub secret which contains the AWS access key ID to use when publishing packages to AWS CodeArtifact. |
| | Provider to use for authorizing requests to AWS CodeArtifact. |
| string | ARN of AWS role to be assumed prior to get authorization token from AWS CodeArtifact This property must be specified only when publishing to AWS CodeArtifact (registry contains AWS CodeArtifact URL). |
| string | GitHub secret which contains the AWS secret access key to use when publishing packages to AWS CodeArtifact. |
accessKeyIdSecretOptional
public readonly accessKeyIdSecret: string;
- Type: string
- Default: When the
authProvidervalue is set toCodeArtifactAuthProvider.ACCESS_AND_SECRET_KEY_PAIR, the default is "AWS_ACCESS_KEY_ID". ForCodeArtifactAuthProvider.GITHUB_OIDC, this value must be left undefined.
GitHub secret which contains the AWS access key ID to use when publishing packages to AWS CodeArtifact.
This property must be specified only when publishing to AWS CodeArtifact (npmRegistryUrl contains AWS CodeArtifact URL).
authProviderOptional
public readonly authProvider: CodeArtifactAuthProvider;
- Type: CodeArtifactAuthProvider
- Default: CodeArtifactAuthProvider.ACCESS_AND_SECRET_KEY_PAIR
Provider to use for authorizing requests to AWS CodeArtifact.
roleToAssumeOptional
public readonly roleToAssume: string;
- Type: string
- Default: undefined
ARN of AWS role to be assumed prior to get authorization token from AWS CodeArtifact This property must be specified only when publishing to AWS CodeArtifact (registry contains AWS CodeArtifact URL).
When using the CodeArtifactAuthProvider.GITHUB_OIDC auth provider, this value must be defined.
secretAccessKeySecretOptional
public readonly secretAccessKeySecret: string;
- Type: string
- Default: When the
authProvidervalue is set toCodeArtifactAuthProvider.ACCESS_AND_SECRET_KEY_PAIR, the default is "AWS_SECRET_ACCESS_KEY". ForCodeArtifactAuthProvider.GITHUB_OIDC, this value must be left undefined.
GitHub secret which contains the AWS secret access key to use when publishing packages to AWS CodeArtifact.
This property must be specified only when publishing to AWS CodeArtifact (npmRegistryUrl contains AWS CodeArtifact URL).
CoverageThreshold
Initializer
import { javascript } from 'projen'
const coverageThreshold: javascript.CoverageThreshold = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| number | No description. |
| number | No description. |
| number | No description. |
| number | No description. |
branchesOptional
public readonly branches: number;
- Type: number
functionsOptional
public readonly functions: number;
- Type: number
linesOptional
public readonly lines: number;
- Type: number
statementsOptional
public readonly statements: number;
- Type: number
DevEngineDependency
A dependency entry for the devEngines field in package.json.
Initializer
import { javascript } from 'projen'
const devEngineDependency: javascript.DevEngineDependency = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | The name of the dependency. |
| string | What action to take if validation fails. |
| string | The version range for the dependency. |
nameRequired
public readonly name: string;
- Type: string
The name of the dependency.
onFailOptional
public readonly onFail: string;
- Type: string
- Default: "error"
What action to take if validation fails.
versionOptional
public readonly version: string;
- Type: string
- Default: "*"
The version range for the dependency.
DevEngines
The devEngines field in package.json.
https://docs.npmjs.com/cli/v10/configuring-npm/package-json#devengines
Initializer
import { javascript } from 'projen'
const devEngines: javascript.DevEngines = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| | Supported CPU architectures. |
| | Supported C standard libraries. |
| | Supported operating systems. |
| | Supported package managers. |
| | Supported JavaScript runtimes. |
cpuOptional
public readonly cpu: DevEngineDependency | DevEngineDependency[];
- Type: DevEngineDependency | DevEngineDependency[]
Supported CPU architectures.
libcOptional
public readonly libc: DevEngineDependency | DevEngineDependency[];
- Type: DevEngineDependency | DevEngineDependency[]
Supported C standard libraries.
osOptional
public readonly os: DevEngineDependency | DevEngineDependency[];
- Type: DevEngineDependency | DevEngineDependency[]
Supported operating systems.
packageManagerOptional
public readonly packageManager: DevEngineDependency | DevEngineDependency[];
- Type: DevEngineDependency | DevEngineDependency[]
Supported package managers.
runtimeOptional
public readonly runtime: DevEngineDependency | DevEngineDependency[];
- Type: DevEngineDependency | DevEngineDependency[]
Supported JavaScript runtimes.
EslintCommandOptions
Initializer
import { javascript } from 'projen'
const eslintCommandOptions: javascript.EslintCommandOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | Extra flag arguments to pass to eslint command. |
| boolean | Whether to fix eslint issues when running the eslint task. |
extraArgsOptional
public readonly extraArgs: string[];
- Type: string[]
Extra flag arguments to pass to eslint command.
fixOptional
public readonly fix: boolean;
- Type: boolean
- Default: true
Whether to fix eslint issues when running the eslint task.
EslintOptions
Initializer
import { javascript } from 'projen'
const eslintOptions: javascript.EslintOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | Files or glob patterns or directories with source files to lint (e.g. [ "src" ]). |
| string[] | Enable import alias for module paths. |
| {[ key: string ]: string} | Enable import alias for module paths. |
| | Options for eslint command executed by eslint task. |
| string[] | Files or glob patterns or directories with source files that include tests and build tools. |
| string[] | File types that should be linted (e.g. [ ".js", ".ts" ]). |
| string[] | List of file patterns that should not be linted, using the same syntax as .gitignore patterns. |
| boolean | Enable prettier for code formatting. |
| boolean | Use the typescript-eslint "project service" for typed linting instead of a single parserOptions.project. |
| projen.ICompareString | The extends array in eslint is order dependent. |
| boolean | Always try to resolve types under <root>@types directory even it doesn't contain any source code. |
| string | Path to tsconfig.json which should be used by eslint. |
| boolean | Write eslint configuration as YAML instead of JSON. |
dirsRequired
public readonly dirs: string[];
- Type: string[]
Files or glob patterns or directories with source files to lint (e.g. [ "src" ]).
aliasExtensionsOptional
public readonly aliasExtensions: string[];
- Type: string[]
- Default: undefined
Enable import alias for module paths.
aliasMapOptional
public readonly aliasMap: {[ key: string ]: string};
- Type: {[ key: string ]: string}
- Default: undefined
Enable import alias for module paths.
commandOptionsOptional
public readonly commandOptions: EslintCommandOptions;
- Type: EslintCommandOptions
Options for eslint command executed by eslint task.
devdirsOptional
public readonly devdirs: string[];
- Type: string[]
- Default: []
Files or glob patterns or directories with source files that include tests and build tools.
These sources are linted but may also import packages from devDependencies.
fileExtensionsOptional
public readonly fileExtensions: string[];
- Type: string[]
- Default: [".ts"]
File types that should be linted (e.g. [ ".js", ".ts" ]).
ignorePatternsOptional
public readonly ignorePatterns: string[];
- Type: string[]
- Default: [ '.js', '.d.ts', 'node_modules/', '*.generated.ts', 'coverage' ]
List of file patterns that should not be linted, using the same syntax as .gitignore patterns.
prettierOptional
public readonly prettier: boolean;
- Type: boolean
- Default: false
Enable prettier for code formatting.
projectServiceOptional
public readonly projectService: boolean;
- Type: boolean
- Default: false
Use the typescript-eslint "project service" for typed linting instead of a single parserOptions.project.
When enabled, typescript-eslint resolves the nearest tsconfig.json for
each linted file (the same resolution model used by the TypeScript language
service / tsserver). This allows files in different directories (e.g.
src and test) to be linted against the tsconfig.json that actually
includes them, without maintaining a single config that lists every file.
Requires @typescript-eslint/* v8 or newer.
sortExtendsOptional
public readonly sortExtends: ICompareString;
- Type: projen.ICompareString
- Default: Use known ESLint best practices to place "prettier" plugins at the end of the array
The extends array in eslint is order dependent.
This option allows to sort the extends array in any way seen fit.
tsAlwaysTryTypesOptional
public readonly tsAlwaysTryTypes: boolean;
- Type: boolean
- Default: true
Always try to resolve types under <root>@types directory even it doesn't contain any source code.
This prevents import/no-unresolved eslint errors when importing a @types/* module that would otherwise remain unresolved.
tsconfigPathOptional
public readonly tsconfigPath: string;
- Type: string
- Default: "./tsconfig.json"
Path to tsconfig.json which should be used by eslint.
yamlOptional
public readonly yaml: boolean;
- Type: boolean
- Default: false
Write eslint configuration as YAML instead of JSON.
EslintOverride
eslint rules override.
Initializer
import { javascript } from 'projen'
const eslintOverride: javascript.EslintOverride = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | Files or file patterns on which to apply the override. |
| string[] | Pattern(s) to exclude from this override. |
| string[] | Config(s) to extend in this override. |
| string | The overridden parser. |
| string[] | plugins override. |
| {[ key: string ]: any} | The overridden rules. |
filesRequired
public readonly files: string[];
- Type: string[]
Files or file patterns on which to apply the override.
excludedFilesOptional
public readonly excludedFiles: string[];
- Type: string[]
Pattern(s) to exclude from this override.
If a file matches any of the excluded patterns, the configuration won’t apply.
extendsOptional
public readonly extends: string[];
- Type: string[]
Config(s) to extend in this override.
parserOptional
public readonly parser: string;
- Type: string
The overridden parser.
pluginsOptional
public readonly plugins: string[];
- Type: string[]
plugins override.
rulesOptional
public readonly rules: {[ key: string ]: any};
- Type: {[ key: string ]: any}
The overridden rules.
FakeTimers
The default configuration of fake timers for all tests.
Initializer
import { javascript } from 'projen'
const fakeTimers: javascript.FakeTimers = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| number | boolean | If set to true all timers will be advanced automatically by 20 milliseconds every 20 milliseconds. |
| string[] | List of names of APIs (e.g. Date, nextTick, setTimeout) that should not be faked. |
| boolean | Whether fake timers should be enabled for all test files. |
| boolean | Use the old fake timers implementation instead of one backed by @sinonjs/fake-timers. |
| number | Sets current system time to be used by fake timers, in milliseconds. |
| number | Maximum number of recursive timers that will be run. |
advanceTimersOptional
public readonly advanceTimers: number | boolean;
- Type: number | boolean
- Default: false
If set to true all timers will be advanced automatically by 20 milliseconds every 20 milliseconds.
A custom time delta may be provided by passing a number.
doNotFakeOptional
public readonly doNotFake: string[];
- Type: string[]
- Default: [] (all APIs are faked)
List of names of APIs (e.g. Date, nextTick, setTimeout) that should not be faked.
enableGloballyOptional
public readonly enableGlobally: boolean;
- Type: boolean
- Default: false
Whether fake timers should be enabled for all test files.
legacyFakeTimersOptional
public readonly legacyFakeTimers: boolean;
- Type: boolean
- Default: false
Use the old fake timers implementation instead of one backed by @sinonjs/fake-timers.
nowOptional
public readonly now: number;
- Type: number
- Default: Date.now()
Sets current system time to be used by fake timers, in milliseconds.
timerLimitOptional
public readonly timerLimit: number;
- Type: number
- Default: 100000
Maximum number of recursive timers that will be run.
HasteConfig
Initializer
import { javascript } from 'projen'
const hasteConfig: javascript.HasteConfig = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| boolean | No description. |
| string | No description. |
| string | No description. |
| string[] | No description. |
| boolean | No description. |
computeSha1Optional
public readonly computeSha1: boolean;
- Type: boolean
defaultPlatformOptional
public readonly defaultPlatform: string;
- Type: string
hasteImplModulePathOptional
public readonly hasteImplModulePath: string;
- Type: string
platformsOptional
public readonly platforms: string[];
- Type: string[]
throwOnModuleCollisionOptional
public readonly throwOnModuleCollision: boolean;
- Type: boolean
InstallTrigger
Describes why dependencies need to be installed.
Initializer
import { javascript } from 'projen'
const installTrigger: javascript.InstallTrigger = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| | The reason for the install. |
| string[] | A unified diff of the package.json changes. Only present when reason is PACKAGE_JSON_CHANGED. |
| string[] | Human-readable descriptions of resolved dependency version changes. |
reasonRequired
public readonly reason: InstallReason;
- Type: InstallReason
The reason for the install.
diffOptional
public readonly diff: string[];
- Type: string[]
A unified diff of the package.json changes. Only present when reason is PACKAGE_JSON_CHANGED.
resolutionsOptional
public readonly resolutions: string[];
- Type: string[]
Human-readable descriptions of resolved dependency version changes.
Only present when reason is DEPS_RESOLVED.
JestConfigOptions
Initializer
import { javascript } from 'projen'
const jestConfigOptions: javascript.JestConfigOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| {[ key: string ]: any} | Escape hatch to allow any value. |
| boolean | This option tells Jest that all imported modules in your tests should be mocked automatically. |
| number | boolean | By default, Jest runs all tests and produces all errors into the console upon completion. |
| string | The directory where Jest should store its cached dependency information. |
| boolean | Automatically clear mock calls and instances before every test. |
| boolean | Indicates whether the coverage information should be collected while executing the test. |
| string[] | An array of glob patterns indicating a set of files for which coverage information should be collected. |
| string | The directory where Jest should output its coverage files. |
| string[] | An array of regexp pattern strings that are matched against all file paths before executing the test. |
| string | Indicates which provider should be used to instrument code for coverage. |
| string[] | A list of reporter names that Jest uses when writing coverage reports. |
| | Specify the global coverage thresholds. |
| string | This option allows the use of a custom dependency extractor. |
| any | Allows for a label to be printed alongside a test while it is running. |
| boolean | Make calling deprecated APIs throw helpful error messages. |
| string[] | Jest will run .mjs and .js files with nearest package.json's type field set to module as ECMAScript Modules. If you have any other files that should run with native ESM, you need to specify their file extension here. |
| string[] | Test files run inside a vm, which slows calls to global context properties (e.g. Math). With this option you can specify extra properties to be defined inside the vm for faster lookups. |
| | The fake timers may be useful when a piece of code sets a long timeout that we don't want to wait for in a test. |
| string[] | Test files are normally ignored from collecting code coverage. |
| any | A set of global variables that need to be available in all test environments. |
| string | This option allows the use of a custom global setup module which exports an async function that is triggered once before all test suites. |
| string | This option allows the use of a custom global teardown module which exports an async function that is triggered once after all test suites. |
| | This will be used to configure the behavior of jest-haste-map, Jest's internal file crawler/cache system. |
| boolean | Insert Jest's globals (expect, test, describe, beforeEach etc.) into the global environment. If you set this to false, you should import from. |
| number | A number limiting the number of tests that are allowed to run at the same time when using test.concurrent. Any test above this limit will be queued and executed once a slot is released. |
| string | number | Specifies the maximum number of workers the worker-pool will spawn for running tests. |
| string[] | An array of directory names to be searched recursively up from the requiring module's location. |
| string[] | An array of file extensions your modules use. |
| {[ key: string ]: string | string[]} | A map from regular expressions to module names or to arrays of module names that allow to stub out resources, like images or styles with a single module. |
| string[] | An array of regexp pattern strings that are matched against all module paths before those paths are to be considered 'visible' to the module loader. |
| string[] | An alternative API to setting the NODE_PATH env variable, modulePaths is an array of absolute paths to additional locations to search when resolving modules. |
| boolean | Activates notifications for test results. |
| string | Specifies notification mode. |
| number | Print a warning indicating that there are probable open handles if Jest does not exit cleanly this number of milliseconds after it completes. |
| string | A preset that is used as a base for Jest's configuration. |
| string | Sets the path to the prettier node module used to update inline snapshots. |
| string | {[ key: string ]: any}[] | When the projects configuration is provided with an array of paths or glob patterns, Jest will run tests in all of the specified projects at the same time. |
| boolean | The equivalent of the --randomize flag to randomize the order of the tests in a file. |
| | Use this configuration option to add custom reporters to Jest. |
| boolean | Automatically reset mock state before every test. |
| boolean | By default, each test file gets its own independent module registry. |
| string | This option allows the use of a custom resolver. |
| boolean | Automatically restore mock state before every test. |
| string | The root directory that Jest should scan for tests and modules within. |
| string[] | A list of paths to directories that Jest should use to search for files in. |
| string | This option allows you to use a custom runner instead of Jest's default test runner. |
| string | This option allows the use of a custom runtime to execute test files. |
| string[] | Test files run inside a vm, which slows calls to global context properties (e.g. Math). With this option you can specify extra properties to be defined inside the vm for faster lookups. |
| string[] | A list of paths to modules that run some code to configure or set up the testing environment. |
| string[] | A list of paths to modules that run some code to configure or set up the testing framework before each test file in the suite is executed. |
| boolean | The equivalent of the --showSeed flag to print the seed in the test report summary. |
| number | The number of seconds after which a test is considered as slow and reported as such in the results. |
| | Allows overriding specific snapshot formatting options documented in the pretty-format readme, with the exceptions of compareKeys and plugins. |
| string | The path to a module that can resolve test<->snapshot path. |
| string[] | A list of paths to snapshot serializer modules Jest should use for snapshot testing. |
| string | The test environment that will be used for testing. |
| any | Test environment options that will be passed to the testEnvironment. |
| number | The exit code Jest returns on test failure. |
| string[] | The glob patterns Jest uses to detect test files. |
| string[] | An array of regexp pattern strings that are matched against all test paths before executing the test. |
| string | string[] | The pattern or patterns Jest uses to detect test files. |
| string | This option allows the use of a custom results processor. |
| string | This option allows the use of a custom test runner. |
| string | This option allows you to use a custom sequencer instead of Jest's default. |
| number | Default timeout of a test in milliseconds. |
| string | This option sets the URL for the jsdom environment. |
| string | Setting this value to legacy or fake allows the use of fake timers for functions such as setTimeout. |
| | A map from regular expressions to paths to transformers. |
| string[] | An array of regexp pattern strings that are matched against all source file paths before transformation. |
| string[] | An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them. |
| boolean | Indicates whether each individual test should be reported during the run. |
| boolean | Gives one event loop turn to handle rejectionHandled, uncaughtException or unhandledRejection. |
| boolean | Whether to use watchman for file crawling. |
| string[] | An array of RegExp patterns that are matched against all source file paths before re-running tests in watch mode. |
| | No description. |
| number | Timeout in milliseconds for a worker process to exit gracefully after all tests have completed. |
| string | number | Specifies the memory limit for workers before they are recycled and is primarily a work-around for memory leaks. |
| boolean | Whether to use worker threads for parallelization. |
additionalOptionsOptional
public readonly additionalOptions: {[ key: string ]: any};
- Type: {[ key: string ]: any}
Escape hatch to allow any value.
automockOptional
public readonly automock: boolean;
- Type: boolean
- Default: false
This option tells Jest that all imported modules in your tests should be mocked automatically.
All modules used in your tests will have a replacement implementation, keeping the API surface
bailOptional
public readonly bail: number | boolean;
- Type: number | boolean
- Default: 0
By default, Jest runs all tests and produces all errors into the console upon completion.
The bail config option can be used here to have Jest stop running tests after n failures. Setting bail to true is the same as setting bail to 1.
cacheDirectoryOptional
public readonly cacheDirectory: string;
- Type: string
- Default: "/tmp/
"
The directory where Jest should store its cached dependency information.
clearMocksOptional
public readonly clearMocks: boolean;
- Type: boolean
- Default: true
Automatically clear mock calls and instances before every test.
Equivalent to calling jest.clearAllMocks() before each test. This does not remove any mock implementation that may have been provided
collectCoverageOptional
public readonly collectCoverage: boolean;
- Type: boolean
- Default: true
Indicates whether the coverage information should be collected while executing the test.
Because this retrofits all executed files with coverage collection statements, it may significantly slow down your tests
collectCoverageFromOptional
public readonly collectCoverageFrom: string[];
- Type: string[]
- Default: undefined
An array of glob patterns indicating a set of files for which coverage information should be collected.
coverageDirectoryOptional
public readonly coverageDirectory: string;
- Type: string
- Default: "coverage"
The directory where Jest should output its coverage files.
coveragePathIgnorePatternsOptional
public readonly coveragePathIgnorePatterns: string[];
- Type: string[]
- Default: "/node_modules/"
An array of regexp pattern strings that are matched against all file paths before executing the test.
If the file path matches any of the patterns, coverage information will be skipped
coverageProviderOptional
public readonly coverageProvider: string;
- Type: string
- Default: "v8"
Indicates which provider should be used to instrument code for coverage.
Allowed values are v8 (default) or babel
coverageReportersOptional
public readonly coverageReporters: string[];
- Type: string[]
- Default: ["json", "lcov", "clover", "cobertura", "text"]
A list of reporter names that Jest uses when writing coverage reports.
Any istanbul reporter can be used
coverageThresholdOptional
public readonly coverageThreshold: CoverageThreshold;
- Type: CoverageThreshold
- Default: undefined
Specify the global coverage thresholds.
This will be used to configure minimum threshold enforcement for coverage results. Thresholds can be specified as global, as a glob, and as a directory or file path. If thresholds aren't met, jest will fail.
dependencyExtractorOptional
public readonly dependencyExtractor: string;
- Type: string
- Default: undefined
This option allows the use of a custom dependency extractor.
It must be a node module that exports an object with an extract function
displayNameOptional
public readonly displayName: any;
- Type: any
- Default: undefined
Allows for a label to be printed alongside a test while it is running.
errorOnDeprecatedOptional
public readonly errorOnDeprecated: boolean;
- Type: boolean
- Default: false
Make calling deprecated APIs throw helpful error messages.
Useful for easing the upgrade process.
extensionsToTreatAsEsmOptional
public readonly extensionsToTreatAsEsm: string[];
- Type: string[]
- Default: []
Jest will run .mjs and .js files with nearest package.json's type field set to module as ECMAScript Modules. If you have any other files that should run with native ESM, you need to specify their file extension here.
extraGlobalsOptional
extraGlobals- Deprecated: Renamed to
sandboxInjectedGlobalsin Jest 28. UsesandboxInjectedGlobalsinstead.
public readonly extraGlobals: string[];
- Type: string[]
- Default: undefined
Test files run inside a vm, which slows calls to global context properties (e.g. Math). With this option you can specify extra properties to be defined inside the vm for faster lookups.
fakeTimersOptional
public readonly fakeTimers: FakeTimers;
- Type: FakeTimers
- Default: {}
The fake timers may be useful when a piece of code sets a long timeout that we don't want to wait for in a test.
This option provides the default configuration of fake timers for all tests.
forceCoverageMatchOptional
public readonly forceCoverageMatch: string[];
- Type: string[]
- Default: ['']
Test files are normally ignored from collecting code coverage.
With this option, you can overwrite this behavior and include otherwise ignored files in code coverage.
globalsOptional
public readonly globals: any;
- Type: any
- Default: {}
A set of global variables that need to be available in all test environments.
globalSetupOptional
public readonly globalSetup: string;
- Type: string
- Default: undefined
This option allows the use of a custom global setup module which exports an async function that is triggered once before all test suites.
This function gets Jest's globalConfig object as a parameter.
globalTeardownOptional
public readonly globalTeardown: string;
- Type: string
- Default: undefined
This option allows the use of a custom global teardown module which exports an async function that is triggered once after all test suites.
This function gets Jest's globalConfig object as a parameter.
hasteOptional
public readonly haste: HasteConfig;
- Type: HasteConfig
- Default: {}
This will be used to configure the behavior of jest-haste-map, Jest's internal file crawler/cache system.
injectGlobalsOptional
public readonly injectGlobals: boolean;
- Type: boolean
- Default: true
Insert Jest's globals (expect, test, describe, beforeEach etc.) into the global environment. If you set this to false, you should import from.
maxConcurrencyOptional
public readonly maxConcurrency: number;
- Type: number
- Default: 5
A number limiting the number of tests that are allowed to run at the same time when using test.concurrent. Any test above this limit will be queued and executed once a slot is released.
maxWorkersOptional
public readonly maxWorkers: string | number;
- Type: string | number
- Default: the number of the cores available on your machine minus one for the main thread
Specifies the maximum number of workers the worker-pool will spawn for running tests.
In single run mode, this defaults to the number of the cores available on your machine minus one for the main thread In watch mode, this defaults to half of the available cores on your machine. For environments with variable CPUs available, you can use percentage based configuration: "maxWorkers": "50%"
moduleDirectoriesOptional
public readonly moduleDirectories: string[];
- Type: string[]
- Default: ["node_modules"]
An array of directory names to be searched recursively up from the requiring module's location.
Setting this option will override the default, if you wish to still search node_modules for packages include it along with any other options: ["node_modules", "bower_components"]
moduleFileExtensionsOptional
public readonly moduleFileExtensions: string[];
- Type: string[]
- Default: ["js", "json", "jsx", "ts", "tsx", "node"]
An array of file extensions your modules use.
If you require modules without specifying a file extension, these are the extensions Jest will look for, in left-to-right order.
moduleNameMapperOptional
public readonly moduleNameMapper: {[ key: string ]: string | string[]};
- Type: {[ key: string ]: string | string[]}
- Default: null
A map from regular expressions to module names or to arrays of module names that allow to stub out resources, like images or styles with a single module.
modulePathIgnorePatternsOptional
public readonly modulePathIgnorePatterns: string[];
- Type: string[]
- Default: []
An array of regexp pattern strings that are matched against all module paths before those paths are to be considered 'visible' to the module loader.
If a given module's path matches any of the patterns, it will not be require()-able in the test environment.
modulePathsOptional
public readonly modulePaths: string[];
- Type: string[]
- Default: []
An alternative API to setting the NODE_PATH env variable, modulePaths is an array of absolute paths to additional locations to search when resolving modules.
Use the
notifyOptional
public readonly notify: boolean;
- Type: boolean
- Default: false
Activates notifications for test results.
notifyModeOptional
public readonly notifyMode: string;
- Type: string
- Default: failure-change
Specifies notification mode.
Requires notify: true
openHandlesTimeoutOptional
public readonly openHandlesTimeout: number;
- Type: number
- Default: 1000
Print a warning indicating that there are probable open handles if Jest does not exit cleanly this number of milliseconds after it completes.
Use 0 to disable the warning.
presetOptional
public readonly preset: string;
- Type: string
- Default: undefined
A preset that is used as a base for Jest's configuration.
A preset should point to an npm module that has a jest-preset.json or jest-preset.js file at the root.
prettierPathOptional
public readonly prettierPath: string;
- Type: string
- Default: "prettier"
Sets the path to the prettier node module used to update inline snapshots.
projectsOptional
public readonly projects: (string | {[ key: string ]: any})[];
- Type: string | {[ key: string ]: any}[]
- Default: undefined
When the projects configuration is provided with an array of paths or glob patterns, Jest will run tests in all of the specified projects at the same time.
This is great for monorepos or when working on multiple projects at the same time.
randomizeOptional
public readonly randomize: boolean;
- Type: boolean
- Default: false
The equivalent of the --randomize flag to randomize the order of the tests in a file.
reportersOptional
public readonly reporters: JestReporter[];
- Type: JestReporter[]
- Default: undefined
Use this configuration option to add custom reporters to Jest.
A custom reporter is a class that implements onRunStart, onTestStart, onTestResult, onRunComplete methods that will be called when any of those events occurs.
resetMocksOptional
public readonly resetMocks: boolean;
- Type: boolean
- Default: false
Automatically reset mock state before every test.
Equivalent to calling jest.resetAllMocks() before each test. This will lead to any mocks having their fake implementations removed but does not restore their initial implementation.
resetModulesOptional
public readonly resetModules: boolean;
- Type: boolean
- Default: false
By default, each test file gets its own independent module registry.
Enabling resetModules goes a step further and resets the module registry before running each individual test.
resolverOptional
public readonly resolver: string;
- Type: string
- Default: undefined
This option allows the use of a custom resolver.
https://jestjs.io/docs/en/configuration#resolver-string
restoreMocksOptional
public readonly restoreMocks: boolean;
- Type: boolean
- Default: false
Automatically restore mock state before every test.
Equivalent to calling jest.restoreAllMocks() before each test. This will lead to any mocks having their fake implementations removed and restores their initial implementation.
rootDirOptional
public readonly rootDir: string;
- Type: string
- Default: directory of the package.json
The root directory that Jest should scan for tests and modules within.
If you put your Jest config inside your package.json and want the root directory to be the root of your repo, the value for this config param will default to the directory of the package.json.
rootsOptional
public readonly roots: string[];
- Type: string[]
- Default: ["
"]
A list of paths to directories that Jest should use to search for files in.
runnerOptional
public readonly runner: string;
- Type: string
- Default: "jest-runner"
This option allows you to use a custom runner instead of Jest's default test runner.
runtimeOptional
public readonly runtime: string;
- Type: string
- Default: "jest-runtime"
This option allows the use of a custom runtime to execute test files.
A custom runtime can be provided by specifying a path to a runtime implementation.
sandboxInjectedGlobalsOptional
public readonly sandboxInjectedGlobals: string[];
- Type: string[]
- Default: undefined
Test files run inside a vm, which slows calls to global context properties (e.g. Math). With this option you can specify extra properties to be defined inside the vm for faster lookups.
setupFilesOptional
public readonly setupFiles: string[];
- Type: string[]
- Default: []
A list of paths to modules that run some code to configure or set up the testing environment.
Each setupFile will be run once per test file. Since every test runs in its own environment, these scripts will be executed in the testing environment immediately before executing the test code itself.
setupFilesAfterEnvOptional
public readonly setupFilesAfterEnv: string[];
- Type: string[]
- Default: []
A list of paths to modules that run some code to configure or set up the testing framework before each test file in the suite is executed.
Since setupFiles executes before the test framework is installed in the environment, this script file presents you the opportunity of running some code immediately after the test framework has been installed in the environment.
showSeedOptional
public readonly showSeed: boolean;
- Type: boolean
- Default: false
The equivalent of the --showSeed flag to print the seed in the test report summary.
slowTestThresholdOptional
public readonly slowTestThreshold: number;
- Type: number
- Default: 5
The number of seconds after which a test is considered as slow and reported as such in the results.
snapshotFormatOptional
public readonly snapshotFormat: SnapshotFormatOptions;
- Type: SnapshotFormatOptions
- Default: {escapeString: false, printBasicPrototype: false}
Allows overriding specific snapshot formatting options documented in the pretty-format readme, with the exceptions of compareKeys and plugins.
snapshotResolverOptional
public readonly snapshotResolver: string;
- Type: string
- Default: undefined
The path to a module that can resolve test<->snapshot path.
This config option lets you customize where Jest stores snapshot files on disk.
snapshotSerializersOptional
public readonly snapshotSerializers: string[];
- Type: string[]
- Default: = []
A list of paths to snapshot serializer modules Jest should use for snapshot testing.
testEnvironmentOptional
public readonly testEnvironment: string;
- Type: string
- Default: "node"
The test environment that will be used for testing.
The default environment in Jest is a Node.js environment. If you are building a web app, you can use a browser-like environment through jsdom instead.
testEnvironmentOptionsOptional
public readonly testEnvironmentOptions: any;
- Type: any
- Default: {}
Test environment options that will be passed to the testEnvironment.
The relevant options depend on the environment.
testFailureExitCodeOptional
public readonly testFailureExitCode: number;
- Type: number
- Default: 1
The exit code Jest returns on test failure.
testMatchOptional
public readonly testMatch: string[];
- Type: string[]
- Default: ['/tests//.[jt]s?(x)', '**/(*.)@(spec|test).[tj]s?(x)']
The glob patterns Jest uses to detect test files.
By default it looks for .js, .jsx, .ts and .tsx files inside of tests folders, as well as any files with a suffix of .test or .spec (e.g. Component.test.js or Component.spec.js). It will also find files called test.js or spec.js.
testPathIgnorePatternsOptional
public readonly testPathIgnorePatterns: string[];
- Type: string[]
- Default: ["/node_modules/"]
An array of regexp pattern strings that are matched against all test paths before executing the test.
If the test path matches any of the patterns, it will be skipped.
testRegexOptional
public readonly testRegex: string | string[];
- Type: string | string[]
- Default: (/tests/.*|(\.|/)(test|spec))\.[jt]sx?$
The pattern or patterns Jest uses to detect test files.
By default it looks for .js, .jsx, .ts and .tsx files inside of tests folders, as well as any files with a suffix of .test or .spec (e.g. Component.test.js or Component.spec.js). It will also find files called test.js or spec.js.
testResultsProcessorOptional
public readonly testResultsProcessor: string;
- Type: string
- Default: undefined
This option allows the use of a custom results processor.
testRunnerOptional
public readonly testRunner: string;
- Type: string
- Default: "jest-circus/runner"
This option allows the use of a custom test runner.
The default is jest-circus. A custom test runner can be provided by specifying a path to a test runner implementation.
testSequencerOptional
public readonly testSequencer: string;
- Type: string
- Default: "@jest/test-sequencer"
This option allows you to use a custom sequencer instead of Jest's default.
Sort may optionally return a Promise.
testTimeoutOptional
public readonly testTimeout: number;
- Type: number
- Default: 5000
Default timeout of a test in milliseconds.
testURLOptional
testURL- Deprecated: Removed in Jest 28. Use
testEnvironmentOptions.urlinstead.
public readonly testURL: string;
- Type: string
- Default: "http://localhost"
This option sets the URL for the jsdom environment.
It is reflected in properties such as location.href.
timersOptional
timers- Deprecated: Renamed to
fakeTimersin Jest 27. UsefakeTimersinstead.
public readonly timers: string;
- Type: string
- Default: "real"
Setting this value to legacy or fake allows the use of fake timers for functions such as setTimeout.
Fake timers are useful when a piece of code sets a long timeout that we don't want to wait for in a test.
transformOptional
public readonly transform: {[ key: string ]: Transform};
- Type: {[ key: string ]: Transform}
- Default: {"\.[jt]sx?$": "babel-jest"}
A map from regular expressions to paths to transformers.
A transformer is a module that provides a synchronous function for transforming source files.
transformIgnorePatternsOptional
public readonly transformIgnorePatterns: string[];
- Type: string[]
- Default: ["/node_modules/", "\.pnp\.[^\/]+$"]
An array of regexp pattern strings that are matched against all source file paths before transformation.
If the test path matches any of the patterns, it will not be transformed.
unmockedModulePathPatternsOptional
public readonly unmockedModulePathPatterns: string[];
- Type: string[]
- Default: []
An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them.
If a module's path matches any of the patterns in this list, it will not be automatically mocked by the module loader.
verboseOptional
public readonly verbose: boolean;
- Type: boolean
- Default: false
Indicates whether each individual test should be reported during the run.
All errors will also still be shown on the bottom after execution. Note that if there is only one test file being run it will default to true.
waitForUnhandledRejectionsOptional
public readonly waitForUnhandledRejections: boolean;
- Type: boolean
- Default: false
Gives one event loop turn to handle rejectionHandled, uncaughtException or unhandledRejection.
Without this flag Jest may report false-positive errors or fail to report actually unhandled rejections. This option may add a noticeable overhead for fast test suites.
watchmanOptional
public readonly watchman: boolean;
- Type: boolean
- Default: true
Whether to use watchman for file crawling.
watchPathIgnorePatternsOptional
public readonly watchPathIgnorePatterns: string[];
- Type: string[]
- Default: ["/node_modules/"]
An array of RegExp patterns that are matched against all source file paths before re-running tests in watch mode.
If the file path matches any of the patterns, when it is updated, it will not trigger a re-run of tests.
watchPluginsOptional
public readonly watchPlugins: WatchPlugin[];
- Type: WatchPlugin[]
- Default:
workerGracefulExitTimeoutOptional
public readonly workerGracefulExitTimeout: number;
- Type: number
- Default: 500
Timeout in milliseconds for a worker process to exit gracefully after all tests have completed.
If a worker does not exit within this timeout, it is force-killed.
workerIdleMemoryLimitOptional
public readonly workerIdleMemoryLimit: string | number;
- Type: string | number
- Default: undefined
Specifies the memory limit for workers before they are recycled and is primarily a work-around for memory leaks.
The limit can be specified as a percentage of system memory (e.g. 0.5 or "50%")
or as a fixed byte value (e.g. "512MB").
workerThreadsOptional
public readonly workerThreads: boolean;
- Type: boolean
- Default: false
Whether to use worker threads for parallelization.
Child processes are used by default. Using worker threads may help to improve performance.
JestDiscoverTestMatchPatternsForDirsOptions
Options for discoverTestMatchPatternsForDirs.
Initializer
import { javascript } from 'projen'
const jestDiscoverTestMatchPatternsForDirsOptions: javascript.JestDiscoverTestMatchPatternsForDirsOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | The file extension pattern to use. |
fileExtensionPatternOptional
public readonly fileExtensionPattern: string;
- Type: string
The file extension pattern to use.
Defaults to "[jt]s?(x)".
JestOptions
Initializer
import { javascript } from 'projen'
const jestOptions: javascript.JestOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | Path to JSON config file for Jest. |
| boolean | Include the text coverage reporter, which means that coverage summary is printed at the end of the jest execution. |
| string[] | Additional options to pass to the Jest CLI invocation. |
| | Jest configuration. |
| string | The version of jest to use. |
| boolean | Result processing with jest-junit. |
| boolean | Pass with no tests. |
| boolean | Preserve the default Jest reporter when additional reporters are added. |
| | Whether to update snapshots in task "test" (which is executed in task "build" and build workflows), or create a separate task "test:update" for updating snapshots. |
configFilePathOptional
public readonly configFilePath: string;
- Type: string
- Default: No separate config file, jest settings are stored in package.json
Path to JSON config file for Jest.
coverageTextOptional
public readonly coverageText: boolean;
- Type: boolean
- Default: true
Include the text coverage reporter, which means that coverage summary is printed at the end of the jest execution.
extraCliOptionsOptional
public readonly extraCliOptions: string[];
- Type: string[]
- Default: no extra options
Additional options to pass to the Jest CLI invocation.
jestConfigOptional
public readonly jestConfig: JestConfigOptions;
- Type: JestConfigOptions
- Default: default jest configuration
Jest configuration.
jestVersionOptional
public readonly jestVersion: string;
- Type: string
- Default: installs the latest jest version
The version of jest to use.
Note that same version is used as version of @types/jest and ts-jest (if Typescript in use), so given version should work also for those.
With Jest 30 ts-jest version 29 is used (if Typescript in use)
junitReportingOptional
public readonly junitReporting: boolean;
- Type: boolean
- Default: true
Result processing with jest-junit.
Output directory is test-reports/.
passWithNoTestsOptional
public readonly passWithNoTests: boolean;
- Type: boolean
- Default: true
Pass with no tests.
preserveDefaultReportersOptional
public readonly preserveDefaultReporters: boolean;
- Type: boolean
- Default: true
Preserve the default Jest reporter when additional reporters are added.
updateSnapshotOptional
public readonly updateSnapshot: UpdateSnapshot;
- Type: UpdateSnapshot
- Default: ALWAYS
Whether to update snapshots in task "test" (which is executed in task "build" and build workflows), or create a separate task "test:update" for updating snapshots.
LicenseCheckerOptions
Options to configure the license checker.
Initializer
import { javascript } from 'projen'
const licenseCheckerOptions: javascript.LicenseCheckerOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | List of SPDX license identifiers that are allowed to be used. |
| string[] | List of SPDX license identifiers that are prohibited to be used. |
| boolean | Check development dependencies. |
| boolean | Check production dependencies. |
| string | The name of the task that is added to check licenses. |
allowOptional
public readonly allow: string[];
- Type: string[]
- Default: no licenses are allowed
List of SPDX license identifiers that are allowed to be used.
For the license check to pass, all detected licenses MUST be in this list.
Only one of allowedLicenses and prohibitedLicenses can be provided and must not be empty.
denyOptional
public readonly deny: string[];
- Type: string[]
- Default: no licenses are prohibited
List of SPDX license identifiers that are prohibited to be used.
For the license check to pass, no detected licenses can be in this list.
Only one of allowedLicenses and prohibitedLicenses can be provided and must not be empty.
developmentOptional
public readonly development: boolean;
- Type: boolean
- Default: false
Check development dependencies.
productionOptional
public readonly production: boolean;
- Type: boolean
- Default: true
Check production dependencies.
taskNameOptional
public readonly taskName: string;
- Type: string
- Default: "check-licenses"
The name of the task that is added to check licenses.
NodePackageOptions
Initializer
import { javascript } from 'projen'
const nodePackageOptions: javascript.NodePackageOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| boolean | Automatically add the resolved packageManager to devEngines.packageManager in package.json, setting onFail to ignore. |
| boolean | Allow the project to include peerDependencies and bundledDependencies. |
| string[] | List of dependency (package) names that are allowed to run lifecycle install scripts (preinstall, install, postinstall, prepare) during dependency installation. |
| string | Author's e-mail. |
| string | Author's name. |
| boolean | Is the author an organization. |
| string | Author's URL / Website. |
| boolean | Automatically add all executables under the bin directory to your package.json file under the bin section. |
| {[ key: string ]: string} | Binary programs vended with your module. |
| string | The email address to which issues should be reported. |
| string | The url to your project's issue tracker. |
| string[] | List of dependencies to bundle into this module. |
| string | The version of Bun to use if using Bun as a package manager. |
| | Options for npm packages using AWS CodeArtifact. |
| boolean | Automatically delete lockfiles from package managers that are not the active one. |
| string[] | Runtime dependencies of this module. |
| string | The description is just a string that helps people understand the purpose of the package. |
| string[] | Build dependencies for this module. |
| | Configure the devEngines field in package.json. |
| string | Module entrypoint (main in package.json). |
| string | Package's Homepage / Website. |
| string[] | Keywords to include in package.json. |
| string | License's SPDX identifier. |
| boolean | Indicates if a license should be added. |
| string | The maximum node version supported by this package. Most projects should not use this option. |
| string | The minimum node version required by this package to function. Most projects should not use this option. |
| | Access level of the npm package. |
| boolean | Should provenance statements be generated when the package is published. |
| string | The base URL of the npm package registry. |
| string | GitHub secret which contains the NPM token to use when publishing packages. |
| boolean | Use trusted publishing for publishing to npmjs.com Needs to be pre-configured on npm.js to work. |
| | The Node Package Manager used to execute scripts. |
| string | The "name" in package.json. |
| | Options for peerDeps. |
| string[] | Peer dependencies for this module. |
| | Options for pnpm. |
| string | The version of PNPM to use if using PNPM as a package manager. |
| string | The repository is the location where the actual code for your package lives. |
| string | If the package.json for your package is not in the root directory (for example if it is part of a monorepo), you can specify the directory in which it lives. |
| | Options for privately hosted scoped packages. |
| string | Package's Stability. |
| | Options for Yarn Berry. |
addPackageManagerToDevEnginesOptional
public readonly addPackageManagerToDevEngines: boolean;
- Type: boolean
- Default: true
Automatically add the resolved packageManager to devEngines.packageManager in package.json, setting onFail to ignore.
allowLibraryDependenciesOptional
public readonly allowLibraryDependencies: boolean;
- Type: boolean
- Default: true
Allow the project to include peerDependencies and bundledDependencies.
This is normally only allowed for libraries. For apps, there's no meaning for specifying these.
allowScriptsOptional
public readonly allowScripts: string[];
- Type: string[]
- Default: all install scripts are allowed to run (package manager default)
List of dependency (package) names that are allowed to run lifecycle install scripts (preinstall, install, postinstall, prepare) during dependency installation.
These scripts can execute arbitrary code, making them a common
supply-chain attack vector. Package managers are moving toward
blocking them by default and requiring an explicit allowlist.
Configuring allowScripts sets up that allowlist so scripts only run
for the packages you have explicitly reviewed and trust.
Support for this setting depends on the configured packageManager:
NPM: written to the nativeallowScriptsfield inpackage.json(requires npm >= 11.16; see https://docs.npmjs.com/cli/v11/commands/npm-approve-scripts).BUN: written to the nativetrustedDependenciesfield inpackage.json(see https://bun.com/docs/pm/lifecycle).PNPM: written to theonlyBuiltDependenciessetting inpnpm-workspace.yaml(see https://pnpm.io/settings#onlybuiltdependencies).YARN2,YARN_BERRY: written to the nativedependenciesMeta.<pkg>.builtallowlist inpackage.json, combined withenableScripts: falsein.yarnrc.yml(see https://yarnpkg.com/features/security#postinstalls). If you setyarnBerryOptions.yarnRcOptions.enableScriptsexplicitly, that value is respected instead of being overridden.YARN,YARN_CLASSIC: not supported. Yarn Classic has no native mechanism to allowlist install scripts for specific dependencies. Setting this option with one of these package managers throws an error at synthesis time.
authorEmailOptional
public readonly authorEmail: string;
- Type: string
Author's e-mail.
authorNameOptional
public readonly authorName: string;
- Type: string
Author's name.
authorOrganizationOptional
public readonly authorOrganization: boolean;
- Type: boolean
Is the author an organization.
authorUrlOptional
public readonly authorUrl: string;
- Type: string
Author's URL / Website.
autoDetectBinOptional
public readonly autoDetectBin: boolean;
- Type: boolean
- Default: true
Automatically add all executables under the bin directory to your package.json file under the bin section.
binOptional
public readonly bin: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Binary programs vended with your module.
You can use this option to add/customize how binaries are represented in
your package.json, but unless autoDetectBin is false, every
executable file under bin will automatically be added to this section.
bugsEmailOptional
public readonly bugsEmail: string;
- Type: string
The email address to which issues should be reported.
bugsUrlOptional
public readonly bugsUrl: string;
- Type: string
The url to your project's issue tracker.
bundledDepsOptional
public readonly bundledDeps: string[];
- Type: string[]
List of dependencies to bundle into this module.
These modules will be
added both to the dependencies section and bundledDependencies section of
your package.json.
The recommendation is to only specify the module name here (e.g.
express). This will behave similar to pnpm add or npm install in the
sense that it will add the module as a dependency to your package.json
file with the latest version (^). You can specify semver requirements in
the same syntax passed to pnpm add or npm i (e.g. express@^2) and
this will be what your package.json will eventually include.
bunVersionOptional
public readonly bunVersion: string;
- Type: string
- Default: "latest"
The version of Bun to use if using Bun as a package manager.
codeArtifactOptionsOptional
public readonly codeArtifactOptions: CodeArtifactOptions;
- Type: CodeArtifactOptions
- Default: undefined
Options for npm packages using AWS CodeArtifact.
This is required if publishing packages to, or installing scoped packages from AWS CodeArtifact
deleteOrphanedLockFilesOptional
public readonly deleteOrphanedLockFiles: boolean;
- Type: boolean
- Default: true
Automatically delete lockfiles from package managers that are not the active one.
Only triggered when the lockfile for the configured package manager already exists.
This is useful when migrating between package managers to avoid conflicts.
depsOptional
public readonly deps: string[];
- Type: string[]
- Default: []
Runtime dependencies of this module.
The recommendation is to only specify the module name here (e.g.
express). This will behave similar to pnpm add or npm install in the
sense that it will add the module as a dependency to your package.json
file with the latest version (^). You can specify semver requirements in
the same syntax passed to pnpm add or npm i (e.g. express@^2) and
this will be what your package.json will eventually include.
Example
[ 'express', 'lodash', 'foo@^2' ]
descriptionOptional
public readonly description: string;
- Type: string
The description is just a string that helps people understand the purpose of the package.
It can be used when searching for packages in a package manager as well. See https://classic.yarnpkg.com/en/docs/package-json/#toc-description
devDepsOptional
public readonly devDeps: string[];
- Type: string[]
- Default: []
Build dependencies for this module.
These dependencies will only be available in your build environment but will not be fetched when this module is consumed.
The recommendation is to only specify the module name here (e.g.
express). This will behave similar to pnpm add or npm install in the
sense that it will add the module as a dependency to your package.json
file with the latest version (^). You can specify semver requirements in
the same syntax passed to pnpm add or npm i (e.g. express@^2) and
this will be what your package.json will eventually include.
Example
[ 'typescript', '@types/express' ]
devEnginesOptional
public readonly devEngines: DevEngines;
- Type: DevEngines
Configure the devEngines field in package.json.
The devEngines.packageManager field is automatically populated based on
the resolved packageManager value. Any fields provided here are merged
with the auto-populated packageManager entry.
https://docs.npmjs.com/cli/v10/configuring-npm/package-json#devengines
entrypointOptional
public readonly entrypoint: string;
- Type: string
- Default: "lib/index.js"
Module entrypoint (main in package.json).
Set to an empty string to not include main in your package.json
homepageOptional
public readonly homepage: string;
- Type: string
Package's Homepage / Website.
keywordsOptional
public readonly keywords: string[];
- Type: string[]
Keywords to include in package.json.
licenseOptional
public readonly license: string;
- Type: string
- Default: "Apache-2.0"
License's SPDX identifier.
See https://github.com/projen/projen/tree/main/license-text for a list of supported licenses.
Use the licensed option if you want to no license to be specified.
licensedOptional
public readonly licensed: boolean;
- Type: boolean
- Default: true
Indicates if a license should be added.
maxNodeVersionOptional
public readonly maxNodeVersion: string;
- Type: string
- Default: no maximum version is enforced
The maximum node version supported by this package. Most projects should not use this option.
The value indicates that the package is incompatible with any newer versions of node. This requirement is enforced via the engines field.
You will normally not need to set this option. Consider this option only if your package is known to not function with newer versions of node.
minNodeVersionOptional
public readonly minNodeVersion: string;
- Type: string
- Default: no minimum version is enforced
The minimum node version required by this package to function. Most projects should not use this option.
The value indicates that the package is incompatible with any older versions of node. This requirement is enforced via the engines field.
You will normally not need to set this option, even if your package is incompatible with EOL versions of node. Consider this option only if your package depends on a specific feature, that is not available in other LTS versions. Setting this option has very high impact on the consumers of your package, as package managers will actively prevent usage with node versions you have marked as incompatible.
To change the node version of your CI/CD workflows, use workflowNodeVersion.
npmAccessOptional
public readonly npmAccess: NpmAccess;
- Type: NpmAccess
- Default: for scoped packages (e.g.
foo@bar), the default isNpmAccess.RESTRICTED, for non-scoped packages, the default isNpmAccess.PUBLIC.
Access level of the npm package.
npmProvenanceOptional
public readonly npmProvenance: boolean;
- Type: boolean
- Default: true for public packages, false otherwise
Should provenance statements be generated when the package is published.
A supported package manager is required to publish a package with npm provenance statements and you will need to use a supported CI/CD provider.
Note that the projen Release and Publisher components are using publib to publish packages,
which is using npm internally and supports provenance statements independently of the package manager used.
npmRegistryUrlOptional
public readonly npmRegistryUrl: string;
- Type: string
- Default: "https://registry.npmjs.org"
The base URL of the npm package registry.
Must be a URL (e.g. start with "https://" or "http://")
npmTokenSecretOptional
public readonly npmTokenSecret: string;
- Type: string
- Default: "NPM_TOKEN"
GitHub secret which contains the NPM token to use when publishing packages.
npmTrustedPublishingOptional
public readonly npmTrustedPublishing: boolean;
- Type: boolean
- Default: false
Use trusted publishing for publishing to npmjs.com Needs to be pre-configured on npm.js to work.
packageManagerOptional
public readonly packageManager: NodePackageManager;
- Type: NodePackageManager
- Default: Detected from the calling process or
YARN_CLASSICif detection fails.
The Node Package Manager used to execute scripts.
packageNameOptional
public readonly packageName: string;
- Type: string
- Default: defaults to project name
The "name" in package.json.
peerDependencyOptionsOptional
public readonly peerDependencyOptions: PeerDependencyOptions;
- Type: PeerDependencyOptions
Options for peerDeps.
peerDepsOptional
public readonly peerDeps: string[];
- Type: string[]
- Default: []
Peer dependencies for this module.
Dependencies listed here are required to
be installed (and satisfied) by the consumer of this library. Using peer
dependencies allows you to ensure that only a single module of a certain
library exists in the node_modules tree of your consumers.
Note that prior to npm@7, peer dependencies are not automatically installed, which means that adding peer dependencies to a library will be a breaking change for your customers.
Unless peerDependencyOptions.pinnedDevDependency is disabled (it is
enabled by default), projen will automatically add a dev dependency with a
pinned version for each peer dependency. This will ensure that you build &
test your module against the lowest peer version required.
pnpmOptionsOptional
public readonly pnpmOptions: PnpmOptions;
- Type: PnpmOptions
- Default: all default options
Options for pnpm.
pnpmVersionOptional
public readonly pnpmVersion: string;
- Type: string
- Default: "10.33.0"
The version of PNPM to use if using PNPM as a package manager.
repositoryOptional
public readonly repository: string;
- Type: string
The repository is the location where the actual code for your package lives.
See https://classic.yarnpkg.com/en/docs/package-json/#toc-repository
repositoryDirectoryOptional
public readonly repositoryDirectory: string;
- Type: string
If the package.json for your package is not in the root directory (for example if it is part of a monorepo), you can specify the directory in which it lives.
scopedPackagesOptionsOptional
public readonly scopedPackagesOptions: ScopedPackagesOptions[];
- Type: ScopedPackagesOptions[]
- Default: fetch all scoped packages from the public npm registry
Options for privately hosted scoped packages.
stabilityOptional
public readonly stability: string;
- Type: string
Package's Stability.
yarnBerryOptionsOptional
public readonly yarnBerryOptions: YarnBerryOptions;
- Type: YarnBerryOptions
- Default: Yarn Berry v4 with all default options
Options for Yarn Berry.
NodeProjectOptions
Initializer
import { javascript } from 'projen'
const nodeProjectOptions: javascript.NodeProjectOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | This is the name of your project. |
| boolean | Whether to commit the managed files by default. |
| projen.IgnoreFileOptions | Configuration options for .gitignore file. |
| projen.GitOptions | Configuration options for git. |
| projen.LoggerOptions | Configure logging options such as verbosity. |
| string | The root directory of the project. |
| projen.Project | The parent project, if this project is part of a bigger project. |
| boolean | Generate a project tree file (.projen/tree.json) that shows all components and their relationships. Useful for understanding your project structure and debugging. |
| string | The shell command to use in order to run the projen CLI. |
| boolean | Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation. |
| projen.ProjenrcJsonOptions | Options for .projenrc.json. |
| boolean | Use renovatebot to handle dependency upgrades. |
| projen.RenovatebotOptions | Options for renovatebot. |
| projen.github.AutoApproveOptions | Enable and configure the 'auto approve' workflow. |
| boolean | Enable automatic merging on GitHub. |
| projen.github.AutoMergeOptions | Configure options for automatic merging on GitHub. |
| boolean | Add a clobber task which resets the repo to origin. |
| boolean | Add a VSCode development environment (used for GitHub Codespaces). |
| boolean | Enable GitHub integration. |
| projen.github.GitHubOptions | Options for GitHub integration. |
| boolean | Add a Gitpod development environment. |
| projen.github.GithubCredentials | Choose a method of providing GitHub API access for projen workflows. |
| projen.SampleReadmeProps | The README setup. |
| boolean | Auto-close of stale issues and pull request. |
| projen.github.StaleOptions | Auto-close stale issues and pull requests. |
| boolean | Enable VSCode integration. |
| boolean | Automatically add the resolved packageManager to devEngines.packageManager in package.json, setting onFail to ignore. |
| boolean | Allow the project to include peerDependencies and bundledDependencies. |
| string[] | List of dependency (package) names that are allowed to run lifecycle install scripts (preinstall, install, postinstall, prepare) during dependency installation. |
| string | Author's e-mail. |
| string | Author's name. |
| boolean | Is the author an organization. |
| string | Author's URL / Website. |
| boolean | Automatically add all executables under the bin directory to your package.json file under the bin section. |
| {[ key: string ]: string} | Binary programs vended with your module. |
| string | The email address to which issues should be reported. |
| string | The url to your project's issue tracker. |
| string[] | List of dependencies to bundle into this module. |
| string | The version of Bun to use if using Bun as a package manager. |
| | Options for npm packages using AWS CodeArtifact. |
| boolean | Automatically delete lockfiles from package managers that are not the active one. |
| string[] | Runtime dependencies of this module. |
| string | The description is just a string that helps people understand the purpose of the package. |
| string[] | Build dependencies for this module. |
| | Configure the devEngines field in package.json. |
| string | Module entrypoint (main in package.json). |
| string | Package's Homepage / Website. |
| string[] | Keywords to include in package.json. |
| string | License's SPDX identifier. |
| boolean | Indicates if a license should be added. |
| string | The maximum node version supported by this package. Most projects should not use this option. |
| string | The minimum node version required by this package to function. Most projects should not use this option. |
| | Access level of the npm package. |
| boolean | Should provenance statements be generated when the package is published. |
| string | The base URL of the npm package registry. |
| string | GitHub secret which contains the NPM token to use when publishing packages. |
| boolean | Use trusted publishing for publishing to npmjs.com Needs to be pre-configured on npm.js to work. |
| | The Node Package Manager used to execute scripts. |
| string | The "name" in package.json. |
| | Options for peerDeps. |
| string[] | Peer dependencies for this module. |
| | Options for pnpm. |
| string | The version of PNPM to use if using PNPM as a package manager. |
| string | The repository is the location where the actual code for your package lives. |
| string | If the package.json for your package is not in the root directory (for example if it is part of a monorepo), you can specify the directory in which it lives. |
| | Options for privately hosted scoped packages. |
| string | Package's Stability. |
| | Options for Yarn Berry. |
| string | The commit-and-tag-version compatible package used to bump the package version, as a dependency string. |
| string | Version requirement of publib which is used to publish modules to npm. |
| number | Major version to release from the default branch. |
| number | Minimal Major version to release. |
| string | A shell command to control the next version to release. |
| string | The npmDistTag to use when publishing from the default branch. |
| projen.github.workflows.JobStep[] | Steps to execute after build as part of the release workflow. |
| string | Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre"). |
| boolean | Instead of actually publishing to package managers, just print the publishing command. |
| boolean | Define publishing tasks that can be executed manually as well as workflows. |
| projen.ReleasableCommits | Find commits that should be considered releasable Used to decide if a release is required. |
| {[ key: string ]: projen.release.BranchOptions} | Defines additional release branches. |
| string | The GitHub Actions environment used for the release. |
| boolean | Create a github issue on every failed publishing task. |
| string | The label to apply to issues indicating publish failures. |
| string | Automatically add the given prefix to release tags. Useful if you are releasing on multiple branches with overlapping version numbers. |
| projen.release.ReleaseTrigger | The release trigger to use. |
| {[ key: string ]: string} | Build environment variables for release workflows. |
| string | The name of the default release workflow. |
| projen.github.workflows.JobStep[] | A set of workflow steps to execute in order to setup the workflow container. |
| {[ key: string ]: any} | Custom configuration used when creating changelog with commit-and-tag-version package. |
| string | Container image to use for GitHub workflows. |
| string[] | Github Runner selection labels. |
| projen.GroupRunnerOptions | Github Runner Group selection options. |
| string | A directory which will contain build artifacts. |
| boolean | Run security audit on dependencies. |
| | Security audit options. |
| boolean | Automatically approve deps upgrade PRs, allowing them to be merged by mergify (if configured). |
| boolean | Setup Biome. |
| | Biome options. |
| boolean | Define a GitHub workflow for building PRs. |
| | Options for PR build workflow. |
| | Options for Bundler. |
| | Configure which licenses should be deemed acceptable for use by dependencies. |
| boolean | Define a GitHub workflow step for sending code coverage metrics to https://codecov.io/ Uses codecov/codecov-action@v5 By default, OIDC auth is used. Alternatively a token can be provided via codeCovTokenSecret. |
| string | Define the secret name for a specified https://codecov.io/ token. |
| string | License copyright owner. |
| string | The copyright years to put in the LICENSE file. |
| string | The name of the main release branch. |
| boolean | Use dependabot to handle dependency upgrades. |
| projen.github.DependabotOptions | Options for dependabot. |
| boolean | Use tasks and github workflows to handle dependency upgrades. |
| | Options for UpgradeDependencies. |
| string[] | Additional entries to .gitignore. |
| boolean | Setup jest unit tests. |
| | Jest options. |
| boolean | Defines an .npmignore file. Normally this is only needed for libraries that are packaged as tarballs. |
| projen.IgnoreFileOptions | Configuration options for .npmignore file. |
| boolean | Defines a package task that will produce an npm tarball under the artifacts directory (e.g. dist). |
| boolean | Setup prettier. |
| | Prettier options. |
| boolean | Indicates of "projen" should be installed as a devDependency. |
| boolean | Generate (once) .projenrc.js (in JavaScript). Set to false in order to disable .projenrc.js generation. |
| | Options for .projenrc.js. |
| string | Version of projen to install. |
| boolean | Include a GitHub pull request template. |
| string[] | The contents of the pull request template. |
| boolean | Add release management to this project. |
| boolean | Automatically release to npm when new versions are introduced. |
| projen.github.workflows.JobStep[] | Workflow steps to use in order to bootstrap this repo. |
| projen.github.GitIdentity | The git identity to use in workflows. |
| string | The node version used in GitHub Actions workflows. |
| boolean | Enable Node.js package cache in GitHub workflows. |
nameRequired
public readonly name: string;
- Type: string
- Default: $BASEDIR
This is the name of your project.
commitGeneratedOptional
public readonly commitGenerated: boolean;
- Type: boolean
- Default: true
Whether to commit the managed files by default.
gitIgnoreOptionsOptional
public readonly gitIgnoreOptions: IgnoreFileOptions;
- Type: projen.IgnoreFileOptions
Configuration options for .gitignore file.
gitOptionsOptional
public readonly gitOptions: GitOptions;
- Type: projen.GitOptions
Configuration options for git.
loggingOptional
public readonly logging: LoggerOptions;
- Type: projen.LoggerOptions
- Default: {}
Configure logging options such as verbosity.
outdirOptional
public readonly outdir: string;
- Type: string
- Default: "."
The root directory of the project.
Relative to this directory, all files are synthesized.
If this project has a parent, this directory is relative to the parent directory and it cannot be the same as the parent or any of it's other subprojects.
parentOptional
public readonly parent: Project;
- Type: projen.Project
The parent project, if this project is part of a bigger project.
projectTreeOptional
public readonly projectTree: boolean;
- Type: boolean
- Default: false
Generate a project tree file (.projen/tree.json) that shows all components and their relationships. Useful for understanding your project structure and debugging.
projenCommandOptional
public readonly projenCommand: string;
- Type: string
- Default: "npx projen"
The shell command to use in order to run the projen CLI.
Can be used to customize in special environments.
projenrcJsonOptional
public readonly projenrcJson: boolean;
- Type: boolean
- Default: false
Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation.
projenrcJsonOptionsOptional
public readonly projenrcJsonOptions: ProjenrcJsonOptions;
- Type: projen.ProjenrcJsonOptions
- Default: default options
Options for .projenrc.json.
renovatebotOptional
public readonly renovatebot: boolean;
- Type: boolean
- Default: false
Use renovatebot to handle dependency upgrades.
renovatebotOptionsOptional
public readonly renovatebotOptions: RenovatebotOptions;
- Type: projen.RenovatebotOptions
- Default: default options
Options for renovatebot.
autoApproveOptionsOptional
public readonly autoApproveOptions: AutoApproveOptions;
- Type: projen.github.AutoApproveOptions
- Default: auto approve is disabled
Enable and configure the 'auto approve' workflow.
autoMergeOptional
public readonly autoMerge: boolean;
- Type: boolean
- Default: true
Enable automatic merging on GitHub.
Has no effect if github.mergify
is set to false.
autoMergeOptionsOptional
public readonly autoMergeOptions: AutoMergeOptions;
- Type: projen.github.AutoMergeOptions
- Default: see defaults in
AutoMergeOptions
Configure options for automatic merging on GitHub.
Has no effect if
github.mergify or autoMerge is set to false.
clobberOptional
public readonly clobber: boolean;
- Type: boolean
- Default: true, but false for subprojects
Add a clobber task which resets the repo to origin.
devContainerOptional
public readonly devContainer: boolean;
- Type: boolean
- Default: false
Add a VSCode development environment (used for GitHub Codespaces).
githubOptional
public readonly github: boolean;
- Type: boolean
- Default: true
Enable GitHub integration.
Enabled by default for root projects. Disabled for non-root projects.
githubOptionsOptional
public readonly githubOptions: GitHubOptions;
- Type: projen.github.GitHubOptions
- Default: see GitHubOptions
Options for GitHub integration.
gitpodOptional
public readonly gitpod: boolean;
- Type: boolean
- Default: false
Add a Gitpod development environment.
projenCredentialsOptional
public readonly projenCredentials: GithubCredentials;
- Type: projen.github.GithubCredentials
- Default: use a personal access token named PROJEN_GITHUB_TOKEN
Choose a method of providing GitHub API access for projen workflows.
readmeOptional
public readonly readme: SampleReadmeProps;
- Type: projen.SampleReadmeProps
- Default: { filename: 'README.md', contents: '# replace this' }
The README setup.
Example
"{ filename: 'readme.md', contents: '# title' }"
staleOptional
public readonly stale: boolean;
- Type: boolean
- Default: false
Auto-close of stale issues and pull request.
See staleOptions for options.
staleOptionsOptional
public readonly staleOptions: StaleOptions;
- Type: projen.github.StaleOptions
- Default: see defaults in
StaleOptions
Auto-close stale issues and pull requests.
To disable set stale to false.
vscodeOptional
public readonly vscode: boolean;
- Type: boolean
- Default: true
Enable VSCode integration.
Enabled by default for root projects. Disabled for non-root projects.
addPackageManagerToDevEnginesOptional
public readonly addPackageManagerToDevEngines: boolean;
- Type: boolean
- Default: true
Automatically add the resolved packageManager to devEngines.packageManager in package.json, setting onFail to ignore.
allowLibraryDependenciesOptional
public readonly allowLibraryDependencies: boolean;
- Type: boolean
- Default: true
Allow the project to include peerDependencies and bundledDependencies.
This is normally only allowed for libraries. For apps, there's no meaning for specifying these.
allowScriptsOptional
public readonly allowScripts: string[];
- Type: string[]
- Default: all install scripts are allowed to run (package manager default)
List of dependency (package) names that are allowed to run lifecycle install scripts (preinstall, install, postinstall, prepare) during dependency installation.
These scripts can execute arbitrary code, making them a common
supply-chain attack vector. Package managers are moving toward
blocking them by default and requiring an explicit allowlist.
Configuring allowScripts sets up that allowlist so scripts only run
for the packages you have explicitly reviewed and trust.
Support for this setting depends on the configured packageManager:
NPM: written to the nativeallowScriptsfield inpackage.json(requires npm >= 11.16; see https://docs.npmjs.com/cli/v11/commands/npm-approve-scripts).BUN: written to the nativetrustedDependenciesfield inpackage.json(see https://bun.com/docs/pm/lifecycle).PNPM: written to theonlyBuiltDependenciessetting inpnpm-workspace.yaml(see https://pnpm.io/settings#onlybuiltdependencies).YARN2,YARN_BERRY: written to the nativedependenciesMeta.<pkg>.builtallowlist inpackage.json, combined withenableScripts: falsein.yarnrc.yml(see https://yarnpkg.com/features/security#postinstalls). If you setyarnBerryOptions.yarnRcOptions.enableScriptsexplicitly, that value is respected instead of being overridden.YARN,YARN_CLASSIC: not supported. Yarn Classic has no native mechanism to allowlist install scripts for specific dependencies. Setting this option with one of these package managers throws an error at synthesis time.
authorEmailOptional
public readonly authorEmail: string;
- Type: string
Author's e-mail.
authorNameOptional
public readonly authorName: string;
- Type: string
Author's name.
authorOrganizationOptional
public readonly authorOrganization: boolean;
- Type: boolean
Is the author an organization.
authorUrlOptional
public readonly authorUrl: string;
- Type: string
Author's URL / Website.
autoDetectBinOptional
public readonly autoDetectBin: boolean;
- Type: boolean
- Default: true
Automatically add all executables under the bin directory to your package.json file under the bin section.
binOptional
public readonly bin: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Binary programs vended with your module.
You can use this option to add/customize how binaries are represented in
your package.json, but unless autoDetectBin is false, every
executable file under bin will automatically be added to this section.
bugsEmailOptional
public readonly bugsEmail: string;
- Type: string
The email address to which issues should be reported.
bugsUrlOptional
public readonly bugsUrl: string;
- Type: string
The url to your project's issue tracker.
bundledDepsOptional
public readonly bundledDeps: string[];
- Type: string[]
List of dependencies to bundle into this module.
These modules will be
added both to the dependencies section and bundledDependencies section of
your package.json.
The recommendation is to only specify the module name here (e.g.
express). This will behave similar to pnpm add or npm install in the
sense that it will add the module as a dependency to your package.json
file with the latest version (^). You can specify semver requirements in
the same syntax passed to pnpm add or npm i (e.g. express@^2) and
this will be what your package.json will eventually include.
bunVersionOptional
public readonly bunVersion: string;
- Type: string
- Default: "latest"
The version of Bun to use if using Bun as a package manager.
codeArtifactOptionsOptional
public readonly codeArtifactOptions: CodeArtifactOptions;
- Type: CodeArtifactOptions
- Default: undefined
Options for npm packages using AWS CodeArtifact.
This is required if publishing packages to, or installing scoped packages from AWS CodeArtifact
deleteOrphanedLockFilesOptional
public readonly deleteOrphanedLockFiles: boolean;
- Type: boolean
- Default: true
Automatically delete lockfiles from package managers that are not the active one.
Only triggered when the lockfile for the configured package manager already exists.
This is useful when migrating between package managers to avoid conflicts.
depsOptional
public readonly deps: string[];
- Type: string[]
- Default: []
Runtime dependencies of this module.
The recommendation is to only specify the module name here (e.g.
express). This will behave similar to pnpm add or npm install in the
sense that it will add the module as a dependency to your package.json
file with the latest version (^). You can specify semver requirements in
the same syntax passed to pnpm add or npm i (e.g. express@^2) and
this will be what your package.json will eventually include.
Example
[ 'express', 'lodash', 'foo@^2' ]
descriptionOptional
public readonly description: string;
- Type: string
The description is just a string that helps people understand the purpose of the package.
It can be used when searching for packages in a package manager as well. See https://classic.yarnpkg.com/en/docs/package-json/#toc-description
devDepsOptional
public readonly devDeps: string[];
- Type: string[]
- Default: []
Build dependencies for this module.
These dependencies will only be available in your build environment but will not be fetched when this module is consumed.
The recommendation is to only specify the module name here (e.g.
express). This will behave similar to pnpm add or npm install in the
sense that it will add the module as a dependency to your package.json
file with the latest version (^). You can specify semver requirements in
the same syntax passed to pnpm add or npm i (e.g. express@^2) and
this will be what your package.json will eventually include.
Example
[ 'typescript', '@types/express' ]
devEnginesOptional
public readonly devEngines: DevEngines;
- Type: DevEngines
Configure the devEngines field in package.json.
The devEngines.packageManager field is automatically populated based on
the resolved packageManager value. Any fields provided here are merged
with the auto-populated packageManager entry.
https://docs.npmjs.com/cli/v10/configuring-npm/package-json#devengines
entrypointOptional
public readonly entrypoint: string;
- Type: string
- Default: "lib/index.js"
Module entrypoint (main in package.json).
Set to an empty string to not include main in your package.json
homepageOptional
public readonly homepage: string;
- Type: string
Package's Homepage / Website.
keywordsOptional
public readonly keywords: string[];
- Type: string[]
Keywords to include in package.json.
licenseOptional
public readonly license: string;
- Type: string
- Default: "Apache-2.0"
License's SPDX identifier.
See https://github.com/projen/projen/tree/main/license-text for a list of supported licenses.
Use the licensed option if you want to no license to be specified.
licensedOptional
public readonly licensed: boolean;
- Type: boolean
- Default: true
Indicates if a license should be added.
maxNodeVersionOptional
public readonly maxNodeVersion: string;
- Type: string
- Default: no maximum version is enforced
The maximum node version supported by this package. Most projects should not use this option.
The value indicates that the package is incompatible with any newer versions of node. This requirement is enforced via the engines field.
You will normally not need to set this option. Consider this option only if your package is known to not function with newer versions of node.
minNodeVersionOptional
public readonly minNodeVersion: string;
- Type: string
- Default: no minimum version is enforced
The minimum node version required by this package to function. Most projects should not use this option.
The value indicates that the package is incompatible with any older versions of node. This requirement is enforced via the engines field.
You will normally not need to set this option, even if your package is incompatible with EOL versions of node. Consider this option only if your package depends on a specific feature, that is not available in other LTS versions. Setting this option has very high impact on the consumers of your package, as package managers will actively prevent usage with node versions you have marked as incompatible.
To change the node version of your CI/CD workflows, use workflowNodeVersion.
npmAccessOptional
public readonly npmAccess: NpmAccess;
- Type: NpmAccess
- Default: for scoped packages (e.g.
foo@bar), the default isNpmAccess.RESTRICTED, for non-scoped packages, the default isNpmAccess.PUBLIC.
Access level of the npm package.
npmProvenanceOptional
public readonly npmProvenance: boolean;
- Type: boolean
- Default: true for public packages, false otherwise
Should provenance statements be generated when the package is published.
A supported package manager is required to publish a package with npm provenance statements and you will need to use a supported CI/CD provider.
Note that the projen Release and Publisher components are using publib to publish packages,
which is using npm internally and supports provenance statements independently of the package manager used.
npmRegistryUrlOptional
public readonly npmRegistryUrl: string;
- Type: string
- Default: "https://registry.npmjs.org"
The base URL of the npm package registry.
Must be a URL (e.g. start with "https://" or "http://")
npmTokenSecretOptional
public readonly npmTokenSecret: string;
- Type: string
- Default: "NPM_TOKEN"
GitHub secret which contains the NPM token to use when publishing packages.
npmTrustedPublishingOptional
public readonly npmTrustedPublishing: boolean;
- Type: boolean
- Default: false
Use trusted publishing for publishing to npmjs.com Needs to be pre-configured on npm.js to work.
packageManagerOptional
public readonly packageManager: NodePackageManager;
- Type: NodePackageManager
- Default: Detected from the calling process or
YARN_CLASSICif detection fails.
The Node Package Manager used to execute scripts.
packageNameOptional
public readonly packageName: string;
- Type: string
- Default: defaults to project name
The "name" in package.json.
peerDependencyOptionsOptional
public readonly peerDependencyOptions: PeerDependencyOptions;
- Type: PeerDependencyOptions
Options for peerDeps.
peerDepsOptional
public readonly peerDeps: string[];
- Type: string[]
- Default: []
Peer dependencies for this module.
Dependencies listed here are required to
be installed (and satisfied) by the consumer of this library. Using peer
dependencies allows you to ensure that only a single module of a certain
library exists in the node_modules tree of your consumers.
Note that prior to npm@7, peer dependencies are not automatically installed, which means that adding peer dependencies to a library will be a breaking change for your customers.
Unless peerDependencyOptions.pinnedDevDependency is disabled (it is
enabled by default), projen will automatically add a dev dependency with a
pinned version for each peer dependency. This will ensure that you build &
test your module against the lowest peer version required.
pnpmOptionsOptional
public readonly pnpmOptions: PnpmOptions;
- Type: PnpmOptions
- Default: all default options
Options for pnpm.
pnpmVersionOptional
public readonly pnpmVersion: string;
- Type: string
- Default: "10.33.0"
The version of PNPM to use if using PNPM as a package manager.
repositoryOptional
public readonly repository: string;
- Type: string
The repository is the location where the actual code for your package lives.
See https://classic.yarnpkg.com/en/docs/package-json/#toc-repository
repositoryDirectoryOptional
public readonly repositoryDirectory: string;
- Type: string
If the package.json for your package is not in the root directory (for example if it is part of a monorepo), you can specify the directory in which it lives.
scopedPackagesOptionsOptional
public readonly scopedPackagesOptions: ScopedPackagesOptions[];
- Type: ScopedPackagesOptions[]
- Default: fetch all scoped packages from the public npm registry
Options for privately hosted scoped packages.
stabilityOptional
public readonly stability: string;
- Type: string
Package's Stability.
yarnBerryOptionsOptional
public readonly yarnBerryOptions: YarnBerryOptions;
- Type: YarnBerryOptions
- Default: Yarn Berry v4 with all default options
Options for Yarn Berry.
bumpPackageOptional
public readonly bumpPackage: string;
- Type: string
- Default: A recent version of "commit-and-tag-version"
The commit-and-tag-version compatible package used to bump the package version, as a dependency string.
This can be any compatible package version, including the deprecated standard-version@9.
jsiiReleaseVersionOptional
public readonly jsiiReleaseVersion: string;
- Type: string
- Default: "latest"
Version requirement of publib which is used to publish modules to npm.
majorVersionOptional
public readonly majorVersion: number;
- Type: number
- Default: Major version is not enforced.
Major version to release from the default branch.
If this is specified, we bump the latest version of this major version line. If not specified, we bump the global latest version.
minMajorVersionOptional
public readonly minMajorVersion: number;
- Type: number
- Default: No minimum version is being enforced
Minimal Major version to release.
This can be useful to set to 1, as breaking changes before the 1.x major release are not incrementing the major version number.
Can not be set together with majorVersion.
nextVersionCommandOptional
public readonly nextVersionCommand: string;
- Type: string
- Default: The next version will be determined based on the commit history and project settings.
A shell command to control the next version to release.
If present, this shell command will be run before the bump is executed, and it determines what version to release. It will be executed in the following environment:
- Working directory: the project directory.
$VERSION: the current version. Looks like1.2.3.$LATEST_TAG: the most recent tag. Looks likeprefix-v1.2.3, or may be unset.$SUGGESTED_BUMP: the suggested bump action based on commits. One ofmajor|minor|patch|none.
The command should print one of the following to stdout:
- Nothing: the next version number will be determined based on commit history.
x.y.z: the next version number will bex.y.z.major|minor|patch: the next version number will be the current version number with the indicated component bumped.
This setting cannot be specified together with minMajorVersion; the invoked
script can be used to achieve the effects of minMajorVersion.
npmDistTagOptional
public readonly npmDistTag: string;
- Type: string
- Default: "latest"
The npmDistTag to use when publishing from the default branch.
To set the npm dist-tag for release branches, set the npmDistTag property
for each branch.
postBuildStepsOptional
public readonly postBuildSteps: JobStep[];
- Type: projen.github.workflows.JobStep[]
- Default: []
Steps to execute after build as part of the release workflow.
prereleaseOptional
public readonly prerelease: string;
- Type: string
- Default: normal semantic versions
Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre").
publishDryRunOptional
public readonly publishDryRun: boolean;
- Type: boolean
- Default: false
Instead of actually publishing to package managers, just print the publishing command.
publishTasksOptional
public readonly publishTasks: boolean;
- Type: boolean
- Default: false
Define publishing tasks that can be executed manually as well as workflows.
Normally, publishing only happens within automated workflows. Enable this in order to create a publishing task for each publishing activity.
releasableCommitsOptional
public readonly releasableCommits: ReleasableCommits;
- Type: projen.ReleasableCommits
- Default: ReleasableCommits.everyCommit()
Find commits that should be considered releasable Used to decide if a release is required.
releaseBranchesOptional
public readonly releaseBranches: {[ key: string ]: BranchOptions};
- Type: {[ key: string ]: projen.release.BranchOptions}
- Default: no additional branches are used for release. you can use
addBranch()to add additional branches.
Defines additional release branches.
A workflow will be created for each
release branch which will publish releases from commits in this branch.
Each release branch must be assigned a major version number which is used
to enforce that versions published from that branch always use that major
version. If multiple branches are used, the majorVersion field must also
be provided for the default branch.
releaseEnvironmentOptional
public readonly releaseEnvironment: string;
- Type: string
- Default: no environment used, unless set at the artifact level
The GitHub Actions environment used for the release.
This can be used to add an explicit approval step to the release or limit who can initiate a release through environment protection rules.
When multiple artifacts are released, the environment can be overwritten on a per artifact basis.
releaseFailureIssueOptional
public readonly releaseFailureIssue: boolean;
- Type: boolean
- Default: false
Create a github issue on every failed publishing task.
releaseFailureIssueLabelOptional
public readonly releaseFailureIssueLabel: string;
- Type: string
- Default: "failed-release"
The label to apply to issues indicating publish failures.
Only applies if releaseFailureIssue is true.
releaseTagPrefixOptional
public readonly releaseTagPrefix: string;
- Type: string
- Default: "v"
Automatically add the given prefix to release tags. Useful if you are releasing on multiple branches with overlapping version numbers.
Note: this prefix is used to detect the latest tagged version when bumping, so if you change this on a project with an existing version history, you may need to manually tag your latest release with the new prefix.
releaseTriggerOptional
public readonly releaseTrigger: ReleaseTrigger;
- Type: projen.release.ReleaseTrigger
- Default: Continuous releases (
ReleaseTrigger.continuous())
The release trigger to use.
releaseWorkflowEnvOptional
public readonly releaseWorkflowEnv: {[ key: string ]: string};
- Type: {[ key: string ]: string}
- Default: {}
Build environment variables for release workflows.
releaseWorkflowNameOptional
public readonly releaseWorkflowName: string;
- Type: string
- Default: "release"
The name of the default release workflow.
releaseWorkflowSetupStepsOptional
public readonly releaseWorkflowSetupSteps: JobStep[];
- Type: projen.github.workflows.JobStep[]
A set of workflow steps to execute in order to setup the workflow container.
versionrcOptionsOptional
public readonly versionrcOptions: {[ key: string ]: any};
- Type: {[ key: string ]: any}
- Default: standard configuration applicable for GitHub repositories
Custom configuration used when creating changelog with commit-and-tag-version package.
Given values either append to default configuration or overwrite values in it.
workflowContainerImageOptional
public readonly workflowContainerImage: string;
- Type: string
- Default: default image
Container image to use for GitHub workflows.
workflowRunsOnOptional
public readonly workflowRunsOn: string[];
- Type: string[]
- Default: ["ubuntu-latest"]
Github Runner selection labels.
workflowRunsOnGroupOptional
public readonly workflowRunsOnGroup: GroupRunnerOptions;
- Type: projen.GroupRunnerOptions
Github Runner Group selection options.
artifactsDirectoryOptional
public readonly artifactsDirectory: string;
- Type: string
- Default: "dist"
A directory which will contain build artifacts.
auditDepsOptional
public readonly auditDeps: boolean;
- Type: boolean
- Default: false
Run security audit on dependencies.
When enabled, creates an "audit" task that checks for known security vulnerabilities in dependencies. By default, runs during every build and checks for "high" severity vulnerabilities or above in all dependencies (including dev dependencies).
auditDepsOptionsOptional
public readonly auditDepsOptions: AuditOptions;
- Type: AuditOptions
- Default: default options
Security audit options.
autoApproveUpgradesOptional
public readonly autoApproveUpgrades: boolean;
- Type: boolean
- Default: true
Automatically approve deps upgrade PRs, allowing them to be merged by mergify (if configured).
Throw if set to true but autoApproveOptions are not defined.
biomeOptional
public readonly biome: boolean;
- Type: boolean
- Default: false
Setup Biome.
biomeOptionsOptional
public readonly biomeOptions: BiomeOptions;
- Type: BiomeOptions
- Default: default options
Biome options.
buildWorkflowOptional
public readonly buildWorkflow: boolean;
- Type: boolean
- Default: true if not a subproject
Define a GitHub workflow for building PRs.
buildWorkflowOptionsOptional
public readonly buildWorkflowOptions: BuildWorkflowOptions;
- Type: BuildWorkflowOptions
Options for PR build workflow.
bundlerOptionsOptional
public readonly bundlerOptions: BundlerOptions;
- Type: BundlerOptions
Options for Bundler.
checkLicensesOptional
public readonly checkLicenses: LicenseCheckerOptions;
- Type: LicenseCheckerOptions
- Default: no license checks are run during the build and all licenses will be accepted
Configure which licenses should be deemed acceptable for use by dependencies.
This setting will cause the build to fail, if any prohibited or not allowed licenses ares encountered.
codeCovOptional
public readonly codeCov: boolean;
- Type: boolean
- Default: false
Define a GitHub workflow step for sending code coverage metrics to https://codecov.io/ Uses codecov/codecov-action@v5 By default, OIDC auth is used. Alternatively a token can be provided via codeCovTokenSecret.
codeCovTokenSecretOptional
public readonly codeCovTokenSecret: string;
- Type: string
- Default: OIDC auth is used
Define the secret name for a specified https://codecov.io/ token.
copyrightOwnerOptional
public readonly copyrightOwner: string;
- Type: string
- Default: defaults to the value of authorName or "" if
authorNameis undefined.
License copyright owner.
copyrightPeriodOptional
public readonly copyrightPeriod: string;
- Type: string
- Default: current year
The copyright years to put in the LICENSE file.
defaultReleaseBranchOptional
public readonly defaultReleaseBranch: string;
- Type: string
- Default: "main"
The name of the main release branch.
dependabotOptional
public readonly dependabot: boolean;
- Type: boolean
- Default: false
Use dependabot to handle dependency upgrades.
Cannot be used in conjunction with depsUpgrade.
dependabotOptionsOptional
public readonly dependabotOptions: DependabotOptions;
- Type: projen.github.DependabotOptions
- Default: default options
Options for dependabot.
depsUpgradeOptional
public readonly depsUpgrade: boolean;
- Type: boolean
- Default:
truefor root projects,falsefor subprojects
Use tasks and github workflows to handle dependency upgrades.
Cannot be used in conjunction with dependabot.
depsUpgradeOptionsOptional
public readonly depsUpgradeOptions: UpgradeDependenciesOptions;
- Type: UpgradeDependenciesOptions
- Default: default options
Options for UpgradeDependencies.
gitignoreOptional
public readonly gitignore: string[];
- Type: string[]
Additional entries to .gitignore.
jestOptional
public readonly jest: boolean;
- Type: boolean
- Default: true
Setup jest unit tests.
jestOptionsOptional
public readonly jestOptions: JestOptions;
- Type: JestOptions
- Default: default options
Jest options.
npmignoreEnabledOptional
public readonly npmignoreEnabled: boolean;
- Type: boolean
- Default: true
Defines an .npmignore file. Normally this is only needed for libraries that are packaged as tarballs.
npmIgnoreOptionsOptional
public readonly npmIgnoreOptions: IgnoreFileOptions;
- Type: projen.IgnoreFileOptions
Configuration options for .npmignore file.
packageOptional
public readonly package: boolean;
- Type: boolean
- Default: true
Defines a package task that will produce an npm tarball under the artifacts directory (e.g. dist).
prettierOptional
public readonly prettier: boolean;
- Type: boolean
- Default: false
Setup prettier.
prettierOptionsOptional
public readonly prettierOptions: PrettierOptions;
- Type: PrettierOptions
- Default: default options
Prettier options.
projenDevDependencyOptional
public readonly projenDevDependency: boolean;
- Type: boolean
- Default: true if not a subproject
Indicates of "projen" should be installed as a devDependency.
projenrcJsOptional
public readonly projenrcJs: boolean;
- Type: boolean
- Default: true if projenrcJson is false
Generate (once) .projenrc.js (in JavaScript). Set to false in order to disable .projenrc.js generation.
projenrcJsOptionsOptional
public readonly projenrcJsOptions: ProjenrcOptions;
- Type: ProjenrcOptions
- Default: default options
Options for .projenrc.js.
projenVersionOptional
public readonly projenVersion: string;
- Type: string
- Default: Defaults to the latest version.
Version of projen to install.
pullRequestTemplateOptional
public readonly pullRequestTemplate: boolean;
- Type: boolean
- Default: true
Include a GitHub pull request template.
pullRequestTemplateContentsOptional
public readonly pullRequestTemplateContents: string[];
- Type: string[]
- Default: default content
The contents of the pull request template.
releaseOptional
public readonly release: boolean;
- Type: boolean
- Default: true (false for subprojects)
Add release management to this project.
releaseToNpmOptional
public readonly releaseToNpm: boolean;
- Type: boolean
- Default: false
Automatically release to npm when new versions are introduced.
workflowBootstrapStepsOptional
public readonly workflowBootstrapSteps: JobStep[];
- Type: projen.github.workflows.JobStep[]
- Default: "yarn install --frozen-lockfile && yarn projen"
Workflow steps to use in order to bootstrap this repo.
workflowGitIdentityOptional
public readonly workflowGitIdentity: GitIdentity;
- Type: projen.github.GitIdentity
- Default: default GitHub Actions user
The git identity to use in workflows.
workflowNodeVersionOptional
public readonly workflowNodeVersion: string;
- Type: string
- Default:
minNodeVersionif set, otherwiselts/*.
The node version used in GitHub Actions workflows.
Always use this option if your GitHub Actions workflows require a specific to run.
workflowPackageCacheOptional
public readonly workflowPackageCache: boolean;
- Type: boolean
- Default: false
Enable Node.js package cache in GitHub workflows.
NpmConfigOptions
Options to configure the local NPM config.
Initializer
import { javascript } from 'projen'
const npmConfigOptions: javascript.NpmConfigOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| boolean | Omits empty objects and arrays. |
| string | URL of the registry mirror to use. |
omitEmptyOptional
public readonly omitEmpty: boolean;
- Type: boolean
- Default: false
Omits empty objects and arrays.
registryOptional
public readonly registry: string;
- Type: string
- Default: use npmjs default registry
URL of the registry mirror to use.
You can change this or add scoped registries using the addRegistry method
PeerDependencyOptions
Initializer
import { javascript } from 'projen'
const peerDependencyOptions: javascript.PeerDependencyOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| boolean | Automatically add a pinned dev dependency. |
pinnedDevDependencyOptional
public readonly pinnedDevDependency: boolean;
- Type: boolean
- Default: true
Automatically add a pinned dev dependency.
PnpmOptions
Configure pnpm.
Initializer
import { javascript } from 'projen'
const pnpmOptions: javascript.PnpmOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| | The pnpm-workspace.yaml configuration. |
workspaceYamlOptionsOptional
public readonly workspaceYamlOptions: PnpmWorkspaceYamlOptions;
- Type: PnpmWorkspaceYamlOptions
- Default: a blank pnpm-workspace.yaml file
The pnpm-workspace.yaml configuration.
PnpmWorkspaceYamlOptions
Options for PnpmWorkspaceYaml.
Initializer
import { javascript } from 'projen'
const pnpmWorkspaceYamlOptions: javascript.PnpmWorkspaceYamlOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| any | A map of package matchers to explicitly allow (true) or disallow (false) script execution. |
| {[ key: string ]: string} | A list of deprecated versions that the warnings are suppressed. |
| boolean | When true, installation won't fail if some of the patches from the "patchedDependencies" field were not applied. |
| boolean | When true, installation won't fail if some of the patches from the "patchedDependencies" field were not applied. |
| | No description. |
| | Controls the level of issues reported by pnpm audit. |
| boolean | When true, any missing non-optional peer dependencies are automatically installed. |
| boolean | When set to true, it prevents the resolution of exotic protocols (like git+ssh: or direct https: tarballs) in transitive dependencies. |
| string | The Certificate Authority signing certificate that is trusted for SSL connections to the registry. |
| string | The location of the cache (package metadata and dlx). |
| string | A path to a file containing one or multiple Certificate Authority signing certificates. |
| {[ key: string ]: string} | Define dependency version ranges as reusable constants, for later reference in package.json files. This (singular) field creates a catalog named default. |
| | Controlling if and how dependencies are added to the default catalog. |
| {[ key: string ]: {[ key: string ]: string}} | Define arbitrarily named catalogs. |
| string | A client certificate to pass when accessing the registry. |
| number | The maximum number of child processes to allocate simultaneously to build node_modules. |
| boolean | When set to true, pnpm will remove unused catalog entries during installation. |
| | Controls colors in the output. |
| any | Config dependencies allow you to share and centralize configuration files, settings, and hooks across multiple projects. |
| boolean | If set to true, all build scripts (e.g. preinstall, install, postinstall) from dependencies will run automatically, without requiring approval. |
| boolean | When set to true, dependencies that are already symlinked to the root node_modules directory of the workspace will not be symlinked to subproject node_modules directories. |
| boolean | When this setting is enabled, dependencies that are injected will be symlinked from the workspace whenever possible. |
| boolean | When this setting is set to true, packages with peer dependencies will be deduplicated after peers resolution. |
| boolean | When enabled, peer dependency suffixes use version-only identifiers (name@version) instead of full dep paths, eliminating nested suffixes like (foo@1.0.0(bar@2.0.0)). This dramatically reduces the number of package instances in projects with many recursive peer dependencies. |
| boolean | When deploying a package or installing a local package, all files of the package are copied. |
| boolean | When set to true, installation will fail if the workspace has cycles. |
| number | The time in minutes after which dlx cache expires. |
| boolean | UNDOCUMENTED. |
| boolean | When enabled, node_modules contains only symlinks to a central virtual store, rather than to node_modules/.pnpm. |
| boolean | When false, pnpm will not write any files to the modules directory (node_modules). |
| boolean | When true, pnpm will run any pre/post scripts automatically. |
| boolean | If this is enabled, pnpm will not install any package that claims to not be compatible with the current Node version. |
| | No description. |
| boolean | When false, the NODE_PATH environment variable is not set in the command shims. |
| boolean | If true, pnpm will fail if no packages match the filter. |
| number | How many times to retry if pnpm fails to fetch from the registry. |
| number | The exponential factor for retry backoff. |
| number | The maximum fallback timeout to ensure the retry factor does not make requests too long. |
| number | The minimum (base) timeout for retrying requests. |
| number | The maximum amount of time to wait for HTTP requests to complete. |
| boolean | By default, pnpm deploy will try creating a dedicated lockfile from a shared lockfile for deployment. |
| boolean | When set to true, the generated lockfile name after installation will be named based on the current branch name to completely avoid merge conflicts. |
| boolean | Check if current branch is your publish branch, clean, and up-to-date with remote. |
| string[] | When fetching dependencies that are Git repositories, if the host is listed in this setting, pnpm will use shallow cloning to fetch only the needed commit, not all the history. |
| string | Allows to set the target directory for the bin files of globally installed packages. |
| string | Specify a custom directory to store global packages. |
| string | The location of a global pnpmfile. |
| boolean | When true, all dependencies are hoisted to node_modules/.pnpm/node_modules. |
| | Added a new hoistingLimits setting for nodeLinker: hoisted installs, mirroring yarn's nmHoistingLimits. |
| string[] | Tells pnpm which packages should be hoisted to node_modules/.pnpm/node_modules. |
| boolean | When true, packages from the workspaces are symlinked to either <workspace_root>/node_modules/.pnpm/node_modules or to <workspace_root>/node_modules depending on other hoisting settings (hoistPattern and publicHoistPattern). |
| string | A proxy to use for outgoing HTTPS requests. |
| boolean | During installation the dependencies of some packages are automatically patched. |
| string[] | A list of package names that should not be built during installation. |
| boolean | Do not execute any scripts of the installed packages. |
| string[] | A list of optional dependencies that the install should be skipped. |
| boolean | Default is undefined. |
| boolean | .pnpmfile.cjs will be ignored. Useful together with --ignore-scripts when you want to make sure that no script gets executed during install. |
| boolean | Do not execute any scripts defined in the project package.json and its dependencies. |
| boolean | When set to true, no workspace cycle warnings will be printed. |
| boolean | Adding a new dependency to the root workspace package fails, unless the --ignore-workspace-root-check or -w flag is used. |
| boolean | When executing commands recursively in a workspace, execute them on the root workspace project as well. |
| boolean | Enables hard-linking of all local workspace dependencies instead of symlinking them. |
| string | A client key to pass when accessing the registry. |
| | If this is enabled, locally available packages are linked to node_modules instead of being downloaded from the registry. |
| string | The IP address of the local interface to use when making connections to the npm registry. |
| boolean | When set to false, pnpm won't read or generate a pnpm-lock.yaml file. |
| boolean | Add the full URL to the package's tarball to every entry in pnpm-lock.yaml. |
| | Any logs at or higher than the given level will be shown. |
| boolean | When enabled, pnpm will automatically download and run the version of pnpm specified in the packageManager field of package.json. |
| number | The maximum number of connections to use per origin (protocol/host/port combination). |
| any[] | This configuration matches the current branch name to determine whether to merge all git branch lockfile files. |
| number | minimumReleaseAge defines the minimum number of minutes that must pass after a version is published before pnpm will install it. |
| string[] | If you set minimumReleaseAge but need certain dependencies to always install the newest version immediately, you can list them under minimumReleaseAgeExclude. |
| boolean | When true, pnpm skips the minimumReleaseAge check for a package whose registry metadata does not include the time field (some private registries and mirrors omit it). |
| boolean | Controls how pnpm behaves when no version of a dependency satisfies the minimumReleaseAge constraint within the requested range. |
| number | The time in minutes after which orphan packages from the modules directory should be removed. |
| string | The directory in which dependencies will be installed (instead of node_modules). |
| number | Controls the maximum number of HTTP(S) requests to process simultaneously. |
| string[] | A list of dependencies to run builds for. |
| {[ key: string ]: string} | Configure custom Node.js download mirrors in pnpm-workspace.yaml. The keys are release channels (release, rc, nightly, v8-canary, etc.) and the values are base URLs. |
| | Defines what linker should be used for installing Node packages. |
| string | Options to pass through to Node.js via the NODE_OPTIONS environment variable. |
| string | The Node.js version to use when checking a package's engines setting. |
| string | A comma-separated string of domain extensions that a proxy should not be used for. |
| string | The location of the npm binary that pnpm uses for some actions, like publishing. |
| string | The path to a file containing registry authentication tokens. |
| string[] | A list of package names that are allowed to be executed during installation. |
| string | Specifies a JSON file that lists the only packages permitted to run installation scripts during the pnpm install process. |
| boolean | When enabled, a fast check will be performed before proceeding to installation. |
| any | Used to override any dependency in the dependency graph. |
| any | Used to extend the existing package definitions with additional information. |
| | Controls the way packages are imported from the store (if you want to disable symlinks inside node_modules, then you need to change the nodeLinker setting, not this one). |
| boolean | If this setting is disabled, pnpm will not fail if a different package manager is specified in the packageManager field of package.json. When enabled, only the package name is checked (since pnpm v9.2.0), so you can still run any version of pnpm regardless of the version specified in the packageManager field. |
| boolean | When enabled, pnpm will fail if its version doesn't exactly match the version specified in the packageManager field of package.json. |
| string[] | Workspace package paths. |
| {[ key: string ]: string} | A list of dependencies that are patched. |
| string | The generated patch file will be saved to this directory. |
| | No description. |
| number | Max length of the peer IDs suffix added to dependency keys in the lockfile. |
| | Overrides the onFail behavior of both the packageManager field and devEngines.packageManager when the running pnpm version does not match the declared one. |
| string | The location of the local pnpmfile. |
| boolean | When set to true and the available pnpm-lock.yaml satisfies the package.json dependencies directive, a headless installation is performed. |
| boolean | Bypass staleness checks for cached data. |
| boolean | Create symlinks to executables in node_modules/.bin instead of command shims. This setting is ignored on Windows, where only command shims work. |
| boolean | If this is enabled, local packages from the workspace are preferred over packages from the registry, even if there is a newer version of the package in the registry. |
| boolean | When publishing from a supported cloud CI/CD system, the package will be publicly linked to where it was built and published from. |
| string | A proxy to use for outgoing http requests. |
| string[] | Unlike hoistPattern, which hoists dependencies to a hidden modules directory inside the virtual store, publicHoistPattern hoists dependencies matching the pattern to the root modules directory. |
| string | The primary branch of the repository which is used for publishing the latest changes. |
| boolean | If this is enabled, the primary behaviour of pnpm install becomes that of pnpm install -r, meaning the install is performed on all workspace or subdirectory packages. |
| {[ key: string ]: string} | Configure registries for scoped packages in pnpm-workspace.yaml. The default key sets the main registry (equivalent to the registry .npmrc setting). Scoped keys configure registries for specific package scopes. |
| string | The base URL of the npm package registry (trailing slash included). |
| boolean | Set this to true if the registry that you are using returns the "time" field in the abbreviated metadata. |
| | Allows you to customize the output style of the logs. |
| string[] | A list of scripts that must exist in each project. |
| | Determines how pnpm resolves dependencies, See https://pnpm.io/settings#resolutionmode. |
| boolean | When enabled, dependencies of the root workspace project are used to resolve peer dependencies of any projects in the workspace. |
| | Overrides the onFail field of devEngines.runtime (and engines.runtime) in the root project's package.json. This is useful when you want a different local behavior than what is written in the manifest — for instance, forcing pnpm to download the declared runtime even when the manifest sets onFail: "warn". |
| boolean | Saved dependencies will be configured with an exact version rather than using pnpm's default semver range operator. |
| | Configure how versions of packages installed to a package.json file get prefixed. |
| | This setting controls how dependencies that are linked from the workspace are added to package.json. |
| string | The shell to use for scripts run with the pnpm run command. |
| boolean | By default, pnpm creates a semistrict node_modules, meaning dependencies have access to undeclared dependencies but modules outside of node_modules do not. |
| boolean | If this is enabled, pnpm creates a single pnpm-lock.yaml file in the root of the workspace. |
| boolean | When true, pnpm will use a JavaScript implementation of a bash-like shell to execute scripts. |
| boolean | Use and cache the results of (pre/post)install hooks. |
| boolean | Only use the side effects cache if present, do not create it for new packages. |
| string | The location where all the packages are saved on the disk. |
| string | The location where all the packages are saved on the disk. |
| boolean | When strictDepBuilds is enabled, the installation will exit with a non-zero exit code if any dependencies have unreviewed build scripts (aka postinstall scripts). |
| boolean | If this is enabled, commands will fail if there is a missing or invalid peer dependency in the tree. |
| boolean | Whether or not to do SSL key validation when making requests to the registry via HTTPS. |
| boolean | Some registries allow the exact same content to be published under different package names and/or versions. |
| | Specifies architectures for which you'd like to install optional dependencies, even if they don't match the architecture of the system running the install. |
| boolean | When symlink is set to false, pnpm creates a virtual store directory without any symlinks. |
| string[] | Injected workspace dependencies are collections of hardlinks, which don't add or remove the files when their sources change. |
| string | If you pnpm add a package and you don't provide a specific version, then it will install the package at the version registered under the tag from this setting. |
| boolean | A new trustLockfile setting controls whether pnpm install re-applies the minimumReleaseAge / trustPolicy: 'no-downgrade' checks to every entry in the loaded lockfile. |
| | When set to no-downgrade, pnpm will fail if a package's trust level has decreased compared to previous releases. |
| string[] | You can now list one or more specific packages or versions that pnpm should allow to install, even if those packages don't satisfy the trust policy requirement. |
| number | Allows ignoring the trust policy check for packages published more than the specified number of minutes ago. |
| boolean | Set to true to enable UID/GID switching when running package scripts. |
| | No description. |
| boolean | When true, pnpm will check for updates to the installed packages and notify the user. |
| boolean | Experimental option that enables beta features of the CLI. |
| string | Specifies which exact Node.js version should be used for the project's runtime. |
| boolean | When true, all the output is written to stderr. |
| any | This setting allows the checking of the state of dependencies before running scripts. |
| boolean | By default, if a file in the store has been modified, the content of this file is checked before linking it to a project's node_modules. |
| string | The directory with links to the store. |
| number | Sets the maximum allowed length of directory names inside the virtual store directory (node_modules/.pnpm). |
| boolean | When set to true, pnpm populates the virtual store without creating importer symlinks, hoisting, bin links, or running lifecycle scripts. |
| number | Set the maximum number of tasks to run simultaneously. |
allowBuildsOptional
public readonly allowBuilds: any;
- Type: any
A map of package matchers to explicitly allow (true) or disallow (false) script execution.
This field replaces onlyBuiltDependencies and ignoredBuiltDependencies (which are also deprecated by this new setting), providing a single source of truth.
allowedDeprecatedVersionsOptional
public readonly allowedDeprecatedVersions: {[ key: string ]: string};
- Type: {[ key: string ]: string}
A list of deprecated versions that the warnings are suppressed.
allowNonAppliedPatchesOptional
public readonly allowNonAppliedPatches: boolean;
- Type: boolean
When true, installation won't fail if some of the patches from the "patchedDependencies" field were not applied.
allowUnusedPatchesOptional
public readonly allowUnusedPatches: boolean;
- Type: boolean
When true, installation won't fail if some of the patches from the "patchedDependencies" field were not applied.
(Previously named "allowNonAppliedPatches")
auditConfigOptional
public readonly auditConfig: PnpmWorkspaceYamlSchemaAuditConfig;
auditLevelOptional
public readonly auditLevel: PnpmWorkspaceYamlSchemaAuditLevel;
Controls the level of issues reported by pnpm audit.
When set to 'low', all vulnerabilities are reported. When set to 'moderate', 'high', or 'critical', only vulnerabilities with that severity or higher are reported.
autoInstallPeersOptional
public readonly autoInstallPeers: boolean;
- Type: boolean
When true, any missing non-optional peer dependencies are automatically installed.
blockExoticSubdepsOptional
public readonly blockExoticSubdeps: boolean;
- Type: boolean
When set to true, it prevents the resolution of exotic protocols (like git+ssh: or direct https: tarballs) in transitive dependencies.
Only direct dependencies are allowed to use exotic sources.
caOptional
public readonly ca: string;
- Type: string
The Certificate Authority signing certificate that is trusted for SSL connections to the registry.
cacheDirOptional
public readonly cacheDir: string;
- Type: string
The location of the cache (package metadata and dlx).
cafileOptional
public readonly cafile: string;
- Type: string
A path to a file containing one or multiple Certificate Authority signing certificates.
catalogOptional
public readonly catalog: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Define dependency version ranges as reusable constants, for later reference in package.json files. This (singular) field creates a catalog named default.
catalogModeOptional
public readonly catalogMode: PnpmWorkspaceYamlSchemaCatalogMode;
Controlling if and how dependencies are added to the default catalog.
catalogsOptional
public readonly catalogs: {[ key: string ]: {[ key: string ]: string}};
- Type: {[ key: string ]: {[ key: string ]: string}}
Define arbitrarily named catalogs.
certOptional
public readonly cert: string;
- Type: string
A client certificate to pass when accessing the registry.
childConcurrencyOptional
public readonly childConcurrency: number;
- Type: number
The maximum number of child processes to allocate simultaneously to build node_modules.
cleanupUnusedCatalogsOptional
public readonly cleanupUnusedCatalogs: boolean;
- Type: boolean
When set to true, pnpm will remove unused catalog entries during installation.
colorOptional
public readonly color: PnpmWorkspaceYamlSchemaColor;
Controls colors in the output.
configDependenciesOptional
public readonly configDependencies: any;
- Type: any
Config dependencies allow you to share and centralize configuration files, settings, and hooks across multiple projects.
They are installed before all regular dependencies ('dependencies', 'devDependencies', 'optionalDependencies'), making them ideal for setting up custom hooks, patches, and catalog entries.
dangerouslyAllowAllBuildsOptional
public readonly dangerouslyAllowAllBuilds: boolean;
- Type: boolean
If set to true, all build scripts (e.g. preinstall, install, postinstall) from dependencies will run automatically, without requiring approval.
dedupeDirectDepsOptional
public readonly dedupeDirectDeps: boolean;
- Type: boolean
When set to true, dependencies that are already symlinked to the root node_modules directory of the workspace will not be symlinked to subproject node_modules directories.
dedupeInjectedDepsOptional
public readonly dedupeInjectedDeps: boolean;
- Type: boolean
When this setting is enabled, dependencies that are injected will be symlinked from the workspace whenever possible.
dedupePeerDependentsOptional
public readonly dedupePeerDependents: boolean;
- Type: boolean
When this setting is set to true, packages with peer dependencies will be deduplicated after peers resolution.
dedupePeersOptional
public readonly dedupePeers: boolean;
- Type: boolean
When enabled, peer dependency suffixes use version-only identifiers (name@version) instead of full dep paths, eliminating nested suffixes like (foo@1.0.0(bar@2.0.0)). This dramatically reduces the number of package instances in projects with many recursive peer dependencies.
deployAllFilesOptional
public readonly deployAllFiles: boolean;
- Type: boolean
When deploying a package or installing a local package, all files of the package are copied.
disallowWorkspaceCyclesOptional
public readonly disallowWorkspaceCycles: boolean;
- Type: boolean
When set to true, installation will fail if the workspace has cycles.
dlxCacheMaxAgeOptional
public readonly dlxCacheMaxAge: number;
- Type: number
The time in minutes after which dlx cache expires.
embedReadmeOptional
public readonly embedReadme: boolean;
- Type: boolean
UNDOCUMENTED.
When true, pnpm publish writes the README file's content into the published package.json (the readme field), so registries such as npmjs.com render the package's README. Added in pnpm 6.28.0; pnpm does not embed the README unless this is enabled. It also won't override a readme field already set in the package.json
enableGlobalVirtualStoreOptional
public readonly enableGlobalVirtualStore: boolean;
- Type: boolean
When enabled, node_modules contains only symlinks to a central virtual store, rather than to node_modules/.pnpm.
enableModulesDirOptional
public readonly enableModulesDir: boolean;
- Type: boolean
When false, pnpm will not write any files to the modules directory (node_modules).
enablePrePostScriptsOptional
public readonly enablePrePostScripts: boolean;
- Type: boolean
When true, pnpm will run any pre/post scripts automatically.
engineStrictOptional
public readonly engineStrict: boolean;
- Type: boolean
If this is enabled, pnpm will not install any package that claims to not be compatible with the current Node version.
executionEnvOptional
public readonly executionEnv: PnpmWorkspaceYamlSchemaExecutionEnv;
extendNodePathOptional
public readonly extendNodePath: boolean;
- Type: boolean
When false, the NODE_PATH environment variable is not set in the command shims.
failIfNoMatchOptional
public readonly failIfNoMatch: boolean;
- Type: boolean
If true, pnpm will fail if no packages match the filter.
fetchRetriesOptional
public readonly fetchRetries: number;
- Type: number
How many times to retry if pnpm fails to fetch from the registry.
fetchRetryFactorOptional
public readonly fetchRetryFactor: number;
- Type: number
The exponential factor for retry backoff.
fetchRetryMaxtimeoutOptional
public readonly fetchRetryMaxtimeout: number;
- Type: number
The maximum fallback timeout to ensure the retry factor does not make requests too long.
fetchRetryMintimeoutOptional
public readonly fetchRetryMintimeout: number;
- Type: number
The minimum (base) timeout for retrying requests.
fetchTimeoutOptional
public readonly fetchTimeout: number;
- Type: number
The maximum amount of time to wait for HTTP requests to complete.
forceLegacyDeployOptional
public readonly forceLegacyDeploy: boolean;
- Type: boolean
By default, pnpm deploy will try creating a dedicated lockfile from a shared lockfile for deployment.
If this setting is set to true, the legacy deploy behavior will be used.
gitBranchLockfileOptional
public readonly gitBranchLockfile: boolean;
- Type: boolean
When set to true, the generated lockfile name after installation will be named based on the current branch name to completely avoid merge conflicts.
gitChecksOptional
public readonly gitChecks: boolean;
- Type: boolean
Check if current branch is your publish branch, clean, and up-to-date with remote.
gitShallowHostsOptional
public readonly gitShallowHosts: string[];
- Type: string[]
When fetching dependencies that are Git repositories, if the host is listed in this setting, pnpm will use shallow cloning to fetch only the needed commit, not all the history.
globalBinDirOptional
public readonly globalBinDir: string;
- Type: string
Allows to set the target directory for the bin files of globally installed packages.
globalDirOptional
public readonly globalDir: string;
- Type: string
Specify a custom directory to store global packages.
globalPnpmfileOptional
public readonly globalPnpmfile: string;
- Type: string
The location of a global pnpmfile.
A global pnpmfile is used by all projects during installation.
hoistOptional
public readonly hoist: boolean;
- Type: boolean
When true, all dependencies are hoisted to node_modules/.pnpm/node_modules.
hoistingLimitsOptional
public readonly hoistingLimits: PnpmWorkspaceYamlSchemaHoistingLimits;
Added a new hoistingLimits setting for nodeLinker: hoisted installs, mirroring yarn's nmHoistingLimits.
It accepts none (the default — hoist as far as possible), workspaces (hoist only as far as each workspace package), or dependencies (hoist only up to each workspace package's direct dependencies).
hoistPatternOptional
public readonly hoistPattern: string[];
- Type: string[]
Tells pnpm which packages should be hoisted to node_modules/.pnpm/node_modules.
hoistWorkspacePackagesOptional
public readonly hoistWorkspacePackages: boolean;
- Type: boolean
When true, packages from the workspaces are symlinked to either <workspace_root>/node_modules/.pnpm/node_modules or to <workspace_root>/node_modules depending on other hoisting settings (hoistPattern and publicHoistPattern).
httpsProxyOptional
public readonly httpsProxy: string;
- Type: string
A proxy to use for outgoing HTTPS requests.
If the HTTPS_PROXY, https_proxy, HTTP_PROXY or http_proxy environment variables are set, their values will be used instead.
ignoreCompatibilityDbOptional
public readonly ignoreCompatibilityDb: boolean;
- Type: boolean
During installation the dependencies of some packages are automatically patched.
If you want to disable this, set this config to false.
ignoredBuiltDependenciesOptional
public readonly ignoredBuiltDependencies: string[];
- Type: string[]
A list of package names that should not be built during installation.
ignoreDepScriptsOptional
public readonly ignoreDepScripts: boolean;
- Type: boolean
Do not execute any scripts of the installed packages.
Scripts of the projects are executed.
ignoredOptionalDependenciesOptional
public readonly ignoredOptionalDependencies: string[];
- Type: string[]
A list of optional dependencies that the install should be skipped.
ignorePatchFailuresOptional
public readonly ignorePatchFailures: boolean;
- Type: boolean
- Default: undefined. Errors out when a patch with an exact version or version range fails. Ignores failures from name-only patches. When true, prints a warning instead of failing when any patch cannot be applied. When false, errors out for any patch failure.
Default is undefined.
Errors out when a patch with an exact version or version range fails. Ignores failures from name-only patches. When true, prints a warning instead of failing when any patch cannot be applied. When false, errors out for any patch failure.
ignorePnpmfileOptional
public readonly ignorePnpmfile: boolean;
- Type: boolean
.pnpmfile.cjs will be ignored. Useful together with --ignore-scripts when you want to make sure that no script gets executed during install.
ignoreScriptsOptional
public readonly ignoreScripts: boolean;
- Type: boolean
Do not execute any scripts defined in the project package.json and its dependencies.
ignoreWorkspaceCyclesOptional
public readonly ignoreWorkspaceCycles: boolean;
- Type: boolean
When set to true, no workspace cycle warnings will be printed.
ignoreWorkspaceRootCheckOptional
public readonly ignoreWorkspaceRootCheck: boolean;
- Type: boolean
Adding a new dependency to the root workspace package fails, unless the --ignore-workspace-root-check or -w flag is used.
includeWorkspaceRootOptional
public readonly includeWorkspaceRoot: boolean;
- Type: boolean
When executing commands recursively in a workspace, execute them on the root workspace project as well.
injectWorkspacePackagesOptional
public readonly injectWorkspacePackages: boolean;
- Type: boolean
Enables hard-linking of all local workspace dependencies instead of symlinking them.
keyOptional
public readonly key: string;
- Type: string
A client key to pass when accessing the registry.
linkWorkspacePackagesOptional
public readonly linkWorkspacePackages: PnpmWorkspaceYamlSchemaLinkWorkspacePackages;
If this is enabled, locally available packages are linked to node_modules instead of being downloaded from the registry.
localAddressOptional
public readonly localAddress: string;
- Type: string
The IP address of the local interface to use when making connections to the npm registry.
lockfileOptional
public readonly lockfile: boolean;
- Type: boolean
When set to false, pnpm won't read or generate a pnpm-lock.yaml file.
lockfileIncludeTarballUrlOptional
public readonly lockfileIncludeTarballUrl: boolean;
- Type: boolean
Add the full URL to the package's tarball to every entry in pnpm-lock.yaml.
loglevelOptional
public readonly loglevel: PnpmWorkspaceYamlSchemaLoglevel;
Any logs at or higher than the given level will be shown.
managePackageManagerVersionsOptional
public readonly managePackageManagerVersions: boolean;
- Type: boolean
When enabled, pnpm will automatically download and run the version of pnpm specified in the packageManager field of package.json.
maxsocketsOptional
public readonly maxsockets: number;
- Type: number
The maximum number of connections to use per origin (protocol/host/port combination).
mergeGitBranchLockfilesBranchPatternOptional
public readonly mergeGitBranchLockfilesBranchPattern: any[];
- Type: any[]
This configuration matches the current branch name to determine whether to merge all git branch lockfile files.
minimumReleaseAgeOptional
public readonly minimumReleaseAge: number;
- Type: number
minimumReleaseAge defines the minimum number of minutes that must pass after a version is published before pnpm will install it.
This applies to all dependencies, including transitive ones.
minimumReleaseAgeExcludeOptional
public readonly minimumReleaseAgeExclude: string[];
- Type: string[]
If you set minimumReleaseAge but need certain dependencies to always install the newest version immediately, you can list them under minimumReleaseAgeExclude.
The exclusion works by package name and applies to all versions of that package.
minimumReleaseAgeIgnoreMissingTimeOptional
public readonly minimumReleaseAgeIgnoreMissingTime: boolean;
- Type: boolean
When true, pnpm skips the minimumReleaseAge check for a package whose registry metadata does not include the time field (some private registries and mirrors omit it).
Set to false to fail resolution in that case instead of installing the package.
minimumReleaseAgeStrictOptional
public readonly minimumReleaseAgeStrict: boolean;
- Type: boolean
Controls how pnpm behaves when no version of a dependency satisfies the minimumReleaseAge constraint within the requested range.
https://pnpm.io/settings#minimumreleaseagestrict
modulesCacheMaxAgeOptional
public readonly modulesCacheMaxAge: number;
- Type: number
The time in minutes after which orphan packages from the modules directory should be removed.
modulesDirOptional
public readonly modulesDir: string;
- Type: string
The directory in which dependencies will be installed (instead of node_modules).
networkConcurrencyOptional
public readonly networkConcurrency: number;
- Type: number
Controls the maximum number of HTTP(S) requests to process simultaneously.
neverBuiltDependenciesOptional
public readonly neverBuiltDependencies: string[];
- Type: string[]
A list of dependencies to run builds for.
nodeDownloadMirrorsOptional
public readonly nodeDownloadMirrors: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Configure custom Node.js download mirrors in pnpm-workspace.yaml. The keys are release channels (release, rc, nightly, v8-canary, etc.) and the values are base URLs.
nodeLinkerOptional
public readonly nodeLinker: PnpmWorkspaceYamlSchemaNodeLinker;
Defines what linker should be used for installing Node packages.
nodeOptionsOptional
public readonly nodeOptions: string;
- Type: string
Options to pass through to Node.js via the NODE_OPTIONS environment variable.
nodeVersionOptional
public readonly nodeVersion: string;
- Type: string
The Node.js version to use when checking a package's engines setting.
noproxyOptional
public readonly noproxy: string;
- Type: string
A comma-separated string of domain extensions that a proxy should not be used for.
npmPathOptional
public readonly npmPath: string;
- Type: string
The location of the npm binary that pnpm uses for some actions, like publishing.
npmrcAuthFileOptional
public readonly npmrcAuthFile: string;
- Type: string
The path to a file containing registry authentication tokens.
By default, pnpm reads auth tokens from ~/.npmrc as a fallback for registry authentication. Use this setting to point to a different file instead.
onlyBuiltDependenciesOptional
public readonly onlyBuiltDependencies: string[];
- Type: string[]
A list of package names that are allowed to be executed during installation.
onlyBuiltDependenciesFileOptional
public readonly onlyBuiltDependenciesFile: string;
- Type: string
Specifies a JSON file that lists the only packages permitted to run installation scripts during the pnpm install process.
optimisticRepeatInstallOptional
public readonly optimisticRepeatInstall: boolean;
- Type: boolean
When enabled, a fast check will be performed before proceeding to installation.
This way a repeat install or an install on a project with everything up-to-date becomes a lot faster.
overridesOptional
public readonly overrides: any;
- Type: any
Used to override any dependency in the dependency graph.
packageExtensionsOptional
public readonly packageExtensions: any;
- Type: any
Used to extend the existing package definitions with additional information.
packageImportMethodOptional
public readonly packageImportMethod: PnpmWorkspaceYamlSchemaPackageImportMethod;
Controls the way packages are imported from the store (if you want to disable symlinks inside node_modules, then you need to change the nodeLinker setting, not this one).
packageManagerStrictOptional
public readonly packageManagerStrict: boolean;
- Type: boolean
If this setting is disabled, pnpm will not fail if a different package manager is specified in the packageManager field of package.json. When enabled, only the package name is checked (since pnpm v9.2.0), so you can still run any version of pnpm regardless of the version specified in the packageManager field.
packageManagerStrictVersionOptional
public readonly packageManagerStrictVersion: boolean;
- Type: boolean
When enabled, pnpm will fail if its version doesn't exactly match the version specified in the packageManager field of package.json.
packagesOptional
public readonly packages: string[];
- Type: string[]
Workspace package paths.
Glob patterns are supported
patchedDependenciesOptional
public readonly patchedDependencies: {[ key: string ]: string};
- Type: {[ key: string ]: string}
A list of dependencies that are patched.
patchesDirOptional
public readonly patchesDir: string;
- Type: string
The generated patch file will be saved to this directory.
peerDependencyRulesOptional
public readonly peerDependencyRules: PnpmWorkspaceYamlSchemaPeerDependencyRules;
peersSuffixMaxLengthOptional
public readonly peersSuffixMaxLength: number;
- Type: number
Max length of the peer IDs suffix added to dependency keys in the lockfile.
If the suffix is longer, it is replaced with a hash.
pmOnFailOptional
public readonly pmOnFail: PnpmWorkspaceYamlSchemaPmOnFail;
Overrides the onFail behavior of both the packageManager field and devEngines.packageManager when the running pnpm version does not match the declared one.
pnpmfileOptional
public readonly pnpmfile: string;
- Type: string
The location of the local pnpmfile.
preferFrozenLockfileOptional
public readonly preferFrozenLockfile: boolean;
- Type: boolean
When set to true and the available pnpm-lock.yaml satisfies the package.json dependencies directive, a headless installation is performed.
preferOfflineOptional
public readonly preferOffline: boolean;
- Type: boolean
Bypass staleness checks for cached data.
Missing data will still be requested from the server.
preferSymlinkedExecutablesOptional
public readonly preferSymlinkedExecutables: boolean;
- Type: boolean
Create symlinks to executables in node_modules/.bin instead of command shims. This setting is ignored on Windows, where only command shims work.
preferWorkspacePackagesOptional
public readonly preferWorkspacePackages: boolean;
- Type: boolean
If this is enabled, local packages from the workspace are preferred over packages from the registry, even if there is a newer version of the package in the registry.
provenanceOptional
public readonly provenance: boolean;
- Type: boolean
When publishing from a supported cloud CI/CD system, the package will be publicly linked to where it was built and published from.
proxyOptional
public readonly proxy: string;
- Type: string
A proxy to use for outgoing http requests.
If the HTTP_PROXY or http_proxy environment variables are set, proxy settings will be honored by the underlying request library.
publicHoistPatternOptional
public readonly publicHoistPattern: string[];
- Type: string[]
Unlike hoistPattern, which hoists dependencies to a hidden modules directory inside the virtual store, publicHoistPattern hoists dependencies matching the pattern to the root modules directory.
publishBranchOptional
public readonly publishBranch: string;
- Type: string
The primary branch of the repository which is used for publishing the latest changes.
recursiveInstallOptional
public readonly recursiveInstall: boolean;
- Type: boolean
If this is enabled, the primary behaviour of pnpm install becomes that of pnpm install -r, meaning the install is performed on all workspace or subdirectory packages.
registriesOptional
public readonly registries: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Configure registries for scoped packages in pnpm-workspace.yaml. The default key sets the main registry (equivalent to the registry .npmrc setting). Scoped keys configure registries for specific package scopes.
registryOptional
public readonly registry: string;
- Type: string
The base URL of the npm package registry (trailing slash included).
registrySupportsTimeFieldOptional
public readonly registrySupportsTimeField: boolean;
- Type: boolean
Set this to true if the registry that you are using returns the "time" field in the abbreviated metadata.
reporterOptional
public readonly reporter: PnpmWorkspaceYamlSchemaReporter;
Allows you to customize the output style of the logs.
https://pnpm.io/cli/install#--reportername
requiredScriptsOptional
public readonly requiredScripts: string[];
- Type: string[]
A list of scripts that must exist in each project.
resolutionModeOptional
public readonly resolutionMode: PnpmWorkspaceYamlSchemaResolutionMode;
Determines how pnpm resolves dependencies, See https://pnpm.io/settings#resolutionmode.
resolvePeersFromWorkspaceRootOptional
public readonly resolvePeersFromWorkspaceRoot: boolean;
- Type: boolean
When enabled, dependencies of the root workspace project are used to resolve peer dependencies of any projects in the workspace.
runtimeOnFailOptional
public readonly runtimeOnFail: PnpmWorkspaceYamlSchemaRuntimeOnFail;
Overrides the onFail field of devEngines.runtime (and engines.runtime) in the root project's package.json. This is useful when you want a different local behavior than what is written in the manifest — for instance, forcing pnpm to download the declared runtime even when the manifest sets onFail: "warn".
saveExactOptional
public readonly saveExact: boolean;
- Type: boolean
Saved dependencies will be configured with an exact version rather than using pnpm's default semver range operator.
savePrefixOptional
public readonly savePrefix: PnpmWorkspaceYamlSchemaSavePrefix;
Configure how versions of packages installed to a package.json file get prefixed.
saveWorkspaceProtocolOptional
public readonly saveWorkspaceProtocol: PnpmWorkspaceYamlSchemaSaveWorkspaceProtocol;
This setting controls how dependencies that are linked from the workspace are added to package.json.
scriptShellOptional
public readonly scriptShell: string;
- Type: string
The shell to use for scripts run with the pnpm run command.
shamefullyHoistOptional
public readonly shamefullyHoist: boolean;
- Type: boolean
By default, pnpm creates a semistrict node_modules, meaning dependencies have access to undeclared dependencies but modules outside of node_modules do not.
sharedWorkspaceLockfileOptional
public readonly sharedWorkspaceLockfile: boolean;
- Type: boolean
If this is enabled, pnpm creates a single pnpm-lock.yaml file in the root of the workspace.
shellEmulatorOptional
public readonly shellEmulator: boolean;
- Type: boolean
When true, pnpm will use a JavaScript implementation of a bash-like shell to execute scripts.
sideEffectsCacheOptional
public readonly sideEffectsCache: boolean;
- Type: boolean
Use and cache the results of (pre/post)install hooks.
sideEffectsCacheReadonlyOptional
public readonly sideEffectsCacheReadonly: boolean;
- Type: boolean
Only use the side effects cache if present, do not create it for new packages.
stateDirOptional
public readonly stateDir: string;
- Type: string
The location where all the packages are saved on the disk.
storeDirOptional
public readonly storeDir: string;
- Type: string
The location where all the packages are saved on the disk.
strictDepBuildsOptional
public readonly strictDepBuilds: boolean;
- Type: boolean
When strictDepBuilds is enabled, the installation will exit with a non-zero exit code if any dependencies have unreviewed build scripts (aka postinstall scripts).
strictPeerDependenciesOptional
public readonly strictPeerDependencies: boolean;
- Type: boolean
If this is enabled, commands will fail if there is a missing or invalid peer dependency in the tree.
strictSslOptional
public readonly strictSsl: boolean;
- Type: boolean
Whether or not to do SSL key validation when making requests to the registry via HTTPS.
strictStorePkgContentCheckOptional
public readonly strictStorePkgContentCheck: boolean;
- Type: boolean
Some registries allow the exact same content to be published under different package names and/or versions.
supportedArchitecturesOptional
public readonly supportedArchitectures: PnpmWorkspaceYamlSchemaSupportedArchitectures;
Specifies architectures for which you'd like to install optional dependencies, even if they don't match the architecture of the system running the install.
symlinkOptional
public readonly symlink: boolean;
- Type: boolean
When symlink is set to false, pnpm creates a virtual store directory without any symlinks.
It is a useful setting together with nodeLinker=pnp.
syncInjectedDepsAfterScriptsOptional
public readonly syncInjectedDepsAfterScripts: string[];
- Type: string[]
Injected workspace dependencies are collections of hardlinks, which don't add or remove the files when their sources change.
tagOptional
public readonly tag: string;
- Type: string
If you pnpm add a package and you don't provide a specific version, then it will install the package at the version registered under the tag from this setting.
trustLockfileOptional
public readonly trustLockfile: boolean;
- Type: boolean
A new trustLockfile setting controls whether pnpm install re-applies the minimumReleaseAge / trustPolicy: 'no-downgrade' checks to every entry in the loaded lockfile.
When true, the install treats the lockfile as already-trusted and skips the verification pass — useful for closed-source projects where every commit comes from a trusted author. The default is false, so verification stays on by default.
trustPolicyOptional
public readonly trustPolicy: PnpmWorkspaceYamlSchemaTrustPolicy;
When set to no-downgrade, pnpm will fail if a package's trust level has decreased compared to previous releases.
For example, if a package was previously published by a trusted publisher but now only has provenance or no trust evidence, installation will fail. This helps prevent installing potentially compromised versions.
trustPolicyExcludeOptional
public readonly trustPolicyExclude: string[];
- Type: string[]
You can now list one or more specific packages or versions that pnpm should allow to install, even if those packages don't satisfy the trust policy requirement.
trustPolicyIgnoreAfterOptional
public readonly trustPolicyIgnoreAfter: number;
- Type: number
Allows ignoring the trust policy check for packages published more than the specified number of minutes ago.
This is useful when enabling strict trust policies, as it allows older versions of packages (which may lack a process for publishing with signatures or provenance) to be installed without manual exclusion, assuming they are safe due to their age.
unsafePermOptional
public readonly unsafePerm: boolean;
- Type: boolean
Set to true to enable UID/GID switching when running package scripts.
If set explicitly to false, then installing as a non-root user will fail.
updateConfigOptional
public readonly updateConfig: PnpmWorkspaceYamlSchemaUpdateConfig;
updateNotifierOptional
public readonly updateNotifier: boolean;
- Type: boolean
When true, pnpm will check for updates to the installed packages and notify the user.
useBetaCliOptional
public readonly useBetaCli: boolean;
- Type: boolean
Experimental option that enables beta features of the CLI.
useNodeVersionOptional
public readonly useNodeVersion: string;
- Type: string
Specifies which exact Node.js version should be used for the project's runtime.
useStderrOptional
public readonly useStderr: boolean;
- Type: boolean
When true, all the output is written to stderr.
verifyDepsBeforeRunOptional
public readonly verifyDepsBeforeRun: any;
- Type: any
This setting allows the checking of the state of dependencies before running scripts.
verifyStoreIntegrityOptional
public readonly verifyStoreIntegrity: boolean;
- Type: boolean
By default, if a file in the store has been modified, the content of this file is checked before linking it to a project's node_modules.
virtualStoreDirOptional
public readonly virtualStoreDir: string;
- Type: string
The directory with links to the store.
virtualStoreDirMaxLengthOptional
public readonly virtualStoreDirMaxLength: number;
- Type: number
Sets the maximum allowed length of directory names inside the virtual store directory (node_modules/.pnpm).
virtualStoreOnlyOptional
public readonly virtualStoreOnly: boolean;
- Type: boolean
When set to true, pnpm populates the virtual store without creating importer symlinks, hoisting, bin links, or running lifecycle scripts.
This is useful for pre-populating a store (e.g., in Nix builds) without creating unnecessary project-level artifacts. pnpm fetch uses this mode internally.
workspaceConcurrencyOptional
public readonly workspaceConcurrency: number;
- Type: number
Set the maximum number of tasks to run simultaneously.
For unlimited concurrency use Infinity. You can set the value to <= 0 and it will use amount of CPU cores of the host minus the absolute value of the provided number as: max(1, (number of cores) - abs(workspaceConcurrency)).
PnpmWorkspaceYamlSchema
JSON schema for pnpm-workspace.yaml files.
Initializer
import { javascript } from 'projen'
const pnpmWorkspaceYamlSchema: javascript.PnpmWorkspaceYamlSchema = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| any | A map of package matchers to explicitly allow (true) or disallow (false) script execution. |
| {[ key: string ]: string} | A list of deprecated versions that the warnings are suppressed. |
| boolean | When true, installation won't fail if some of the patches from the "patchedDependencies" field were not applied. |
| boolean | When true, installation won't fail if some of the patches from the "patchedDependencies" field were not applied. |
| | No description. |
| | Controls the level of issues reported by pnpm audit. |
| boolean | When true, any missing non-optional peer dependencies are automatically installed. |
| boolean | When set to true, it prevents the resolution of exotic protocols (like git+ssh: or direct https: tarballs) in transitive dependencies. |
| string | The Certificate Authority signing certificate that is trusted for SSL connections to the registry. |
| string | The location of the cache (package metadata and dlx). |
| string | A path to a file containing one or multiple Certificate Authority signing certificates. |
| {[ key: string ]: string} | Define dependency version ranges as reusable constants, for later reference in package.json files. This (singular) field creates a catalog named default. |
| | Controlling if and how dependencies are added to the default catalog. |
| {[ key: string ]: {[ key: string ]: string}} | Define arbitrarily named catalogs. |
| string | A client certificate to pass when accessing the registry. |
| number | The maximum number of child processes to allocate simultaneously to build node_modules. |
| boolean | When set to true, pnpm will remove unused catalog entries during installation. |
| | Controls colors in the output. |
| any | Config dependencies allow you to share and centralize configuration files, settings, and hooks across multiple projects. |
| boolean | If set to true, all build scripts (e.g. preinstall, install, postinstall) from dependencies will run automatically, without requiring approval. |
| boolean | When set to true, dependencies that are already symlinked to the root node_modules directory of the workspace will not be symlinked to subproject node_modules directories. |
| boolean | When this setting is enabled, dependencies that are injected will be symlinked from the workspace whenever possible. |
| boolean | When this setting is set to true, packages with peer dependencies will be deduplicated after peers resolution. |
| boolean | When enabled, peer dependency suffixes use version-only identifiers (name@version) instead of full dep paths, eliminating nested suffixes like (foo@1.0.0(bar@2.0.0)). This dramatically reduces the number of package instances in projects with many recursive peer dependencies. |
| boolean | When deploying a package or installing a local package, all files of the package are copied. |
| boolean | When set to true, installation will fail if the workspace has cycles. |
| number | The time in minutes after which dlx cache expires. |
| boolean | UNDOCUMENTED. |
| boolean | When enabled, node_modules contains only symlinks to a central virtual store, rather than to node_modules/.pnpm. |
| boolean | When false, pnpm will not write any files to the modules directory (node_modules). |
| boolean | When true, pnpm will run any pre/post scripts automatically. |
| boolean | If this is enabled, pnpm will not install any package that claims to not be compatible with the current Node version. |
| | No description. |
| boolean | When false, the NODE_PATH environment variable is not set in the command shims. |
| boolean | If true, pnpm will fail if no packages match the filter. |
| number | How many times to retry if pnpm fails to fetch from the registry. |
| number | The exponential factor for retry backoff. |
| number | The maximum fallback timeout to ensure the retry factor does not make requests too long. |
| number | The minimum (base) timeout for retrying requests. |
| number | The maximum amount of time to wait for HTTP requests to complete. |
| boolean | By default, pnpm deploy will try creating a dedicated lockfile from a shared lockfile for deployment. |
| boolean | When set to true, the generated lockfile name after installation will be named based on the current branch name to completely avoid merge conflicts. |
| boolean | Check if current branch is your publish branch, clean, and up-to-date with remote. |
| string[] | When fetching dependencies that are Git repositories, if the host is listed in this setting, pnpm will use shallow cloning to fetch only the needed commit, not all the history. |
| string | Allows to set the target directory for the bin files of globally installed packages. |
| string | Specify a custom directory to store global packages. |
| string | The location of a global pnpmfile. |
| boolean | When true, all dependencies are hoisted to node_modules/.pnpm/node_modules. |
| | Added a new hoistingLimits setting for nodeLinker: hoisted installs, mirroring yarn's nmHoistingLimits. |
| string[] | Tells pnpm which packages should be hoisted to node_modules/.pnpm/node_modules. |
| boolean | When true, packages from the workspaces are symlinked to either <workspace_root>/node_modules/.pnpm/node_modules or to <workspace_root>/node_modules depending on other hoisting settings (hoistPattern and publicHoistPattern). |
| string | A proxy to use for outgoing HTTPS requests. |
| boolean | During installation the dependencies of some packages are automatically patched. |
| string[] | A list of package names that should not be built during installation. |
| boolean | Do not execute any scripts of the installed packages. |
| string[] | A list of optional dependencies that the install should be skipped. |
| boolean | Default is undefined. |
| boolean | .pnpmfile.cjs will be ignored. Useful together with --ignore-scripts when you want to make sure that no script gets executed during install. |
| boolean | Do not execute any scripts defined in the project package.json and its dependencies. |
| boolean | When set to true, no workspace cycle warnings will be printed. |
| boolean | Adding a new dependency to the root workspace package fails, unless the --ignore-workspace-root-check or -w flag is used. |
| boolean | When executing commands recursively in a workspace, execute them on the root workspace project as well. |
| boolean | Enables hard-linking of all local workspace dependencies instead of symlinking them. |
| string | A client key to pass when accessing the registry. |
| | If this is enabled, locally available packages are linked to node_modules instead of being downloaded from the registry. |
| string | The IP address of the local interface to use when making connections to the npm registry. |
| boolean | When set to false, pnpm won't read or generate a pnpm-lock.yaml file. |
| boolean | Add the full URL to the package's tarball to every entry in pnpm-lock.yaml. |
| | Any logs at or higher than the given level will be shown. |
| boolean | When enabled, pnpm will automatically download and run the version of pnpm specified in the packageManager field of package.json. |
| number | The maximum number of connections to use per origin (protocol/host/port combination). |
| any[] | This configuration matches the current branch name to determine whether to merge all git branch lockfile files. |
| number | minimumReleaseAge defines the minimum number of minutes that must pass after a version is published before pnpm will install it. |
| string[] | If you set minimumReleaseAge but need certain dependencies to always install the newest version immediately, you can list them under minimumReleaseAgeExclude. |
| boolean | When true, pnpm skips the minimumReleaseAge check for a package whose registry metadata does not include the time field (some private registries and mirrors omit it). |
| boolean | Controls how pnpm behaves when no version of a dependency satisfies the minimumReleaseAge constraint within the requested range. |
| number | The time in minutes after which orphan packages from the modules directory should be removed. |
| string | The directory in which dependencies will be installed (instead of node_modules). |
| number | Controls the maximum number of HTTP(S) requests to process simultaneously. |
| string[] | A list of dependencies to run builds for. |
| {[ key: string ]: string} | Configure custom Node.js download mirrors in pnpm-workspace.yaml. The keys are release channels (release, rc, nightly, v8-canary, etc.) and the values are base URLs. |
| | Defines what linker should be used for installing Node packages. |
| string | Options to pass through to Node.js via the NODE_OPTIONS environment variable. |
| string | The Node.js version to use when checking a package's engines setting. |
| string | A comma-separated string of domain extensions that a proxy should not be used for. |
| string | The location of the npm binary that pnpm uses for some actions, like publishing. |
| string | The path to a file containing registry authentication tokens. |
| string[] | A list of package names that are allowed to be executed during installation. |
| string | Specifies a JSON file that lists the only packages permitted to run installation scripts during the pnpm install process. |
| boolean | When enabled, a fast check will be performed before proceeding to installation. |
| any | Used to override any dependency in the dependency graph. |
| any | Used to extend the existing package definitions with additional information. |
| | Controls the way packages are imported from the store (if you want to disable symlinks inside node_modules, then you need to change the nodeLinker setting, not this one). |
| boolean | If this setting is disabled, pnpm will not fail if a different package manager is specified in the packageManager field of package.json. When enabled, only the package name is checked (since pnpm v9.2.0), so you can still run any version of pnpm regardless of the version specified in the packageManager field. |
| boolean | When enabled, pnpm will fail if its version doesn't exactly match the version specified in the packageManager field of package.json. |
| string[] | Workspace package paths. |
| {[ key: string ]: string} | A list of dependencies that are patched. |
| string | The generated patch file will be saved to this directory. |
| | No description. |
| number | Max length of the peer IDs suffix added to dependency keys in the lockfile. |
| | Overrides the onFail behavior of both the packageManager field and devEngines.packageManager when the running pnpm version does not match the declared one. |
| string | The location of the local pnpmfile. |
| boolean | When set to true and the available pnpm-lock.yaml satisfies the package.json dependencies directive, a headless installation is performed. |
| boolean | Bypass staleness checks for cached data. |
| boolean | Create symlinks to executables in node_modules/.bin instead of command shims. This setting is ignored on Windows, where only command shims work. |
| boolean | If this is enabled, local packages from the workspace are preferred over packages from the registry, even if there is a newer version of the package in the registry. |
| boolean | When publishing from a supported cloud CI/CD system, the package will be publicly linked to where it was built and published from. |
| string | A proxy to use for outgoing http requests. |
| string[] | Unlike hoistPattern, which hoists dependencies to a hidden modules directory inside the virtual store, publicHoistPattern hoists dependencies matching the pattern to the root modules directory. |
| string | The primary branch of the repository which is used for publishing the latest changes. |
| boolean | If this is enabled, the primary behaviour of pnpm install becomes that of pnpm install -r, meaning the install is performed on all workspace or subdirectory packages. |
| {[ key: string ]: string} | Configure registries for scoped packages in pnpm-workspace.yaml. The default key sets the main registry (equivalent to the registry .npmrc setting). Scoped keys configure registries for specific package scopes. |
| string | The base URL of the npm package registry (trailing slash included). |
| boolean | Set this to true if the registry that you are using returns the "time" field in the abbreviated metadata. |
| | Allows you to customize the output style of the logs. |
| string[] | A list of scripts that must exist in each project. |
| | Determines how pnpm resolves dependencies, See https://pnpm.io/settings#resolutionmode. |
| boolean | When enabled, dependencies of the root workspace project are used to resolve peer dependencies of any projects in the workspace. |
| | Overrides the onFail field of devEngines.runtime (and engines.runtime) in the root project's package.json. This is useful when you want a different local behavior than what is written in the manifest — for instance, forcing pnpm to download the declared runtime even when the manifest sets onFail: "warn". |
| boolean | Saved dependencies will be configured with an exact version rather than using pnpm's default semver range operator. |
| | Configure how versions of packages installed to a package.json file get prefixed. |
| | This setting controls how dependencies that are linked from the workspace are added to package.json. |
| string | The shell to use for scripts run with the pnpm run command. |
| boolean | By default, pnpm creates a semistrict node_modules, meaning dependencies have access to undeclared dependencies but modules outside of node_modules do not. |
| boolean | If this is enabled, pnpm creates a single pnpm-lock.yaml file in the root of the workspace. |
| boolean | When true, pnpm will use a JavaScript implementation of a bash-like shell to execute scripts. |
| boolean | Use and cache the results of (pre/post)install hooks. |
| boolean | Only use the side effects cache if present, do not create it for new packages. |
| string | The location where all the packages are saved on the disk. |
| string | The location where all the packages are saved on the disk. |
| boolean | When strictDepBuilds is enabled, the installation will exit with a non-zero exit code if any dependencies have unreviewed build scripts (aka postinstall scripts). |
| boolean | If this is enabled, commands will fail if there is a missing or invalid peer dependency in the tree. |
| boolean | Whether or not to do SSL key validation when making requests to the registry via HTTPS. |
| boolean | Some registries allow the exact same content to be published under different package names and/or versions. |
| | Specifies architectures for which you'd like to install optional dependencies, even if they don't match the architecture of the system running the install. |
| boolean | When symlink is set to false, pnpm creates a virtual store directory without any symlinks. |
| string[] | Injected workspace dependencies are collections of hardlinks, which don't add or remove the files when their sources change. |
| string | If you pnpm add a package and you don't provide a specific version, then it will install the package at the version registered under the tag from this setting. |
| boolean | A new trustLockfile setting controls whether pnpm install re-applies the minimumReleaseAge / trustPolicy: 'no-downgrade' checks to every entry in the loaded lockfile. |
| | When set to no-downgrade, pnpm will fail if a package's trust level has decreased compared to previous releases. |
| string[] | You can now list one or more specific packages or versions that pnpm should allow to install, even if those packages don't satisfy the trust policy requirement. |
| number | Allows ignoring the trust policy check for packages published more than the specified number of minutes ago. |
| boolean | Set to true to enable UID/GID switching when running package scripts. |
| | No description. |
| boolean | When true, pnpm will check for updates to the installed packages and notify the user. |
| boolean | Experimental option that enables beta features of the CLI. |
| string | Specifies which exact Node.js version should be used for the project's runtime. |
| boolean | When true, all the output is written to stderr. |
| any | This setting allows the checking of the state of dependencies before running scripts. |
| boolean | By default, if a file in the store has been modified, the content of this file is checked before linking it to a project's node_modules. |
| string | The directory with links to the store. |
| number | Sets the maximum allowed length of directory names inside the virtual store directory (node_modules/.pnpm). |
| boolean | When set to true, pnpm populates the virtual store without creating importer symlinks, hoisting, bin links, or running lifecycle scripts. |
| number | Set the maximum number of tasks to run simultaneously. |
allowBuildsOptional
public readonly allowBuilds: any;
- Type: any
A map of package matchers to explicitly allow (true) or disallow (false) script execution.
This field replaces onlyBuiltDependencies and ignoredBuiltDependencies (which are also deprecated by this new setting), providing a single source of truth.
allowedDeprecatedVersionsOptional
public readonly allowedDeprecatedVersions: {[ key: string ]: string};
- Type: {[ key: string ]: string}
A list of deprecated versions that the warnings are suppressed.
allowNonAppliedPatchesOptional
public readonly allowNonAppliedPatches: boolean;
- Type: boolean
When true, installation won't fail if some of the patches from the "patchedDependencies" field were not applied.
allowUnusedPatchesOptional
public readonly allowUnusedPatches: boolean;
- Type: boolean
When true, installation won't fail if some of the patches from the "patchedDependencies" field were not applied.
(Previously named "allowNonAppliedPatches")
auditConfigOptional
public readonly auditConfig: PnpmWorkspaceYamlSchemaAuditConfig;
auditLevelOptional
public readonly auditLevel: PnpmWorkspaceYamlSchemaAuditLevel;
Controls the level of issues reported by pnpm audit.
When set to 'low', all vulnerabilities are reported. When set to 'moderate', 'high', or 'critical', only vulnerabilities with that severity or higher are reported.
autoInstallPeersOptional
public readonly autoInstallPeers: boolean;
- Type: boolean
When true, any missing non-optional peer dependencies are automatically installed.
blockExoticSubdepsOptional
public readonly blockExoticSubdeps: boolean;
- Type: boolean
When set to true, it prevents the resolution of exotic protocols (like git+ssh: or direct https: tarballs) in transitive dependencies.
Only direct dependencies are allowed to use exotic sources.
caOptional
public readonly ca: string;
- Type: string
The Certificate Authority signing certificate that is trusted for SSL connections to the registry.
cacheDirOptional
public readonly cacheDir: string;
- Type: string
The location of the cache (package metadata and dlx).
cafileOptional
public readonly cafile: string;
- Type: string
A path to a file containing one or multiple Certificate Authority signing certificates.
catalogOptional
public readonly catalog: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Define dependency version ranges as reusable constants, for later reference in package.json files. This (singular) field creates a catalog named default.
catalogModeOptional
public readonly catalogMode: PnpmWorkspaceYamlSchemaCatalogMode;
Controlling if and how dependencies are added to the default catalog.
catalogsOptional
public readonly catalogs: {[ key: string ]: {[ key: string ]: string}};
- Type: {[ key: string ]: {[ key: string ]: string}}
Define arbitrarily named catalogs.
certOptional
public readonly cert: string;
- Type: string
A client certificate to pass when accessing the registry.
childConcurrencyOptional
public readonly childConcurrency: number;
- Type: number
The maximum number of child processes to allocate simultaneously to build node_modules.
cleanupUnusedCatalogsOptional
public readonly cleanupUnusedCatalogs: boolean;
- Type: boolean
When set to true, pnpm will remove unused catalog entries during installation.
colorOptional
public readonly color: PnpmWorkspaceYamlSchemaColor;
Controls colors in the output.
configDependenciesOptional
public readonly configDependencies: any;
- Type: any
Config dependencies allow you to share and centralize configuration files, settings, and hooks across multiple projects.
They are installed before all regular dependencies ('dependencies', 'devDependencies', 'optionalDependencies'), making them ideal for setting up custom hooks, patches, and catalog entries.
dangerouslyAllowAllBuildsOptional
public readonly dangerouslyAllowAllBuilds: boolean;
- Type: boolean
If set to true, all build scripts (e.g. preinstall, install, postinstall) from dependencies will run automatically, without requiring approval.
dedupeDirectDepsOptional
public readonly dedupeDirectDeps: boolean;
- Type: boolean
When set to true, dependencies that are already symlinked to the root node_modules directory of the workspace will not be symlinked to subproject node_modules directories.
dedupeInjectedDepsOptional
public readonly dedupeInjectedDeps: boolean;
- Type: boolean
When this setting is enabled, dependencies that are injected will be symlinked from the workspace whenever possible.
dedupePeerDependentsOptional
public readonly dedupePeerDependents: boolean;
- Type: boolean
When this setting is set to true, packages with peer dependencies will be deduplicated after peers resolution.
dedupePeersOptional
public readonly dedupePeers: boolean;
- Type: boolean
When enabled, peer dependency suffixes use version-only identifiers (name@version) instead of full dep paths, eliminating nested suffixes like (foo@1.0.0(bar@2.0.0)). This dramatically reduces the number of package instances in projects with many recursive peer dependencies.
deployAllFilesOptional
public readonly deployAllFiles: boolean;
- Type: boolean
When deploying a package or installing a local package, all files of the package are copied.
disallowWorkspaceCyclesOptional
public readonly disallowWorkspaceCycles: boolean;
- Type: boolean
When set to true, installation will fail if the workspace has cycles.
dlxCacheMaxAgeOptional
public readonly dlxCacheMaxAge: number;
- Type: number
The time in minutes after which dlx cache expires.
embedReadmeOptional
public readonly embedReadme: boolean;
- Type: boolean
UNDOCUMENTED.
When true, pnpm publish writes the README file's content into the published package.json (the readme field), so registries such as npmjs.com render the package's README. Added in pnpm 6.28.0; pnpm does not embed the README unless this is enabled. It also won't override a readme field already set in the package.json
enableGlobalVirtualStoreOptional
public readonly enableGlobalVirtualStore: boolean;
- Type: boolean
When enabled, node_modules contains only symlinks to a central virtual store, rather than to node_modules/.pnpm.
enableModulesDirOptional
public readonly enableModulesDir: boolean;
- Type: boolean
When false, pnpm will not write any files to the modules directory (node_modules).
enablePrePostScriptsOptional
public readonly enablePrePostScripts: boolean;
- Type: boolean
When true, pnpm will run any pre/post scripts automatically.
engineStrictOptional
public readonly engineStrict: boolean;
- Type: boolean
If this is enabled, pnpm will not install any package that claims to not be compatible with the current Node version.
executionEnvOptional
public readonly executionEnv: PnpmWorkspaceYamlSchemaExecutionEnv;
extendNodePathOptional
public readonly extendNodePath: boolean;
- Type: boolean
When false, the NODE_PATH environment variable is not set in the command shims.
failIfNoMatchOptional
public readonly failIfNoMatch: boolean;
- Type: boolean
If true, pnpm will fail if no packages match the filter.
fetchRetriesOptional
public readonly fetchRetries: number;
- Type: number
How many times to retry if pnpm fails to fetch from the registry.
fetchRetryFactorOptional
public readonly fetchRetryFactor: number;
- Type: number
The exponential factor for retry backoff.
fetchRetryMaxtimeoutOptional
public readonly fetchRetryMaxtimeout: number;
- Type: number
The maximum fallback timeout to ensure the retry factor does not make requests too long.
fetchRetryMintimeoutOptional
public readonly fetchRetryMintimeout: number;
- Type: number
The minimum (base) timeout for retrying requests.
fetchTimeoutOptional
public readonly fetchTimeout: number;
- Type: number
The maximum amount of time to wait for HTTP requests to complete.
forceLegacyDeployOptional
public readonly forceLegacyDeploy: boolean;
- Type: boolean
By default, pnpm deploy will try creating a dedicated lockfile from a shared lockfile for deployment.
If this setting is set to true, the legacy deploy behavior will be used.
gitBranchLockfileOptional
public readonly gitBranchLockfile: boolean;
- Type: boolean
When set to true, the generated lockfile name after installation will be named based on the current branch name to completely avoid merge conflicts.
gitChecksOptional
public readonly gitChecks: boolean;
- Type: boolean
Check if current branch is your publish branch, clean, and up-to-date with remote.
gitShallowHostsOptional
public readonly gitShallowHosts: string[];
- Type: string[]
When fetching dependencies that are Git repositories, if the host is listed in this setting, pnpm will use shallow cloning to fetch only the needed commit, not all the history.
globalBinDirOptional
public readonly globalBinDir: string;
- Type: string
Allows to set the target directory for the bin files of globally installed packages.
globalDirOptional
public readonly globalDir: string;
- Type: string
Specify a custom directory to store global packages.
globalPnpmfileOptional
public readonly globalPnpmfile: string;
- Type: string
The location of a global pnpmfile.
A global pnpmfile is used by all projects during installation.
hoistOptional
public readonly hoist: boolean;
- Type: boolean
When true, all dependencies are hoisted to node_modules/.pnpm/node_modules.
hoistingLimitsOptional
public readonly hoistingLimits: PnpmWorkspaceYamlSchemaHoistingLimits;
Added a new hoistingLimits setting for nodeLinker: hoisted installs, mirroring yarn's nmHoistingLimits.
It accepts none (the default — hoist as far as possible), workspaces (hoist only as far as each workspace package), or dependencies (hoist only up to each workspace package's direct dependencies).
hoistPatternOptional
public readonly hoistPattern: string[];
- Type: string[]
Tells pnpm which packages should be hoisted to node_modules/.pnpm/node_modules.
hoistWorkspacePackagesOptional
public readonly hoistWorkspacePackages: boolean;
- Type: boolean
When true, packages from the workspaces are symlinked to either <workspace_root>/node_modules/.pnpm/node_modules or to <workspace_root>/node_modules depending on other hoisting settings (hoistPattern and publicHoistPattern).
httpsProxyOptional
public readonly httpsProxy: string;
- Type: string
A proxy to use for outgoing HTTPS requests.
If the HTTPS_PROXY, https_proxy, HTTP_PROXY or http_proxy environment variables are set, their values will be used instead.
ignoreCompatibilityDbOptional
public readonly ignoreCompatibilityDb: boolean;
- Type: boolean
During installation the dependencies of some packages are automatically patched.
If you want to disable this, set this config to false.
ignoredBuiltDependenciesOptional
public readonly ignoredBuiltDependencies: string[];
- Type: string[]
A list of package names that should not be built during installation.
ignoreDepScriptsOptional
public readonly ignoreDepScripts: boolean;
- Type: boolean
Do not execute any scripts of the installed packages.
Scripts of the projects are executed.
ignoredOptionalDependenciesOptional
public readonly ignoredOptionalDependencies: string[];
- Type: string[]
A list of optional dependencies that the install should be skipped.
ignorePatchFailuresOptional
public readonly ignorePatchFailures: boolean;
- Type: boolean
- Default: undefined. Errors out when a patch with an exact version or version range fails. Ignores failures from name-only patches. When true, prints a warning instead of failing when any patch cannot be applied. When false, errors out for any patch failure.
Default is undefined.
Errors out when a patch with an exact version or version range fails. Ignores failures from name-only patches. When true, prints a warning instead of failing when any patch cannot be applied. When false, errors out for any patch failure.
ignorePnpmfileOptional
public readonly ignorePnpmfile: boolean;
- Type: boolean
.pnpmfile.cjs will be ignored. Useful together with --ignore-scripts when you want to make sure that no script gets executed during install.
ignoreScriptsOptional
public readonly ignoreScripts: boolean;
- Type: boolean
Do not execute any scripts defined in the project package.json and its dependencies.
ignoreWorkspaceCyclesOptional
public readonly ignoreWorkspaceCycles: boolean;
- Type: boolean
When set to true, no workspace cycle warnings will be printed.
ignoreWorkspaceRootCheckOptional
public readonly ignoreWorkspaceRootCheck: boolean;
- Type: boolean
Adding a new dependency to the root workspace package fails, unless the --ignore-workspace-root-check or -w flag is used.
includeWorkspaceRootOptional
public readonly includeWorkspaceRoot: boolean;
- Type: boolean
When executing commands recursively in a workspace, execute them on the root workspace project as well.
injectWorkspacePackagesOptional
public readonly injectWorkspacePackages: boolean;
- Type: boolean
Enables hard-linking of all local workspace dependencies instead of symlinking them.
keyOptional
public readonly key: string;
- Type: string
A client key to pass when accessing the registry.
linkWorkspacePackagesOptional
public readonly linkWorkspacePackages: PnpmWorkspaceYamlSchemaLinkWorkspacePackages;
If this is enabled, locally available packages are linked to node_modules instead of being downloaded from the registry.
localAddressOptional
public readonly localAddress: string;
- Type: string
The IP address of the local interface to use when making connections to the npm registry.
lockfileOptional
public readonly lockfile: boolean;
- Type: boolean
When set to false, pnpm won't read or generate a pnpm-lock.yaml file.
lockfileIncludeTarballUrlOptional
public readonly lockfileIncludeTarballUrl: boolean;
- Type: boolean
Add the full URL to the package's tarball to every entry in pnpm-lock.yaml.
loglevelOptional
public readonly loglevel: PnpmWorkspaceYamlSchemaLoglevel;
Any logs at or higher than the given level will be shown.
managePackageManagerVersionsOptional
public readonly managePackageManagerVersions: boolean;
- Type: boolean
When enabled, pnpm will automatically download and run the version of pnpm specified in the packageManager field of package.json.
maxsocketsOptional
public readonly maxsockets: number;
- Type: number
The maximum number of connections to use per origin (protocol/host/port combination).
mergeGitBranchLockfilesBranchPatternOptional
public readonly mergeGitBranchLockfilesBranchPattern: any[];
- Type: any[]
This configuration matches the current branch name to determine whether to merge all git branch lockfile files.
minimumReleaseAgeOptional
public readonly minimumReleaseAge: number;
- Type: number
minimumReleaseAge defines the minimum number of minutes that must pass after a version is published before pnpm will install it.
This applies to all dependencies, including transitive ones.
minimumReleaseAgeExcludeOptional
public readonly minimumReleaseAgeExclude: string[];
- Type: string[]
If you set minimumReleaseAge but need certain dependencies to always install the newest version immediately, you can list them under minimumReleaseAgeExclude.
The exclusion works by package name and applies to all versions of that package.
minimumReleaseAgeIgnoreMissingTimeOptional
public readonly minimumReleaseAgeIgnoreMissingTime: boolean;
- Type: boolean
When true, pnpm skips the minimumReleaseAge check for a package whose registry metadata does not include the time field (some private registries and mirrors omit it).
Set to false to fail resolution in that case instead of installing the package.
minimumReleaseAgeStrictOptional
public readonly minimumReleaseAgeStrict: boolean;
- Type: boolean
Controls how pnpm behaves when no version of a dependency satisfies the minimumReleaseAge constraint within the requested range.
https://pnpm.io/settings#minimumreleaseagestrict
modulesCacheMaxAgeOptional
public readonly modulesCacheMaxAge: number;
- Type: number
The time in minutes after which orphan packages from the modules directory should be removed.
modulesDirOptional
public readonly modulesDir: string;
- Type: string
The directory in which dependencies will be installed (instead of node_modules).
networkConcurrencyOptional
public readonly networkConcurrency: number;
- Type: number
Controls the maximum number of HTTP(S) requests to process simultaneously.
neverBuiltDependenciesOptional
public readonly neverBuiltDependencies: string[];
- Type: string[]
A list of dependencies to run builds for.
nodeDownloadMirrorsOptional
public readonly nodeDownloadMirrors: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Configure custom Node.js download mirrors in pnpm-workspace.yaml. The keys are release channels (release, rc, nightly, v8-canary, etc.) and the values are base URLs.
nodeLinkerOptional
public readonly nodeLinker: PnpmWorkspaceYamlSchemaNodeLinker;
Defines what linker should be used for installing Node packages.
nodeOptionsOptional
public readonly nodeOptions: string;
- Type: string
Options to pass through to Node.js via the NODE_OPTIONS environment variable.
nodeVersionOptional
public readonly nodeVersion: string;
- Type: string
The Node.js version to use when checking a package's engines setting.
noproxyOptional
public readonly noproxy: string;
- Type: string
A comma-separated string of domain extensions that a proxy should not be used for.
npmPathOptional
public readonly npmPath: string;
- Type: string
The location of the npm binary that pnpm uses for some actions, like publishing.
npmrcAuthFileOptional
public readonly npmrcAuthFile: string;
- Type: string
The path to a file containing registry authentication tokens.
By default, pnpm reads auth tokens from ~/.npmrc as a fallback for registry authentication. Use this setting to point to a different file instead.
onlyBuiltDependenciesOptional
public readonly onlyBuiltDependencies: string[];
- Type: string[]
A list of package names that are allowed to be executed during installation.
onlyBuiltDependenciesFileOptional
public readonly onlyBuiltDependenciesFile: string;
- Type: string
Specifies a JSON file that lists the only packages permitted to run installation scripts during the pnpm install process.
optimisticRepeatInstallOptional
public readonly optimisticRepeatInstall: boolean;
- Type: boolean
When enabled, a fast check will be performed before proceeding to installation.
This way a repeat install or an install on a project with everything up-to-date becomes a lot faster.
overridesOptional
public readonly overrides: any;
- Type: any
Used to override any dependency in the dependency graph.
packageExtensionsOptional
public readonly packageExtensions: any;
- Type: any
Used to extend the existing package definitions with additional information.
packageImportMethodOptional
public readonly packageImportMethod: PnpmWorkspaceYamlSchemaPackageImportMethod;
Controls the way packages are imported from the store (if you want to disable symlinks inside node_modules, then you need to change the nodeLinker setting, not this one).
packageManagerStrictOptional
public readonly packageManagerStrict: boolean;
- Type: boolean
If this setting is disabled, pnpm will not fail if a different package manager is specified in the packageManager field of package.json. When enabled, only the package name is checked (since pnpm v9.2.0), so you can still run any version of pnpm regardless of the version specified in the packageManager field.
packageManagerStrictVersionOptional
public readonly packageManagerStrictVersion: boolean;
- Type: boolean
When enabled, pnpm will fail if its version doesn't exactly match the version specified in the packageManager field of package.json.
packagesOptional
public readonly packages: string[];
- Type: string[]
Workspace package paths.
Glob patterns are supported
patchedDependenciesOptional
public readonly patchedDependencies: {[ key: string ]: string};
- Type: {[ key: string ]: string}
A list of dependencies that are patched.
patchesDirOptional
public readonly patchesDir: string;
- Type: string
The generated patch file will be saved to this directory.
peerDependencyRulesOptional
public readonly peerDependencyRules: PnpmWorkspaceYamlSchemaPeerDependencyRules;
peersSuffixMaxLengthOptional
public readonly peersSuffixMaxLength: number;
- Type: number
Max length of the peer IDs suffix added to dependency keys in the lockfile.
If the suffix is longer, it is replaced with a hash.
pmOnFailOptional
public readonly pmOnFail: PnpmWorkspaceYamlSchemaPmOnFail;
Overrides the onFail behavior of both the packageManager field and devEngines.packageManager when the running pnpm version does not match the declared one.
pnpmfileOptional
public readonly pnpmfile: string;
- Type: string
The location of the local pnpmfile.
preferFrozenLockfileOptional
public readonly preferFrozenLockfile: boolean;
- Type: boolean
When set to true and the available pnpm-lock.yaml satisfies the package.json dependencies directive, a headless installation is performed.
preferOfflineOptional
public readonly preferOffline: boolean;
- Type: boolean
Bypass staleness checks for cached data.
Missing data will still be requested from the server.
preferSymlinkedExecutablesOptional
public readonly preferSymlinkedExecutables: boolean;
- Type: boolean
Create symlinks to executables in node_modules/.bin instead of command shims. This setting is ignored on Windows, where only command shims work.
preferWorkspacePackagesOptional
public readonly preferWorkspacePackages: boolean;
- Type: boolean
If this is enabled, local packages from the workspace are preferred over packages from the registry, even if there is a newer version of the package in the registry.
provenanceOptional
public readonly provenance: boolean;
- Type: boolean
When publishing from a supported cloud CI/CD system, the package will be publicly linked to where it was built and published from.
proxyOptional
public readonly proxy: string;
- Type: string
A proxy to use for outgoing http requests.
If the HTTP_PROXY or http_proxy environment variables are set, proxy settings will be honored by the underlying request library.
publicHoistPatternOptional
public readonly publicHoistPattern: string[];
- Type: string[]
Unlike hoistPattern, which hoists dependencies to a hidden modules directory inside the virtual store, publicHoistPattern hoists dependencies matching the pattern to the root modules directory.
publishBranchOptional
public readonly publishBranch: string;
- Type: string
The primary branch of the repository which is used for publishing the latest changes.
recursiveInstallOptional
public readonly recursiveInstall: boolean;
- Type: boolean
If this is enabled, the primary behaviour of pnpm install becomes that of pnpm install -r, meaning the install is performed on all workspace or subdirectory packages.
registriesOptional
public readonly registries: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Configure registries for scoped packages in pnpm-workspace.yaml. The default key sets the main registry (equivalent to the registry .npmrc setting). Scoped keys configure registries for specific package scopes.
registryOptional
public readonly registry: string;
- Type: string
The base URL of the npm package registry (trailing slash included).
registrySupportsTimeFieldOptional
public readonly registrySupportsTimeField: boolean;
- Type: boolean
Set this to true if the registry that you are using returns the "time" field in the abbreviated metadata.
reporterOptional
public readonly reporter: PnpmWorkspaceYamlSchemaReporter;
Allows you to customize the output style of the logs.
https://pnpm.io/cli/install#--reportername
requiredScriptsOptional
public readonly requiredScripts: string[];
- Type: string[]
A list of scripts that must exist in each project.
resolutionModeOptional
public readonly resolutionMode: PnpmWorkspaceYamlSchemaResolutionMode;
Determines how pnpm resolves dependencies, See https://pnpm.io/settings#resolutionmode.
resolvePeersFromWorkspaceRootOptional
public readonly resolvePeersFromWorkspaceRoot: boolean;
- Type: boolean
When enabled, dependencies of the root workspace project are used to resolve peer dependencies of any projects in the workspace.
runtimeOnFailOptional
public readonly runtimeOnFail: PnpmWorkspaceYamlSchemaRuntimeOnFail;
Overrides the onFail field of devEngines.runtime (and engines.runtime) in the root project's package.json. This is useful when you want a different local behavior than what is written in the manifest — for instance, forcing pnpm to download the declared runtime even when the manifest sets onFail: "warn".
saveExactOptional
public readonly saveExact: boolean;
- Type: boolean
Saved dependencies will be configured with an exact version rather than using pnpm's default semver range operator.
savePrefixOptional
public readonly savePrefix: PnpmWorkspaceYamlSchemaSavePrefix;
Configure how versions of packages installed to a package.json file get prefixed.
saveWorkspaceProtocolOptional
public readonly saveWorkspaceProtocol: PnpmWorkspaceYamlSchemaSaveWorkspaceProtocol;
This setting controls how dependencies that are linked from the workspace are added to package.json.
scriptShellOptional
public readonly scriptShell: string;
- Type: string
The shell to use for scripts run with the pnpm run command.
shamefullyHoistOptional
public readonly shamefullyHoist: boolean;
- Type: boolean
By default, pnpm creates a semistrict node_modules, meaning dependencies have access to undeclared dependencies but modules outside of node_modules do not.
sharedWorkspaceLockfileOptional
public readonly sharedWorkspaceLockfile: boolean;
- Type: boolean
If this is enabled, pnpm creates a single pnpm-lock.yaml file in the root of the workspace.
shellEmulatorOptional
public readonly shellEmulator: boolean;
- Type: boolean
When true, pnpm will use a JavaScript implementation of a bash-like shell to execute scripts.
sideEffectsCacheOptional
public readonly sideEffectsCache: boolean;
- Type: boolean
Use and cache the results of (pre/post)install hooks.
sideEffectsCacheReadonlyOptional
public readonly sideEffectsCacheReadonly: boolean;
- Type: boolean
Only use the side effects cache if present, do not create it for new packages.
stateDirOptional
public readonly stateDir: string;
- Type: string
The location where all the packages are saved on the disk.
storeDirOptional
public readonly storeDir: string;
- Type: string
The location where all the packages are saved on the disk.
strictDepBuildsOptional
public readonly strictDepBuilds: boolean;
- Type: boolean
When strictDepBuilds is enabled, the installation will exit with a non-zero exit code if any dependencies have unreviewed build scripts (aka postinstall scripts).
strictPeerDependenciesOptional
public readonly strictPeerDependencies: boolean;
- Type: boolean
If this is enabled, commands will fail if there is a missing or invalid peer dependency in the tree.
strictSslOptional
public readonly strictSsl: boolean;
- Type: boolean
Whether or not to do SSL key validation when making requests to the registry via HTTPS.
strictStorePkgContentCheckOptional
public readonly strictStorePkgContentCheck: boolean;
- Type: boolean
Some registries allow the exact same content to be published under different package names and/or versions.
supportedArchitecturesOptional
public readonly supportedArchitectures: PnpmWorkspaceYamlSchemaSupportedArchitectures;
Specifies architectures for which you'd like to install optional dependencies, even if they don't match the architecture of the system running the install.
symlinkOptional
public readonly symlink: boolean;
- Type: boolean
When symlink is set to false, pnpm creates a virtual store directory without any symlinks.
It is a useful setting together with nodeLinker=pnp.
syncInjectedDepsAfterScriptsOptional
public readonly syncInjectedDepsAfterScripts: string[];
- Type: string[]
Injected workspace dependencies are collections of hardlinks, which don't add or remove the files when their sources change.
tagOptional
public readonly tag: string;
- Type: string
If you pnpm add a package and you don't provide a specific version, then it will install the package at the version registered under the tag from this setting.
trustLockfileOptional
public readonly trustLockfile: boolean;
- Type: boolean
A new trustLockfile setting controls whether pnpm install re-applies the minimumReleaseAge / trustPolicy: 'no-downgrade' checks to every entry in the loaded lockfile.
When true, the install treats the lockfile as already-trusted and skips the verification pass — useful for closed-source projects where every commit comes from a trusted author. The default is false, so verification stays on by default.
trustPolicyOptional
public readonly trustPolicy: PnpmWorkspaceYamlSchemaTrustPolicy;
When set to no-downgrade, pnpm will fail if a package's trust level has decreased compared to previous releases.
For example, if a package was previously published by a trusted publisher but now only has provenance or no trust evidence, installation will fail. This helps prevent installing potentially compromised versions.
trustPolicyExcludeOptional
public readonly trustPolicyExclude: string[];
- Type: string[]
You can now list one or more specific packages or versions that pnpm should allow to install, even if those packages don't satisfy the trust policy requirement.
trustPolicyIgnoreAfterOptional
public readonly trustPolicyIgnoreAfter: number;
- Type: number
Allows ignoring the trust policy check for packages published more than the specified number of minutes ago.
This is useful when enabling strict trust policies, as it allows older versions of packages (which may lack a process for publishing with signatures or provenance) to be installed without manual exclusion, assuming they are safe due to their age.
unsafePermOptional
public readonly unsafePerm: boolean;
- Type: boolean
Set to true to enable UID/GID switching when running package scripts.
If set explicitly to false, then installing as a non-root user will fail.
updateConfigOptional
public readonly updateConfig: PnpmWorkspaceYamlSchemaUpdateConfig;
updateNotifierOptional
public readonly updateNotifier: boolean;
- Type: boolean
When true, pnpm will check for updates to the installed packages and notify the user.
useBetaCliOptional
public readonly useBetaCli: boolean;
- Type: boolean
Experimental option that enables beta features of the CLI.
useNodeVersionOptional
public readonly useNodeVersion: string;
- Type: string
Specifies which exact Node.js version should be used for the project's runtime.
useStderrOptional
public readonly useStderr: boolean;
- Type: boolean
When true, all the output is written to stderr.
verifyDepsBeforeRunOptional
public readonly verifyDepsBeforeRun: any;
- Type: any
This setting allows the checking of the state of dependencies before running scripts.
verifyStoreIntegrityOptional
public readonly verifyStoreIntegrity: boolean;
- Type: boolean
By default, if a file in the store has been modified, the content of this file is checked before linking it to a project's node_modules.
virtualStoreDirOptional
public readonly virtualStoreDir: string;
- Type: string
The directory with links to the store.
virtualStoreDirMaxLengthOptional
public readonly virtualStoreDirMaxLength: number;
- Type: number
Sets the maximum allowed length of directory names inside the virtual store directory (node_modules/.pnpm).
virtualStoreOnlyOptional
public readonly virtualStoreOnly: boolean;
- Type: boolean
When set to true, pnpm populates the virtual store without creating importer symlinks, hoisting, bin links, or running lifecycle scripts.
This is useful for pre-populating a store (e.g., in Nix builds) without creating unnecessary project-level artifacts. pnpm fetch uses this mode internally.
workspaceConcurrencyOptional
public readonly workspaceConcurrency: number;
- Type: number
Set the maximum number of tasks to run simultaneously.
For unlimited concurrency use Infinity. You can set the value to <= 0 and it will use amount of CPU cores of the host minus the absolute value of the provided number as: max(1, (number of cores) - abs(workspaceConcurrency)).
PnpmWorkspaceYamlSchemaAuditConfig
Initializer
import { javascript } from 'projen'
const pnpmWorkspaceYamlSchemaAuditConfig: javascript.PnpmWorkspaceYamlSchemaAuditConfig = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | A list of CVE IDs that will be ignored by "pnpm audit". |
| string[] | A list of GHSA Codes that will be ignored by "pnpm audit". |
ignoreCvesOptional
public readonly ignoreCves: string[];
- Type: string[]
A list of CVE IDs that will be ignored by "pnpm audit".
ignoreGhsasOptional
public readonly ignoreGhsas: string[];
- Type: string[]
A list of GHSA Codes that will be ignored by "pnpm audit".
PnpmWorkspaceYamlSchemaExecutionEnv
Initializer
import { javascript } from 'projen'
const pnpmWorkspaceYamlSchemaExecutionEnv: javascript.PnpmWorkspaceYamlSchemaExecutionEnv = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | Specifies which exact Node.js version should be used for the project's runtime. |
nodeVersionOptional
public readonly nodeVersion: string;
- Type: string
Specifies which exact Node.js version should be used for the project's runtime.
PnpmWorkspaceYamlSchemaPeerDependencyRules
Initializer
import { javascript } from 'projen'
const pnpmWorkspaceYamlSchemaPeerDependencyRules: javascript.PnpmWorkspaceYamlSchemaPeerDependencyRules = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | Any peer dependency matching the pattern will be resolved from any version, regardless of the range specified in "peerDependencies". |
| any | Unmet peer dependency warnings will not be printed for peer dependencies of the specified range. |
| string[] | pnpm will not print warnings about missing peer dependencies from this list. |
allowAnyOptional
public readonly allowAny: string[];
- Type: string[]
Any peer dependency matching the pattern will be resolved from any version, regardless of the range specified in "peerDependencies".
allowedVersionsOptional
public readonly allowedVersions: any;
- Type: any
Unmet peer dependency warnings will not be printed for peer dependencies of the specified range.
ignoreMissingOptional
public readonly ignoreMissing: string[];
- Type: string[]
pnpm will not print warnings about missing peer dependencies from this list.
PnpmWorkspaceYamlSchemaSupportedArchitectures
Specifies architectures for which you'd like to install optional dependencies, even if they don't match the architecture of the system running the install.
Initializer
import { javascript } from 'projen'
const pnpmWorkspaceYamlSchemaSupportedArchitectures: javascript.PnpmWorkspaceYamlSchemaSupportedArchitectures = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | No description. |
| string[] | No description. |
| string[] | No description. |
cpuOptional
public readonly cpu: string[];
- Type: string[]
libcOptional
public readonly libc: string[];
- Type: string[]
osOptional
public readonly os: string[];
- Type: string[]
PnpmWorkspaceYamlSchemaUpdateConfig
Initializer
import { javascript } from 'projen'
const pnpmWorkspaceYamlSchemaUpdateConfig: javascript.PnpmWorkspaceYamlSchemaUpdateConfig = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | A list of packages that should be ignored when running "pnpm outdated" or "pnpm update --latest". |
ignoreDependenciesOptional
public readonly ignoreDependencies: string[];
- Type: string[]
A list of packages that should be ignored when running "pnpm outdated" or "pnpm update --latest".
PrettierOptions
Options for Prettier.
Initializer
import { javascript } from 'projen'
const prettierOptions: javascript.PrettierOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| boolean | Defines an .prettierIgnore file. |
| projen.IgnoreFileOptions | Configuration options for .prettierignore file. |
| | Provide a list of patterns to override prettier configuration. |
| | Prettier settings. |
| boolean | Write prettier configuration as YAML instead of JSON. |
ignoreFileOptional
public readonly ignoreFile: boolean;
- Type: boolean
- Default: true
Defines an .prettierIgnore file.
ignoreFileOptionsOptional
public readonly ignoreFileOptions: IgnoreFileOptions;
- Type: projen.IgnoreFileOptions
Configuration options for .prettierignore file.
overridesOptional
public readonly overrides: PrettierOverride[];
- Type: PrettierOverride[]
- Default: []
Provide a list of patterns to override prettier configuration.
https://prettier.io/docs/en/configuration.html#configuration-overrides
settingsOptional
public readonly settings: PrettierSettings;
- Type: PrettierSettings
- Default: default settings
Prettier settings.
yamlOptional
public readonly yaml: boolean;
- Type: boolean
- Default: false
Write prettier configuration as YAML instead of JSON.
PrettierOverride
Initializer
import { javascript } from 'projen'
const prettierOverride: javascript.PrettierOverride = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | string[] | Include these files in this override. |
| | The options to apply for this override. |
| string | string[] | Exclude these files from this override. |
filesRequired
public readonly files: string | string[];
- Type: string | string[]
Include these files in this override.
optionsRequired
public readonly options: PrettierSettings;
- Type: PrettierSettings
The options to apply for this override.
excludeFilesOptional
public readonly excludeFiles: string | string[];
- Type: string | string[]
Exclude these files from this override.
PrettierSettings
Options to set in Prettier directly or through overrides.
Initializer
import { javascript } from 'projen'
const prettierSettings: javascript.PrettierSettings = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| | Include parentheses around a sole arrow function parameter. |
| boolean | Put > of opening tags on the last line instead of on a new line. |
| boolean | Print spaces between brackets. |
| number | Print (to stderr) where a cursor at the given position would move to after formatting. |
| | Control how Prettier formats quoted code embedded in the file. |
| | Which end of line characters to apply. |
| string | Specify the input filepath. |
| | How to handle whitespaces in HTML. |
| boolean | Insert. |
| boolean | Use single quotes in JSX. |
| string | Which parser to use. |
| string[] | Add a plugin. |
| string[] | Custom directory that contains prettier plugins in node_modules subdirectory. |
| number | The line length where Prettier will try wrap. |
| | How to wrap prose. |
| | Change when properties in objects are quoted. |
| number | Format code ending at a given character offset (exclusive). |
| number | Format code starting at a given character offset. |
| boolean | Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted. |
| boolean | Print semicolons. |
| boolean | Use single quotes instead of double quotes. |
| number | Number of spaces per indentation level. |
| | Print trailing commas wherever possible when multi-line. |
| boolean | Indent with tabs instead of spaces. |
| boolean | Indent script and style tags in Vue files. |
arrowParensOptional
public readonly arrowParens: ArrowParens;
- Type: ArrowParens
- Default: ArrowParens.ALWAYS
Include parentheses around a sole arrow function parameter.
bracketSameLineOptional
public readonly bracketSameLine: boolean;
- Type: boolean
- Default: false
Put > of opening tags on the last line instead of on a new line.
bracketSpacingOptional
public readonly bracketSpacing: boolean;
- Type: boolean
- Default: true
Print spaces between brackets.
cursorOffsetOptional
public readonly cursorOffset: number;
- Type: number
- Default: 1
Print (to stderr) where a cursor at the given position would move to after formatting.
This option cannot be used with --range-start and --range-end.
embeddedLanguageFormattingOptional
public readonly embeddedLanguageFormatting: EmbeddedLanguageFormatting;
- Type: EmbeddedLanguageFormatting
- Default: EmbeddedLanguageFormatting.AUTO
Control how Prettier formats quoted code embedded in the file.
endOfLineOptional
public readonly endOfLine: EndOfLine;
- Type: EndOfLine
- Default: EndOfLine.LF
Which end of line characters to apply.
filepathOptional
public readonly filepath: string;
- Type: string
- Default: none
Specify the input filepath.
This will be used to do parser inference.
htmlWhitespaceSensitivityOptional
public readonly htmlWhitespaceSensitivity: HTMLWhitespaceSensitivity;
- Type: HTMLWhitespaceSensitivity
- Default: HTMLWhitespaceSensitivity.CSS
How to handle whitespaces in HTML.
insertPragmaOptional
public readonly insertPragma: boolean;
- Type: boolean
- Default: false
Insert.
jsxSingleQuoteOptional
public readonly jsxSingleQuote: boolean;
- Type: boolean
- Default: false
Use single quotes in JSX.
parserOptional
public readonly parser: string;
- Type: string
- Default: Prettier automatically infers the parser from the input file path, so you shouldn’t have to change this setting.
Which parser to use.
pluginsOptional
public readonly plugins: string[];
- Type: string[]
- Default: []
Add a plugin.
Multiple plugins can be passed as separate --plugins.
pluginSearchDirsOptional
public readonly pluginSearchDirs: string[];
- Type: string[]
- Default: []
Custom directory that contains prettier plugins in node_modules subdirectory.
Overrides default behavior when plugins are searched relatively to the location of Prettier. Multiple values are accepted.
printWidthOptional
public readonly printWidth: number;
- Type: number
- Default: 80
The line length where Prettier will try wrap.
proseWrapOptional
public readonly proseWrap: ProseWrap;
- Type: ProseWrap
- Default: ProseWrap.PRESERVE
How to wrap prose.
quotePropsOptional
public readonly quoteProps: QuoteProps;
- Type: QuoteProps
- Default: QuoteProps.ASNEEDED
Change when properties in objects are quoted.
rangeEndOptional
public readonly rangeEnd: number;
- Type: number
- Default: null
Format code ending at a given character offset (exclusive).
The range will extend forwards to the end of the selected statement. This option cannot be used with --cursor-offset.
rangeStartOptional
public readonly rangeStart: number;
- Type: number
- Default: 0
Format code starting at a given character offset.
The range will extend backwards to the start of the first line containing the selected statement. This option cannot be used with --cursor-offset.
requirePragmaOptional
public readonly requirePragma: boolean;
- Type: boolean
- Default: false
Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.
semiOptional
public readonly semi: boolean;
- Type: boolean
- Default: true
Print semicolons.
singleQuoteOptional
public readonly singleQuote: boolean;
- Type: boolean
- Default: false
Use single quotes instead of double quotes.
tabWidthOptional
public readonly tabWidth: number;
- Type: number
- Default: 2
Number of spaces per indentation level.
trailingCommaOptional
public readonly trailingComma: TrailingComma;
- Type: TrailingComma
- Default: TrailingComma.ES5
Print trailing commas wherever possible when multi-line.
useTabsOptional
public readonly useTabs: boolean;
- Type: boolean
- Default: false
Indent with tabs instead of spaces.
vueIndentScriptAndStyleOptional
public readonly vueIndentScriptAndStyle: boolean;
- Type: boolean
- Default: false
Indent script and style tags in Vue files.
ProjenrcOptions
Initializer
import { javascript } from 'projen'
const projenrcOptions: javascript.ProjenrcOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | The name of the projenrc file. |
filenameOptional
public readonly filename: string;
- Type: string
- Default: ".projenrc.js"
The name of the projenrc file.
RenderWorkflowSetupOptions
Options for renderWorkflowSetup().
Initializer
import { javascript } from 'projen'
const renderWorkflowSetupOptions: javascript.RenderWorkflowSetupOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| projen.github.workflows.JobStepConfiguration | Configure the install step in the workflow setup. |
| boolean | Should the package lockfile be updated? |
installStepConfigurationOptional
public readonly installStepConfiguration: JobStepConfiguration;
- Type: projen.github.workflows.JobStepConfiguration
- Default:
{ name: "Install dependencies" }
Configure the install step in the workflow setup.
Example
- { env: { NPM_TOKEN: "token" }} for installing from private npm registry.
mutableOptional
public readonly mutable: boolean;
- Type: boolean
- Default: false
Should the package lockfile be updated?
ScopedPackagesOptions
Options for scoped packages.
Initializer
import { javascript } from 'projen'
const scopedPackagesOptions: javascript.ScopedPackagesOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | URL of the registry for scoped packages. |
| string | Scope of the packages. |
registryUrlRequired
public readonly registryUrl: string;
- Type: string
URL of the registry for scoped packages.
scopeRequired
public readonly scope: string;
- Type: string
Scope of the packages.
Example
"@angular"
SnapshotFormatOptions
Snapshot formatting options.
Mirrors the pretty-format options, with the exceptions of
compareKeys and plugins.
Initializer
import { javascript } from 'projen'
const snapshotFormatOptions: javascript.SnapshotFormatOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| boolean | Calls toJSON on objects that have such a method. |
| boolean | Escapes special characters in regular expressions. |
| boolean | Escapes quotes in strings. |
| boolean | Highlights syntax with colors in terminal (some plugins). |
| number | Spaces of indentation between levels of nesting. |
| number | Maximum number of levels to print. |
| number | Maximum number of elements to print at a given level. |
| boolean | Prints objects on a single line when true. |
| boolean | Prints the prototype for basic objects and arrays. |
| boolean | Prints the name of functions. |
callToJSONOptional
public readonly callToJSON: boolean;
- Type: boolean
- Default: true
Calls toJSON on objects that have such a method.
escapeRegexOptional
public readonly escapeRegex: boolean;
- Type: boolean
- Default: false
Escapes special characters in regular expressions.
escapeStringOptional
public readonly escapeString: boolean;
- Type: boolean
- Default: false
Escapes quotes in strings.
highlightOptional
public readonly highlight: boolean;
- Type: boolean
- Default: false
Highlights syntax with colors in terminal (some plugins).
indentOptional
public readonly indent: number;
- Type: number
- Default: 2
Spaces of indentation between levels of nesting.
maxDepthOptional
public readonly maxDepth: number;
- Type: number
- Default: Infinity
Maximum number of levels to print.
maxWidthOptional
public readonly maxWidth: number;
- Type: number
- Default: Infinity
Maximum number of elements to print at a given level.
minOptional
public readonly min: boolean;
- Type: boolean
- Default: false
Prints objects on a single line when true.
printBasicPrototypeOptional
public readonly printBasicPrototype: boolean;
- Type: boolean
- Default: false
Prints the prototype for basic objects and arrays.
printFunctionNameOptional
public readonly printFunctionName: boolean;
- Type: boolean
- Default: true
Prints the name of functions.
TypeScriptCompilerOptions
Initializer
import { javascript } from 'projen'
const typeScriptCompilerOptions: javascript.TypeScriptCompilerOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| boolean | Suppress arbitrary extension import errors with the assumption that a bundler will be handling it. |
| boolean | Allows TypeScript files to import each other with TypeScript-specific extensions (.ts, .mts, .tsx). Requires noEmit or emitDeclarationOnly. |
| boolean | Allow JavaScript files to be compiled. |
| boolean | Allow default imports from modules with no default export. |
| boolean | Allow Unreachable Code. |
| boolean | Allow Unused Labels. |
| boolean | Ensures that your files are parsed in the ECMAScript strict mode, and emit “use strict” for each source file. |
| string | Lets you set a base directory to resolve non-absolute module names. |
| boolean | Check JS. |
| string[] | List of additional conditions that should succeed when TypeScript resolves from an exports or imports field of a package.json. |
| boolean | To be specified along with the above. |
| string | Offers a way to configure the root directory for where declaration files are emitted. |
| boolean | Generates a source map for .d.ts files which map back to the original .ts source file. This will allow editors such as VS Code to go to the original .ts file when using features like Go to Definition. |
| boolean | Downleveling is TypeScript’s term for transpiling to an older version of JavaScript. |
| boolean | Only emit .d.ts files; do not emit .js files. |
| boolean | Enables experimental support for decorators, which is in stage 2 of the TC39 standardization process. |
| boolean | Emit __importStar and __importDefault helpers for runtime babel ecosystem compatibility and enable --allowSyntheticDefaultImports for typesystem compatibility. |
| boolean | Specifies that optional property types should be interpreted exactly as written, meaning that | undefined is not added to the type Available with TypeScript 4.4 and newer. |
| boolean | Enables experimental support for decorators, which is in stage 2 of the TC39 standardization process. |
| boolean | Disallow inconsistently-cased references to the same file. |
| string | Silence deprecation warnings for options scheduled for removal in a future TypeScript release (for example moduleResolution: "node10", which became an error in TypeScript 6.0). |
| | This flag works because you can use import type to explicitly create an import statement which should never be emitted into JavaScript. |
| boolean | Tells TypeScript to save information about the project graph from the last compilation to files stored on disk. |
| boolean | When set, instead of writing out a .js.map file to provide source maps, TypeScript will embed the source map content in the .js files. |
| boolean | When set, TypeScript will include the original content of the .ts file as an embedded string in the source map. This is often useful in the same cases as inlineSourceMap. |
| boolean | Perform additional checks to ensure that separate compilation (such as with transpileModule or. |
| | Support JSX in .tsx files: "react", "preserve", "react-native" etc. |
| string | Declares the module specifier to be used for importing the jsx and jsxs factory functions when using jsx. |
| string[] | Reference for type definitions / libraries to use (eg. |
| string | Sets the module system for the program. |
| | This setting controls how TypeScript determines whether a file is a script or a module. |
| | Determine how modules get resolved. |
| boolean | Do not emit outputs. |
| boolean | Do not emit compiler output files like JavaScript source code, source-maps or declarations if any errors were reported. |
| boolean | Report errors for fallthrough cases in switch statements. |
| boolean | In some cases where no type annotations are present, TypeScript will fall back to a type of any for a variable when it cannot infer the type. |
| boolean | Using noImplicitOverride, you can ensure that sub-classes never go out of sync as they are required to explicitly declare that they are overriding a member using the override keyword. |
| boolean | When enabled, TypeScript will check all code paths in a function to ensure they return a value. |
| boolean | Raise error on ‘this’ expressions with an implied ‘any’ type. |
| boolean | Raise error on use of the dot syntax to access fields which are not defined. |
| boolean | Raise error when accessing indexes on objects with unknown keys defined in index signatures. |
| boolean | Report errors on unused local variables. |
| boolean | Report errors on unused parameters in functions. |
| string | Output directory for the compiled files. |
| {[ key: string ]: string[]} | A series of entries which re-map imports to lookup locations relative to the baseUrl, there is a larger coverage of paths in the handbook. |
| boolean | Allows importing modules with a ‘.json’ extension, which is a common practice in node projects. This includes generating a type for the import based on the static JSON shape. |
| boolean | Forces TypeScript to consult the exports field of package.json files if it ever reads from a package in node_modules. |
| boolean | Forces TypeScript to consult the imports field of package.json when performing a lookup that begins with # from a file that has a package.json as an ancestor. |
| string | Specifies the root directory of input files. |
| boolean | Skip type checking of all declaration files (*.d.ts). |
| boolean | Enables the generation of sourcemap files. |
| string | Specify the location where a debugger should locate TypeScript files instead of relative source locations. |
| boolean | The strict flag enables a wide range of type checking behavior that results in stronger guarantees of program correctness. |
| boolean | When strictNullChecks is false, null and undefined are effectively ignored by the language. |
| boolean | When set to true, TypeScript will raise an error when a class property was declared but not set in the constructor. |
| boolean | Do not emit declarations for code that has an @internal annotation in it’s JSDoc comment. |
| string | Modern browsers support all ES6 features, so ES6 is a good choice. |
| string | This setting lets you specify a file for storing incremental compilation information as a part of composite projects which enables faster building of larger TypeScript codebases. |
| string[] | If typeRoots is specified, only packages under typeRoots will be included. |
| string[] | If types is specified, only packages listed will be included in the global scope. |
| boolean | Change the type of the variable in a catch clause from any to unknown Available with TypeScript 4.4 and newer. |
| boolean | Simplifies TypeScript's handling of import/export type modifiers. |
allowArbitraryExtensionsOptional
public readonly allowArbitraryExtensions: boolean;
- Type: boolean
- Default: undefined
Suppress arbitrary extension import errors with the assumption that a bundler will be handling it.
https://www.typescriptlang.org/tsconfig#allowArbitraryExtensions
allowImportingTsExtensionsOptional
public readonly allowImportingTsExtensions: boolean;
- Type: boolean
- Default: undefined
Allows TypeScript files to import each other with TypeScript-specific extensions (.ts, .mts, .tsx). Requires noEmit or emitDeclarationOnly.
allowJsOptional
public readonly allowJs: boolean;
- Type: boolean
- Default: false
Allow JavaScript files to be compiled.
allowSyntheticDefaultImportsOptional
public readonly allowSyntheticDefaultImports: boolean;
- Type: boolean
Allow default imports from modules with no default export.
This does not affect code emit, just typechecking.
allowUnreachableCodeOptional
public readonly allowUnreachableCode: boolean;
- Type: boolean
Allow Unreachable Code.
When:
undefined(default) provide suggestions as warnings to editorstrueunreachable code is ignoredfalseraises compiler errors about unreachable code
These warnings are only about code which is provably unreachable due to the use of JavaScript syntax.
https://www.typescriptlang.org/tsconfig#allowUnreachableCode
allowUnusedLabelsOptional
public readonly allowUnusedLabels: boolean;
- Type: boolean
Allow Unused Labels.
When:
undefined(default) provide suggestions as warnings to editorstrueunused labels are ignoredfalseraises compiler errors about unused labels
Labels are very rare in JavaScript and typically indicate an attempt to write an object literal:
function verifyAge(age: number) {
// Forgot 'return' statement
if (age > 18) {
verified: true;
// ^^^^^^^^ Unused label.
}
}
alwaysStrictOptional
public readonly alwaysStrict: boolean;
- Type: boolean
- Default: true
Ensures that your files are parsed in the ECMAScript strict mode, and emit “use strict” for each source file.
baseUrlOptional
public readonly baseUrl: string;
- Type: string
Lets you set a base directory to resolve non-absolute module names.
You can define a root folder where you can do absolute file resolution.
checkJsOptional
public readonly checkJs: boolean;
- Type: boolean
Check JS.
Works in tandem with allowJs. When checkJs is enabled then errors are reported in JavaScript files. This is the equivalent of including //
customConditionsOptional
public readonly customConditions: string[];
- Type: string[]
- Default: undefined
List of additional conditions that should succeed when TypeScript resolves from an exports or imports field of a package.json.
declarationOptional
public readonly declaration: boolean;
- Type: boolean
To be specified along with the above.
declarationDirOptional
public readonly declarationDir: string;
- Type: string
Offers a way to configure the root directory for where declaration files are emitted.
declarationMapOptional
public readonly declarationMap: boolean;
- Type: boolean
Generates a source map for .d.ts files which map back to the original .ts source file. This will allow editors such as VS Code to go to the original .ts file when using features like Go to Definition.
[{@link https://www.typescriptlang.org/tsconfig#declarationMap}]({@link https://www.typescriptlang.org/tsconfig#declarationMap})
downlevelIterationOptional
public readonly downlevelIteration: boolean;
- Type: boolean
Downleveling is TypeScript’s term for transpiling to an older version of JavaScript.
This flag is to enable support for a more accurate implementation of how modern JavaScript iterates through new concepts in older JavaScript runtimes.
ECMAScript 6 added several new iteration primitives: the for / of loop (for (el of arr)), Array spread ([a, ...b]), argument spread (fn(...args)), and Symbol.iterator. downlevelIteration allows for these iteration primitives to be used more accurately in ES5 environments if a Symbol.iterator implementation is present.
emitDeclarationOnlyOptional
public readonly emitDeclarationOnly: boolean;
- Type: boolean
- Default: false
Only emit .d.ts files; do not emit .js files.
emitDecoratorMetadataOptional
public readonly emitDecoratorMetadata: boolean;
- Type: boolean
- Default: undefined
Enables experimental support for decorators, which is in stage 2 of the TC39 standardization process.
Decorators are a language feature which hasn’t yet been fully ratified into the JavaScript specification. This means that the implementation version in TypeScript may differ from the implementation in JavaScript when it it decided by TC39. You can find out more about decorator support in TypeScript in the handbook.
https://www.typescriptlang.org/docs/handbook/decorators.html
esModuleInteropOptional
public readonly esModuleInterop: boolean;
- Type: boolean
- Default: false
Emit __importStar and __importDefault helpers for runtime babel ecosystem compatibility and enable --allowSyntheticDefaultImports for typesystem compatibility.
exactOptionalPropertyTypesOptional
public readonly exactOptionalPropertyTypes: boolean;
- Type: boolean
- Default: false
Specifies that optional property types should be interpreted exactly as written, meaning that | undefined is not added to the type Available with TypeScript 4.4 and newer.
experimentalDecoratorsOptional
public readonly experimentalDecorators: boolean;
- Type: boolean
- Default: true
Enables experimental support for decorators, which is in stage 2 of the TC39 standardization process.
forceConsistentCasingInFileNamesOptional
public readonly forceConsistentCasingInFileNames: boolean;
- Type: boolean
- Default: false
Disallow inconsistently-cased references to the same file.
ignoreDeprecationsOptional
public readonly ignoreDeprecations: string;
- Type: string
- Default: undefined
Silence deprecation warnings for options scheduled for removal in a future TypeScript release (for example moduleResolution: "node10", which became an error in TypeScript 6.0).
Set to the TypeScript version that introduced the deprecation, e.g. "6.0".
importsNotUsedAsValuesOptional
public readonly importsNotUsedAsValues: TypeScriptImportsNotUsedAsValues;
- Type: TypeScriptImportsNotUsedAsValues
- Default: "remove"
This flag works because you can use import type to explicitly create an import statement which should never be emitted into JavaScript.
https://www.typescriptlang.org/tsconfig#importsNotUsedAsValues
incrementalOptional
public readonly incremental: boolean;
- Type: boolean
Tells TypeScript to save information about the project graph from the last compilation to files stored on disk.
This creates a series of .tsbuildinfo files in the same folder as your compilation output. They are not used by your JavaScript at runtime and can be safely deleted. You can read more about the flag in the 3.4 release notes.
To control which folders you want to the files to be built to, use the config option tsBuildInfoFile.](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#faster-subsequent-builds-with-the---incremental-flag
To control which folders you want to the files to be built to, use the config option tsBuildInfoFile.)
inlineSourceMapOptional
public readonly inlineSourceMap: boolean;
- Type: boolean
- Default: true
When set, instead of writing out a .js.map file to provide source maps, TypeScript will embed the source map content in the .js files.
inlineSourcesOptional
public readonly inlineSources: boolean;
- Type: boolean
- Default: true
When set, TypeScript will include the original content of the .ts file as an embedded string in the source map. This is often useful in the same cases as inlineSourceMap.
isolatedModulesOptional
public readonly isolatedModules: boolean;
- Type: boolean
- Default: false
Perform additional checks to ensure that separate compilation (such as with transpileModule or.
jsxOptional
public readonly jsx: TypeScriptJsxMode;
- Type: TypeScriptJsxMode
- Default: undefined
Support JSX in .tsx files: "react", "preserve", "react-native" etc.
jsxImportSourceOptional
public readonly jsxImportSource: string;
- Type: string
- Default: undefined
Declares the module specifier to be used for importing the jsx and jsxs factory functions when using jsx.
libOptional
public readonly lib: string[];
- Type: string[]
- Default: [ "es2018" ]
Reference for type definitions / libraries to use (eg.
ES2016, ES5, ES2018).
moduleOptional
public readonly module: string;
- Type: string
- Default: "CommonJS"
Sets the module system for the program.
See https://www.typescriptlang.org/docs/handbook/modules.html#ambient-modules.
moduleDetectionOptional
public readonly moduleDetection: TypeScriptModuleDetection;
- Type: TypeScriptModuleDetection
- Default: "auto"
This setting controls how TypeScript determines whether a file is a script or a module.
moduleResolutionOptional
public readonly moduleResolution: TypeScriptModuleResolution;
- Type: TypeScriptModuleResolution
- Default: "node"
Determine how modules get resolved.
Either "Node" for Node.js/io.js style resolution, or "Classic".
noEmitOptional
public readonly noEmit: boolean;
- Type: boolean
- Default: false
Do not emit outputs.
noEmitOnErrorOptional
public readonly noEmitOnError: boolean;
- Type: boolean
- Default: true
Do not emit compiler output files like JavaScript source code, source-maps or declarations if any errors were reported.
noFallthroughCasesInSwitchOptional
public readonly noFallthroughCasesInSwitch: boolean;
- Type: boolean
- Default: true
Report errors for fallthrough cases in switch statements.
Ensures that any non-empty case inside a switch statement includes either break or return. This means you won’t accidentally ship a case fallthrough bug.
noImplicitAnyOptional
public readonly noImplicitAny: boolean;
- Type: boolean
- Default: true
In some cases where no type annotations are present, TypeScript will fall back to a type of any for a variable when it cannot infer the type.
noImplicitOverrideOptional
public readonly noImplicitOverride: boolean;
- Type: boolean
- Default: false
Using noImplicitOverride, you can ensure that sub-classes never go out of sync as they are required to explicitly declare that they are overriding a member using the override keyword.
This also improves readability of the programmer's intent.
Available with TypeScript 4.3 and newer.
noImplicitReturnsOptional
public readonly noImplicitReturns: boolean;
- Type: boolean
- Default: true
When enabled, TypeScript will check all code paths in a function to ensure they return a value.
noImplicitThisOptional
public readonly noImplicitThis: boolean;
- Type: boolean
- Default: true
Raise error on ‘this’ expressions with an implied ‘any’ type.
noPropertyAccessFromIndexSignatureOptional
public readonly noPropertyAccessFromIndexSignature: boolean;
- Type: boolean
- Default: true
Raise error on use of the dot syntax to access fields which are not defined.
noUncheckedIndexedAccessOptional
public readonly noUncheckedIndexedAccess: boolean;
- Type: boolean
- Default: true
Raise error when accessing indexes on objects with unknown keys defined in index signatures.
noUnusedLocalsOptional
public readonly noUnusedLocals: boolean;
- Type: boolean
- Default: true
Report errors on unused local variables.
noUnusedParametersOptional
public readonly noUnusedParameters: boolean;
- Type: boolean
- Default: true
Report errors on unused parameters in functions.
outDirOptional
public readonly outDir: string;
- Type: string
Output directory for the compiled files.
pathsOptional
public readonly paths: {[ key: string ]: string[]};
- Type: {[ key: string ]: string[]}
A series of entries which re-map imports to lookup locations relative to the baseUrl, there is a larger coverage of paths in the handbook.
paths lets you declare how TypeScript should resolve an import in your require/imports.
resolveJsonModuleOptional
public readonly resolveJsonModule: boolean;
- Type: boolean
- Default: true
Allows importing modules with a ‘.json’ extension, which is a common practice in node projects. This includes generating a type for the import based on the static JSON shape.
resolvePackageJsonExportsOptional
public readonly resolvePackageJsonExports: boolean;
- Type: boolean
- Default: true
Forces TypeScript to consult the exports field of package.json files if it ever reads from a package in node_modules.
resolvePackageJsonImportsOptional
public readonly resolvePackageJsonImports: boolean;
- Type: boolean
- Default: undefined
Forces TypeScript to consult the imports field of package.json when performing a lookup that begins with # from a file that has a package.json as an ancestor.
rootDirOptional
public readonly rootDir: string;
- Type: string
Specifies the root directory of input files.
Only use to control the output directory structure with outDir.
skipLibCheckOptional
public readonly skipLibCheck: boolean;
- Type: boolean
- Default: false
Skip type checking of all declaration files (*.d.ts).
sourceMapOptional
public readonly sourceMap: boolean;
- Type: boolean
- Default: undefined
Enables the generation of sourcemap files.
sourceRootOptional
public readonly sourceRoot: string;
- Type: string
- Default: undefined
Specify the location where a debugger should locate TypeScript files instead of relative source locations.
strictOptional
public readonly strict: boolean;
- Type: boolean
- Default: true
The strict flag enables a wide range of type checking behavior that results in stronger guarantees of program correctness.
Turning this on is equivalent to enabling all of the strict mode family options, which are outlined below. You can then turn off individual strict mode family checks as needed.
strictNullChecksOptional
public readonly strictNullChecks: boolean;
- Type: boolean
- Default: true
When strictNullChecks is false, null and undefined are effectively ignored by the language.
This can lead to unexpected errors at runtime. When strictNullChecks is true, null and undefined have their own distinct types and you’ll get a type error if you try to use them where a concrete value is expected.
strictPropertyInitializationOptional
public readonly strictPropertyInitialization: boolean;
- Type: boolean
- Default: true
When set to true, TypeScript will raise an error when a class property was declared but not set in the constructor.
stripInternalOptional
public readonly stripInternal: boolean;
- Type: boolean
- Default: true
Do not emit declarations for code that has an @internal annotation in it’s JSDoc comment.
targetOptional
public readonly target: string;
- Type: string
- Default: "ES2018"
Modern browsers support all ES6 features, so ES6 is a good choice.
You might choose to set a lower target if your code is deployed to older environments, or a higher target if your code is guaranteed to run in newer environments.
tsBuildInfoFileOptional
public readonly tsBuildInfoFile: string;
- Type: string
This setting lets you specify a file for storing incremental compilation information as a part of composite projects which enables faster building of larger TypeScript codebases.
You can read more about composite projects in the handbook.
typeRootsOptional
public readonly typeRoots: string[];
- Type: string[]
If typeRoots is specified, only packages under typeRoots will be included.
typesOptional
public readonly types: string[];
- Type: string[]
If types is specified, only packages listed will be included in the global scope.
useUnknownInCatchVariablesOptional
public readonly useUnknownInCatchVariables: boolean;
- Type: boolean
- Default: true
Change the type of the variable in a catch clause from any to unknown Available with TypeScript 4.4 and newer.
verbatimModuleSyntaxOptional
public readonly verbatimModuleSyntax: boolean;
- Type: boolean
- Default: undefined
Simplifies TypeScript's handling of import/export type modifiers.
https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax
TypescriptConfigOptions
Initializer
import { javascript } from 'projen'
const typescriptConfigOptions: javascript.TypescriptConfigOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| | Compiler options to use. |
| string[] | Filters results from the "include" option. |
| | Base tsconfig.json configuration(s) to inherit from. |
| string | No description. |
| string[] | Specifies a list of glob patterns that match TypeScript files to be included in compilation. |
compilerOptionsOptional
public readonly compilerOptions: TypeScriptCompilerOptions;
Compiler options to use.
excludeOptional
public readonly exclude: string[];
- Type: string[]
- Default: node_modules is excluded by default
Filters results from the "include" option.
extendsOptional
public readonly extends: TypescriptConfigExtends;
- Type: TypescriptConfigExtends
Base tsconfig.json configuration(s) to inherit from.
fileNameOptional
public readonly fileName: string;
- Type: string
- Default: "tsconfig.json"
includeOptional
public readonly include: string[];
- Type: string[]
- Default: all .ts files recursively
Specifies a list of glob patterns that match TypeScript files to be included in compilation.
UpgradeDependenciesOptions
Options for UpgradeDependencies.
Initializer
import { javascript } from 'projen'
const upgradeDependenciesOptions: javascript.UpgradeDependenciesOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| number | Exclude package versions published within the specified number of days. |
| string[] | List of package names to exclude during the upgrade. |
| string[] | List of package names to include during the upgrade. |
| boolean | Include deprecated packages. |
| string | Title of the pull request to use (should be all lower-case). |
| boolean | Check peer dependencies of installed packages and filter updates to compatible versions. |
| string | The semantic commit type. |
| boolean | Add Signed-off-by line by the committer at the end of the commit log message. |
| string | Determines the target version to upgrade dependencies to. |
| string | The name of the task that will be created. |
| projen.DependencyType[] | Specify which dependency types the upgrade should operate on. |
| boolean | Include a github workflow for creating PR's that upgrades the required dependencies, either by manual dispatch, or by a schedule. |
| | Options for the github workflow. |
cooldownOptional
public readonly cooldown: number;
- Type: number
- Default: No cooldown period.
Exclude package versions published within the specified number of days.
This may provide some protection against supply chain attacks, simply by avoiding newly published packages that may be malicious. It gives the ecosystem more time to detect malicious packages. However it comes at the cost of updating other packages slower, which might also contain vulnerabilities or bugs in need of a fix.
The cooldown period applies to both npm-check-updates discovery and the package manager update command.
excludeOptional
public readonly exclude: string[];
- Type: string[]
- Default: Nothing is excluded.
List of package names to exclude during the upgrade.
includeOptional
public readonly include: string[];
- Type: string[]
- Default: Everything is included.
List of package names to include during the upgrade.
includeDeprecatedVersionsOptional
public readonly includeDeprecatedVersions: boolean;
- Type: boolean
- Default: false
Include deprecated packages.
By default, deprecated versions will be excluded from upgrades.
https://github.com/raineorshine/npm-check-updates?tab=readme-ov-file#options
pullRequestTitleOptional
public readonly pullRequestTitle: string;
- Type: string
- Default: "upgrade dependencies"
Title of the pull request to use (should be all lower-case).
satisfyPeerDependenciesOptional
public readonly satisfyPeerDependencies: boolean;
- Type: boolean
- Default: true
Check peer dependencies of installed packages and filter updates to compatible versions.
By default, the upgrade workflow will adhere to version constraints from peer dependencies. Sometimes this is not desirable and can be disabled.
semanticCommitOptional
public readonly semanticCommit: string;
- Type: string
- Default: 'chore'
The semantic commit type.
signoffOptional
public readonly signoff: boolean;
- Type: boolean
- Default: true
Add Signed-off-by line by the committer at the end of the commit log message.
targetOptional
public readonly target: string;
- Type: string
- Default: "minor"
Determines the target version to upgrade dependencies to.
taskNameOptional
public readonly taskName: string;
- Type: string
- Default: "upgrade".
The name of the task that will be created.
This will also be the workflow name.
typesOptional
public readonly types: DependencyType[];
- Type: projen.DependencyType[]
- Default: All dependency types.
Specify which dependency types the upgrade should operate on.
workflowOptional
public readonly workflow: boolean;
- Type: boolean
- Default: true for root projects, false for subprojects.
Include a github workflow for creating PR's that upgrades the required dependencies, either by manual dispatch, or by a schedule.
If this is false, only a local projen task is created, which can be executed manually to
upgrade the dependencies.
workflowOptionsOptional
public readonly workflowOptions: UpgradeDependenciesWorkflowOptions;
- Type: UpgradeDependenciesWorkflowOptions
- Default: default options.
Options for the github workflow.
Only applies if workflow is true.
UpgradeDependenciesWorkflowOptions
Options for UpgradeDependencies.workflowOptions.
Initializer
import { javascript } from 'projen'
const upgradeDependenciesWorkflowOptions: javascript.UpgradeDependenciesWorkflowOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | Assignees to add on the PR. |
| string[] | List of branches to create PR's for. |
| projen.github.workflows.ContainerOptions | Job container options. |
| {[ key: string ]: string} | Build environment variables for the upgrade job. |
| projen.github.GitIdentity | The git identity to use for commits. |
| string[] | Labels to apply on the PR. |
| projen.github.workflows.JobPermissions | Permissions granted to the upgrade job To limit job permissions for contents, the desired permissions have to be explicitly set, e.g.: { contents: JobPermission.NONE }. |
| projen.github.GithubCredentials | Choose a method for authenticating with GitHub for creating the PR. |
| string[] | Github Runner selection labels. |
| projen.GroupRunnerOptions | Github Runner Group selection options. |
| | Schedule to run on. |
assigneesOptional
public readonly assignees: string[];
- Type: string[]
- Default: no assignees
Assignees to add on the PR.
branchesOptional
public readonly branches: string[];
- Type: string[]
- Default: All release branches configured for the project.
List of branches to create PR's for.
containerOptional
public readonly container: ContainerOptions;
- Type: projen.github.workflows.ContainerOptions
- Default: defaults
Job container options.
envOptional
public readonly env: {[ key: string ]: string};
- Type: {[ key: string ]: string}
- Default: {}
Build environment variables for the upgrade job.
gitIdentityOptional
public readonly gitIdentity: GitIdentity;
- Type: projen.github.GitIdentity
- Default: default GitHub Actions user
The git identity to use for commits.
labelsOptional
public readonly labels: string[];
- Type: string[]
- Default: no labels.
Labels to apply on the PR.
permissionsOptional
public readonly permissions: JobPermissions;
- Type: projen.github.workflows.JobPermissions
- Default:
{ contents: JobPermission.READ }
Permissions granted to the upgrade job To limit job permissions for contents, the desired permissions have to be explicitly set, e.g.: { contents: JobPermission.NONE }.
projenCredentialsOptional
public readonly projenCredentials: GithubCredentials;
- Type: projen.github.GithubCredentials
- Default: personal access token named PROJEN_GITHUB_TOKEN
Choose a method for authenticating with GitHub for creating the PR.
When using the default github token, PR's created by this workflow will not trigger any subsequent workflows (i.e the build workflow), so projen requires API access to be provided through e.g. a personal access token or other method.
https://github.com/peter-evans/create-pull-request/issues/48
runsOnOptional
public readonly runsOn: string[];
- Type: string[]
- Default: ["ubuntu-latest"]
Github Runner selection labels.
runsOnGroupOptional
public readonly runsOnGroup: GroupRunnerOptions;
- Type: projen.GroupRunnerOptions
Github Runner Group selection options.
scheduleOptional
public readonly schedule: UpgradeDependenciesSchedule;
- Type: UpgradeDependenciesSchedule
- Default: UpgradeDependenciesSchedule.DAILY
Schedule to run on.
YarnBerryOptions
Configure Yarn Berry.
Initializer
import { javascript } from 'projen'
const yarnBerryOptions: javascript.YarnBerryOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | A fully specified version to use for yarn (e.g., x.x.x). |
| | The yarnrc configuration. |
| boolean | Should zero-installs be enabled? |
versionOptional
public readonly version: string;
- Type: string
- Default: 4.13.0
A fully specified version to use for yarn (e.g., x.x.x).
yarnRcOptionsOptional
public readonly yarnRcOptions: YarnrcOptions;
- Type: YarnrcOptions
- Default: a blank Yarn RC file
The yarnrc configuration.
zeroInstallsOptional
public readonly zeroInstalls: boolean;
- Type: boolean
- Default: false
Should zero-installs be enabled?
Learn more at: https://yarnpkg.com/features/caching#zero-installs
YarnLogFilter
https://yarnpkg.com/configuration/yarnrc#logFilters.
Initializer
import { javascript } from 'projen'
const yarnLogFilter: javascript.YarnLogFilter = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | No description. |
| | No description. |
| string | No description. |
| string | No description. |
codeOptional
public readonly code: string;
- Type: string
levelOptional
public readonly level: YarnLogFilterLevel;
- Type: YarnLogFilterLevel
patternOptional
public readonly pattern: string;
- Type: string
textOptional
public readonly text: string;
- Type: string
YarnNetworkSetting
https://yarnpkg.com/configuration/yarnrc#networkSettings.
Initializer
import { javascript } from 'projen'
const yarnNetworkSetting: javascript.YarnNetworkSetting = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| boolean | No description. |
| string | No description. |
| string | No description. |
| string | No description. |
| string | No description. |
| string | No description. |
enableNetworkOptional
public readonly enableNetwork: boolean;
- Type: boolean
httpProxyOptional
public readonly httpProxy: string;
- Type: string
httpsCaFilePathOptional
public readonly httpsCaFilePath: string;
- Type: string
httpsCertFilePathOptional
public readonly httpsCertFilePath: string;
- Type: string
httpsKeyFilePathOptional
public readonly httpsKeyFilePath: string;
- Type: string
httpsProxyOptional
public readonly httpsProxy: string;
- Type: string
YarnNpmRegistry
https://yarnpkg.com/configuration/yarnrc#npmRegistries.
Initializer
import { javascript } from 'projen'
const yarnNpmRegistry: javascript.YarnNpmRegistry = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| boolean | No description. |
| string | No description. |
| string | No description. |
npmAlwaysAuthOptional
public readonly npmAlwaysAuth: boolean;
- Type: boolean
npmAuthIdentOptional
public readonly npmAuthIdent: string;
- Type: string
npmAuthTokenOptional
public readonly npmAuthToken: string;
- Type: string
YarnNpmScope
https://yarnpkg.com/configuration/yarnrc#npmScopes.
Initializer
import { javascript } from 'projen'
const yarnNpmScope: javascript.YarnNpmScope = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| boolean | No description. |
| string | No description. |
| string | No description. |
| string | No description. |
| string | No description. |
npmAlwaysAuthOptional
public readonly npmAlwaysAuth: boolean;
- Type: boolean
npmAuthIdentOptional
public readonly npmAuthIdent: string;
- Type: string
npmAuthTokenOptional
public readonly npmAuthToken: string;
- Type: string
npmPublishRegistryOptional
public readonly npmPublishRegistry: string;
- Type: string
npmRegistryServerOptional
public readonly npmRegistryServer: string;
- Type: string
YarnPackageExtension
https://yarnpkg.com/configuration/yarnrc#packageExtensions.
Initializer
import { javascript } from 'projen'
const yarnPackageExtension: javascript.YarnPackageExtension = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| {[ key: string ]: string} | No description. |
| {[ key: string ]: string} | No description. |
| | No description. |
dependenciesOptional
public readonly dependencies: {[ key: string ]: string};
- Type: {[ key: string ]: string}
peerDependenciesOptional
public readonly peerDependencies: {[ key: string ]: string};
- Type: {[ key: string ]: string}
peerDependenciesMetaOptional
public readonly peerDependenciesMeta: {[ key: string ]: {[ key: string ]: YarnPeerDependencyMeta}};
- Type: {[ key: string ]: {[ key: string ]: YarnPeerDependencyMeta}}
YarnPeerDependencyMeta
https://yarnpkg.com/configuration/yarnrc#packageExtensions.
Initializer
import { javascript } from 'projen'
const yarnPeerDependencyMeta: javascript.YarnPeerDependencyMeta = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| boolean | No description. |
optionalOptional
public readonly optional: boolean;
- Type: boolean
YarnrcOptions
Configuration for .yarnrc.yml in Yarn Berry v4.
Initializer
import { javascript } from 'projen'
const yarnrcOptions: javascript.YarnrcOptions = { ... }
Properties
cacheFolderOptional
public readonly cacheFolder: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#cacheFolder.
cacheMigrationModeOptional
public readonly cacheMigrationMode: YarnCacheMigrationMode;
- Type: YarnCacheMigrationMode
https://yarnpkg.com/configuration/yarnrc#cacheMigrationMode.
changesetBaseRefsOptional
public readonly changesetBaseRefs: string[];
- Type: string[]
https://yarnpkg.com/configuration/yarnrc#changesetBaseRefs.
changesetIgnorePatternsOptional
public readonly changesetIgnorePatterns: string[];
- Type: string[]
https://yarnpkg.com/configuration/yarnrc#changesetIgnorePatterns.
checksumBehaviorOptional
public readonly checksumBehavior: YarnChecksumBehavior;
- Type: YarnChecksumBehavior
https://yarnpkg.com/configuration/yarnrc#checksumBehavior.
cloneConcurrencyOptional
public readonly cloneConcurrency: number;
- Type: number
https://yarnpkg.com/configuration/yarnrc#cloneConcurrency.
compressionLevelOptional
public readonly compressionLevel: string | number;
- Type: string | number
https://yarnpkg.com/configuration/yarnrc#compressionLevel.
constraintsPathOptional
public readonly constraintsPath: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#constraintsPath.
defaultLanguageNameOptional
public readonly defaultLanguageName: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#defaultLanguageName.
defaultProtocolOptional
public readonly defaultProtocol: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#defaultProtocol.
defaultSemverRangePrefixOptional
public readonly defaultSemverRangePrefix: YarnDefaultSemverRangePrefix;
https://yarnpkg.com/configuration/yarnrc#defaultSemverRangePrefix.
deferredVersionFolderOptional
public readonly deferredVersionFolder: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#deferredVersionFolder.
enableColorsOptional
public readonly enableColors: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#enableColors.
enableConstraintsCheckOptional
public readonly enableConstraintsCheck: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#enableConstraintsCheck.
enableGlobalCacheOptional
public readonly enableGlobalCache: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#enableGlobalCache.
enableHardenedModeOptional
public readonly enableHardenedMode: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#enableHardenedMode.
enableHyperlinksOptional
public readonly enableHyperlinks: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#enableHyperlinks.
enableImmutableCacheOptional
public readonly enableImmutableCache: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#enableImmutableCache.
enableImmutableInstallsOptional
public readonly enableImmutableInstalls: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#enableImmutableInstalls.
enableInlineBuildsOptional
public readonly enableInlineBuilds: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#enableInlineBuilds.
enableInlineHunksOptional
public readonly enableInlineHunks: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#enableInlineHunks.
enableMessageNamesOptional
public readonly enableMessageNames: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#enableMessageNames.
enableMirrorOptional
public readonly enableMirror: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#enableMirror.
enableNetworkOptional
public readonly enableNetwork: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#enableNetwork.
enableOfflineModeOptional
public readonly enableOfflineMode: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#enableOfflineMode.
enableProgressBarsOptional
public readonly enableProgressBars: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#enableProgressBars.
enableScriptsOptional
public readonly enableScripts: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#enableScripts.
enableStrictSslOptional
public readonly enableStrictSsl: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#enableStrictSsl.
enableTelemetryOptional
public readonly enableTelemetry: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#enableTelemetry.
enableTimersOptional
public readonly enableTimers: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#enableTimers.
enableTransparentWorkspacesOptional
public readonly enableTransparentWorkspaces: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#enableTransparentWorkspaces.
globalFolderOptional
public readonly globalFolder: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#globalFolder.
httpProxyOptional
public readonly httpProxy: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#httpProxy.
httpRetryOptional
public readonly httpRetry: number;
- Type: number
https://yarnpkg.com/configuration/yarnrc#httpRetry.
httpsCaFilePathOptional
public readonly httpsCaFilePath: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#httpsCaFilePath.
httpsCertFilePathOptional
public readonly httpsCertFilePath: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#httpsCertFilePath.
httpsKeyFilePathOptional
public readonly httpsKeyFilePath: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#httpsKeyFilePath.
httpsProxyOptional
public readonly httpsProxy: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#httpsProxy.
httpTimeoutOptional
public readonly httpTimeout: number;
- Type: number
https://yarnpkg.com/configuration/yarnrc#httpTimeout.
ignorePathOptional
public readonly ignorePath: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#ignorePath.
immutablePatternsOptional
public readonly immutablePatterns: string[];
- Type: string[]
https://yarnpkg.com/configuration/yarnrc#immutablePatterns.
initFieldsOptional
public readonly initFields: {[ key: string ]: any};
- Type: {[ key: string ]: any}
https://yarnpkg.com/configuration/yarnrc#initFields.
initScopeOptional
public readonly initScope: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#initScope.
injectEnvironmentFilesOptional
public readonly injectEnvironmentFiles: string[];
- Type: string[]
https://yarnpkg.com/configuration/yarnrc#injectEnvironmentFiles.
installStatePathOptional
public readonly installStatePath: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#installStatePath.
logFiltersOptional
public readonly logFilters: YarnLogFilter[];
- Type: YarnLogFilter[]
https://yarnpkg.com/configuration/yarnrc#logFilters.
networkConcurrencyOptional
public readonly networkConcurrency: number;
- Type: number
https://yarnpkg.com/configuration/yarnrc#networkConcurrency.
networkSettingsOptional
public readonly networkSettings: {[ key: string ]: YarnNetworkSetting};
- Type: {[ key: string ]: YarnNetworkSetting}
https://yarnpkg.com/configuration/yarnrc#networkSettings.
nmHoistingLimitsOptional
public readonly nmHoistingLimits: YarnNmHoistingLimit;
- Type: YarnNmHoistingLimit
https://yarnpkg.com/configuration/yarnrc#nmHoistingLimits.
nmModeOptional
public readonly nmMode: YarnNmMode;
- Type: YarnNmMode
https://yarnpkg.com/configuration/yarnrc#nmMode.
nmSelfReferencesOptional
public readonly nmSelfReferences: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#nmSelfReferences.
nodeLinkerOptional
public readonly nodeLinker: YarnNodeLinker;
- Type: YarnNodeLinker
https://yarnpkg.com/configuration/yarnrc#nodeLinker.
npmAlwaysAuthOptional
public readonly npmAlwaysAuth: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#npmAlwaysAuth.
npmAuditExcludePackagesOptional
public readonly npmAuditExcludePackages: string[];
- Type: string[]
https://yarnpkg.com/configuration/yarnrc#npmAuditExcludePackages.
npmAuditIgnoreAdvisoriesOptional
public readonly npmAuditIgnoreAdvisories: string[];
- Type: string[]
https://yarnpkg.com/configuration/yarnrc#npmAuditIgnoreAdvisories.
npmAuditRegistryOptional
public readonly npmAuditRegistry: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#npmAuditRegistry.
npmAuthIdentOptional
public readonly npmAuthIdent: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#npmAuthIdent.
npmAuthTokenOptional
public readonly npmAuthToken: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#npmAuthToken.
npmPublishAccessOptional
public readonly npmPublishAccess: YarnNpmPublishAccess;
- Type: YarnNpmPublishAccess
https://yarnpkg.com/configuration/yarnrc#npmPublishAccess.
npmPublishRegistryOptional
public readonly npmPublishRegistry: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#npmPublishRegistry.
npmRegistriesOptional
public readonly npmRegistries: {[ key: string ]: YarnNpmRegistry};
- Type: {[ key: string ]: YarnNpmRegistry}
https://yarnpkg.com/configuration/yarnrc#npmRegistries.
npmRegistryServerOptional
public readonly npmRegistryServer: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#npmRegistryServer.
npmScopesOptional
public readonly npmScopes: {[ key: string ]: YarnNpmScope};
- Type: {[ key: string ]: YarnNpmScope}
https://yarnpkg.com/configuration/yarnrc#npmScopes.
packageExtensionsOptional
public readonly packageExtensions: {[ key: string ]: YarnPackageExtension};
- Type: {[ key: string ]: YarnPackageExtension}
https://yarnpkg.com/configuration/yarnrc#packageExtensions.
patchFolderOptional
public readonly patchFolder: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#patchFolder.
pnpEnableEsmLoaderOptional
public readonly pnpEnableEsmLoader: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#pnpEnableEsmLoader.
pnpEnableInliningOptional
public readonly pnpEnableInlining: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#pnpEnableInlining.
pnpFallbackModeOptional
public readonly pnpFallbackMode: YarnPnpFallbackMode;
- Type: YarnPnpFallbackMode
https://yarnpkg.com/configuration/yarnrc#pnpFallbackMode.
pnpIgnorePatternsOptional
public readonly pnpIgnorePatterns: string[];
- Type: string[]
https://yarnpkg.com/configuration/yarnrc#pnpIgnorePatterns.
pnpModeOptional
public readonly pnpMode: YarnPnpMode;
- Type: YarnPnpMode
https://yarnpkg.com/configuration/yarnrc#pnpMode.
pnpShebangOptional
public readonly pnpShebang: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#pnpShebang.
pnpUnpluggedFolderOptional
public readonly pnpUnpluggedFolder: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#pnpUnpluggedFolder.
preferDeferredVersionsOptional
public readonly preferDeferredVersions: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#preferDeferredVersions.
preferInteractiveOptional
public readonly preferInteractive: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#preferInteractive.
preferReuseOptional
public readonly preferReuse: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#preferReuse.
preferTruncatedLinesOptional
public readonly preferTruncatedLines: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#preferTruncatedLines.
progressBarStyleOptional
public readonly progressBarStyle: YarnProgressBarStyle;
- Type: YarnProgressBarStyle
https://yarnpkg.com/configuration/yarnrc#progressBarStyle.
rcFilenameOptional
public readonly rcFilename: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#rcFilename.
supportedArchitecturesOptional
public readonly supportedArchitectures: YarnSupportedArchitectures;
https://yarnpkg.com/configuration/yarnrc#supportedArchitectures.
taskPoolConcurrencyOptional
public readonly taskPoolConcurrency: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#taskPoolConcurrency.
telemetryIntervalOptional
public readonly telemetryInterval: number;
- Type: number
https://yarnpkg.com/configuration/yarnrc#telemetryInterval.
telemetryUserIdOptional
public readonly telemetryUserId: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#telemetryUserId.
tsEnableAutoTypesOptional
public readonly tsEnableAutoTypes: boolean;
- Type: boolean
https://yarnpkg.com/configuration/yarnrc#tsEnableAutoTypes.
unsafeHttpWhitelistOptional
public readonly unsafeHttpWhitelist: string[];
- Type: string[]
https://yarnpkg.com/configuration/yarnrc#unsafeHttpWhitelist.
virtualFolderOptional
public readonly virtualFolder: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#virtualFolder.
winLinkTypeOptional
public readonly winLinkType: YarnWinLinkType;
- Type: YarnWinLinkType
https://yarnpkg.com/configuration/yarnrc#winLinkType.
workerPoolModeOptional
public readonly workerPoolMode: YarnWorkerPoolMode;
- Type: YarnWorkerPoolMode
https://yarnpkg.com/configuration/yarnrc#workerPoolMode.
yarnPathOptional
public readonly yarnPath: string;
- Type: string
https://yarnpkg.com/configuration/yarnrc#yarnPath.
YarnSupportedArchitectures
https://yarnpkg.com/configuration/yarnrc#supportedArchitectures.
Initializer
import { javascript } from 'projen'
const yarnSupportedArchitectures: javascript.YarnSupportedArchitectures = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | No description. |
| string[] | No description. |
| string[] | No description. |
cpuOptional
public readonly cpu: string[];
- Type: string[]
libcOptional
public readonly libc: string[];
- Type: string[]
osOptional
public readonly os: string[];
- Type: string[]
Classes
JestReporter
Initializers
import { javascript } from 'projen'
new javascript.JestReporter(name: string, options?: {[ key: string ]: any})
| Name | Type | Description |
|---|---|---|
| string | No description. |
| {[ key: string ]: any} | No description. |
nameRequired
- Type: string
optionsOptional
- Type: {[ key: string ]: any}
PnpmWorkspaceYamlSchemaLinkWorkspacePackages
If this is enabled, locally available packages are linked to node_modules instead of being downloaded from the registry.
Static Functions
| Name | Description |
|---|---|
| No description. |
| No description. |
fromBoolean
import { javascript } from 'projen'
javascript.PnpmWorkspaceYamlSchemaLinkWorkspacePackages.fromBoolean(value: boolean)
valueRequired
- Type: boolean
fromString
import { javascript } from 'projen'
javascript.PnpmWorkspaceYamlSchemaLinkWorkspacePackages.fromString(value: string)
valueRequired
- Type: string
Properties
| Name | Type | Description |
|---|---|---|
| string | boolean | No description. |
valueRequired
public readonly value: string | boolean;
- Type: string | boolean
PnpmWorkspaceYamlSchemaSaveWorkspaceProtocol
This setting controls how dependencies that are linked from the workspace are added to package.json.
Static Functions
| Name | Description |
|---|---|
| No description. |
| No description. |
fromBoolean
import { javascript } from 'projen'
javascript.PnpmWorkspaceYamlSchemaSaveWorkspaceProtocol.fromBoolean(value: boolean)
valueRequired
- Type: boolean
fromString
import { javascript } from 'projen'
javascript.PnpmWorkspaceYamlSchemaSaveWorkspaceProtocol.fromString(value: string)
valueRequired
- Type: string
Properties
| Name | Type | Description |
|---|---|---|
| string | boolean | No description. |
valueRequired
public readonly value: string | boolean;
- Type: string | boolean
Transform
Initializers
import { javascript } from 'projen'
new javascript.Transform(name: string, options?: any)
| Name | Type | Description |
|---|---|---|
| string | No description. |
| any | No description. |
nameRequired
- Type: string
optionsOptional
- Type: any
TypescriptConfigExtends
Container for TypescriptConfig tsconfig.json base configuration(s). Extending from more than one base config file requires TypeScript 5.0+.
Methods
| Name | Description |
|---|---|
| No description. |
toJSON
public toJSON(): string[]
Static Functions
| Name | Description |
|---|---|
| Factory for creation from array of file paths. |
| Factory for creation from array of other TypescriptConfig instances. |
fromPaths
import { javascript } from 'projen'
javascript.TypescriptConfigExtends.fromPaths(paths: string[])
Factory for creation from array of file paths.
pathsRequired
- Type: string[]
Absolute or relative paths to base tsconfig.json files.
fromTypescriptConfigs
import { javascript } from 'projen'
javascript.TypescriptConfigExtends.fromTypescriptConfigs(configs: TypescriptConfig[])
Factory for creation from array of other TypescriptConfig instances.
configsRequired
- Type: TypescriptConfig[]
Base TypescriptConfig instances.
UpgradeDependenciesSchedule
How often to check for new versions and raise pull requests for version upgrades.
Static Functions
| Name | Description |
|---|---|
| Create a schedule from a raw cron expression. |
expressions
import { javascript } from 'projen'
javascript.UpgradeDependenciesSchedule.expressions(cron: string[])
Create a schedule from a raw cron expression.
cronRequired
- Type: string[]
Properties
| Name | Type | Description |
|---|---|---|
| string[] | No description. |
cronRequired
public readonly cron: string[];
- Type: string[]
Constants
| Name | Type | Description |
|---|---|---|
| | At 00:00. |
| | At 00:00 on day-of-month 1. |
| | Disables automatic upgrades. |
| | At 00:00 on every day-of-week from Monday through Friday. |
| | At 00:00 on Monday. |
DAILYRequired
public readonly DAILY: UpgradeDependenciesSchedule;
At 00:00.
MONTHLYRequired
public readonly MONTHLY: UpgradeDependenciesSchedule;
At 00:00 on day-of-month 1.
NEVERRequired
public readonly NEVER: UpgradeDependenciesSchedule;
Disables automatic upgrades.
WEEKDAYRequired
public readonly WEEKDAY: UpgradeDependenciesSchedule;
At 00:00 on every day-of-week from Monday through Friday.
WEEKLYRequired
public readonly WEEKLY: UpgradeDependenciesSchedule;
At 00:00 on Monday.
WatchPlugin
Initializers
import { javascript } from 'projen'
new javascript.WatchPlugin(name: string, options?: any)
| Name | Type | Description |
|---|---|---|
| string | No description. |
| any | No description. |
nameRequired
- Type: string
optionsOptional
- Type: any
Enums
ArrowParens
Members
| Name | Description |
|---|---|
| Always include parens. |
| Omit parens when possible. |
ALWAYS
Always include parens.
Example: (x) => x
AVOID
Omit parens when possible.
Example: x => x
AutoRelease
Automatic bump modes.
Members
| Name | Description |
|---|---|
| Automatically bump & release a new version for every commit to "main". |
| Automatically bump & release a new version on a daily basis. |
EVERY_COMMIT
Automatically bump & release a new version for every commit to "main".
DAILY
Automatically bump & release a new version on a daily basis.
BundleLogLevel
Log levels for esbuild and package managers' install commands.
Members
| Name | Description |
|---|---|
| Show everything. |
| Show everything from info and some additional messages for debugging. |
| Show warnings, errors, and an output file summary. |
| Show warnings and errors. |
| Show errors only. |
| Show nothing. |
VERBOSE
Show everything.
DEBUG
Show everything from info and some additional messages for debugging.
INFO
Show warnings, errors, and an output file summary.
WARNING
Show warnings and errors.
ERROR
Show errors only.
SILENT
Show nothing.
Charset
Charset for esbuild's output.
Members
| Name | Description |
|---|---|
| ASCII. |
| UTF-8. |
ASCII
ASCII.
Any non-ASCII characters are escaped using backslash escape sequences
UTF8
UTF-8.
Keep original characters without using escape sequences
CodeArtifactAuthProvider
Options for authorizing requests to a AWS CodeArtifact npm repository.
Members
| Name | Description |
|---|---|
| Fixed credentials provided via Github secrets. |
| Ephemeral credentials provided via Github's OIDC integration with an IAM role. |
ACCESS_AND_SECRET_KEY_PAIR
Fixed credentials provided via Github secrets.
GITHUB_OIDC
Ephemeral credentials provided via Github's OIDC integration with an IAM role.
See: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_oidc.html https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services
EmbeddedLanguageFormatting
Members
| Name | Description |
|---|---|
| Format embedded code if Prettier can automatically identify it. |
| Never automatically format embedded code. |
AUTO
Format embedded code if Prettier can automatically identify it.
OFF
Never automatically format embedded code.
EndOfLine
Members
| Name | Description |
|---|---|
| Maintain existing (mixed values within one file are normalised by looking at what's used after the first line). |
| Carriage Return character only (\r), used very rarely. |
| Carriage Return + Line Feed characters (\r\n), common on Windows. |
| Line Feed only (\n), common on Linux and macOS as well as inside git repos. |
AUTO
Maintain existing (mixed values within one file are normalised by looking at what's used after the first line).
CR
Carriage Return character only (\r), used very rarely.
CRLF
Carriage Return + Line Feed characters (\r\n), common on Windows.
LF
Line Feed only (\n), common on Linux and macOS as well as inside git repos.
HTMLWhitespaceSensitivity
Members
| Name | Description |
|---|---|
| Respect the default value of CSS display property. |
| Whitespaces are considered insignificant. |
| Whitespaces are considered significant. |
CSS
Respect the default value of CSS display property.
IGNORE
Whitespaces are considered insignificant.
STRICT
Whitespaces are considered significant.
InstallReason
Why a dependency install was triggered during synthesis.
Members
| Name | Description |
|---|---|
| The node_modules directory does not exist. |
| The package.json file was modified during synthesis. |
| Wildcard dependency versions were resolved to concrete ranges. |
NO_NODE_MODULES
The node_modules directory does not exist.
PACKAGE_JSON_CHANGED
The package.json file was modified during synthesis.
DEPS_RESOLVED
Wildcard dependency versions were resolved to concrete ranges.
NodePackageManager
The node package manager to use.
Members
| Name | Description |
|---|---|
| Use yarn as the package manager. |
| Use yarn versions >= 2 as the package manager. |
| Use yarn 1.x as the package manager. |
| Use yarn versions >= 2 as the package manager. |
| Use npm as the package manager. |
| Use pnpm as the package manager. |
| Use bun as the package manager. |
YARN
YARN- Deprecated: For
yarn1.x useYARN_CLASSICforyarn>= 2 useYARN_BERRY. Currently,NodePackageManager.YARNmeansYARN_CLASSIC. In the future, we might repurpose it to meanYARN_BERRY.
Use yarn as the package manager.
YARN2
YARN2- Deprecated: use YARN_BERRY instead
Use yarn versions >= 2 as the package manager.
YARN_CLASSIC
Use yarn 1.x as the package manager.
YARN_BERRY
Use yarn versions >= 2 as the package manager.
NPM
Use npm as the package manager.
PNPM
Use pnpm as the package manager.
BUN
Use bun as the package manager.
NpmAccess
Npm package access level.
Members
| Name | Description |
|---|---|
| Package is public. |
| Package can only be accessed with credentials. |
PUBLIC
Package is public.
RESTRICTED
Package can only be accessed with credentials.
PnpmWorkspaceYamlSchemaAuditLevel
Controls the level of issues reported by pnpm audit.
When set to 'low', all vulnerabilities are reported. When set to 'moderate', 'high', or 'critical', only vulnerabilities with that severity or higher are reported.
Members
| Name | Description |
|---|---|
| low. |
| moderate. |
| high. |
| critical. |
LOW
low.
MODERATE
moderate.
HIGH
high.
CRITICAL
critical.
PnpmWorkspaceYamlSchemaCatalogMode
Controlling if and how dependencies are added to the default catalog.
Members
| Name | Description |
|---|---|
| strict. |
| prefer. |
| manual. |
STRICT
strict.
PREFER
prefer.
MANUAL
manual.
PnpmWorkspaceYamlSchemaColor
Controls colors in the output.
Members
| Name | Description |
|---|---|
| always. |
| auto. |
| never. |
ALWAYS
always.
AUTO
auto.
NEVER
never.
PnpmWorkspaceYamlSchemaHoistingLimits
Added a new hoistingLimits setting for nodeLinker: hoisted installs, mirroring yarn's nmHoistingLimits.
It accepts none (the default — hoist as far as possible), workspaces (hoist only as far as each workspace package), or dependencies (hoist only up to each workspace package's direct dependencies).
Members
| Name | Description |
|---|---|
| node. |
| workspaces. |
| dependencies. |
NODE
node.
WORKSPACES
workspaces.
DEPENDENCIES
dependencies.
PnpmWorkspaceYamlSchemaLoglevel
Any logs at or higher than the given level will be shown.
Members
| Name | Description |
|---|---|
| debug. |
| info. |
| warn. |
| error. |
DEBUG
debug.
INFO
info.
WARN
warn.
ERROR
error.
PnpmWorkspaceYamlSchemaNodeLinker
Defines what linker should be used for installing Node packages.
Members
| Name | Description |
|---|---|
| isolated. |
| hoisted. |
| pnp. |
ISOLATED
isolated.
HOISTED
hoisted.
PNP
pnp.
PnpmWorkspaceYamlSchemaPackageImportMethod
Controls the way packages are imported from the store (if you want to disable symlinks inside node_modules, then you need to change the nodeLinker setting, not this one).
Members
| Name | Description |
|---|---|
| auto. |
| hardlink. |
| copy. |
| clone. |
| clone-or-copy. |
AUTO
auto.
HARDLINK
hardlink.
COPY
copy.
CLONE
clone.
CLONE_HYPHEN_OR_HYPHEN_COPY
clone-or-copy.
PnpmWorkspaceYamlSchemaPmOnFail
Overrides the onFail behavior of both the packageManager field and devEngines.packageManager when the running pnpm version does not match the declared one.
Members
| Name | Description |
|---|---|
| download. |
| error. |
| warn. |
| ignore. |
DOWNLOAD
download.
ERROR
error.
WARN
warn.
IGNORE
ignore.
PnpmWorkspaceYamlSchemaReporter
Allows you to customize the output style of the logs.
https://pnpm.io/cli/install#--reportername
Members
| Name | Description |
|---|---|
| silent. |
| default. |
| append-only. |
| ndjson. |
SILENT
silent.
DEFAULT
default.
APPEND_HYPHEN_ONLY
append-only.
NDJSON
ndjson.
PnpmWorkspaceYamlSchemaResolutionMode
Determines how pnpm resolves dependencies, See https://pnpm.io/settings#resolutionmode.
Members
| Name | Description |
|---|---|
| highest. |
| time-based. |
| lowest-direct. |
HIGHEST
highest.
TIME_HYPHEN_BASED
time-based.
LOWEST_HYPHEN_DIRECT
lowest-direct.
PnpmWorkspaceYamlSchemaRuntimeOnFail
Overrides the onFail field of devEngines.runtime (and engines.runtime) in the root project's package.json. This is useful when you want a different local behavior than what is written in the manifest — for instance, forcing pnpm to download the declared runtime even when the manifest sets onFail: "warn".
Members
| Name | Description |
|---|---|
| download. |
| error. |
| warn. |
| ignore. |
DOWNLOAD
download.
ERROR
error.
WARN
warn.
IGNORE
ignore.
PnpmWorkspaceYamlSchemaSavePrefix
Configure how versions of packages installed to a package.json file get prefixed.
Members
| Name | Description |
|---|---|
| ^. |
| ~. |
VALUE_CARAT
^.
VALUE_TILDE
~.
PnpmWorkspaceYamlSchemaTrustPolicy
When set to no-downgrade, pnpm will fail if a package's trust level has decreased compared to previous releases.
For example, if a package was previously published by a trusted publisher but now only has provenance or no trust evidence, installation will fail. This helps prevent installing potentially compromised versions.
Members
| Name | Description |
|---|---|
| off. |
| no-downgrade. |
OFF
off.
NO_HYPHEN_DOWNGRADE
no-downgrade.
ProseWrap
Members
| Name | Description |
|---|---|
| Wrap prose if it exceeds the print width. |
| Do not wrap prose. |
| Wrap prose as-is. |
ALWAYS
Wrap prose if it exceeds the print width.
NEVER
Do not wrap prose.
PRESERVE
Wrap prose as-is.
QuoteProps
Members
| Name | Description |
|---|---|
| Only add quotes around object properties where required. |
| If at least one property in an object requires quotes, quote all properties. |
| Respect the input use of quotes in object properties. |
ASNEEDED
Only add quotes around object properties where required.
CONSISTENT
If at least one property in an object requires quotes, quote all properties.
PRESERVE
Respect the input use of quotes in object properties.
RunBundleTask
Options for BundlerOptions.runBundleTask.
Members
| Name | Description |
|---|---|
| Don't bundle automatically as part of the build. |
| Bundle automatically before compilation. |
| Bundle automatically after compilation. This is useful if you want to bundle the compiled results. |
MANUAL
Don't bundle automatically as part of the build.
PRE_COMPILE
Bundle automatically before compilation.
POST_COMPILE
Bundle automatically after compilation. This is useful if you want to bundle the compiled results.
Thus will run compilation tasks (using tsc, etc.) before running file through bundling step.
This is only required unless you are using new experimental features that
are not supported by esbuild but are supported by typescript's tsc
compiler. One example of such feature is emitDecoratorMetadata.
// In a TypeScript project with output configured
// to go to the "lib" directory:
const project = new TypeScriptProject({
name: "test",
tsconfig: {
compilerOptions: {
outDir: "lib",
},
},
bundlerOptions: {
// ensure we compile with `tsc` before bundling
runBundleTask: RunBundleTask.POST_COMPILE,
},
});
// Tell the bundler to bundle the compiled results (from the "lib" directory)
project.bundler.addBundle("./lib/index.js", {
platform: "node",
target: "node22",
sourcemap: false,
format: "esm",
});
SourceMapMode
SourceMap mode for esbuild.
Members
| Name | Description |
|---|---|
| Default sourceMap mode - will generate a .js.map file alongside any generated .js file and add a special //# sourceMappingURL= comment to the bottom of the .js file pointing to the .js.map file. |
| External sourceMap mode - If you want to omit the special //# sourceMappingURL= comment from the generated .js file but you still want to generate the .js.map files. |
| Inline sourceMap mode - If you want to insert the entire source map into the .js file instead of generating a separate .js.map file. |
| Both sourceMap mode - If you want to have the effect of both inline and external simultaneously. |
DEFAULT
Default sourceMap mode - will generate a .js.map file alongside any generated .js file and add a special //# sourceMappingURL= comment to the bottom of the .js file pointing to the .js.map file.
EXTERNAL
External sourceMap mode - If you want to omit the special //# sourceMappingURL= comment from the generated .js file but you still want to generate the .js.map files.
INLINE
Inline sourceMap mode - If you want to insert the entire source map into the .js file instead of generating a separate .js.map file.
BOTH
Both sourceMap mode - If you want to have the effect of both inline and external simultaneously.
TrailingComma
Members
| Name | Description |
|---|---|
| Trailing commas wherever possible (including function arguments). |
| Trailing commas where valid in ES5 (objects, arrays, etc.). |
| No trailing commas. |
ALL
Trailing commas wherever possible (including function arguments).
ES5
Trailing commas where valid in ES5 (objects, arrays, etc.).
NONE
No trailing commas.
TypeScriptImportsNotUsedAsValues
This flag controls how import works, there are 3 different options.
https://www.typescriptlang.org/tsconfig#importsNotUsedAsValues
Members
| Name | Description |
|---|---|
| The default behavior of dropping import statements which only reference types. |
| Preserves all import statements whose values or types are never used. |
| This preserves all imports (the same as the preserve option), but will error when a value import is only used as a type. |
REMOVE
The default behavior of dropping import statements which only reference types.
PRESERVE
Preserves all import statements whose values or types are never used.
This can cause imports/side-effects to be preserved.
ERROR
This preserves all imports (the same as the preserve option), but will error when a value import is only used as a type.
This might be useful if you want to ensure no values are being accidentally imported, but still make side-effect imports explicit.
TypeScriptJsxMode
Determines how JSX should get transformed into valid JavaScript.
Members
| Name | Description |
|---|---|
| Keeps the JSX as part of the output to be further consumed by another transform step (e.g. Babel). |
| Converts JSX syntax into React.createElement, does not need to go through a JSX transformation before use, and the output will have a .js file extension. |
| Keeps all JSX like 'preserve' mode, but output will have a .js extension. |
| Passes key separately from props and always passes children as props (since React 17). |
| Same as REACT_JSX with additional debug data. |
PRESERVE
Keeps the JSX as part of the output to be further consumed by another transform step (e.g. Babel).
REACT
Converts JSX syntax into React.createElement, does not need to go through a JSX transformation before use, and the output will have a .js file extension.
REACT_NATIVE
Keeps all JSX like 'preserve' mode, but output will have a .js extension.
REACT_JSX
Passes key separately from props and always passes children as props (since React 17).
REACT_JSXDEV
Same as REACT_JSX with additional debug data.
TypeScriptModuleDetection
This setting controls how TypeScript determines whether a file is a script or a module.
https://www.typescriptlang.org/docs/handbook/modules/theory.html#scripts-and-modules-in-javascript
Members
| Name | Description |
|---|---|
| TypeScript will not only look for import and export statements, but it will also check whether the "type" field in a package.json is set to "module" when running with module: nodenext or node16, and check whether the current file is a JSX file when running under jsx: react-jsx. |
| The same behavior as 4.6 and prior, usings import and export statements to determine whether a file is a module. |
| Ensures that every non-declaration file is treated as a module. |
AUTO
TypeScript will not only look for import and export statements, but it will also check whether the "type" field in a package.json is set to "module" when running with module: nodenext or node16, and check whether the current file is a JSX file when running under jsx: react-jsx.
LEGACY
The same behavior as 4.6 and prior, usings import and export statements to determine whether a file is a module.
FORCE
Ensures that every non-declaration file is treated as a module.
TypeScriptModuleResolution
Determines how modules get resolved.
https://www.typescriptlang.org/docs/handbook/module-resolution.html
Members
| Name | Description |
|---|---|
| TypeScript's former default resolution strategy. |
| Resolution strategy which attempts to mimic the Node.js module resolution strategy at runtime. |
| --moduleResolution node was renamed to node10 (keeping node as an alias for backward compatibility) in TypeScript 5.0. It reflects the CommonJS module resolution algorithm as it existed in Node.js versions earlier than v12. It should no longer be used. |
| Node.js’ ECMAScript Module Support from TypeScript 4.7 onwards. |
| Node.js’ ECMAScript Module Support from TypeScript 4.7 onwards. |
| Resolution strategy which attempts to mimic resolution patterns of modern bundlers; |
CLASSIC
TypeScript's former default resolution strategy.
https://www.typescriptlang.org/docs/handbook/module-resolution.html#classic
NODE
Resolution strategy which attempts to mimic the Node.js module resolution strategy at runtime.
https://www.typescriptlang.org/docs/handbook/module-resolution.html#node
NODE10
--moduleResolution node was renamed to node10 (keeping node as an alias for backward compatibility) in TypeScript 5.0. It reflects the CommonJS module resolution algorithm as it existed in Node.js versions earlier than v12. It should no longer be used.
https://www.typescriptlang.org/docs/handbook/modules/reference.html#node10-formerly-known-as-node
NODE16
Node.js’ ECMAScript Module Support from TypeScript 4.7 onwards.
NODE_NEXT
Node.js’ ECMAScript Module Support from TypeScript 4.7 onwards.
BUNDLER
Resolution strategy which attempts to mimic resolution patterns of modern bundlers;
from TypeScript 5.0 onwards.
UpdateSnapshot
Members
| Name | Description |
|---|---|
| Always update snapshots in "test" task. |
| Never update snapshots in "test" task and create a separate "test:update" task. |
ALWAYS
Always update snapshots in "test" task.
NEVER
Never update snapshots in "test" task and create a separate "test:update" task.
YarnCacheMigrationMode
https://yarnpkg.com/configuration/yarnrc#cacheMigrationMode.
Members
| Name | Description |
|---|---|
| No description. |
| No description. |
| No description. |
REQUIRED_ONLY
MATCH_SPEC
ALWAYS
YarnChecksumBehavior
https://yarnpkg.com/configuration/yarnrc#checksumBehavior.
Members
| Name | Description |
|---|---|
| No description. |
| No description. |
| No description. |
| No description. |
THROW
UPDATE
RESET
IGNORE
YarnDefaultSemverRangePrefix
https://yarnpkg.com/configuration/yarnrc#defaultSemverRangePrefix.
Members
| Name | Description |
|---|---|
| No description. |
| No description. |
| No description. |
CARET
TILDE
EMPTY_STRING
YarnLogFilterLevel
https://v3.yarnpkg.com/configuration/yarnrc#logFilters.0.level.
Members
| Name | Description |
|---|---|
| No description. |
| No description. |
| No description. |
| No description. |
INFO
WARNING
ERROR
DISCARD
YarnNmHoistingLimit
https://yarnpkg.com/configuration/yarnrc#nmHoistingLimits.
Members
| Name | Description |
|---|---|
| No description. |
| No description. |
| No description. |
DEPENDENCIES
NONE
WORKSPACES
YarnNmMode
https://yarnpkg.com/configuration/yarnrc#nmMode.
Members
| Name | Description |
|---|---|
| No description. |
| No description. |
| No description. |
CLASSIC
HARDLINKS_LOCAL
HARDLINKS_GLOBAL
YarnNodeLinker
https://yarnpkg.com/configuration/yarnrc#nodeLinker.
Members
| Name | Description |
|---|---|
| No description. |
| No description. |
| No description. |
PNP
PNPM
NODE_MODULES
YarnNpmPublishAccess
https://yarnpkg.com/configuration/yarnrc#npmPublishAccess.
Members
| Name | Description |
|---|---|
| No description. |
| No description. |
PUBLIC
RESTRICTED
YarnPnpFallbackMode
https://yarnpkg.com/configuration/yarnrc#pnpFallbackMode.
Members
| Name | Description |
|---|---|
| No description. |
| No description. |
| No description. |
NONE
DEPENDENCIES_ONLY
ALL
YarnPnpMode
https://yarnpkg.com/configuration/yarnrc#pnpMode.
Members
| Name | Description |
|---|---|
| No description. |
| No description. |
STRICT
LOOSE
YarnProgressBarStyle
https://yarnpkg.com/configuration/yarnrc#progressBarStyle.
Members
| Name | Description |
|---|---|
| No description. |
| No description. |
| No description. |
| No description. |
| No description. |
PATRICK
SIMBA
JACK
HOGSFATHER
DEFAULT
YarnWinLinkType
https://yarnpkg.com/configuration/yarnrc#winLinkType.
Members
| Name | Description |
|---|---|
| No description. |
| No description. |
JUNCTIONS
SYMLINKS
YarnWorkerPoolMode
Members
| Name | Description |
|---|---|
| No description. |
| No description. |