Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LernaProject

Hierarchy

  • NodeProject
    • LernaProject

Index

Constructors

constructor

Properties

Readonly antitamper

antitamper: boolean

(experimental) Indicates if workflows have anti-tamper checks.

experimental

Optional Readonly autoApprove

autoApprove: AutoApprove

(deprecated) Auto approve set up for this project.

deprecated

Optional Readonly autoMerge

autoMerge: AutoMerge

(experimental) Automatic PR merges.

experimental

Readonly buildTask

buildTask: Task

(experimental) The task responsible for a full release build.

It spawns: compile + test + release + package

experimental

Optional Readonly buildWorkflow

buildWorkflow: TaskWorkflow

(experimental) The PR build GitHub workflow.

undefined if buildWorkflow is disabled.

experimental

Optional Readonly buildWorkflowJobId

buildWorkflowJobId: string
experimental

Readonly compileTask

compileTask: Task

(experimental) Compiles the code.

By default for node.js projects this task is empty.

experimental

Readonly deps

deps: Dependencies

(experimental) Project dependencies.

experimental

Readonly devContainer

devContainer: undefined | DevContainer

(deprecated) Access for .devcontainer.json (used for GitHub Codespaces).

This will be undefined if devContainer boolean is false

deprecated

Readonly gitattributes

gitattributes: GitAttributesFile

(experimental) The .gitattributes file for this repository.

experimental

Readonly github

github: undefined | GitHub

(deprecated) Access all github components.

This will be undefined for subprojects.

deprecated

Readonly gitignore

gitignore: IgnoreFile

(experimental) .gitignore.

experimental

Readonly gitpod

gitpod: undefined | Gitpod

(deprecated) Access for Gitpod.

This will be undefined if gitpod boolean is false

deprecated

Optional Readonly jest

jest: Jest

(experimental) The Jest configuration (if enabled).

experimental

Readonly logger

logger: Logger

(experimental) Logging utilities.

experimental

Readonly name

name: string

(experimental) Project name.

experimental

Optional Readonly newProject

newProject: NewProject

(experimental) 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.

experimental

Protected Readonly npmDistTag

npmDistTag: string
deprecated

use package.npmDistTag

Protected Readonly npmRegistry

npmRegistry: string
deprecated

use package.npmRegistry

Optional Readonly npmignore

npmignore: IgnoreFile

(experimental) The .npmignore file.

experimental

Readonly outdir

outdir: string

(experimental) Absolute output directory of this project.

experimental

Readonly package

package: NodePackage

(experimental) API for managing the node package.

experimental

Optional Readonly parent

parent: Project

(experimental) A parent project.

If undefined, this is the root project.

experimental

Readonly projectType

projectType: ProjectType
deprecated

Optional Readonly publisher

publisher: Publisher

(deprecated) Package publisher.

This will be undefined if the project does not have a release workflow.

deprecated

use release.publisher.

Optional Readonly release

release: Release

(experimental) Release management.

experimental

Readonly root

root: Project

(experimental) The root project.

experimental

Readonly runScriptCommand

runScriptCommand: string

(experimental) The command to use to run scripts (e.g. yarn run or npm run depends on the package manager).

experimental

Private subProjects

subProjects: Record<string, Project>

Readonly tasks

tasks: Tasks

(experimental) Project tasks.

experimental

Readonly testCompileTask

testCompileTask: Task

(experimental) Compiles the test code.

experimental

Readonly testTask

testTask: Task

(experimental) Tests the code.

experimental

Readonly vscode

vscode: undefined | VsCode

(deprecated) Access all VSCode components.

This will be undefined for subprojects.

deprecated

Static Readonly DEFAULT_TASK

DEFAULT_TASK: "default" = "default"

(experimental) The name of the default task (the task executed when projen is run without arguments).

Normally this task should synthesize the project files.

experimental

Accessors

allowLibraryDependencies

  • get allowLibraryDependencies(): boolean
  • deprecated

    use package.allowLibraryDependencies

    Returns boolean

components

  • get components(): Component[]
  • (experimental) Returns all the components within this project.

    experimental

    Returns Component[]

entrypoint

  • get entrypoint(): string
  • deprecated

    use package.entrypoint

    Returns string

files

  • get files(): FileBase[]
  • (experimental) All files in this project.

    experimental

    Returns FileBase[]

installWorkflowSteps

  • get installWorkflowSteps(): JobStep[]
  • experimental

    Returns JobStep[]

manifest

  • get manifest(): any
  • deprecated

    use package.addField(x, y)

    Returns any

maxNodeVersion

  • get maxNodeVersion(): undefined | string
  • (experimental) Maximum node version required by this pacakge.

    experimental

    Returns undefined | string

minNodeVersion

  • get minNodeVersion(): undefined | string
  • (experimental) Minimum node.js version required by this package.

    experimental

    Returns undefined | string

packageManager

  • get packageManager(): NodePackageManager
  • (deprecated) The package manager to use.

    deprecated

    use package.packageManager

    Returns NodePackageManager

projenCommand

  • get projenCommand(): string
  • (experimental) The command to use in order to run the projen CLI.

    experimental

    Returns string

Methods

addBins

  • addBins(bins: Record<string, string>): void
  • experimental

    Parameters

    • bins: Record<string, string>

    Returns void

addBuildCommand

  • addBuildCommand(...commands: string[]): void
  • (deprecated) DEPRECATED.

    deprecated

    use project.buildTask.exec()

    Parameters

    • Rest ...commands: string[]

    Returns void

addBundledDeps

  • addBundledDeps(...deps: string[]): void
  • (experimental) Defines bundled dependencies.

    Bundled dependencies will be added as normal dependencies as well as to the bundledDependencies section of your package.json.

    experimental

    Parameters

    • Rest ...deps: string[]

      Names modules to install.

    Returns void

addCompileCommand

  • addCompileCommand(...commands: string[]): void
  • (deprecated) DEPRECATED.

    deprecated

    use project.compileTask.exec()

    Parameters

    • Rest ...commands: string[]

    Returns void

addDeps

  • addDeps(...deps: string[]): void
  • (experimental) Defines normal dependencies.

    experimental

    Parameters

    • Rest ...deps: string[]

      Names modules to install.

    Returns void

addDevDeps

  • addDevDeps(...deps: string[]): void
  • (experimental) Defines development/test dependencies.

    experimental

    Parameters

    • Rest ...deps: string[]

      Names modules to install.

    Returns void

addExcludeFromCleanup

  • addExcludeFromCleanup(...globs: string[]): void
  • (experimental) 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.

    experimental

    Parameters

    • Rest ...globs: string[]

      The glob patterns to match.

    Returns void

addFields

  • addFields(fields: {}): void
  • (experimental) Directly set fields in package.json.

    experimental

    Parameters

    • fields: {}

      The fields to set.

      • [name: string]: any

    Returns void

addGitIgnore

  • addGitIgnore(pattern: string): void
  • (experimental) Adds a .gitignore pattern.

    experimental

    Parameters

    • pattern: string

      The glob pattern to ignore.

    Returns void

addKeywords

  • addKeywords(...keywords: string[]): void
  • (experimental) Adds keywords to package.json (deduplicated).

    experimental

    Parameters

    • Rest ...keywords: string[]

      The keywords to add.

    Returns void

addPackageIgnore

  • addPackageIgnore(pattern: string): void
  • (experimental) Exclude these files from the bundled package.

    Implemented by project types based on the packaging mechanism. For example, NodeProject delegates this to .npmignore.

    experimental

    Parameters

    • pattern: string

    Returns void

addPeerDeps

  • addPeerDeps(...deps: string[]): void
  • (experimental) 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.

    experimental

    Parameters

    • Rest ...deps: string[]

      Names modules to install.

    Returns void

addSubProject

  • addSubProject(subProject: Project): void
  • Parameters

    • subProject: Project

    Returns void

addTask

  • addTask(name: string, props?: TaskOptions): Task
  • (experimental) Adds a new task to this project.

    This will fail if the project already has a task with this name.

    experimental

    Parameters

    • name: string

      The task name to add.

    • Optional props: TaskOptions

      Task properties.

    Returns Task

addTestCommand

  • addTestCommand(...commands: string[]): void
  • (deprecated) DEPRECATED.

    deprecated

    use project.testTask.exec()

    Parameters

    • Rest ...commands: string[]

    Returns void

addTip

  • addTip(message: string): void
  • (deprecated) Prints a "tip" message during synthesis.

    deprecated
    • use project.logger.info(message) to show messages during synthesis

    Parameters

    • message: string

      The message.

    Returns void

annotateGenerated

  • annotateGenerated(glob: string): void
  • (deprecated) 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.

    see

    https://github.com/github/linguist/blob/master/docs/overrides.md

    deprecated

    Parameters

    • glob: string

      the glob pattern to match (could be a file path).

    Returns void

hasScript

  • hasScript(name: string): boolean
  • (experimental) Indicates if a script by the name name is defined.

    experimental

    Parameters

    • name: string

      The name of the script.

    Returns boolean

postSynthesize

  • postSynthesize(): void
  • (experimental) Called after all components are synthesized.

    Order is not guaranteed.

    experimental

    Returns void

preSynthesize

  • preSynthesize(): void
  • Returns void

removeScript

  • removeScript(name: string): void
  • (experimental) Removes the npm script (always successful).

    experimental

    Parameters

    • name: string

      The name of the script.

    Returns void

removeTask

  • removeTask(name: string): undefined | Task
  • (experimental) Removes a task from a project.

    experimental

    Parameters

    • name: string

      The name of the task to remove.

    Returns undefined | Task

    The Task that was removed, otherwise undefined.

runTaskCommand

  • runTaskCommand(task: Task): string
  • (experimental) Returns the shell command to execute in order to run a task.

    This will typically be npx projen TASK.

    experimental

    Parameters

    • task: Task

      The task for which the command is required.

    Returns string

setScript

  • setScript(name: string, command: string): void
  • (experimental) Replaces the contents of an npm package.json script.

    experimental

    Parameters

    • name: string

      The script name.

    • command: string

      The command to execute.

    Returns void

synth

  • synth(): void
  • (experimental) Synthesize all project files into outdir.

    1. Call "this.preSynthesize()"
    2. Delete all generated files
    3. Synthesize all sub-projects
    4. Synthesize all components of this project
    5. Call "postSynthesize()" for all components of this project
    6. Call "this.postSynthesize()"
    experimental

    Returns void

tryFindFile

  • tryFindFile(filePath: string): undefined | FileBase
  • (experimental) Finds a file at the specified relative path within this project and all its subprojects.

    experimental

    Parameters

    • filePath: string

      The file path.

    Returns undefined | FileBase

    a FileBase or undefined if there is no file in that path

tryFindJsonFile

  • tryFindJsonFile(filePath: string): undefined | JsonFile
  • (deprecated) Finds a json file by name.

    deprecated

    use tryFindObjectFile

    Parameters

    • filePath: string

      The file path.

    Returns undefined | JsonFile

tryFindObjectFile

  • tryFindObjectFile(filePath: string): undefined | ObjectFile
  • (experimental) Finds an object file (like JsonFile, YamlFile, etc.) by name.

    experimental

    Parameters

    • filePath: string

      The file path.

    Returns undefined | ObjectFile

Generated using TypeDoc