import { OpsBRTypeScriptProject } from '@opsbr/projen-typescript'
new OpsBRTypeScriptProject(options: TypeScriptProjectOptions)
Name | Type | Description |
---|---|---|
options |
projen.typescript.TypeScriptProjectOptions |
No description. |
- Type: projen.typescript.TypeScriptProjectOptions
Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
addExcludeFromCleanup |
Exclude the matching files from pre-synth cleanup. |
addGitIgnore |
Adds a .gitignore pattern. |
addPackageIgnore |
Adds patterns to be ignored by npm. |
addTask |
Adds a new task to this project. |
addTip |
Prints a "tip" message during synthesis. |
annotateGenerated |
Marks the provided file(s) as being generated. |
postSynthesize |
Called after all components are synthesized. |
preSynthesize |
Called before all components are synthesized. |
removeTask |
Removes a task from a project. |
runTaskCommand |
Returns the shell command to execute in order to run a task. |
synth |
Synthesize all project files into outdir . |
tryFindFile |
Finds a file at the specified relative path within this project and all its subprojects. |
tryFindJsonFile |
Finds a json file by name. |
tryFindObjectFile |
Finds an object file (like JsonFile, YamlFile, etc.) by name. |
tryRemoveFile |
Finds a file at the specified relative path within this project and removes it. |
addBins |
No description. |
addBundledDeps |
Defines bundled dependencies. |
addCompileCommand |
DEPRECATED. |
addDeps |
Defines normal dependencies. |
addDevDeps |
Defines development/test dependencies. |
addFields |
Directly set fields in package.json . |
addKeywords |
Adds keywords to package.json (deduplicated). |
addPeerDeps |
Defines peer dependencies. |
addScripts |
Replaces the contents of multiple npm package.json scripts. |
addTestCommand |
DEPRECATED. |
hasScript |
Indicates if a script by the name name is defined. |
removeScript |
Removes the npm script (always successful). |
renderWorkflowSetup |
Returns the set of workflow steps which should be executed to bootstrap a workflow. |
setScript |
Replaces the contents of an npm package.json script. |
public toString(): string
Returns a string representation of this construct.
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.
- Type: string
The glob patterns to match.
public addGitIgnore(pattern: string): void
Adds a .gitignore pattern.
- Type: string
The glob pattern to ignore.
public addPackageIgnore(pattern: string): void
Adds patterns to be ignored by npm.
- Type: string
The pattern to ignore.
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.
- Type: string
The task name to add.
- Type: projen.TaskOptions
Task properties.
public addTip(message: string): void
Prints a "tip" message during synthesis.
- Type: string
The message.
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
- Type: string
the glob pattern to match (could be a file path).
public postSynthesize(): void
Called after all components are synthesized.
Order is not guaranteed.
public preSynthesize(): void
Called before all components are synthesized.
public removeTask(name: string): Task
Removes a task from a project.
- Type: string
The name of the task to remove.
public runTaskCommand(task: Task): string
Returns the shell command to execute in order to run a task.
This will
typically be npx projen TASK
.
- Type: projen.Task
The task for which the command is required.
public synth(): void
Synthesize all project files into outdir
.
- Call "this.preSynthesize()"
- Delete all generated files
- Synthesize all subprojects
- Synthesize all components of this project
- Call "postSynthesize()" for all components of this project
- Call "this.postSynthesize()"
public tryFindFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and all its subprojects.
- Type: string
The file path.
If this path is relative, it will be resolved from the root of this project.
public tryFindJsonFile(filePath: string): JsonFile
Finds a json file by name.
- Type: string
The file path.
public tryFindObjectFile(filePath: string): ObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
- Type: string
The file path.
public tryRemoveFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and removes it.
- Type: string
The file path.
If this path is relative, it will be resolved from the root of this project.
public addBins(bins: {[ key: string ]: string}): void
- Type: {[ key: string ]: string}
public addBundledDeps(deps: string): void
Defines bundled dependencies.
Bundled dependencies will be added as normal dependencies as well as to the
bundledDependencies
section of your package.json
.
- Type: string
Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
public addCompileCommand(commands: string): void
DEPRECATED.
- Type: string
public addDeps(deps: string): void
Defines normal dependencies.
- Type: string
Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
public addDevDeps(deps: string): void
Defines development/test dependencies.
- Type: string
Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
public addFields(fields: {[ key: string ]: any}): void
Directly set fields in package.json
.
- Type: {[ key: string ]: any}
The fields to set.
public addKeywords(keywords: string): void
Adds keywords to package.json (deduplicated).
- Type: string
The keywords to add.
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.
- Type: string
Names modules to install.
By default, the the dependency will
be installed in the next npx projen
run and the version will be recorded
in your package.json
file. You can upgrade manually or using yarn add/upgrade
. If you wish to specify a version range use this syntax:
module@^7
.
public addScripts(scripts: {[ key: string ]: string}): void
Replaces the contents of multiple npm package.json scripts.
- Type: {[ key: string ]: string}
The scripts to set.
public addTestCommand(commands: string): void
DEPRECATED.
- Type: string
public hasScript(name: string): boolean
Indicates if a script by the name name is defined.
- Type: string
The name of the script.
public removeScript(name: string): void
Removes the npm script (always successful).
- Type: string
The name of the script.
public renderWorkflowSetup(options?: RenderWorkflowSetupOptions): JobStep[]
Returns the set of workflow steps which should be executed to bootstrap a workflow.
- Type: projen.javascript.RenderWorkflowSetupOptions
Options.
public setScript(name: string, command: string): void
Replaces the contents of an npm package.json script.
- Type: string
The script name.
- Type: string
The command to execute.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isProject |
Test whether the given construct is a project. |
of |
Find the closest ancestor project for given construct. |
import { OpsBRTypeScriptProject } from '@opsbr/projen-typescript'
OpsBRTypeScriptProject.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.
- Type: any
Any object.
import { OpsBRTypeScriptProject } from '@opsbr/projen-typescript'
OpsBRTypeScriptProject.isProject(x: any)
Test whether the given construct is a project.
- Type: any
import { OpsBRTypeScriptProject } from '@opsbr/projen-typescript'
OpsBRTypeScriptProject.of(construct: IConstruct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
- Type: constructs.IConstruct
Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
buildTask |
projen.Task |
No description. |
commitGenerated |
boolean |
Whether to commit the managed files by default. |
compileTask |
projen.Task |
No description. |
components |
projen.Component[] |
Returns all the components within this project. |
deps |
projen.Dependencies |
Project dependencies. |
ejected |
boolean |
Whether or not the project is being ejected. |
files |
projen.FileBase[] |
All files in this project. |
gitattributes |
projen.GitAttributesFile |
The .gitattributes file for this repository. |
gitignore |
projen.IgnoreFile |
.gitignore. |
logger |
projen.Logger |
Logging utilities. |
name |
string |
Project name. |
outdir |
string |
Absolute output directory of this project. |
packageTask |
projen.Task |
No description. |
postCompileTask |
projen.Task |
No description. |
preCompileTask |
projen.Task |
No description. |
projectBuild |
projen.ProjectBuild |
Manages the build process of the project. |
projenCommand |
string |
The command to use in order to run the projen CLI. |
root |
projen.Project |
The root project. |
subprojects |
projen.Project[] |
Returns all the subprojects within this project. |
tasks |
projen.Tasks |
Project tasks. |
testTask |
projen.Task |
No description. |
defaultTask |
projen.Task |
This is the "default" task, the one that executes "projen". |
initProject |
projen.InitProject |
The options used when this project is bootstrapped via projen new . |
parent |
projen.Project |
A parent project. |
projectType |
projen.ProjectType |
No description. |
autoApprove |
projen.github.AutoApprove |
Auto approve set up for this project. |
devContainer |
projen.vscode.DevContainer |
Access for .devcontainer.json (used for GitHub Codespaces). |
github |
projen.github.GitHub |
Access all github components. |
gitpod |
projen.Gitpod |
Access for Gitpod. |
vscode |
projen.vscode.VsCode |
Access all VSCode components. |
allowLibraryDependencies |
boolean |
No description. |
artifactsDirectory |
string |
The build output directory. |
artifactsJavascriptDirectory |
string |
The location of the npm tarball after build (${artifactsDirectory}/js ). |
bundler |
projen.javascript.Bundler |
No description. |
entrypoint |
string |
No description. |
manifest |
any |
No description. |
npmrc |
projen.javascript.NpmConfig |
The .npmrc file. |
package |
projen.javascript.NodePackage |
API for managing the node package. |
packageManager |
projen.javascript.NodePackageManager |
The package manager to use. |
runScriptCommand |
string |
The command to use to run scripts (e.g. yarn run or npm run depends on the package manager). |
autoMerge |
projen.github.AutoMerge |
Component that sets up mergify for merging approved pull requests. |
buildWorkflow |
projen.build.BuildWorkflow |
The PR build GitHub workflow. |
buildWorkflowJobId |
string |
The job ID of the build workflow. |
jest |
projen.javascript.Jest |
The Jest configuration (if enabled). |
maxNodeVersion |
string |
Maximum node version required by this package. |
minNodeVersion |
string |
Minimum node.js version required by this package. |
npmignore |
projen.IgnoreFile |
The .npmignore file. |
prettier |
projen.javascript.Prettier |
No description. |
publisher |
projen.release.Publisher |
Package publisher. |
release |
projen.release.Release |
Release management. |
upgradeWorkflow |
projen.javascript.UpgradeDependencies |
The upgrade workflow. |
docsDirectory |
string |
No description. |
libdir |
string |
The directory in which compiled .js files reside. |
srcdir |
string |
The directory in which the .ts sources reside. |
testdir |
string |
The directory in which tests reside. |
tsconfigDev |
projen.javascript.TypescriptConfig |
A typescript configuration file which covers all files (sources, tests, projen). |
watchTask |
projen.Task |
The "watch" task. |
docgen |
boolean |
No description. |
eslint |
projen.javascript.Eslint |
No description. |
tsconfig |
projen.javascript.TypescriptConfig |
No description. |
tsconfigEslint |
projen.javascript.TypescriptConfig |
No description. |
public readonly node: Node;
- Type: constructs.Node
The tree node.
public readonly buildTask: Task;
- Type: projen.Task
public readonly commitGenerated: boolean;
- Type: boolean
Whether to commit the managed files by default.
public readonly compileTask: Task;
- Type: projen.Task
public readonly components: Component[];
- Type: projen.Component[]
Returns all the components within this project.
public readonly deps: Dependencies;
- Type: projen.Dependencies
Project dependencies.
public readonly ejected: boolean;
- Type: boolean
Whether or not the project is being ejected.
public readonly files: FileBase[];
- Type: projen.FileBase[]
All files in this project.
public readonly gitattributes: GitAttributesFile;
- Type: projen.GitAttributesFile
The .gitattributes file for this repository.
public readonly gitignore: IgnoreFile;
- Type: projen.IgnoreFile
.gitignore.
public readonly logger: Logger;
- Type: projen.Logger
Logging utilities.
public readonly name: string;
- Type: string
Project name.
public readonly outdir: string;
- Type: string
Absolute output directory of this project.
public readonly packageTask: Task;
- Type: projen.Task
public readonly postCompileTask: Task;
- Type: projen.Task
public readonly preCompileTask: Task;
- Type: projen.Task
public readonly projectBuild: ProjectBuild;
- Type: projen.ProjectBuild
Manages the build process of the project.
public readonly projenCommand: string;
- Type: string
The command to use in order to run the projen CLI.
public readonly root: Project;
- Type: projen.Project
The root project.
public readonly subprojects: Project[];
- Type: projen.Project[]
Returns all the subprojects within this project.
public readonly tasks: Tasks;
- Type: projen.Tasks
Project tasks.
public readonly testTask: Task;
- Type: projen.Task
public readonly defaultTask: Task;
- Type: projen.Task
This is the "default" task, the one that executes "projen".
Undefined if the project is being ejected.
public readonly initProject: InitProject;
- Type: projen.InitProject
The options used when this project is bootstrapped via projen new
.
It includes the original set of options passed to the CLI and also the JSII FQN of the project type.
public readonly parent: Project;
- Type: projen.Project
A parent project.
If undefined, this is the root project.
public readonly projectType: ProjectType;
- Type: projen.ProjectType
public readonly autoApprove: AutoApprove;
- Type: projen.github.AutoApprove
Auto approve set up for this project.
public readonly devContainer: DevContainer;
- Type: projen.vscode.DevContainer
Access for .devcontainer.json (used for GitHub Codespaces).
This will be undefined
if devContainer boolean is false
public readonly github: GitHub;
- Type: projen.github.GitHub
Access all github components.
This will be undefined
for subprojects.
public readonly gitpod: Gitpod;
- Type: projen.Gitpod
Access for Gitpod.
This will be undefined
if gitpod boolean is false
public readonly vscode: VsCode;
- Type: projen.vscode.VsCode
Access all VSCode components.
This will be undefined
for subprojects.
- Deprecated: use
package.allowLibraryDependencies
public readonly allowLibraryDependencies: boolean;
- Type: boolean
public readonly artifactsDirectory: string;
- Type: string
The build output directory.
An npm tarball will be created under the js
subdirectory. For example, if this is set to dist
(the default), the npm
tarball will be placed under dist/js/boom-boom-1.2.3.tg
.
public readonly artifactsJavascriptDirectory: string;
- Type: string
The location of the npm tarball after build (${artifactsDirectory}/js
).
public readonly bundler: Bundler;
- Type: projen.javascript.Bundler
- Deprecated: use
package.entrypoint
public readonly entrypoint: string;
- Type: string
- Deprecated: use
package.addField(x, y)
public readonly manifest: any;
- Type: any
public readonly npmrc: NpmConfig;
- Type: projen.javascript.NpmConfig
The .npmrc file.
public readonly package: NodePackage;
- Type: projen.javascript.NodePackage
API for managing the node package.
- Deprecated: use
package.packageManager
public readonly packageManager: NodePackageManager;
- Type: projen.javascript.NodePackageManager
The package manager to use.
public readonly runScriptCommand: string;
- Type: string
The command to use to run scripts (e.g. yarn run
or npm run
depends on the package manager).
public readonly autoMerge: AutoMerge;
- Type: projen.github.AutoMerge
Component that sets up mergify for merging approved pull requests.
public readonly buildWorkflow: BuildWorkflow;
- Type: projen.build.BuildWorkflow
The PR build GitHub workflow.
undefined
if buildWorkflow
is disabled.
public readonly buildWorkflowJobId: string;
- Type: string
The job ID of the build workflow.
public readonly jest: Jest;
- Type: projen.javascript.Jest
The Jest configuration (if enabled).
public readonly maxNodeVersion: string;
- Type: string
Maximum node version required by this package.
public readonly minNodeVersion: string;
- Type: string
Minimum node.js version required by this package.
public readonly npmignore: IgnoreFile;
- Type: projen.IgnoreFile
The .npmignore file.
public readonly prettier: Prettier;
- Type: projen.javascript.Prettier
- Deprecated: use
release.publisher
.
public readonly publisher: Publisher;
- Type: projen.release.Publisher
Package publisher.
This will be undefined
if the project does not have a
release workflow.
public readonly release: Release;
- Type: projen.release.Release
Release management.
public readonly upgradeWorkflow: UpgradeDependencies;
- Type: projen.javascript.UpgradeDependencies
The upgrade workflow.
public readonly docsDirectory: string;
- Type: string
public readonly libdir: string;
- Type: string
The directory in which compiled .js files reside.
public readonly srcdir: string;
- Type: string
The directory in which the .ts sources reside.
public readonly testdir: string;
- Type: string
The directory in which tests reside.
public readonly tsconfigDev: TypescriptConfig;
- Type: projen.javascript.TypescriptConfig
A typescript configuration file which covers all files (sources, tests, projen).
public readonly watchTask: Task;
- Type: projen.Task
The "watch" task.
public readonly docgen: boolean;
- Type: boolean
public readonly eslint: Eslint;
- Type: projen.javascript.Eslint
public readonly tsconfig: TypescriptConfig;
- Type: projen.javascript.TypescriptConfig
public readonly tsconfigEslint: TypescriptConfig;
- Type: projen.javascript.TypescriptConfig
Name | Type | Description |
---|---|---|
DEFAULT_TASK |
string |
The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TS_JEST_TRANFORM_PATTERN |
string |
No description. |
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.
public readonly DEFAULT_TS_JEST_TRANFORM_PATTERN: string;
- Type: string