Documentation - v0.0.0
    Preparing search index...

    Use TypescriptBaseBuilder instead

    Hierarchy

    • TypeScriptProject
      • TypescriptProject
    Index

    Constructors

    Properties

    artifactsDirectory: string

    The build output directory. An npm tarball will be created under the js subdirectory. For example, if this is set to dist (the default), the npm tarball will be placed under dist/js/boom-boom-1.2.3.tg.

    artifactsJavascriptDirectory: string

    The location of the npm tarball after build (${artifactsDirectory}/js).

    autoApprove?: AutoApprove

    Auto approve set up for this project.

    autoMerge?: AutoMerge

    Component that sets up mergify for merging approved pull requests.

    biome?: Biome
    buildWorkflow?: BuildWorkflow

    The PR build GitHub workflow. undefined if buildWorkflow is disabled.

    bundler: Bundler
    commitGenerated: boolean

    Whether to commit the managed files by default.

    defaultTask?: Task

    This is the "default" task, the one that executes "projen". Undefined if the project is being ejected.

    deps: Dependencies

    Project dependencies.

    devContainer: DevContainer | undefined

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

    This will be undefined if devContainer boolean is false

    docgen?: boolean
    docsDirectory: string
    eslint?: Eslint
    gitattributes: GitAttributesFile

    The .gitattributes file for this repository.

    github: GitHub | undefined

    Access all github components.

    This will be undefined for subprojects.

    gitignore: IgnoreFile

    .gitignore

    gitpod: Gitpod | undefined

    Access for Gitpod

    This will be undefined if gitpod boolean is false

    initProject?: InitProject

    The options used when this project is bootstrapped via projen new. It includes the original set of options passed to the CLI and also the JSII FQN of the project type.

    jest?: Jest

    The Jest configuration (if enabled)

    libdir: string

    The directory in which compiled .js files reside.

    lintConfig: LintConfig
    logger: Logger

    Logging utilities.

    name: string

    Project name.

    node: Node

    The tree node.

    nodeVersion?: string
    npmignore?: IgnoreFile

    The .npmignore file.

    outdir: string

    Absolute output directory of this project.

    package: NodePackage

    API for managing the node package.

    parent?: Project

    A parent project. If undefined, this is the root project.

    prettier?: Prettier
    projectBuild: ProjectBuild

    Manages the build process of the project.

    projectName: ProjectName
    projectType: ProjectType
    publisher?: Publisher

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

    use release.publisher.

    release?: Release

    Release management.

    runScriptCommand: string

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

    srcdir: string

    The directory in which the .ts sources reside.

    tasks: Tasks

    Project tasks.

    testdir: string

    The directory in which tests reside.

    tsconfig: TypescriptConfig
    tsconfigContainer: TypescriptConfigContainer
    tsconfigDev: TypescriptConfig

    A typescript configuration file which covers all files (sources, tests, projen).

    tsconfigEslint?: TypescriptConfig
    upgradeWorkflow?: UpgradeDependencies

    The upgrade workflow.

    vscode: VsCode | undefined

    Access all VSCode components.

    This will be undefined for subprojects.

    watchTask: Task

    The "watch" task.

    workflowBootstrapSteps: JobStep[]
    workflowPackageCache: boolean
    DEFAULT_TASK: "default"

    The name of the default task (the task executed when projen is run without arguments). Normally this task should synthesize the project files.

    DEFAULT_TS_JEST_TRANFORM_PATTERN: "^.+\\.[t]sx?$"

    Accessors

    • get allowLibraryDependencies(): boolean

      Returns boolean

      use package.allowLibraryDependencies

    • get buildTask(): Task

      Returns Task

    • get buildWorkflowJobId(): string | undefined

      The job ID of the build workflow.

      Returns string | undefined

    • get compileTask(): Task

      Returns Task

    • get components(): Component[]

      Returns all the components within this project.

      Returns Component[]

    • get ejected(): boolean

      Whether or not the project is being ejected.

      Returns boolean

    • get entrypoint(): string

      Returns string

      use package.entrypoint

    • get files(): FileBase[]

      All files in this project.

      Returns FileBase[]

    • get manifest(): any

      Returns any

      use package.addField(x, y)

    • get maxNodeVersion(): string | undefined

      Maximum node version supported by this package.

      The value indicates the package is incompatible with newer versions.

      Returns string | undefined

    • get minNodeVersion(): string | undefined

      The minimum node version required by this package to function.

      This value indicates the package is incompatible with older versions.

      Returns string | undefined

    • get npmrc(): NpmConfig

      The .npmrc file

      Returns NpmConfig

    • get packageManager(): NodePackageManager

      The package manager to use.

      Returns NodePackageManager

      use package.packageManager

    • get packageTask(): Task

      Returns Task

    • get postCompileTask(): Task

      Returns Task

    • get preCompileTask(): Task

      Returns Task

    • get projenCommand(): string

      The command to use in order to run the projen CLI.

      Returns string

    • get root(): Project

      The root project.

      Returns Project

    • get subprojects(): Project[]

      Returns all the subprojects within this project.

      Returns Project[]

    • get testTask(): Task

      Returns Task

    Methods

    • Parameters

      • bins: Record<string, string>

      Returns void

    • Defines bundled dependencies.

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

      Parameters

      • ...deps: string[]

        Names modules to install. By default, the the dependency will be installed in the next npx projen run and the version will be recorded in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax: module@^7.

      Returns void

    • DEPRECATED

      Parameters

      • ...commands: string[]

      Returns void

      use project.compileTask.exec()

    • Defines normal dependencies.

      Parameters

      • ...deps: string[]

        Names modules to install. By default, the the dependency will be installed in the next npx projen run and the version will be recorded in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax: module@^7.

      Returns void

    • Defines development/test dependencies.

      Parameters

      • ...deps: string[]

        Names modules to install. By default, the the dependency will be installed in the next npx projen run and the version will be recorded in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax: module@^7.

      Returns 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.

      Parameters

      • ...globs: string[]

        The glob patterns to match

      Returns void

    • Directly set fields in package.json.

      Parameters

      • fields: { [name: string]: any }

        The fields to set

      Returns void

    • Adds a .gitignore pattern.

      Parameters

      • pattern: string

        The glob pattern to ignore.

      Returns void

    • Adds keywords to package.json (deduplicated)

      Parameters

      • ...keywords: string[]

        The keywords to add

      Returns void

    • Adds patterns to be ignored by npm.

      Parameters

      • pattern: string

        The pattern to ignore.

      Returns void

      If you are having trouble getting an ignore to populate, try using your construct or component's preSynthesize method to properly delay calling this method.

    • 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.

      Parameters

      • ...deps: string[]

        Names modules to install. By default, the the dependency will be installed in the next npx projen run and the version will be recorded in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax: module@^7.

      Returns void

    • Replaces the contents of multiple npm package.json scripts.

      Parameters

      • scripts: { [name: string]: string }

        The scripts to set

      Returns void

    • Adds a new task to this project. This will fail if the project already has a task with this name.

      Parameters

      • name: string

        The task name to add

      • Optionalprops: TaskOptions

        Task properties

      Returns Task

    • DEPRECATED

      Parameters

      • ...commands: string[]

      Returns void

      use project.testTask.exec()

    • Prints a "tip" message during synthesis.

      Parameters

      • message: string

        The message

      Returns void

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

      • ...dependency: [
            options: | string
            | NodeProject
            | { addTsPath: boolean; depType: DependencyType },
            ...deps: (string | NodeProject)[],
        ]

      Returns 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.

      Parameters

      • glob: string

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

      Returns void

    • Projen default Typescript compiler options.

      Returns TypeScriptCompilerOptions

    • Indicates if a script by the name name is defined.

      Parameters

      • name: string

        The name of the script

      Returns boolean

      Use project.tasks.tryFind(name)

    • Called after all components are synthesized. Order is not guaranteed.

      Returns void

    • Called before all components are synthesized.

      Returns void

    • Removes the npm script (always successful).

      Parameters

      • name: string

        The name of the script.

      Returns void

    • Removes a task from a project.

      Parameters

      • name: string

        The name of the task to remove.

      Returns Task | undefined

      The Task that was removed, otherwise undefined.

    • Returns the set of workflow steps which should be executed to bootstrap a workflow.

      Parameters

      • Optionaloptions: RenderWorkflowSetupOptions

        Options.

      Returns JobStep[]

      Job steps

    • Returns the shell command to execute in order to run a task. This will typically be npx projen TASK.

      Parameters

      • task: Task

        The task for which the command is required

      Returns string

    • Replaces the contents of an npm package.json script.

      Parameters

      • name: string

        The script name

      • command: string

        The command to execute

      Returns void

    • Synthesize all project files into outdir.

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

      Returns void

    • Returns a string representation of this construct.

      Returns string

    • Finds a file at the specified relative path within this project and all its subprojects.

      Parameters

      • filePath: string

        The file path. If this path is relative, it will be resolved from the root of this project.

      Returns FileBase | undefined

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

    • Finds a json file by name.

      Parameters

      • filePath: string

        The file path.

      Returns JsonFile | undefined

      use tryFindObjectFile

    • Finds an object file (like JsonFile, YamlFile, etc.) by name.

      Parameters

      • filePath: string

        The file path.

      Returns ObjectFile | undefined

    • Finds a file at the specified relative path within this project and removes it.

      Parameters

      • filePath: string

        The file path. If this path is relative, it will be resolved from the root of this project.

      Returns FileBase | undefined

      a FileBase if the file was found and removed, or undefined if the file was not found.

    • 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.

      Parameters

      • ...mixins: IMixin[]

        The mixins to apply

      Returns IConstruct

      This construct for chaining

    • 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.

      Parameters

      • x: any

        Any object

      Returns x is Construct

      true if x is an object created from a class which extends Construct.

    • Test whether the given construct is a project.

      Parameters

      • x: any

      Returns x is Project

    • Find the closest ancestor project for given construct. When given a project, this it the project itself.

      Parameters

      • construct: IConstruct

      Returns Project

      when no project is found in the path to the root