Documentation
¶
Index ¶
- func NewBundler_Override(b Bundler, project projen.Project, options *BundlerOptions)
- func NewEslint_Override(e Eslint, project NodeProject, options *EslintOptions)
- func NewJestReporter_Override(j JestReporter, name *string, options *map[string]interface{})
- func NewJest_Override(j Jest, project NodeProject, options *JestOptions)
- func NewNodePackage_Override(n NodePackage, project projen.Project, options *NodePackageOptions)
- func NewNodeProject_Override(n NodeProject, options *NodeProjectOptions)
- func NewNpmConfig_Override(n NpmConfig, project NodeProject, options *NpmConfigOptions)
- func NewPrettier_Override(p Prettier, project NodeProject, options *PrettierOptions)
- func NewProjenrc_Override(p Projenrc, project projen.Project, options *ProjenrcOptions)
- func NewTransform_Override(t Transform, name *string, options interface{})
- func NewTypescriptConfig_Override(t TypescriptConfig, project projen.Project, options *TypescriptConfigOptions)
- func NewUpgradeDependencies_Override(u UpgradeDependencies, project NodeProject, ...)
- func NewWatchPlugin_Override(w WatchPlugin, name *string, options interface{})
- func NodeProject_DEFAULT_TASK() *string
- func Projenrc_Of(project projen.Project) projen.ProjenrcFile
- type AddBundleOptions
- type ArrowParens
- type AutoRelease
- type Bundle
- type Bundler
- type BundlerOptions
- type BundlingOptions
- type CodeArtifactAuthProvider
- type CodeArtifactOptions
- type CoverageThreshold
- type EmbeddedLanguageFormatting
- type EndOfLine
- type Eslint
- type EslintOptions
- type EslintOverride
- type HTMLWhitespaceSensitivity
- type HasteConfig
- type Jest
- type JestConfigOptions
- type JestOptions
- type JestReporter
- type NodePackage
- type NodePackageManager
- type NodePackageOptions
- type NodeProject
- type NodeProjectOptions
- type NpmAccess
- type NpmConfig
- type NpmConfigOptions
- type PeerDependencyOptions
- type Prettier
- type PrettierOptions
- type PrettierOverride
- type PrettierSettings
- type Projenrc
- type ProjenrcOptions
- type ProseWrap
- type QuoteProps
- type RenderWorkflowSetupOptions
- type ScopedPackagesOptions
- type TrailingComma
- type Transform
- type TypeScriptCompilerOptions
- type TypeScriptImportsNotUsedAsValues
- type TypeScriptJsxMode
- type TypeScriptModuleResolution
- type TypescriptConfig
- type TypescriptConfigExtends
- type TypescriptConfigOptions
- type UpdateSnapshot
- type UpgradeDependencies
- type UpgradeDependenciesOptions
- type UpgradeDependenciesSchedule
- func UpgradeDependenciesSchedule_DAILY() UpgradeDependenciesSchedule
- func UpgradeDependenciesSchedule_Expressions(cron *[]*string) UpgradeDependenciesSchedule
- func UpgradeDependenciesSchedule_MONTHLY() UpgradeDependenciesSchedule
- func UpgradeDependenciesSchedule_NEVER() UpgradeDependenciesSchedule
- func UpgradeDependenciesSchedule_WEEKDAY() UpgradeDependenciesSchedule
- func UpgradeDependenciesSchedule_WEEKLY() UpgradeDependenciesSchedule
- type UpgradeDependenciesWorkflowOptions
- type WatchPlugin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBundler_Override ¶
func NewBundler_Override(b Bundler, project projen.Project, options *BundlerOptions)
Creates a `Bundler`. Experimental.
func NewEslint_Override ¶
func NewEslint_Override(e Eslint, project NodeProject, options *EslintOptions)
Experimental.
func NewJestReporter_Override ¶
func NewJestReporter_Override(j JestReporter, name *string, options *map[string]interface{})
Experimental.
func NewJest_Override ¶
func NewJest_Override(j Jest, project NodeProject, options *JestOptions)
Experimental.
func NewNodePackage_Override ¶
func NewNodePackage_Override(n NodePackage, project projen.Project, options *NodePackageOptions)
Experimental.
func NewNodeProject_Override ¶
func NewNodeProject_Override(n NodeProject, options *NodeProjectOptions)
Experimental.
func NewNpmConfig_Override ¶
func NewNpmConfig_Override(n NpmConfig, project NodeProject, options *NpmConfigOptions)
Experimental.
func NewPrettier_Override ¶
func NewPrettier_Override(p Prettier, project NodeProject, options *PrettierOptions)
Experimental.
func NewProjenrc_Override ¶
func NewProjenrc_Override(p Projenrc, project projen.Project, options *ProjenrcOptions)
Experimental.
func NewTransform_Override ¶
Experimental.
func NewTypescriptConfig_Override ¶
func NewTypescriptConfig_Override(t TypescriptConfig, project projen.Project, options *TypescriptConfigOptions)
Experimental.
func NewUpgradeDependencies_Override ¶
func NewUpgradeDependencies_Override(u UpgradeDependencies, project NodeProject, options *UpgradeDependenciesOptions)
Experimental.
func NewWatchPlugin_Override ¶
func NewWatchPlugin_Override(w WatchPlugin, name *string, options interface{})
Experimental.
func NodeProject_DEFAULT_TASK ¶
func NodeProject_DEFAULT_TASK() *string
func Projenrc_Of ¶
func Projenrc_Of(project projen.Project) projen.ProjenrcFile
Returns the `Projenrc` instance associated with a project or `undefined` if there is no Projenrc.
Returns: A Projenrc. Experimental.
Types ¶
type AddBundleOptions ¶
type AddBundleOptions struct {
// 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.
// Default: [].
//
// Experimental.
Externals *[]*string `field:"optional" json:"externals" yaml:"externals"`
// Include a source map in the bundle.
// Default: false.
//
// Experimental.
Sourcemap *bool `field:"optional" json:"sourcemap" yaml:"sourcemap"`
// 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.
// Default: true.
//
// Experimental.
WatchTask *bool `field:"optional" json:"watchTask" yaml:"watchTask"`
// esbuild platform.
//
// Example:
// "node"
//
// Experimental.
Platform *string `field:"required" json:"platform" yaml:"platform"`
// esbuild target.
//
// Example:
// "node12"
//
// Experimental.
Target *string `field:"required" json:"target" yaml:"target"`
// Mark the output file as executable.
// Default: false.
//
// Experimental.
Executable *bool `field:"optional" json:"executable" yaml:"executable"`
// 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`
// Experimental.
Loaders *map[string]*string `field:"optional" json:"loaders" yaml:"loaders"`
// Bundler output path relative to the asset's output directory.
// Default: "index.js"
//
// Experimental.
Outfile *string `field:"optional" json:"outfile" yaml:"outfile"`
// The path of the tsconfig.json file to use for bundling.
// Default: "tsconfig.json"
//
// Experimental.
TsconfigPath *string `field:"optional" json:"tsconfigPath" yaml:"tsconfigPath"`
}
Options for `addBundle()`. Experimental.
type ArrowParens ¶
type ArrowParens string
Experimental.
const ( // Always include parens. // // Example: `(x) => x`. // Experimental. ArrowParens_ALWAYS ArrowParens = "ALWAYS" // Omit parens when possible. // // Example: `x => x`. // Experimental. ArrowParens_AVOID ArrowParens = "AVOID" )
type AutoRelease ¶
type AutoRelease string
Automatic bump modes. Experimental.
const ( // Automatically bump & release a new version for every commit to "main". // Experimental. AutoRelease_EVERY_COMMIT AutoRelease = "EVERY_COMMIT" // Automatically bump & release a new version on a daily basis. // Experimental. AutoRelease_DAILY AutoRelease = "DAILY" )
type Bundle ¶
type Bundle struct {
// The task that produces this bundle.
// Experimental.
BundleTask projen.Task `field:"required" json:"bundleTask" yaml:"bundleTask"`
// Base directory containing the output file (relative to project root).
// Experimental.
Outdir *string `field:"required" json:"outdir" yaml:"outdir"`
// Location of the output file (relative to project root).
// Experimental.
Outfile *string `field:"required" json:"outfile" yaml:"outfile"`
// The "watch" task for this bundle.
// Experimental.
WatchTask projen.Task `field:"optional" json:"watchTask" yaml:"watchTask"`
}
Experimental.
type Bundler ¶
type Bundler interface {
projen.Component
// Root bundle directory.
// Experimental.
Bundledir() *string
// 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.
// Experimental.
BundleTask() projen.Task
// The semantic version requirement for `esbuild` (if defined).
// Experimental.
EsbuildVersion() *string
// Experimental.
Project() projen.Project
// Adds a task to the project which bundles a specific entrypoint and all of its dependencies into a single javascript output file.
// Experimental.
AddBundle(entrypoint *string, options *AddBundleOptions) *Bundle
// Called after synthesis.
//
// Order is *not* guaranteed.
// Experimental.
PostSynthesize()
// Called before synthesis.
// Experimental.
PreSynthesize()
// Synthesizes files to the project output directory.
// Experimental.
Synthesize()
}
Adds support for bundling JavaScript applications and dependencies into a single file.
In the future, this will also supports bundling websites. Experimental.
func Bundler_Of ¶
Returns the `Bundler` instance associated with a project or `undefined` if there is no Bundler.
Returns: A bundler. Experimental.
func NewBundler ¶
func NewBundler(project projen.Project, options *BundlerOptions) Bundler
Creates a `Bundler`. Experimental.
type BundlerOptions ¶
type BundlerOptions struct {
// Install the `bundle` command as a pre-compile phase.
// Default: true.
//
// Experimental.
AddToPreCompile *bool `field:"optional" json:"addToPreCompile" yaml:"addToPreCompile"`
// Output directory for all bundles.
// Default: "assets".
//
// Experimental.
AssetsDir *string `field:"optional" json:"assetsDir" yaml:"assetsDir"`
// The semantic version requirement for `esbuild`.
// Default: - no specific version (implies latest).
//
// Experimental.
EsbuildVersion *string `field:"optional" json:"esbuildVersion" yaml:"esbuildVersion"`
// 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`
// Experimental.
Loaders *map[string]*string `field:"optional" json:"loaders" yaml:"loaders"`
}
Options for `Bundler`. Experimental.
type BundlingOptions ¶
type BundlingOptions struct {
// 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.
// Default: [].
//
// Experimental.
Externals *[]*string `field:"optional" json:"externals" yaml:"externals"`
// Include a source map in the bundle.
// Default: false.
//
// Experimental.
Sourcemap *bool `field:"optional" json:"sourcemap" yaml:"sourcemap"`
// 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.
// Default: true.
//
// Experimental.
WatchTask *bool `field:"optional" json:"watchTask" yaml:"watchTask"`
}
Options for bundling. Experimental.
type CodeArtifactAuthProvider ¶
type CodeArtifactAuthProvider string
Options for authorizing requests to a AWS CodeArtifact npm repository. Experimental.
const ( // Fixed credentials provided via Github secrets. // Experimental. CodeArtifactAuthProvider_ACCESS_AND_SECRET_KEY_PAIR CodeArtifactAuthProvider = "ACCESS_AND_SECRET_KEY_PAIR" // 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 // Experimental. CodeArtifactAuthProvider_GITHUB_OIDC CodeArtifactAuthProvider = "GITHUB_OIDC" )
type CodeArtifactOptions ¶
type CodeArtifactOptions struct {
// 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).
// Default: - When the `authProvider` value is set to
// `CodeArtifactAuthProvider.ACCESS_AND_SECRET_KEY_PAIR`, the default is
// "AWS_ACCESS_KEY_ID". For `CodeArtifactAuthProvider.GITHUB_OIDC`, this
// value must be left undefined.
//
// Experimental.
AccessKeyIdSecret *string `field:"optional" json:"accessKeyIdSecret" yaml:"accessKeyIdSecret"`
// Provider to use for authorizing requests to AWS CodeArtifact.
// Default: CodeArtifactAuthProvider.ACCESS_AND_SECRET_KEY_PAIR
//
// Experimental.
AuthProvider CodeArtifactAuthProvider `field:"optional" json:"authProvider" yaml:"authProvider"`
// 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.
// Default: undefined.
//
// Experimental.
RoleToAssume *string `field:"optional" json:"roleToAssume" yaml:"roleToAssume"`
// 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).
// Default: - When the `authProvider` value is set to
// `CodeArtifactAuthProvider.ACCESS_AND_SECRET_KEY_PAIR`, the default is
// "AWS_SECRET_ACCESS_KEY". For `CodeArtifactAuthProvider.GITHUB_OIDC`, this
// value must be left undefined.
//
// Experimental.
SecretAccessKeySecret *string `field:"optional" json:"secretAccessKeySecret" yaml:"secretAccessKeySecret"`
}
Options for publishing npm packages to AWS CodeArtifact. Experimental.
type CoverageThreshold ¶
type CoverageThreshold struct {
// Experimental.
Branches *float64 `field:"optional" json:"branches" yaml:"branches"`
// Experimental.
Functions *float64 `field:"optional" json:"functions" yaml:"functions"`
// Experimental.
Lines *float64 `field:"optional" json:"lines" yaml:"lines"`
// Experimental.
Statements *float64 `field:"optional" json:"statements" yaml:"statements"`
}
Experimental.
type EmbeddedLanguageFormatting ¶
type EmbeddedLanguageFormatting string
Experimental.
const ( // Format embedded code if Prettier can automatically identify it. // Experimental. EmbeddedLanguageFormatting_AUTO EmbeddedLanguageFormatting = "AUTO" // Never automatically format embedded code. // Experimental. EmbeddedLanguageFormatting_OFF EmbeddedLanguageFormatting = "OFF" )
type EndOfLine ¶
type EndOfLine string
Experimental.
const ( // Maintain existing (mixed values within one file are normalised by looking at what's used after the first line). // Experimental. EndOfLine_AUTO EndOfLine = "AUTO" // Carriage Return character only (\r), used very rarely. // Experimental. EndOfLine_CR EndOfLine = "CR" // Carriage Return + Line Feed characters (\r\n), common on Windows. // Experimental. EndOfLine_CRLF EndOfLine = "CRLF" // Line Feed only (\n), common on Linux and macOS as well as inside git repos. // Experimental. EndOfLine_LF EndOfLine = "LF" )
type Eslint ¶
type Eslint interface {
projen.Component
// Direct access to the eslint configuration (escape hatch).
// Experimental.
Config() interface{}
// eslint task.
// Experimental.
EslintTask() projen.Task
// File patterns that should not be linted.
// Experimental.
IgnorePatterns() *[]*string
// eslint overrides.
// Experimental.
Overrides() *[]*EslintOverride
// Experimental.
Project() projen.Project
// eslint rules.
// Experimental.
Rules() *map[string]*[]interface{}
// Adds an `extends` item to the eslint configuration.
// Experimental.
AddExtends(extendList ...*string)
// Do not lint these files.
// Experimental.
AddIgnorePattern(pattern *string)
// Add a file, glob pattern or directory with source files to lint (e.g. [ "src" ]).
// Experimental.
AddLintPattern(pattern *string)
// Add an eslint override.
// Experimental.
AddOverride(override *EslintOverride)
// Adds an eslint plugin.
// Experimental.
AddPlugins(plugins ...*string)
// Add an eslint rule.
// Experimental.
AddRules(rules *map[string]interface{})
// Add a glob file pattern which allows importing dev dependencies.
// Experimental.
AllowDevDeps(pattern *string)
// Called after synthesis.
//
// Order is *not* guaranteed.
// Experimental.
PostSynthesize()
// Called before synthesis.
// Experimental.
PreSynthesize()
// Synthesizes files to the project output directory.
// Experimental.
Synthesize()
}
Represents eslint configuration. Experimental.
type EslintOptions ¶
type EslintOptions struct {
// Files or glob patterns or directories with source files to lint (e.g. [ "src" ]).
// Experimental.
Dirs *[]*string `field:"required" json:"dirs" yaml:"dirs"`
// Enable import alias for module paths.
// Default: undefined.
//
// Experimental.
AliasExtensions *[]*string `field:"optional" json:"aliasExtensions" yaml:"aliasExtensions"`
// Enable import alias for module paths.
// Default: undefined.
//
// Experimental.
AliasMap *map[string]*string `field:"optional" json:"aliasMap" yaml:"aliasMap"`
// 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`.
// Default: [].
//
// Experimental.
Devdirs *[]*string `field:"optional" json:"devdirs" yaml:"devdirs"`
// File types that should be linted (e.g. [ ".js", ".ts" ]).
// Default: [".ts"]
//
// Experimental.
FileExtensions *[]*string `field:"optional" json:"fileExtensions" yaml:"fileExtensions"`
// List of file patterns that should not be linted, using the same syntax as .gitignore patterns.
// Default: [ '*.js', '*.d.ts', 'node_modules/', '*.generated.ts', 'coverage' ]
//
// Experimental.
IgnorePatterns *[]*string `field:"optional" json:"ignorePatterns" yaml:"ignorePatterns"`
// Should we lint .projenrc.js.
// Default: true.
//
// Deprecated: set to `false` to remove any automatic rules and add manually.
LintProjenRc *bool `field:"optional" json:"lintProjenRc" yaml:"lintProjenRc"`
// Projenrc file to lint.
//
// Use empty string to disable.
// Default: PROJEN_RC.
//
// Deprecated: provide as `devdirs`.
LintProjenRcFile *string `field:"optional" json:"lintProjenRcFile" yaml:"lintProjenRcFile"`
// Enable prettier for code formatting.
// Default: false.
//
// Experimental.
Prettier *bool `field:"optional" json:"prettier" yaml:"prettier"`
// 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.
// Default: true.
//
// Experimental.
TsAlwaysTryTypes *bool `field:"optional" json:"tsAlwaysTryTypes" yaml:"tsAlwaysTryTypes"`
// Path to `tsconfig.json` which should be used by eslint.
// Default: "./tsconfig.json"
//
// Experimental.
TsconfigPath *string `field:"optional" json:"tsconfigPath" yaml:"tsconfigPath"`
// Write eslint configuration as YAML instead of JSON.
// Default: false.
//
// Experimental.
Yaml *bool `field:"optional" json:"yaml" yaml:"yaml"`
}
Experimental.
type EslintOverride ¶
type EslintOverride struct {
// Files or file patterns on which to apply the override.
// Experimental.
Files *[]*string `field:"required" json:"files" yaml:"files"`
// Pattern(s) to exclude from this override.
//
// If a file matches any of the excluded patterns, the configuration won’t apply.
// Experimental.
ExcludedFiles *[]*string `field:"optional" json:"excludedFiles" yaml:"excludedFiles"`
// Config(s) to extend in this override.
// Experimental.
Extends *[]*string `field:"optional" json:"extends" yaml:"extends"`
// The overridden parser.
// Experimental.
Parser *string `field:"optional" json:"parser" yaml:"parser"`
// `plugins` override.
// Experimental.
Plugins *[]*string `field:"optional" json:"plugins" yaml:"plugins"`
// The overriden rules.
// Experimental.
Rules *map[string]interface{} `field:"optional" json:"rules" yaml:"rules"`
}
eslint rules override. Experimental.
type HTMLWhitespaceSensitivity ¶
type HTMLWhitespaceSensitivity string
Experimental.
const ( // Respect the default value of CSS display property. // Experimental. HTMLWhitespaceSensitivity_CSS HTMLWhitespaceSensitivity = "CSS" // Whitespaces are considered insignificant. // Experimental. HTMLWhitespaceSensitivity_IGNORE HTMLWhitespaceSensitivity = "IGNORE" // Whitespaces are considered significant. // Experimental. HTMLWhitespaceSensitivity_STRICT HTMLWhitespaceSensitivity = "STRICT" )
type HasteConfig ¶
type HasteConfig struct {
// Experimental.
ComputeSha1 *bool `field:"optional" json:"computeSha1" yaml:"computeSha1"`
// Experimental.
DefaultPlatform *string `field:"optional" json:"defaultPlatform" yaml:"defaultPlatform"`
// Experimental.
HasteImplModulePath *string `field:"optional" json:"hasteImplModulePath" yaml:"hasteImplModulePath"`
// Experimental.
Platforms *[]*string `field:"optional" json:"platforms" yaml:"platforms"`
// Experimental.
ThrowOnModuleCollision *bool `field:"optional" json:"throwOnModuleCollision" yaml:"throwOnModuleCollision"`
}
Experimental.
type Jest ¶
type Jest interface {
projen.Component
// Escape hatch.
// Experimental.
Config() interface{}
// Jest config file.
//
// `undefined` if settings are written to `package.json`
// Experimental.
File() projen.JsonFile
// Jest version, including `@` symbol, like `@^29`.
// Experimental.
JestVersion() *string
// Experimental.
Project() projen.Project
// Experimental.
AddIgnorePattern(pattern *string)
// Experimental.
AddReporter(reporter JestReporter)
// Adds a a setup file to Jest's setupFiles configuration.
// Experimental.
AddSetupFile(file *string)
// Adds a a setup file to Jest's setupFilesAfterEnv configuration.
// Experimental.
AddSetupFileAfterEnv(file *string)
// Experimental.
AddSnapshotResolver(file *string)
// Adds a test match pattern.
// Experimental.
AddTestMatch(pattern *string)
// Adds a watch ignore pattern.
// Experimental.
AddWatchIgnorePattern(pattern *string)
// Called after synthesis.
//
// Order is *not* guaranteed.
// Experimental.
PostSynthesize()
// Called before synthesis.
// Experimental.
PreSynthesize()
// Synthesizes files to the project output directory.
// Experimental.
Synthesize()
}
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 when `updateSnapshot: UpdateSnapshot: NEVER`. Experimental.
type JestConfigOptions ¶
type JestConfigOptions struct {
// Escape hatch to allow any value.
// Experimental.
AdditionalOptions *map[string]interface{} `field:"optional" json:"additionalOptions" yaml:"additionalOptions"`
// 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.
// Default: - false.
//
// Experimental.
Automock *bool `field:"optional" json:"automock" yaml:"automock"`
// 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.
// Default: - 0.
//
// Experimental.
Bail interface{} `field:"optional" json:"bail" yaml:"bail"`
// The directory where Jest should store its cached dependency information.
// Default: - "/tmp/<path>".
//
// Experimental.
CacheDirectory *string `field:"optional" json:"cacheDirectory" yaml:"cacheDirectory"`
// 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.
// Default: true.
//
// Experimental.
ClearMocks *bool `field:"optional" json:"clearMocks" yaml:"clearMocks"`
// 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.
// Default: true.
//
// Experimental.
CollectCoverage *bool `field:"optional" json:"collectCoverage" yaml:"collectCoverage"`
// An array of glob patterns indicating a set of files for which coverage information should be collected.
// Default: - undefined.
//
// Experimental.
CollectCoverageFrom *[]*string `field:"optional" json:"collectCoverageFrom" yaml:"collectCoverageFrom"`
// The directory where Jest should output its coverage files.
// Default: "coverage".
//
// Experimental.
CoverageDirectory *string `field:"optional" json:"coverageDirectory" yaml:"coverageDirectory"`
// 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.
// Default: "/node_modules/".
//
// Experimental.
CoveragePathIgnorePatterns *[]*string `field:"optional" json:"coveragePathIgnorePatterns" yaml:"coveragePathIgnorePatterns"`
// Indicates which provider should be used to instrument code for coverage.
//
// Allowed values are babel (default) or v8.
// Default: - "babel".
//
// Experimental.
CoverageProvider *string `field:"optional" json:"coverageProvider" yaml:"coverageProvider"`
// A list of reporter names that Jest uses when writing coverage reports.
//
// Any istanbul reporter can be used.
// Default: - ["json", "lcov", "text", "clover", "cobertura"].
//
// Experimental.
CoverageReporters *[]*string `field:"optional" json:"coverageReporters" yaml:"coverageReporters"`
// 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.
// Default: - undefined.
//
// Experimental.
CoverageThreshold *CoverageThreshold `field:"optional" json:"coverageThreshold" yaml:"coverageThreshold"`
// This option allows the use of a custom dependency extractor.
//
// It must be a node module that exports an object with an extract function.
// Default: - undefined.
//
// Experimental.
DependencyExtractor *string `field:"optional" json:"dependencyExtractor" yaml:"dependencyExtractor"`
// Allows for a label to be printed alongside a test while it is running.
// Default: - undefined.
//
// Experimental.
DisplayName interface{} `field:"optional" json:"displayName" yaml:"displayName"`
// Make calling deprecated APIs throw helpful error messages.
//
// Useful for easing the upgrade process.
// Default: - false.
//
// Experimental.
ErrorOnDeprecated *bool `field:"optional" json:"errorOnDeprecated" yaml:"errorOnDeprecated"`
// 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.
// Default: - undefined.
//
// Experimental.
ExtraGlobals *[]*string `field:"optional" json:"extraGlobals" yaml:"extraGlobals"`
// 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.
// Default: - [”].
//
// Experimental.
ForceCoverageMatch *[]*string `field:"optional" json:"forceCoverageMatch" yaml:"forceCoverageMatch"`
// A set of global variables that need to be available in all test environments.
// Default: - {}.
//
// Experimental.
Globals interface{} `field:"optional" json:"globals" yaml:"globals"`
// 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.
// Default: - undefined.
//
// Experimental.
GlobalSetup *string `field:"optional" json:"globalSetup" yaml:"globalSetup"`
// 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.
// Default: - undefined.
//
// Experimental.
GlobalTeardown *string `field:"optional" json:"globalTeardown" yaml:"globalTeardown"`
// This will be used to configure the behavior of jest-haste-map, Jest's internal file crawler/cache system.
// Default: - {}.
//
// Experimental.
Haste *HasteConfig `field:"optional" json:"haste" yaml:"haste"`
// Insert Jest's globals (expect, test, describe, beforeEach etc.) into the global environment. If you set this to false, you should import from.
// Default: - true.
//
// Experimental.
InjectGlobals *bool `field:"optional" json:"injectGlobals" yaml:"injectGlobals"`
// 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.
// Default: - 5.
//
// Experimental.
MaxConcurrency *float64 `field:"optional" json:"maxConcurrency" yaml:"maxConcurrency"`
// 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%".
// Default: - the number of the cores available on your machine minus one for the main thread.
//
// Experimental.
MaxWorkers interface{} `field:"optional" json:"maxWorkers" yaml:"maxWorkers"`
// 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"].
// Default: - ["node_modules"].
//
// Experimental.
ModuleDirectories *[]*string `field:"optional" json:"moduleDirectories" yaml:"moduleDirectories"`
// 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.
// Default: - ["js", "json", "jsx", "ts", "tsx", "node"].
//
// Experimental.
ModuleFileExtensions *[]*string `field:"optional" json:"moduleFileExtensions" yaml:"moduleFileExtensions"`
// 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.
// Default: - null.
//
// Experimental.
ModuleNameMapper *map[string]interface{} `field:"optional" json:"moduleNameMapper" yaml:"moduleNameMapper"`
// 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.
// Default: - [].
//
// Experimental.
ModulePathIgnorePatterns *[]*string `field:"optional" json:"modulePathIgnorePatterns" yaml:"modulePathIgnorePatterns"`
// 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 <rootDir> string token to include
// the path to your project's root directory. Example: ["<rootDir>/app/"].
// Default: - [].
//
// Experimental.
ModulePaths *[]*string `field:"optional" json:"modulePaths" yaml:"modulePaths"`
// Activates notifications for test results.
// Default: - false.
//
// Experimental.
Notify *bool `field:"optional" json:"notify" yaml:"notify"`
// Specifies notification mode.
//
// Requires notify: true.
// Default: - failure-change.
//
// Experimental.
NotifyMode *string `field:"optional" json:"notifyMode" yaml:"notifyMode"`
// 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.
// Default: - undefined.
//
// Experimental.
Preset *string `field:"optional" json:"preset" yaml:"preset"`
// Sets the path to the prettier node module used to update inline snapshots.
// Default: - "prettier".
//
// Experimental.
PrettierPath *string `field:"optional" json:"prettierPath" yaml:"prettierPath"`
// 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.
// Default: - undefined.
//
// Experimental.
Projects *[]interface{} `field:"optional" json:"projects" yaml:"projects"`
// 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.
// Default: - undefined.
//
// Experimental.
Reporters *[]JestReporter `field:"optional" json:"reporters" yaml:"reporters"`
// 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.
// Default: - false.
//
// Experimental.
ResetMocks *bool `field:"optional" json:"resetMocks" yaml:"resetMocks"`
// 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.
// Default: - false.
//
// Experimental.
ResetModules *bool `field:"optional" json:"resetModules" yaml:"resetModules"`
// This option allows the use of a custom resolver.
//
// https://jestjs.io/docs/en/configuration#resolver-string
// Default: - undefined.
//
// Experimental.
Resolver *string `field:"optional" json:"resolver" yaml:"resolver"`
// 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.
// Default: - false.
//
// Experimental.
RestoreMocks *bool `field:"optional" json:"restoreMocks" yaml:"restoreMocks"`
// 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.
// Default: - directory of the package.json
//
// Experimental.
RootDir *string `field:"optional" json:"rootDir" yaml:"rootDir"`
// A list of paths to directories that Jest should use to search for files in.
// Default: - ["<rootDir>"].
//
// Experimental.
Roots *[]*string `field:"optional" json:"roots" yaml:"roots"`
// This option allows you to use a custom runner instead of Jest's default test runner.
// Default: - "jest-runner".
//
// Experimental.
Runner *string `field:"optional" json:"runner" yaml:"runner"`
// 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.
// Default: - [].
//
// Experimental.
SetupFiles *[]*string `field:"optional" json:"setupFiles" yaml:"setupFiles"`
// 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.
// Default: - [].
//
// Experimental.
SetupFilesAfterEnv *[]*string `field:"optional" json:"setupFilesAfterEnv" yaml:"setupFilesAfterEnv"`
// The number of seconds after which a test is considered as slow and reported as such in the results.
// Default: - 5.
//
// Experimental.
SlowTestThreshold *float64 `field:"optional" json:"slowTestThreshold" yaml:"slowTestThreshold"`
// The path to a module that can resolve test<->snapshot path.
//
// This config option lets you customize
// where Jest stores snapshot files on disk.
// Default: - undefined.
//
// Experimental.
SnapshotResolver *string `field:"optional" json:"snapshotResolver" yaml:"snapshotResolver"`
// A list of paths to snapshot serializer modules Jest should use for snapshot testing.
// Default: = [].
//
// Experimental.
SnapshotSerializers *[]*string `field:"optional" json:"snapshotSerializers" yaml:"snapshotSerializers"`
// The test environment that will be used for testing.
//
// The default environment in Jest is a
// browser-like environment through jsdom. If you are building a node service, you can use the node
// option to use a node-like environment instead.
// Default: - "jsdom".
//
// Experimental.
TestEnvironment *string `field:"optional" json:"testEnvironment" yaml:"testEnvironment"`
// Test environment options that will be passed to the testEnvironment.
//
// The relevant options depend on the environment.
// Default: - {}.
//
// Experimental.
TestEnvironmentOptions interface{} `field:"optional" json:"testEnvironmentOptions" yaml:"testEnvironmentOptions"`
// The exit code Jest returns on test failure.
// Default: - 1.
//
// Experimental.
TestFailureExitCode *float64 `field:"optional" json:"testFailureExitCode" yaml:"testFailureExitCode"`
// 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.
// Default: ['**\/__tests__/**\/*.[jt]s?(x)', '**\/?(*.)+(spec|test).[tj]s?(x)']
//
// Experimental.
TestMatch *[]*string `field:"optional" json:"testMatch" yaml:"testMatch"`
// 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.
// Default: - ["/node_modules/"].
//
// Experimental.
TestPathIgnorePatterns *[]*string `field:"optional" json:"testPathIgnorePatterns" yaml:"testPathIgnorePatterns"`
// 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.
// Default: - (/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$
//
// Experimental.
TestRegex interface{} `field:"optional" json:"testRegex" yaml:"testRegex"`
// This option allows the use of a custom results processor.
// Default: - undefined.
//
// Experimental.
TestResultsProcessor *string `field:"optional" json:"testResultsProcessor" yaml:"testResultsProcessor"`
// This option allows the use of a custom test runner.
//
// The default is jasmine2. A custom test runner
// can be provided by specifying a path to a test runner implementation.
// Default: - "jasmine2".
//
// Experimental.
TestRunner *string `field:"optional" json:"testRunner" yaml:"testRunner"`
// This option allows you to use a custom sequencer instead of Jest's default.
//
// Sort may optionally return a Promise.
// Default: - "@jest/test-sequencer".
//
// Experimental.
TestSequencer *string `field:"optional" json:"testSequencer" yaml:"testSequencer"`
// Default timeout of a test in milliseconds.
// Default: - 5000.
//
// Experimental.
TestTimeout *float64 `field:"optional" json:"testTimeout" yaml:"testTimeout"`
// This option sets the URL for the jsdom environment.
//
// It is reflected in properties such as location.href.
// Default: - "http://localhost".
//
// Experimental.
TestURL *string `field:"optional" json:"testURL" yaml:"testURL"`
// 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.
// Default: - "real".
//
// Experimental.
Timers *string `field:"optional" json:"timers" yaml:"timers"`
// A map from regular expressions to paths to transformers.
//
// A transformer is a module that provides a
// synchronous function for transforming source files.
// Default: - {"\\.[jt]sx?$": "babel-jest"}
//
// Experimental.
Transform *map[string]Transform `field:"optional" json:"transform" yaml:"transform"`
// 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.
// Default: - ["/node_modules/", "\\.pnp\\.[^\\\/]+$"]
//
// Experimental.
TransformIgnorePatterns *[]*string `field:"optional" json:"transformIgnorePatterns" yaml:"transformIgnorePatterns"`
// 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.
// Default: - [].
//
// Experimental.
UnmockedModulePathPatterns *[]*string `field:"optional" json:"unmockedModulePathPatterns" yaml:"unmockedModulePathPatterns"`
// 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.
// Default: - false.
//
// Experimental.
Verbose *bool `field:"optional" json:"verbose" yaml:"verbose"`
// Whether to use watchman for file crawling.
// Default: - true.
//
// Experimental.
Watchman *bool `field:"optional" json:"watchman" yaml:"watchman"`
// 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.
// Default: - [].
//
// Experimental.
WatchPathIgnorePatterns *[]*string `field:"optional" json:"watchPathIgnorePatterns" yaml:"watchPathIgnorePatterns"`
// Default: -.
//
// Experimental.
WatchPlugins *[]WatchPlugin `field:"optional" json:"watchPlugins" yaml:"watchPlugins"`
}
Experimental.
type JestOptions ¶
type JestOptions struct {
// Path to JSON config file for Jest.
// Default: - No separate config file, jest settings are stored in package.json
//
// Experimental.
ConfigFilePath *string `field:"optional" json:"configFilePath" yaml:"configFilePath"`
// Collect coverage.
//
// Deprecated.
// Default: true.
//
// Deprecated: use jestConfig.collectCoverage
Coverage *bool `field:"optional" json:"coverage" yaml:"coverage"`
// Include the `text` coverage reporter, which means that coverage summary is printed at the end of the jest execution.
// Default: true.
//
// Experimental.
CoverageText *bool `field:"optional" json:"coverageText" yaml:"coverageText"`
// Additional options to pass to the Jest CLI invocation.
// Default: - no extra options.
//
// Experimental.
ExtraCliOptions *[]*string `field:"optional" json:"extraCliOptions" yaml:"extraCliOptions"`
// Defines `testPathIgnorePatterns` and `coveragePathIgnorePatterns`.
// Default: ["/node_modules/"].
//
// Deprecated: use jestConfig.coveragePathIgnorePatterns or jestConfig.testPathIgnorePatterns respectively
IgnorePatterns *[]*string `field:"optional" json:"ignorePatterns" yaml:"ignorePatterns"`
// Jest configuration.
// Default: - default jest configuration.
//
// Experimental.
JestConfig *JestConfigOptions `field:"optional" json:"jestConfig" yaml:"jestConfig"`
// 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.
// Default: - installs the latest jest version.
//
// Experimental.
JestVersion *string `field:"optional" json:"jestVersion" yaml:"jestVersion"`
// Result processing with jest-junit.
//
// Output directory is `test-reports/`.
// Default: true.
//
// Experimental.
JunitReporting *bool `field:"optional" json:"junitReporting" yaml:"junitReporting"`
// Preserve the default Jest reporter when additional reporters are added.
// Default: true.
//
// Experimental.
PreserveDefaultReporters *bool `field:"optional" json:"preserveDefaultReporters" yaml:"preserveDefaultReporters"`
// 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.
// Default: - ALWAYS.
//
// Experimental.
UpdateSnapshot UpdateSnapshot `field:"optional" json:"updateSnapshot" yaml:"updateSnapshot"`
}
Experimental.
type JestReporter ¶
type JestReporter interface {
}
Experimental.
func NewJestReporter ¶
func NewJestReporter(name *string, options *map[string]interface{}) JestReporter
Experimental.
type NodePackage ¶
type NodePackage interface {
projen.Component
// Allow project to take library dependencies.
// Experimental.
AllowLibraryDependencies() *bool
// Options for npm packages using AWS CodeArtifact.
//
// This is required if publishing packages to, or installing scoped packages from AWS CodeArtifact.
// Default: - undefined.
//
// Experimental.
CodeArtifactOptions() *CodeArtifactOptions
// The module's entrypoint (e.g. `lib/index.js`).
// Experimental.
Entrypoint() *string
// The package.json file.
// Experimental.
File() projen.JsonFile
// Renders `yarn install` or `npm install` with lockfile update (not frozen).
// Experimental.
InstallAndUpdateLockfileCommand() *string
// The task for installing project dependencies (frozen).
// Experimental.
InstallCiTask() projen.Task
// Returns the command to execute in order to install all dependencies (always frozen).
// Experimental.
InstallCommand() *string
// The task for installing project dependencies (non-frozen).
// Experimental.
InstallTask() projen.Task
// The SPDX license of this module.
//
// `undefined` if this package is not licensed.
// Experimental.
License() *string
// The name of the lock file.
// Experimental.
LockFile() *string
// Deprecated: use `addField(x, y)`.
Manifest() interface{}
// Maximum node version required by this package.
// Default: - no maximum.
//
// Experimental.
MaxNodeVersion() *string
// Minimum node.js version required by this package.
// Default: - no minimum.
//
// Experimental.
MinNodeVersion() *string
// npm package access level.
// Experimental.
NpmAccess() NpmAccess
// The npm registry host (e.g. `registry.npmjs.org`).
// Experimental.
NpmRegistry() *string
// npm registry (e.g. `https://registry.npmjs.org`). Use `npmRegistryHost` to get just the host name.
// Experimental.
NpmRegistryUrl() *string
// GitHub secret which contains the NPM token to use when publishing packages.
// Experimental.
NpmTokenSecret() *string
// The package manager to use.
// Experimental.
PackageManager() NodePackageManager
// The name of the npm package.
// Experimental.
PackageName() *string
// The version of PNPM to use if using PNPM as a package manager.
// Default: "7".
//
// Experimental.
PnpmVersion() *string
// Experimental.
Project() projen.Project
// The command which executes "projen".
// Experimental.
ProjenCommand() *string
// Options for privately hosted scoped packages.
// Default: undefined.
//
// Experimental.
ScopedPackagesOptions() *[]*ScopedPackagesOptions
// Experimental.
AddBin(bins *map[string]*string)
// Defines bundled dependencies.
//
// Bundled dependencies will be added as normal dependencies as well as to the
// `bundledDependencies` section of your `package.json`.
// Experimental.
AddBundledDeps(deps ...*string)
// Defines normal dependencies.
// Experimental.
AddDeps(deps ...*string)
// Defines development/test dependencies.
// Experimental.
AddDevDeps(deps ...*string)
// Adds an `engines` requirement to your package.
// Experimental.
AddEngine(engine *string, version *string)
// Directly set fields in `package.json`.
// Experimental.
AddField(name *string, value interface{})
// Adds keywords to package.json (deduplicated).
// Experimental.
AddKeywords(keywords ...*string)
// Defines resolutions for dependencies to change the normally resolved version of a dependency to something else.
// Experimental.
AddPackageResolutions(resolutions ...*string)
// 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.
AddPeerDeps(deps ...*string)
// Sets the package version.
// Experimental.
AddVersion(version *string)
// Indicates if a script by the given name is defined.
// Deprecated: Use `project.tasks.tryFind(name)`
HasScript(name *string) *bool
// Called after synthesis.
//
// Order is *not* guaranteed.
// Experimental.
PostSynthesize()
// Called before synthesis.
// Experimental.
PreSynthesize()
// Removes an npm script (always successful).
// Experimental.
RemoveScript(name *string)
// Add a npm package.json script.
// Experimental.
SetScript(name *string, command *string)
// Synthesizes files to the project output directory.
// Experimental.
Synthesize()
// Attempt to resolve the currently installed version for a given dependency.
// Experimental.
TryResolveDependencyVersion(dependencyName *string) *string
}
Represents the npm `package.json` file. Experimental.
func NewNodePackage ¶
func NewNodePackage(project projen.Project, options *NodePackageOptions) NodePackage
Experimental.
type NodePackageManager ¶
type NodePackageManager string
The node package manager to use. Experimental.
const ( // Use `yarn` as the package manager. // Experimental. NodePackageManager_YARN NodePackageManager = "YARN" // Use `yarn` versions >= 2 as the package manager. // Experimental. NodePackageManager_YARN2 NodePackageManager = "YARN2" // Use `npm` as the package manager. // Experimental. NodePackageManager_NPM NodePackageManager = "NPM" // Use `pnpm` as the package manager. // Experimental. NodePackageManager_PNPM NodePackageManager = "PNPM" // Use `bun` as the package manager. // Experimental. NodePackageManager_BUN NodePackageManager = "BUN" )
type NodePackageOptions ¶
type NodePackageOptions struct {
// Allow the project to include `peerDependencies` and `bundledDependencies`.
//
// This is normally only allowed for libraries. For apps, there's no meaning
// for specifying these.
// Default: true.
//
// Experimental.
AllowLibraryDependencies *bool `field:"optional" json:"allowLibraryDependencies" yaml:"allowLibraryDependencies"`
// Author's e-mail.
// Experimental.
AuthorEmail *string `field:"optional" json:"authorEmail" yaml:"authorEmail"`
// Author's name.
// Experimental.
AuthorName *string `field:"optional" json:"authorName" yaml:"authorName"`
// Is the author an organization.
// Experimental.
AuthorOrganization *bool `field:"optional" json:"authorOrganization" yaml:"authorOrganization"`
// Author's URL / Website.
// Experimental.
AuthorUrl *string `field:"optional" json:"authorUrl" yaml:"authorUrl"`
// Automatically add all executables under the `bin` directory to your `package.json` file under the `bin` section.
// Default: true.
//
// Experimental.
AutoDetectBin *bool `field:"optional" json:"autoDetectBin" yaml:"autoDetectBin"`
// 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.
// Experimental.
Bin *map[string]*string `field:"optional" json:"bin" yaml:"bin"`
// The email address to which issues should be reported.
// Experimental.
BugsEmail *string `field:"optional" json:"bugsEmail" yaml:"bugsEmail"`
// The url to your project's issue tracker.
// Experimental.
BugsUrl *string `field:"optional" json:"bugsUrl" yaml:"bugsUrl"`
// 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 `yarn 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 `npm i` or `yarn add` (e.g. `express@^2`) and
// this will be what you `package.json` will eventually include.
// Experimental.
BundledDeps *[]*string `field:"optional" json:"bundledDeps" yaml:"bundledDeps"`
// Options for npm packages using AWS CodeArtifact.
//
// This is required if publishing packages to, or installing scoped packages from AWS CodeArtifact.
// Default: - undefined.
//
// Experimental.
CodeArtifactOptions *CodeArtifactOptions `field:"optional" json:"codeArtifactOptions" yaml:"codeArtifactOptions"`
// Runtime dependencies of this module.
//
// The recommendation is to only specify the module name here (e.g.
// `express`). This will behave similar to `yarn 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 `npm i` or `yarn add` (e.g. `express@^2`) and
// this will be what you `package.json` will eventually include.
//
// Example:
// [ 'express', 'lodash', 'foo@^2' ]
//
// Default: [].
//
// Experimental.
Deps *[]*string `field:"optional" json:"deps" yaml:"deps"`
// 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
// Experimental.
Description *string `field:"optional" json:"description" yaml:"description"`
// 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 `yarn 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 `npm i` or `yarn add` (e.g. `express@^2`) and
// this will be what you `package.json` will eventually include.
//
// Example:
// [ 'typescript', '@types/express' ]
//
// Default: [].
//
// Experimental.
DevDeps *[]*string `field:"optional" json:"devDeps" yaml:"devDeps"`
// Module entrypoint (`main` in `package.json`).
//
// Set to an empty string to not include `main` in your package.json
// Default: "lib/index.js"
//
// Experimental.
Entrypoint *string `field:"optional" json:"entrypoint" yaml:"entrypoint"`
// Package's Homepage / Website.
// Experimental.
Homepage *string `field:"optional" json:"homepage" yaml:"homepage"`
// Keywords to include in `package.json`.
// Experimental.
Keywords *[]*string `field:"optional" json:"keywords" yaml:"keywords"`
// 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.
// Default: "Apache-2.0"
//
// Experimental.
License *string `field:"optional" json:"license" yaml:"license"`
// Indicates if a license should be added.
// Default: true.
//
// Experimental.
Licensed *bool `field:"optional" json:"licensed" yaml:"licensed"`
// Minimum node.js version to require via `engines` (inclusive).
// Default: - no max.
//
// Experimental.
MaxNodeVersion *string `field:"optional" json:"maxNodeVersion" yaml:"maxNodeVersion"`
// Minimum Node.js version to require via package.json `engines` (inclusive).
// Default: - no "engines" specified.
//
// Experimental.
MinNodeVersion *string `field:"optional" json:"minNodeVersion" yaml:"minNodeVersion"`
// Access level of the npm package.
// Default: - for scoped packages (e.g. `foo@bar`), the default is
// `NpmAccess.RESTRICTED`, for non-scoped packages, the default is
// `NpmAccess.PUBLIC`.
//
// Experimental.
NpmAccess NpmAccess `field:"optional" json:"npmAccess" yaml:"npmAccess"`
// The host name of the npm registry to publish to.
//
// Cannot be set together with `npmRegistryUrl`.
// Deprecated: use `npmRegistryUrl` instead.
NpmRegistry *string `field:"optional" json:"npmRegistry" yaml:"npmRegistry"`
// The base URL of the npm package registry.
//
// Must be a URL (e.g. start with "https://" or "http://")
// Default: "https://registry.npmjs.org"
//
// Experimental.
NpmRegistryUrl *string `field:"optional" json:"npmRegistryUrl" yaml:"npmRegistryUrl"`
// GitHub secret which contains the NPM token to use when publishing packages.
// Default: "NPM_TOKEN".
//
// Experimental.
NpmTokenSecret *string `field:"optional" json:"npmTokenSecret" yaml:"npmTokenSecret"`
// The Node Package Manager used to execute scripts.
// Default: NodePackageManager.YARN
//
// Experimental.
PackageManager NodePackageManager `field:"optional" json:"packageManager" yaml:"packageManager"`
// The "name" in package.json.
// Default: - defaults to project name.
//
// Experimental.
PackageName *string `field:"optional" json:"packageName" yaml:"packageName"`
// Options for `peerDeps`.
// Experimental.
PeerDependencyOptions *PeerDependencyOptions `field:"optional" json:"peerDependencyOptions" yaml:"peerDependencyOptions"`
// 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.
// Default: [].
//
// Experimental.
PeerDeps *[]*string `field:"optional" json:"peerDeps" yaml:"peerDeps"`
// The version of PNPM to use if using PNPM as a package manager.
// Default: "7".
//
// Experimental.
PnpmVersion *string `field:"optional" json:"pnpmVersion" yaml:"pnpmVersion"`
// The repository is the location where the actual code for your package lives.
//
// See https://classic.yarnpkg.com/en/docs/package-json/#toc-repository
// Experimental.
Repository *string `field:"optional" json:"repository" yaml:"repository"`
// 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.
// Experimental.
RepositoryDirectory *string `field:"optional" json:"repositoryDirectory" yaml:"repositoryDirectory"`
// Options for privately hosted scoped packages.
// Default: - fetch all scoped packages from the public npm registry.
//
// Experimental.
ScopedPackagesOptions *[]*ScopedPackagesOptions `field:"optional" json:"scopedPackagesOptions" yaml:"scopedPackagesOptions"`
// npm scripts to include.
//
// If a script has the same name as a standard script,
// the standard script will be overwritten.
// Also adds the script as a task.
// Default: {}.
//
// Deprecated: use `project.addTask()` or `package.setScript()`
Scripts *map[string]*string `field:"optional" json:"scripts" yaml:"scripts"`
// Package's Stability.
// Experimental.
Stability *string `field:"optional" json:"stability" yaml:"stability"`
}
Experimental.
type NodeProject ¶
type NodeProject interface {
github.GitHubProject
// Deprecated: use `package.allowLibraryDependencies`
AllowLibraryDependencies() *bool
// 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`.
// Experimental.
ArtifactsDirectory() *string
// The location of the npm tarball after build (`${artifactsDirectory}/js`).
// Experimental.
ArtifactsJavascriptDirectory() *string
// Auto approve set up for this project.
// Deprecated.
AutoApprove() github.AutoApprove
// Component that sets up mergify for merging approved pull requests.
// Experimental.
AutoMerge() github.AutoMerge
// Experimental.
BuildTask() projen.Task
// The PR build GitHub workflow.
//
// `undefined` if `buildWorkflow` is disabled.
// Experimental.
BuildWorkflow() build.BuildWorkflow
// The job ID of the build workflow.
// Experimental.
BuildWorkflowJobId() *string
// Experimental.
Bundler() Bundler
// Whether to commit the managed files by default.
// Experimental.
CommitGenerated() *bool
// Experimental.
CompileTask() projen.Task
// Returns all the components within this project.
// Experimental.
Components() *[]projen.Component
// This is the "default" task, the one that executes "projen".
//
// Undefined if
// the project is being ejected.
// Experimental.
DefaultTask() projen.Task
// Project dependencies.
// Experimental.
Deps() projen.Dependencies
// Access for .devcontainer.json (used for GitHub Codespaces).
//
// This will be `undefined` if devContainer boolean is false.
// Deprecated.
DevContainer() vscode.DevContainer
// Whether or not the project is being ejected.
// Experimental.
Ejected() *bool
// Deprecated: use `package.entrypoint`
Entrypoint() *string
// All files in this project.
// Experimental.
Files() *[]projen.FileBase
// The .gitattributes file for this repository.
// Experimental.
Gitattributes() projen.GitAttributesFile
// Access all github components.
//
// This will be `undefined` for subprojects.
// Deprecated.
Github() github.GitHub
// .gitignore.
// Experimental.
Gitignore() projen.IgnoreFile
// Access for Gitpod.
//
// This will be `undefined` if gitpod boolean is false.
// Deprecated.
Gitpod() projen.Gitpod
// 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.
InitProject() *projen.InitProject
// The Jest configuration (if enabled).
// Experimental.
Jest() Jest
// Logging utilities.
// Experimental.
Logger() projen.Logger
// Deprecated: use `package.addField(x, y)`
Manifest() interface{}
// Maximum node version required by this package.
// Experimental.
MaxNodeVersion() *string
// Minimum node.js version required by this package.
// Experimental.
MinNodeVersion() *string
// Project name.
// Experimental.
Name() *string
// Experimental.
NodeVersion() *string
// The .npmignore file.
// Experimental.
Npmignore() projen.IgnoreFile
// The .npmrc file.
// Experimental.
Npmrc() NpmConfig
// Absolute output directory of this project.
// Experimental.
Outdir() *string
// API for managing the node package.
// Experimental.
Package() NodePackage
// The package manager to use.
// Deprecated: use `package.packageManager`
PackageManager() NodePackageManager
// Experimental.
PackageTask() projen.Task
// A parent project.
//
// If undefined, this is the root project.
// Experimental.
Parent() projen.Project
// Experimental.
PostCompileTask() projen.Task
// Experimental.
PreCompileTask() projen.Task
// Experimental.
Prettier() Prettier
// Manages the build process of the project.
// Experimental.
ProjectBuild() projen.ProjectBuild
// Deprecated.
ProjectType() projen.ProjectType
// The command to use in order to run the projen CLI.
// Experimental.
ProjenCommand() *string
// Package publisher.
//
// This will be `undefined` if the project does not have a
// release workflow.
// Deprecated: use `release.publisher`.
Publisher() release.Publisher
// Release management.
// Experimental.
Release() release.Release
// The root project.
// Experimental.
Root() projen.Project
// The command to use to run scripts (e.g. `yarn run` or `npm run` depends on the package manager).
// Experimental.
RunScriptCommand() *string
// Returns all the subprojects within this project.
// Experimental.
Subprojects() *[]projen.Project
// Project tasks.
// Experimental.
Tasks() projen.Tasks
// Experimental.
TestTask() projen.Task
// The upgrade workflow.
// Experimental.
UpgradeWorkflow() UpgradeDependencies
// Access all VSCode components.
//
// This will be `undefined` for subprojects.
// Deprecated.
Vscode() vscode.VsCode
// Experimental.
WorkflowBootstrapSteps() *[]*workflows.JobStep
// Experimental.
WorkflowPackageCache() *bool
// Experimental.
AddBins(bins *map[string]*string)
// Defines bundled dependencies.
//
// Bundled dependencies will be added as normal dependencies as well as to the
// `bundledDependencies` section of your `package.json`.
// Experimental.
AddBundledDeps(deps ...*string)
// DEPRECATED.
// Deprecated: use `project.compileTask.exec()`
AddCompileCommand(commands ...*string)
// Defines normal dependencies.
// Experimental.
AddDeps(deps ...*string)
// Defines development/test dependencies.
// Experimental.
AddDevDeps(deps ...*string)
// 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.
AddExcludeFromCleanup(globs ...*string)
// Directly set fields in `package.json`.
// Experimental.
AddFields(fields *map[string]interface{})
// Adds a .gitignore pattern.
// Experimental.
AddGitIgnore(pattern *string)
// Adds keywords to package.json (deduplicated).
// Experimental.
AddKeywords(keywords ...*string)
// Exclude these files from the bundled package.
//
// Implemented by project types based on the
// packaging mechanism. For example, `NodeProject` delegates this to `.npmignore`.
// Experimental.
AddPackageIgnore(pattern *string)
// 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.
AddPeerDeps(deps ...*string)
// Replaces the contents of multiple npm package.json scripts.
// Experimental.
AddScripts(scripts *map[string]*string)
// Adds a new task to this project.
//
// This will fail if the project already has
// a task with this name.
// Experimental.
AddTask(name *string, props *projen.TaskOptions) projen.Task
// DEPRECATED.
// Deprecated: use `project.testTask.exec()`
AddTestCommand(commands ...*string)
// Prints a "tip" message during synthesis.
// Deprecated: - use `project.logger.info(message)` to show messages during synthesis
AddTip(message *string)
// 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.
AnnotateGenerated(glob *string)
// Indicates if a script by the name name is defined.
// Deprecated: Use `project.tasks.tryFind(name)`
HasScript(name *string) *bool
// Called after all components are synthesized.
//
// Order is *not* guaranteed.
// Experimental.
PostSynthesize()
// Called before all components are synthesized.
// Experimental.
PreSynthesize()
// Removes the npm script (always successful).
// Experimental.
RemoveScript(name *string)
// Removes a task from a project.
//
// Returns: The `Task` that was removed, otherwise `undefined`.
// Experimental.
RemoveTask(name *string) projen.Task
// Returns the set of workflow steps which should be executed to bootstrap a workflow.
//
// Returns: Job steps.
// Experimental.
RenderWorkflowSetup(options *RenderWorkflowSetupOptions) *[]*workflows.JobStep
// Returns the shell command to execute in order to run a task.
//
// This will
// typically be `npx projen TASK`.
// Experimental.
RunTaskCommand(task projen.Task) *string
// Replaces the contents of an npm package.json script.
// Experimental.
SetScript(name *string, command *string)
// 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.
Synth()
// Finds a file at the specified relative path within this project and all its subprojects.
//
// Returns: a `FileBase` or undefined if there is no file in that path.
// Experimental.
TryFindFile(filePath *string) projen.FileBase
// Finds a json file by name.
// Deprecated: use `tryFindObjectFile`.
TryFindJsonFile(filePath *string) projen.JsonFile
// Finds an object file (like JsonFile, YamlFile, etc.) by name.
// Experimental.
TryFindObjectFile(filePath *string) projen.ObjectFile
// Finds a file at the specified relative path within this project and removes it.
//
// Returns: a `FileBase` if the file was found and removed, or undefined if
// the file was not found.
// Experimental.
TryRemoveFile(filePath *string) projen.FileBase
}
Node.js project. Experimental.
type NodeProjectOptions ¶
type NodeProjectOptions struct {
// This is the name of your project.
// Default: $BASEDIR.
//
// Experimental.
Name *string `field:"required" json:"name" yaml:"name"`
// Whether to commit the managed files by default.
// Default: true.
//
// Experimental.
CommitGenerated *bool `field:"optional" json:"commitGenerated" yaml:"commitGenerated"`
// Configuration options for .gitignore file.
// Experimental.
GitIgnoreOptions *projen.IgnoreFileOptions `field:"optional" json:"gitIgnoreOptions" yaml:"gitIgnoreOptions"`
// Configuration options for git.
// Experimental.
GitOptions *projen.GitOptions `field:"optional" json:"gitOptions" yaml:"gitOptions"`
// Configure logging options such as verbosity.
// Default: {}.
//
// Experimental.
Logging *projen.LoggerOptions `field:"optional" json:"logging" yaml:"logging"`
// 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
// sub-projects.
// Default: "."
//
// Experimental.
Outdir *string `field:"optional" json:"outdir" yaml:"outdir"`
// The parent project, if this project is part of a bigger project.
// Experimental.
Parent projen.Project `field:"optional" json:"parent" yaml:"parent"`
// The shell command to use in order to run the projen CLI.
//
// Can be used to customize in special environments.
// Default: "npx projen".
//
// Experimental.
ProjenCommand *string `field:"optional" json:"projenCommand" yaml:"projenCommand"`
// Generate (once) .projenrc.json (in JSON). Set to `false` in order to disable .projenrc.json generation.
// Default: false.
//
// Experimental.
ProjenrcJson *bool `field:"optional" json:"projenrcJson" yaml:"projenrcJson"`
// Options for .projenrc.json.
// Default: - default options.
//
// Experimental.
ProjenrcJsonOptions *projen.ProjenrcJsonOptions `field:"optional" json:"projenrcJsonOptions" yaml:"projenrcJsonOptions"`
// Use renovatebot to handle dependency upgrades.
// Default: false.
//
// Experimental.
Renovatebot *bool `field:"optional" json:"renovatebot" yaml:"renovatebot"`
// Options for renovatebot.
// Default: - default options.
//
// Experimental.
RenovatebotOptions *projen.RenovatebotOptions `field:"optional" json:"renovatebotOptions" yaml:"renovatebotOptions"`
// Enable and configure the 'auto approve' workflow.
// Default: - auto approve is disabled.
//
// Experimental.
AutoApproveOptions *github.AutoApproveOptions `field:"optional" json:"autoApproveOptions" yaml:"autoApproveOptions"`
// Enable automatic merging on GitHub.
//
// Has no effect if `github.mergify`
// is set to false.
// Default: true.
//
// Experimental.
AutoMerge *bool `field:"optional" json:"autoMerge" yaml:"autoMerge"`
// Configure options for automatic merging on GitHub.
//
// Has no effect if
// `github.mergify` or `autoMerge` is set to false.
// Default: - see defaults in `AutoMergeOptions`.
//
// Experimental.
AutoMergeOptions *github.AutoMergeOptions `field:"optional" json:"autoMergeOptions" yaml:"autoMergeOptions"`
// Add a `clobber` task which resets the repo to origin.
// Default: - true, but false for subprojects.
//
// Experimental.
Clobber *bool `field:"optional" json:"clobber" yaml:"clobber"`
// Add a VSCode development environment (used for GitHub Codespaces).
// Default: false.
//
// Experimental.
DevContainer *bool `field:"optional" json:"devContainer" yaml:"devContainer"`
// Enable GitHub integration.
//
// Enabled by default for root projects. Disabled for non-root projects.
// Default: true.
//
// Experimental.
Github *bool `field:"optional" json:"github" yaml:"github"`
// Options for GitHub integration.
// Default: - see GitHubOptions.
//
// Experimental.
GithubOptions *github.GitHubOptions `field:"optional" json:"githubOptions" yaml:"githubOptions"`
// Add a Gitpod development environment.
// Default: false.
//
// Experimental.
Gitpod *bool `field:"optional" json:"gitpod" yaml:"gitpod"`
// Whether mergify should be enabled on this repository or not.
// Default: true.
//
// Deprecated: use `githubOptions.mergify` instead
Mergify *bool `field:"optional" json:"mergify" yaml:"mergify"`
// Options for mergify.
// Default: - default options.
//
// Deprecated: use `githubOptions.mergifyOptions` instead
MergifyOptions *github.MergifyOptions `field:"optional" json:"mergifyOptions" yaml:"mergifyOptions"`
// Which type of project this is (library/app).
// Default: ProjectType.UNKNOWN
//
// Deprecated: no longer supported at the base project level.
ProjectType projen.ProjectType `field:"optional" json:"projectType" yaml:"projectType"`
// Choose a method of providing GitHub API access for projen workflows.
// Default: - use a personal access token named PROJEN_GITHUB_TOKEN.
//
// Experimental.
ProjenCredentials github.GithubCredentials `field:"optional" json:"projenCredentials" yaml:"projenCredentials"`
// The name of a secret which includes a GitHub Personal Access Token to be used by projen workflows.
//
// This token needs to have the `repo`, `workflows`
// and `packages` scope.
// Default: "PROJEN_GITHUB_TOKEN".
//
// Deprecated: use `projenCredentials`.
ProjenTokenSecret *string `field:"optional" json:"projenTokenSecret" yaml:"projenTokenSecret"`
// The README setup.
//
// Example:
// "{ filename: 'readme.md', contents: '# title' }"
//
// Default: - { filename: 'README.md', contents: '# replace this' }
//
// Experimental.
Readme *projen.SampleReadmeProps `field:"optional" json:"readme" yaml:"readme"`
// Auto-close of stale issues and pull request.
//
// See `staleOptions` for options.
// Default: false.
//
// Experimental.
Stale *bool `field:"optional" json:"stale" yaml:"stale"`
// Auto-close stale issues and pull requests.
//
// To disable set `stale` to `false`.
// Default: - see defaults in `StaleOptions`.
//
// Experimental.
StaleOptions *github.StaleOptions `field:"optional" json:"staleOptions" yaml:"staleOptions"`
// Enable VSCode integration.
//
// Enabled by default for root projects. Disabled for non-root projects.
// Default: true.
//
// Experimental.
Vscode *bool `field:"optional" json:"vscode" yaml:"vscode"`
// Allow the project to include `peerDependencies` and `bundledDependencies`.
//
// This is normally only allowed for libraries. For apps, there's no meaning
// for specifying these.
// Default: true.
//
// Experimental.
AllowLibraryDependencies *bool `field:"optional" json:"allowLibraryDependencies" yaml:"allowLibraryDependencies"`
// Author's e-mail.
// Experimental.
AuthorEmail *string `field:"optional" json:"authorEmail" yaml:"authorEmail"`
// Author's name.
// Experimental.
AuthorName *string `field:"optional" json:"authorName" yaml:"authorName"`
// Is the author an organization.
// Experimental.
AuthorOrganization *bool `field:"optional" json:"authorOrganization" yaml:"authorOrganization"`
// Author's URL / Website.
// Experimental.
AuthorUrl *string `field:"optional" json:"authorUrl" yaml:"authorUrl"`
// Automatically add all executables under the `bin` directory to your `package.json` file under the `bin` section.
// Default: true.
//
// Experimental.
AutoDetectBin *bool `field:"optional" json:"autoDetectBin" yaml:"autoDetectBin"`
// 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.
// Experimental.
Bin *map[string]*string `field:"optional" json:"bin" yaml:"bin"`
// The email address to which issues should be reported.
// Experimental.
BugsEmail *string `field:"optional" json:"bugsEmail" yaml:"bugsEmail"`
// The url to your project's issue tracker.
// Experimental.
BugsUrl *string `field:"optional" json:"bugsUrl" yaml:"bugsUrl"`
// 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 `yarn 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 `npm i` or `yarn add` (e.g. `express@^2`) and
// this will be what you `package.json` will eventually include.
// Experimental.
BundledDeps *[]*string `field:"optional" json:"bundledDeps" yaml:"bundledDeps"`
// Options for npm packages using AWS CodeArtifact.
//
// This is required if publishing packages to, or installing scoped packages from AWS CodeArtifact.
// Default: - undefined.
//
// Experimental.
CodeArtifactOptions *CodeArtifactOptions `field:"optional" json:"codeArtifactOptions" yaml:"codeArtifactOptions"`
// Runtime dependencies of this module.
//
// The recommendation is to only specify the module name here (e.g.
// `express`). This will behave similar to `yarn 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 `npm i` or `yarn add` (e.g. `express@^2`) and
// this will be what you `package.json` will eventually include.
//
// Example:
// [ 'express', 'lodash', 'foo@^2' ]
//
// Default: [].
//
// Experimental.
Deps *[]*string `field:"optional" json:"deps" yaml:"deps"`
// 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
// Experimental.
Description *string `field:"optional" json:"description" yaml:"description"`
// 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 `yarn 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 `npm i` or `yarn add` (e.g. `express@^2`) and
// this will be what you `package.json` will eventually include.
//
// Example:
// [ 'typescript', '@types/express' ]
//
// Default: [].
//
// Experimental.
DevDeps *[]*string `field:"optional" json:"devDeps" yaml:"devDeps"`
// Module entrypoint (`main` in `package.json`).
//
// Set to an empty string to not include `main` in your package.json
// Default: "lib/index.js"
//
// Experimental.
Entrypoint *string `field:"optional" json:"entrypoint" yaml:"entrypoint"`
// Package's Homepage / Website.
// Experimental.
Homepage *string `field:"optional" json:"homepage" yaml:"homepage"`
// Keywords to include in `package.json`.
// Experimental.
Keywords *[]*string `field:"optional" json:"keywords" yaml:"keywords"`
// 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.
// Default: "Apache-2.0"
//
// Experimental.
License *string `field:"optional" json:"license" yaml:"license"`
// Indicates if a license should be added.
// Default: true.
//
// Experimental.
Licensed *bool `field:"optional" json:"licensed" yaml:"licensed"`
// Minimum node.js version to require via `engines` (inclusive).
// Default: - no max.
//
// Experimental.
MaxNodeVersion *string `field:"optional" json:"maxNodeVersion" yaml:"maxNodeVersion"`
// Minimum Node.js version to require via package.json `engines` (inclusive).
// Default: - no "engines" specified.
//
// Experimental.
MinNodeVersion *string `field:"optional" json:"minNodeVersion" yaml:"minNodeVersion"`
// Access level of the npm package.
// Default: - for scoped packages (e.g. `foo@bar`), the default is
// `NpmAccess.RESTRICTED`, for non-scoped packages, the default is
// `NpmAccess.PUBLIC`.
//
// Experimental.
NpmAccess NpmAccess `field:"optional" json:"npmAccess" yaml:"npmAccess"`
// The host name of the npm registry to publish to.
//
// Cannot be set together with `npmRegistryUrl`.
// Deprecated: use `npmRegistryUrl` instead.
NpmRegistry *string `field:"optional" json:"npmRegistry" yaml:"npmRegistry"`
// The base URL of the npm package registry.
//
// Must be a URL (e.g. start with "https://" or "http://")
// Default: "https://registry.npmjs.org"
//
// Experimental.
NpmRegistryUrl *string `field:"optional" json:"npmRegistryUrl" yaml:"npmRegistryUrl"`
// GitHub secret which contains the NPM token to use when publishing packages.
// Default: "NPM_TOKEN".
//
// Experimental.
NpmTokenSecret *string `field:"optional" json:"npmTokenSecret" yaml:"npmTokenSecret"`
// The Node Package Manager used to execute scripts.
// Default: NodePackageManager.YARN
//
// Experimental.
PackageManager NodePackageManager `field:"optional" json:"packageManager" yaml:"packageManager"`
// The "name" in package.json.
// Default: - defaults to project name.
//
// Experimental.
PackageName *string `field:"optional" json:"packageName" yaml:"packageName"`
// Options for `peerDeps`.
// Experimental.
PeerDependencyOptions *PeerDependencyOptions `field:"optional" json:"peerDependencyOptions" yaml:"peerDependencyOptions"`
// 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.
// Default: [].
//
// Experimental.
PeerDeps *[]*string `field:"optional" json:"peerDeps" yaml:"peerDeps"`
// The version of PNPM to use if using PNPM as a package manager.
// Default: "7".
//
// Experimental.
PnpmVersion *string `field:"optional" json:"pnpmVersion" yaml:"pnpmVersion"`
// The repository is the location where the actual code for your package lives.
//
// See https://classic.yarnpkg.com/en/docs/package-json/#toc-repository
// Experimental.
Repository *string `field:"optional" json:"repository" yaml:"repository"`
// 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.
// Experimental.
RepositoryDirectory *string `field:"optional" json:"repositoryDirectory" yaml:"repositoryDirectory"`
// Options for privately hosted scoped packages.
// Default: - fetch all scoped packages from the public npm registry.
//
// Experimental.
ScopedPackagesOptions *[]*ScopedPackagesOptions `field:"optional" json:"scopedPackagesOptions" yaml:"scopedPackagesOptions"`
// npm scripts to include.
//
// If a script has the same name as a standard script,
// the standard script will be overwritten.
// Also adds the script as a task.
// Default: {}.
//
// Deprecated: use `project.addTask()` or `package.setScript()`
Scripts *map[string]*string `field:"optional" json:"scripts" yaml:"scripts"`
// Package's Stability.
// Experimental.
Stability *string `field:"optional" json:"stability" yaml:"stability"`
// Version requirement of `publib` which is used to publish modules to npm.
// Default: "latest".
//
// Experimental.
JsiiReleaseVersion *string `field:"optional" json:"jsiiReleaseVersion" yaml:"jsiiReleaseVersion"`
// 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.
// Default: - Major version is not enforced.
//
// Experimental.
MajorVersion *float64 `field:"optional" json:"majorVersion" yaml:"majorVersion"`
// 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`.
// Default: - No minimum version is being enforced.
//
// Experimental.
MinMajorVersion *float64 `field:"optional" json:"minMajorVersion" yaml:"minMajorVersion"`
// 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.
// Default: "latest".
//
// Experimental.
NpmDistTag *string `field:"optional" json:"npmDistTag" yaml:"npmDistTag"`
// Steps to execute after build as part of the release workflow.
// Default: [].
//
// Experimental.
PostBuildSteps *[]*workflows.JobStep `field:"optional" json:"postBuildSteps" yaml:"postBuildSteps"`
// Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre").
// Default: - normal semantic versions.
//
// Experimental.
Prerelease *string `field:"optional" json:"prerelease" yaml:"prerelease"`
// Instead of actually publishing to package managers, just print the publishing command.
// Default: false.
//
// Experimental.
PublishDryRun *bool `field:"optional" json:"publishDryRun" yaml:"publishDryRun"`
// 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.
// Default: false.
//
// Experimental.
PublishTasks *bool `field:"optional" json:"publishTasks" yaml:"publishTasks"`
// Find commits that should be considered releasable Used to decide if a release is required.
// Default: ReleasableCommits.everyCommit()
//
// Experimental.
ReleasableCommits projen.ReleasableCommits `field:"optional" json:"releasableCommits" yaml:"releasableCommits"`
// 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.
// Default: - no additional branches are used for release. you can use
// `addBranch()` to add additional branches.
//
// Experimental.
ReleaseBranches *map[string]*release.BranchOptions `field:"optional" json:"releaseBranches" yaml:"releaseBranches"`
// Automatically release new versions every commit to one of branches in `releaseBranches`.
// Default: true.
//
// Deprecated: Use `releaseTrigger: ReleaseTrigger.continuous()` instead
ReleaseEveryCommit *bool `field:"optional" json:"releaseEveryCommit" yaml:"releaseEveryCommit"`
// Create a github issue on every failed publishing task.
// Default: false.
//
// Experimental.
ReleaseFailureIssue *bool `field:"optional" json:"releaseFailureIssue" yaml:"releaseFailureIssue"`
// The label to apply to issues indicating publish failures.
//
// Only applies if `releaseFailureIssue` is true.
// Default: "failed-release".
//
// Experimental.
ReleaseFailureIssueLabel *string `field:"optional" json:"releaseFailureIssueLabel" yaml:"releaseFailureIssueLabel"`
// CRON schedule to trigger new releases.
// Default: - no scheduled releases.
//
// Deprecated: Use `releaseTrigger: ReleaseTrigger.scheduled()` instead
ReleaseSchedule *string `field:"optional" json:"releaseSchedule" yaml:"releaseSchedule"`
// 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.
// Default: "v".
//
// Experimental.
ReleaseTagPrefix *string `field:"optional" json:"releaseTagPrefix" yaml:"releaseTagPrefix"`
// The release trigger to use.
// Default: - Continuous releases (`ReleaseTrigger.continuous()`)
//
// Experimental.
ReleaseTrigger release.ReleaseTrigger `field:"optional" json:"releaseTrigger" yaml:"releaseTrigger"`
// The name of the default release workflow.
// Default: "Release".
//
// Experimental.
ReleaseWorkflowName *string `field:"optional" json:"releaseWorkflowName" yaml:"releaseWorkflowName"`
// A set of workflow steps to execute in order to setup the workflow container.
// Experimental.
ReleaseWorkflowSetupSteps *[]*workflows.JobStep `field:"optional" json:"releaseWorkflowSetupSteps" yaml:"releaseWorkflowSetupSteps"`
// Custom configuration used when creating changelog with standard-version package.
//
// Given values either append to default configuration or overwrite values in it.
// Default: - standard configuration applicable for GitHub repositories.
//
// Experimental.
VersionrcOptions *map[string]interface{} `field:"optional" json:"versionrcOptions" yaml:"versionrcOptions"`
// Container image to use for GitHub workflows.
// Default: - default image.
//
// Experimental.
WorkflowContainerImage *string `field:"optional" json:"workflowContainerImage" yaml:"workflowContainerImage"`
// Github Runner selection labels.
// Default: ["ubuntu-latest"].
//
// Experimental.
WorkflowRunsOn *[]*string `field:"optional" json:"workflowRunsOn" yaml:"workflowRunsOn"`
// Github Runner Group selection options.
// Experimental.
WorkflowRunsOnGroup *projen.GroupRunnerOptions `field:"optional" json:"workflowRunsOnGroup" yaml:"workflowRunsOnGroup"`
// The name of the main release branch.
// Default: "main".
//
// Experimental.
DefaultReleaseBranch *string `field:"required" json:"defaultReleaseBranch" yaml:"defaultReleaseBranch"`
// A directory which will contain build artifacts.
// Default: "dist".
//
// Experimental.
ArtifactsDirectory *string `field:"optional" json:"artifactsDirectory" yaml:"artifactsDirectory"`
// Automatically approve deps upgrade PRs, allowing them to be merged by mergify (if configued).
//
// Throw if set to true but `autoApproveOptions` are not defined.
// Default: - true.
//
// Experimental.
AutoApproveUpgrades *bool `field:"optional" json:"autoApproveUpgrades" yaml:"autoApproveUpgrades"`
// Define a GitHub workflow for building PRs.
// Default: - true if not a subproject.
//
// Experimental.
BuildWorkflow *bool `field:"optional" json:"buildWorkflow" yaml:"buildWorkflow"`
// Build workflow triggers.
// Default: "{ pullRequest: {}, workflowDispatch: {} }".
//
// Experimental.
BuildWorkflowTriggers *workflows.Triggers `field:"optional" json:"buildWorkflowTriggers" yaml:"buildWorkflowTriggers"`
// Options for `Bundler`.
// Experimental.
BundlerOptions *BundlerOptions `field:"optional" json:"bundlerOptions" yaml:"bundlerOptions"`
// Define a GitHub workflow step for sending code coverage metrics to https://codecov.io/ Uses codecov/codecov-action@v3 A secret is required for private repos. Configured with `@codeCovTokenSecret`.
// Default: false.
//
// Experimental.
CodeCov *bool `field:"optional" json:"codeCov" yaml:"codeCov"`
// Define the secret name for a specified https://codecov.io/ token A secret is required to send coverage for private repositories.
// Default: - if this option is not specified, only public repositories are supported.
//
// Experimental.
CodeCovTokenSecret *string `field:"optional" json:"codeCovTokenSecret" yaml:"codeCovTokenSecret"`
// License copyright owner.
// Default: - defaults to the value of authorName or "" if `authorName` is undefined.
//
// Experimental.
CopyrightOwner *string `field:"optional" json:"copyrightOwner" yaml:"copyrightOwner"`
// The copyright years to put in the LICENSE file.
// Default: - current year.
//
// Experimental.
CopyrightPeriod *string `field:"optional" json:"copyrightPeriod" yaml:"copyrightPeriod"`
// Use dependabot to handle dependency upgrades.
//
// Cannot be used in conjunction with `depsUpgrade`.
// Default: false.
//
// Experimental.
Dependabot *bool `field:"optional" json:"dependabot" yaml:"dependabot"`
// Options for dependabot.
// Default: - default options.
//
// Experimental.
DependabotOptions *github.DependabotOptions `field:"optional" json:"dependabotOptions" yaml:"dependabotOptions"`
// Use tasks and github workflows to handle dependency upgrades.
//
// Cannot be used in conjunction with `dependabot`.
// Default: true.
//
// Experimental.
DepsUpgrade *bool `field:"optional" json:"depsUpgrade" yaml:"depsUpgrade"`
// Options for `UpgradeDependencies`.
// Default: - default options.
//
// Experimental.
DepsUpgradeOptions *UpgradeDependenciesOptions `field:"optional" json:"depsUpgradeOptions" yaml:"depsUpgradeOptions"`
// Additional entries to .gitignore.
// Experimental.
Gitignore *[]*string `field:"optional" json:"gitignore" yaml:"gitignore"`
// Setup jest unit tests.
// Default: true.
//
// Experimental.
Jest *bool `field:"optional" json:"jest" yaml:"jest"`
// Jest options.
// Default: - default options.
//
// Experimental.
JestOptions *JestOptions `field:"optional" json:"jestOptions" yaml:"jestOptions"`
// 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.
// Default: true.
//
// Experimental.
MutableBuild *bool `field:"optional" json:"mutableBuild" yaml:"mutableBuild"`
// Additional entries to .npmignore.
// Deprecated: - use `project.addPackageIgnore`
Npmignore *[]*string `field:"optional" json:"npmignore" yaml:"npmignore"`
// Defines an .npmignore file. Normally this is only needed for libraries that are packaged as tarballs.
// Default: true.
//
// Experimental.
NpmignoreEnabled *bool `field:"optional" json:"npmignoreEnabled" yaml:"npmignoreEnabled"`
// Configuration options for .npmignore file.
// Experimental.
NpmIgnoreOptions *projen.IgnoreFileOptions `field:"optional" json:"npmIgnoreOptions" yaml:"npmIgnoreOptions"`
// Defines a `package` task that will produce an npm tarball under the artifacts directory (e.g. `dist`).
// Default: true.
//
// Experimental.
Package *bool `field:"optional" json:"package" yaml:"package"`
// Setup prettier.
// Default: false.
//
// Experimental.
Prettier *bool `field:"optional" json:"prettier" yaml:"prettier"`
// Prettier options.
// Default: - default options.
//
// Experimental.
PrettierOptions *PrettierOptions `field:"optional" json:"prettierOptions" yaml:"prettierOptions"`
// Indicates of "projen" should be installed as a devDependency.
// Default: true.
//
// Experimental.
ProjenDevDependency *bool `field:"optional" json:"projenDevDependency" yaml:"projenDevDependency"`
// Generate (once) .projenrc.js (in JavaScript). Set to `false` in order to disable .projenrc.js generation.
// Default: - true if projenrcJson is false.
//
// Experimental.
ProjenrcJs *bool `field:"optional" json:"projenrcJs" yaml:"projenrcJs"`
// Options for .projenrc.js.
// Default: - default options.
//
// Experimental.
ProjenrcJsOptions *ProjenrcOptions `field:"optional" json:"projenrcJsOptions" yaml:"projenrcJsOptions"`
// Version of projen to install.
// Default: - Defaults to the latest version.
//
// Experimental.
ProjenVersion *string `field:"optional" json:"projenVersion" yaml:"projenVersion"`
// Include a GitHub pull request template.
// Default: true.
//
// Experimental.
PullRequestTemplate *bool `field:"optional" json:"pullRequestTemplate" yaml:"pullRequestTemplate"`
// The contents of the pull request template.
// Default: - default content.
//
// Experimental.
PullRequestTemplateContents *[]*string `field:"optional" json:"pullRequestTemplateContents" yaml:"pullRequestTemplateContents"`
// Add release management to this project.
// Default: - true (false for subprojects).
//
// Experimental.
Release *bool `field:"optional" json:"release" yaml:"release"`
// Automatically release to npm when new versions are introduced.
// Default: false.
//
// Experimental.
ReleaseToNpm *bool `field:"optional" json:"releaseToNpm" yaml:"releaseToNpm"`
// DEPRECATED: renamed to `release`.
// Default: - true if not a subproject.
//
// Deprecated: see `release`.
ReleaseWorkflow *bool `field:"optional" json:"releaseWorkflow" yaml:"releaseWorkflow"`
// Workflow steps to use in order to bootstrap this repo.
// Default: "yarn install --frozen-lockfile && yarn projen".
//
// Experimental.
WorkflowBootstrapSteps *[]*workflows.JobStep `field:"optional" json:"workflowBootstrapSteps" yaml:"workflowBootstrapSteps"`
// The git identity to use in workflows.
// Default: - GitHub Actions.
//
// Experimental.
WorkflowGitIdentity *github.GitIdentity `field:"optional" json:"workflowGitIdentity" yaml:"workflowGitIdentity"`
// The node version to use in GitHub workflows.
// Default: - same as `minNodeVersion`.
//
// Experimental.
WorkflowNodeVersion *string `field:"optional" json:"workflowNodeVersion" yaml:"workflowNodeVersion"`
// Enable Node.js package cache in GitHub workflows.
// Default: false.
//
// Experimental.
WorkflowPackageCache *bool `field:"optional" json:"workflowPackageCache" yaml:"workflowPackageCache"`
}
Experimental.
type NpmConfig ¶
type NpmConfig interface {
projen.Component
// Experimental.
Project() projen.Project
// configure a generic property.
// Experimental.
AddConfig(name *string, value *string)
// configure a scoped registry.
// Experimental.
AddRegistry(url *string, scope *string)
// Called after synthesis.
//
// Order is *not* guaranteed.
// Experimental.
PostSynthesize()
// Called before synthesis.
// Experimental.
PreSynthesize()
// Synthesizes files to the project output directory.
// Experimental.
Synthesize()
}
File representing the local NPM config in .npmrc. Experimental.
func NewNpmConfig ¶
func NewNpmConfig(project NodeProject, options *NpmConfigOptions) NpmConfig
Experimental.
type NpmConfigOptions ¶
type NpmConfigOptions struct {
// Omits empty objects and arrays.
// Default: false.
//
// Experimental.
OmitEmpty *bool `field:"optional" json:"omitEmpty" yaml:"omitEmpty"`
// URL of the registry mirror to use.
//
// You can change this or add scoped registries using the addRegistry method.
// Default: - use npmjs default registry.
//
// Experimental.
Registry *string `field:"optional" json:"registry" yaml:"registry"`
}
Options to configure the local NPM config. Experimental.
type PeerDependencyOptions ¶
type PeerDependencyOptions struct {
// Automatically add a pinned dev dependency.
// Default: true.
//
// Experimental.
PinnedDevDependency *bool `field:"optional" json:"pinnedDevDependency" yaml:"pinnedDevDependency"`
}
Experimental.
type Prettier ¶
type Prettier interface {
projen.Component
// The .prettierIgnore file.
// Experimental.
IgnoreFile() projen.IgnoreFile
// Returns all Prettier overrides.
// Experimental.
Overrides() *[]*PrettierOverride
// Experimental.
Project() projen.Project
// Direct access to the prettier settings.
// Experimental.
Settings() *PrettierSettings
// Defines Prettier ignore Patterns these patterns will be added to the file .prettierignore.
// Experimental.
AddIgnorePattern(pattern *string)
// Add a prettier override.
// See: https://prettier.io/docs/en/configuration.html#configuration-overrides
//
// Experimental.
AddOverride(override *PrettierOverride)
// Called after synthesis.
//
// Order is *not* guaranteed.
// Experimental.
PostSynthesize()
// Called before synthesis.
// Experimental.
PreSynthesize()
// Synthesizes files to the project output directory.
// Experimental.
Synthesize()
}
Represents prettier configuration. Experimental.
func NewPrettier ¶
func NewPrettier(project NodeProject, options *PrettierOptions) Prettier
Experimental.
type PrettierOptions ¶
type PrettierOptions struct {
// Defines an .prettierIgnore file.
// Default: true.
//
// Experimental.
IgnoreFile *bool `field:"optional" json:"ignoreFile" yaml:"ignoreFile"`
// Configuration options for .prettierignore file.
// Experimental.
IgnoreFileOptions *projen.IgnoreFileOptions `field:"optional" json:"ignoreFileOptions" yaml:"ignoreFileOptions"`
// Provide a list of patterns to override prettier configuration.
// See: https://prettier.io/docs/en/configuration.html#configuration-overrides
//
// Default: [].
//
// Experimental.
Overrides *[]*PrettierOverride `field:"optional" json:"overrides" yaml:"overrides"`
// Prettier settings.
// Default: - default settings.
//
// Experimental.
Settings *PrettierSettings `field:"optional" json:"settings" yaml:"settings"`
// Write prettier configuration as YAML instead of JSON.
// Default: false.
//
// Experimental.
Yaml *bool `field:"optional" json:"yaml" yaml:"yaml"`
}
Options for Prettier. Experimental.
type PrettierOverride ¶
type PrettierOverride struct {
// Include these files in this override.
// Experimental.
Files interface{} `field:"required" json:"files" yaml:"files"`
// The options to apply for this override.
// Experimental.
Options *PrettierSettings `field:"required" json:"options" yaml:"options"`
// Exclude these files from this override.
// Experimental.
ExcludeFiles interface{} `field:"optional" json:"excludeFiles" yaml:"excludeFiles"`
}
Experimental.
type PrettierSettings ¶
type PrettierSettings struct {
// Include parentheses around a sole arrow function parameter.
// Default: ArrowParens.ALWAYS
//
// Experimental.
ArrowParens ArrowParens `field:"optional" json:"arrowParens" yaml:"arrowParens"`
// Put > of opening tags on the last line instead of on a new line.
// Default: false.
//
// Experimental.
BracketSameLine *bool `field:"optional" json:"bracketSameLine" yaml:"bracketSameLine"`
// Print spaces between brackets.
// Default: true.
//
// Experimental.
BracketSpacing *bool `field:"optional" json:"bracketSpacing" yaml:"bracketSpacing"`
// 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.
// Default: -1.
//
// Experimental.
CursorOffset *float64 `field:"optional" json:"cursorOffset" yaml:"cursorOffset"`
// Control how Prettier formats quoted code embedded in the file.
// Default: EmbeddedLanguageFormatting.AUTO
//
// Experimental.
EmbeddedLanguageFormatting EmbeddedLanguageFormatting `field:"optional" json:"embeddedLanguageFormatting" yaml:"embeddedLanguageFormatting"`
// Which end of line characters to apply.
// Default: EndOfLine.LF
//
// Experimental.
EndOfLine EndOfLine `field:"optional" json:"endOfLine" yaml:"endOfLine"`
// Specify the input filepath.
//
// This will be used to do parser inference.
// Default: none.
//
// Experimental.
Filepath *string `field:"optional" json:"filepath" yaml:"filepath"`
// How to handle whitespaces in HTML.
// Default: HTMLWhitespaceSensitivity.CSS
//
// Experimental.
HtmlWhitespaceSensitivity HTMLWhitespaceSensitivity `field:"optional" json:"htmlWhitespaceSensitivity" yaml:"htmlWhitespaceSensitivity"`
// Insert.
// Default: false.
//
// Experimental.
InsertPragma *bool `field:"optional" json:"insertPragma" yaml:"insertPragma"`
// Use single quotes in JSX.
// Default: false.
//
// Experimental.
JsxSingleQuote *bool `field:"optional" json:"jsxSingleQuote" yaml:"jsxSingleQuote"`
// Which parser to use.
// Default: - Prettier automatically infers the parser from the input file path, so you shouldn’t have to change this setting.
//
// Experimental.
Parser *string `field:"optional" json:"parser" yaml:"parser"`
// Add a plugin.
//
// Multiple plugins can be passed as separate `--plugin`s.
// Default: [].
//
// Experimental.
Plugins *[]*string `field:"optional" json:"plugins" yaml:"plugins"`
// 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.
// Default: [].
//
// Experimental.
PluginSearchDirs *[]*string `field:"optional" json:"pluginSearchDirs" yaml:"pluginSearchDirs"`
// The line length where Prettier will try wrap.
// Default: 80.
//
// Experimental.
PrintWidth *float64 `field:"optional" json:"printWidth" yaml:"printWidth"`
// How to wrap prose.
// Default: ProseWrap.PRESERVE
//
// Experimental.
ProseWrap ProseWrap `field:"optional" json:"proseWrap" yaml:"proseWrap"`
// Change when properties in objects are quoted.
// Default: QuoteProps.ASNEEDED
//
// Experimental.
QuoteProps QuoteProps `field:"optional" json:"quoteProps" yaml:"quoteProps"`
// 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.
// Default: null.
//
// Experimental.
RangeEnd *float64 `field:"optional" json:"rangeEnd" yaml:"rangeEnd"`
// 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.
// Default: 0.
//
// Experimental.
RangeStart *float64 `field:"optional" json:"rangeStart" yaml:"rangeStart"`
// Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.
// Default: false.
//
// Experimental.
RequirePragma *bool `field:"optional" json:"requirePragma" yaml:"requirePragma"`
// Print semicolons.
// Default: true.
//
// Experimental.
Semi *bool `field:"optional" json:"semi" yaml:"semi"`
// Use single quotes instead of double quotes.
// Default: false.
//
// Experimental.
SingleQuote *bool `field:"optional" json:"singleQuote" yaml:"singleQuote"`
// Number of spaces per indentation level.
// Default: 2.
//
// Experimental.
TabWidth *float64 `field:"optional" json:"tabWidth" yaml:"tabWidth"`
// Print trailing commas wherever possible when multi-line.
// Default: TrailingComma.ES5
//
// Experimental.
TrailingComma TrailingComma `field:"optional" json:"trailingComma" yaml:"trailingComma"`
// Indent with tabs instead of spaces.
// Default: false.
//
// Experimental.
UseTabs *bool `field:"optional" json:"useTabs" yaml:"useTabs"`
// Indent script and style tags in Vue files.
// Default: false.
//
// Experimental.
VueIndentScriptAndStyle *bool `field:"optional" json:"vueIndentScriptAndStyle" yaml:"vueIndentScriptAndStyle"`
}
Options to set in Prettier directly or through overrides. See: https://prettier.io/docs/en/options.html
Experimental.
type Projenrc ¶
type Projenrc interface {
projen.ProjenrcFile
// The path of the projenrc file.
// Experimental.
FilePath() *string
// Experimental.
Project() projen.Project
// Called after synthesis.
//
// Order is *not* guaranteed.
// Experimental.
PostSynthesize()
// Called before synthesis.
// Experimental.
PreSynthesize()
// Synthesizes files to the project output directory.
// Experimental.
Synthesize()
}
Sets up a javascript project to use TypeScript for projenrc. Experimental.
func NewProjenrc ¶
func NewProjenrc(project projen.Project, options *ProjenrcOptions) Projenrc
Experimental.
type ProjenrcOptions ¶
type ProjenrcOptions struct {
// The name of the projenrc file.
// Default: ".projenrc.js"
//
// Experimental.
Filename *string `field:"optional" json:"filename" yaml:"filename"`
}
Experimental.
type QuoteProps ¶
type QuoteProps string
Experimental.
const ( // Only add quotes around object properties where required. // Experimental. QuoteProps_ASNEEDED QuoteProps = "ASNEEDED" // If at least one property in an object requires quotes, quote all properties. // Experimental. QuoteProps_CONSISTENT QuoteProps = "CONSISTENT" // Respect the input use of quotes in object properties. // Experimental. QuoteProps_PRESERVE QuoteProps = "PRESERVE" )
type RenderWorkflowSetupOptions ¶
type RenderWorkflowSetupOptions struct {
// Should the pacakge lockfile be updated?
// Default: false.
//
// Experimental.
Mutable *bool `field:"optional" json:"mutable" yaml:"mutable"`
}
Options for `renderInstallSteps()`. Experimental.
type ScopedPackagesOptions ¶
type ScopedPackagesOptions struct {
// URL of the registry for scoped packages.
// Experimental.
RegistryUrl *string `field:"required" json:"registryUrl" yaml:"registryUrl"`
// Scope of the packages.
//
// Example:
// "@angular"
//
// Experimental.
Scope *string `field:"required" json:"scope" yaml:"scope"`
}
Options for scoped packages. Experimental.
type TrailingComma ¶
type TrailingComma string
Experimental.
const ( // Trailing commas wherever possible (including function arguments). // Experimental. TrailingComma_ALL TrailingComma = "ALL" // Trailing commas where valid in ES5 (objects, arrays, etc.). // Experimental. TrailingComma_ES5 TrailingComma = "ES5" // No trailing commas. // Experimental. TrailingComma_NONE TrailingComma = "NONE" )
type TypeScriptCompilerOptions ¶
type TypeScriptCompilerOptions struct {
// Suppress arbitrary extension import errors with the assumption that a bundler will be handling it.
// See: https://www.typescriptlang.org/tsconfig#allowArbitraryExtensions
//
// Default: undefined.
//
// Experimental.
AllowArbitraryExtensions *bool `field:"optional" json:"allowArbitraryExtensions" yaml:"allowArbitraryExtensions"`
// Allows TypeScript files to import each other with TypeScript-specific extensions (`.ts`, `.mts`, `.tsx`). Requires `noEmit` or `emitDeclarationOnly`.
// Default: undefined.
//
// Experimental.
AllowImportingTsExtensions *bool `field:"optional" json:"allowImportingTsExtensions" yaml:"allowImportingTsExtensions"`
// Allow JavaScript files to be compiled.
// Default: false.
//
// Experimental.
AllowJs *bool `field:"optional" json:"allowJs" yaml:"allowJs"`
// Allow default imports from modules with no default export.
//
// This does not affect code emit, just typechecking.
// Experimental.
AllowSyntheticDefaultImports *bool `field:"optional" json:"allowSyntheticDefaultImports" yaml:"allowSyntheticDefaultImports"`
// Ensures that your files are parsed in the ECMAScript strict mode, and emit “use strict” for each source file.
// Default: true.
//
// Experimental.
AlwaysStrict *bool `field:"optional" json:"alwaysStrict" yaml:"alwaysStrict"`
// 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.
// Experimental.
BaseUrl *string `field:"optional" json:"baseUrl" yaml:"baseUrl"`
// List of additional conditions that should succeed when TypeScript resolves from an `exports` or `imports` field of a `package.json`.
// See: https://www.typescriptlang.org/tsconfig#customConditions
//
// Default: undefined.
//
// Experimental.
CustomConditions *[]*string `field:"optional" json:"customConditions" yaml:"customConditions"`
// To be specified along with the above.
// Experimental.
Declaration *bool `field:"optional" json:"declaration" yaml:"declaration"`
// Offers a way to configure the root directory for where declaration files are emitted.
// Experimental.
DeclarationDir *string `field:"optional" json:"declarationDir" yaml:"declarationDir"`
// 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.
// See: {@link https://www.typescriptlang.org/tsconfig#declarationMap}
//
// Experimental.
DeclarationMap *bool `field:"optional" json:"declarationMap" yaml:"declarationMap"`
// Only emit .d.ts files; do not emit .js files.
// Default: false.
//
// Experimental.
EmitDeclarationOnly *bool `field:"optional" json:"emitDeclarationOnly" yaml:"emitDeclarationOnly"`
// 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.
// See: https://www.typescriptlang.org/docs/handbook/decorators.html
//
// Default: undefined.
//
// Experimental.
EmitDecoratorMetadata *bool `field:"optional" json:"emitDecoratorMetadata" yaml:"emitDecoratorMetadata"`
// Emit __importStar and __importDefault helpers for runtime babel ecosystem compatibility and enable --allowSyntheticDefaultImports for typesystem compatibility.
// Default: false.
//
// Experimental.
EsModuleInterop *bool `field:"optional" json:"esModuleInterop" yaml:"esModuleInterop"`
// 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.
// Default: false.
//
// Experimental.
ExactOptionalPropertyTypes *bool `field:"optional" json:"exactOptionalPropertyTypes" yaml:"exactOptionalPropertyTypes"`
// Enables experimental support for decorators, which is in stage 2 of the TC39 standardization process.
// Default: true.
//
// Experimental.
ExperimentalDecorators *bool `field:"optional" json:"experimentalDecorators" yaml:"experimentalDecorators"`
// Disallow inconsistently-cased references to the same file.
// Default: false.
//
// Experimental.
ForceConsistentCasingInFileNames *bool `field:"optional" json:"forceConsistentCasingInFileNames" yaml:"forceConsistentCasingInFileNames"`
// This flag works because you can use `import type` to explicitly create an `import` statement which should never be emitted into JavaScript.
// See: https://www.typescriptlang.org/tsconfig#importsNotUsedAsValues
//
// Default: "remove".
//
// Experimental.
ImportsNotUsedAsValues TypeScriptImportsNotUsedAsValues `field:"optional" json:"importsNotUsedAsValues" yaml:"importsNotUsedAsValues"`
// 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.
// Default: true.
//
// Experimental.
InlineSourceMap *bool `field:"optional" json:"inlineSourceMap" yaml:"inlineSourceMap"`
// 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.
// Default: true.
//
// Experimental.
InlineSources *bool `field:"optional" json:"inlineSources" yaml:"inlineSources"`
// Perform additional checks to ensure that separate compilation (such as with transpileModule or.
// Default: false.
//
// Experimental.
IsolatedModules *bool `field:"optional" json:"isolatedModules" yaml:"isolatedModules"`
// Support JSX in .tsx files: "react", "preserve", "react-native" etc.
// Default: undefined.
//
// Experimental.
Jsx TypeScriptJsxMode `field:"optional" json:"jsx" yaml:"jsx"`
// Declares the module specifier to be used for importing the jsx and jsxs factory functions when using jsx.
// Default: undefined.
//
// Experimental.
JsxImportSource *string `field:"optional" json:"jsxImportSource" yaml:"jsxImportSource"`
// Reference for type definitions / libraries to use (eg.
//
// ES2016, ES5, ES2018).
// Default: [ "es2018" ].
//
// Experimental.
Lib *[]*string `field:"optional" json:"lib" yaml:"lib"`
// Sets the module system for the program.
//
// See https://www.typescriptlang.org/docs/handbook/modules.html#ambient-modules.
// Default: "CommonJS".
//
// Experimental.
Module *string `field:"optional" json:"module" yaml:"module"`
// Determine how modules get resolved.
//
// Either "Node" for Node.js/io.js style resolution, or "Classic".
// Default: "node".
//
// Experimental.
ModuleResolution TypeScriptModuleResolution `field:"optional" json:"moduleResolution" yaml:"moduleResolution"`
// Do not emit outputs.
// Default: false.
//
// Experimental.
NoEmit *bool `field:"optional" json:"noEmit" yaml:"noEmit"`
// Do not emit compiler output files like JavaScript source code, source-maps or declarations if any errors were reported.
// Default: true.
//
// Experimental.
NoEmitOnError *bool `field:"optional" json:"noEmitOnError" yaml:"noEmitOnError"`
// 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.
// Default: true.
//
// Experimental.
NoFallthroughCasesInSwitch *bool `field:"optional" json:"noFallthroughCasesInSwitch" yaml:"noFallthroughCasesInSwitch"`
// 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.
// Default: true.
//
// Experimental.
NoImplicitAny *bool `field:"optional" json:"noImplicitAny" yaml:"noImplicitAny"`
// 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.
// Default: false.
//
// Experimental.
NoImplicitOverride *bool `field:"optional" json:"noImplicitOverride" yaml:"noImplicitOverride"`
// When enabled, TypeScript will check all code paths in a function to ensure they return a value.
// Default: true.
//
// Experimental.
NoImplicitReturns *bool `field:"optional" json:"noImplicitReturns" yaml:"noImplicitReturns"`
// Raise error on ‘this’ expressions with an implied ‘any’ type.
// Default: true.
//
// Experimental.
NoImplicitThis *bool `field:"optional" json:"noImplicitThis" yaml:"noImplicitThis"`
// Raise error on use of the dot syntax to access fields which are not defined.
// Default: true.
//
// Experimental.
NoPropertyAccessFromIndexSignature *bool `field:"optional" json:"noPropertyAccessFromIndexSignature" yaml:"noPropertyAccessFromIndexSignature"`
// Raise error when accessing indexes on objects with unknown keys defined in index signatures.
// Default: true.
//
// Experimental.
NoUncheckedIndexedAccess *bool `field:"optional" json:"noUncheckedIndexedAccess" yaml:"noUncheckedIndexedAccess"`
// Report errors on unused local variables.
// Default: true.
//
// Experimental.
NoUnusedLocals *bool `field:"optional" json:"noUnusedLocals" yaml:"noUnusedLocals"`
// Report errors on unused parameters in functions.
// Default: true.
//
// Experimental.
NoUnusedParameters *bool `field:"optional" json:"noUnusedParameters" yaml:"noUnusedParameters"`
// Output directory for the compiled files.
// Experimental.
OutDir *string `field:"optional" json:"outDir" yaml:"outDir"`
// 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.
// Experimental.
Paths *map[string]*[]*string `field:"optional" json:"paths" yaml:"paths"`
// 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.
// Default: true.
//
// Experimental.
ResolveJsonModule *bool `field:"optional" json:"resolveJsonModule" yaml:"resolveJsonModule"`
// Forces TypeScript to consult the `exports` field of `package.json` files if it ever reads from a package in `node_modules`.
// Default: true.
//
// Experimental.
ResolvePackageJsonExports *bool `field:"optional" json:"resolvePackageJsonExports" yaml:"resolvePackageJsonExports"`
// 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.
// Default: undefined.
//
// Experimental.
ResolvePackageJsonImports *bool `field:"optional" json:"resolvePackageJsonImports" yaml:"resolvePackageJsonImports"`
// Specifies the root directory of input files.
//
// Only use to control the output directory structure with `outDir`.
// Experimental.
RootDir *string `field:"optional" json:"rootDir" yaml:"rootDir"`
// Skip type checking of all declaration files (*.d.ts).
// Default: false.
//
// Experimental.
SkipLibCheck *bool `field:"optional" json:"skipLibCheck" yaml:"skipLibCheck"`
// Enables the generation of sourcemap files.
// Default: undefined.
//
// Experimental.
SourceMap *bool `field:"optional" json:"sourceMap" yaml:"sourceMap"`
// Specify the location where a debugger should locate TypeScript files instead of relative source locations.
// Default: undefined.
//
// Experimental.
SourceRoot *string `field:"optional" json:"sourceRoot" yaml:"sourceRoot"`
// 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.
// Default: true.
//
// Experimental.
Strict *bool `field:"optional" json:"strict" yaml:"strict"`
// 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.
// Default: true.
//
// Experimental.
StrictNullChecks *bool `field:"optional" json:"strictNullChecks" yaml:"strictNullChecks"`
// When set to true, TypeScript will raise an error when a class property was declared but not set in the constructor.
// Default: true.
//
// Experimental.
StrictPropertyInitialization *bool `field:"optional" json:"strictPropertyInitialization" yaml:"strictPropertyInitialization"`
// Do not emit declarations for code that has an `@internal` annotation in it’s JSDoc comment.
// Default: true.
//
// Experimental.
StripInternal *bool `field:"optional" json:"stripInternal" yaml:"stripInternal"`
// 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.
// Default: "ES2018".
//
// Experimental.
Target *string `field:"optional" json:"target" yaml:"target"`
// If types is specified, only packages listed will be included in the global scope.
// See: {@link https://www.typescriptlang.org/tsconfig#types}
//
// Experimental.
Types *[]*string `field:"optional" json:"types" yaml:"types"`
// Change the type of the variable in a catch clause from any to unknown Available with TypeScript 4.4 and newer.
// Default: true.
//
// Experimental.
UseUnknownInCatchVariables *bool `field:"optional" json:"useUnknownInCatchVariables" yaml:"useUnknownInCatchVariables"`
// Simplifies TypeScript's handling of import/export `type` modifiers.
// See: https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax
//
// Default: undefined.
//
// Experimental.
VerbatimModuleSyntax *bool `field:"optional" json:"verbatimModuleSyntax" yaml:"verbatimModuleSyntax"`
}
Experimental.
type TypeScriptImportsNotUsedAsValues ¶
type TypeScriptImportsNotUsedAsValues string
This flag controls how `import` works, there are 3 different options. See: https://www.typescriptlang.org/tsconfig#importsNotUsedAsValues
Experimental.
const ( // The default behavior of dropping `import` statements which only reference types. // Experimental. TypeScriptImportsNotUsedAsValues_REMOVE TypeScriptImportsNotUsedAsValues = "REMOVE" // Preserves all `import` statements whose values or types are never used. // // This can cause imports/side-effects to be preserved. // Experimental. TypeScriptImportsNotUsedAsValues_PRESERVE TypeScriptImportsNotUsedAsValues = "PRESERVE" // 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. // Experimental. TypeScriptImportsNotUsedAsValues_ERROR TypeScriptImportsNotUsedAsValues = "ERROR" )
type TypeScriptJsxMode ¶
type TypeScriptJsxMode string
Determines how JSX should get transformed into valid JavaScript. See: https://www.typescriptlang.org/docs/handbook/jsx.html
Experimental.
const ( // Keeps the JSX as part of the output to be further consumed by another transform step (e.g. Babel). // Experimental. TypeScriptJsxMode_PRESERVE TypeScriptJsxMode = "PRESERVE" // 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. // Experimental. TypeScriptJsxMode_REACT TypeScriptJsxMode = "REACT" // Keeps all JSX like 'preserve' mode, but output will have a .js extension. // Experimental. TypeScriptJsxMode_REACT_NATIVE TypeScriptJsxMode = "REACT_NATIVE" // Passes `key` separately from props and always passes `children` as props (since React 17). // See: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-1.html#react-17-jsx-factories // // Experimental. TypeScriptJsxMode_REACT_JSX TypeScriptJsxMode = "REACT_JSX" // Same as `REACT_JSX` with additional debug data. // Experimental. TypeScriptJsxMode_REACT_JSXDEV TypeScriptJsxMode = "REACT_JSXDEV" )
type TypeScriptModuleResolution ¶
type TypeScriptModuleResolution string
Determines how modules get resolved. See: https://www.typescriptlang.org/docs/handbook/module-resolution.html
Experimental.
const ( // TypeScript's former default resolution strategy. // See: https://www.typescriptlang.org/docs/handbook/module-resolution.html#classic // // Experimental. TypeScriptModuleResolution_CLASSIC TypeScriptModuleResolution = "CLASSIC" // Resolution strategy which attempts to mimic the Node.js module resolution strategy at runtime. // See: https://www.typescriptlang.org/docs/handbook/module-resolution.html#node // // Experimental. TypeScriptModuleResolution_NODE TypeScriptModuleResolution = "NODE" // Node.js’ ECMAScript Module Support from TypeScript 4.7 onwards. // See: https://www.typescriptlang.org/tsconfig#moduleResolution // // Experimental. TypeScriptModuleResolution_NODE16 TypeScriptModuleResolution = "NODE16" // Node.js’ ECMAScript Module Support from TypeScript 4.7 onwards. // See: https://www.typescriptlang.org/tsconfig#moduleResolution // // Experimental. TypeScriptModuleResolution_NODE_NEXT TypeScriptModuleResolution = "NODE_NEXT" // Resolution strategy which attempts to mimic resolution patterns of modern bundlers; // // from TypeScript 5.0 onwards. // See: https://www.typescriptlang.org/tsconfig#moduleResolution // // Experimental. TypeScriptModuleResolution_BUNDLER TypeScriptModuleResolution = "BUNDLER" )
type TypescriptConfig ¶
type TypescriptConfig interface {
projen.Component
// Experimental.
CompilerOptions() *TypeScriptCompilerOptions
// Experimental.
Exclude() *[]*string
// Array of base `tsconfig.json` paths. Any absolute paths are resolved relative to this instance, while any relative paths are used as is.
// Experimental.
Extends() *[]*string
// Experimental.
File() projen.JsonFile
// Experimental.
FileName() *string
// Experimental.
Include() *[]*string
// Experimental.
Project() projen.Project
// Experimental.
AddExclude(pattern *string)
// Extend from base `TypescriptConfig` instance.
// Experimental.
AddExtends(value TypescriptConfig)
// Experimental.
AddInclude(pattern *string)
// Called after synthesis.
//
// Order is *not* guaranteed.
// Experimental.
PostSynthesize()
// Called before synthesis.
// Experimental.
PreSynthesize()
// Resolve valid TypeScript extends paths relative to this config.
// Experimental.
ResolveExtendsPath(configPath *string) *string
// Synthesizes files to the project output directory.
// Experimental.
Synthesize()
}
Experimental.
func NewTypescriptConfig ¶
func NewTypescriptConfig(project projen.Project, options *TypescriptConfigOptions) TypescriptConfig
Experimental.
type TypescriptConfigExtends ¶
type TypescriptConfigExtends interface {
// Experimental.
ToJSON() *[]*string
}
Container for `TypescriptConfig` `tsconfig.json` base configuration(s). Extending from more than one base config file requires TypeScript 5.0+. Experimental.
func TypescriptConfigExtends_FromPaths ¶
func TypescriptConfigExtends_FromPaths(paths *[]*string) TypescriptConfigExtends
Factory for creation from array of file paths. Experimental.
func TypescriptConfigExtends_FromTypescriptConfigs ¶
func TypescriptConfigExtends_FromTypescriptConfigs(configs *[]TypescriptConfig) TypescriptConfigExtends
Factory for creation from array of other `TypescriptConfig` instances. Experimental.
type TypescriptConfigOptions ¶
type TypescriptConfigOptions struct {
// Compiler options to use.
// Experimental.
CompilerOptions *TypeScriptCompilerOptions `field:"required" json:"compilerOptions" yaml:"compilerOptions"`
// Filters results from the "include" option.
// Default: - node_modules is excluded by default.
//
// Experimental.
Exclude *[]*string `field:"optional" json:"exclude" yaml:"exclude"`
// Base `tsconfig.json` configuration(s) to inherit from.
// Experimental.
Extends TypescriptConfigExtends `field:"optional" json:"extends" yaml:"extends"`
// Default: "tsconfig.json"
//
// Experimental.
FileName *string `field:"optional" json:"fileName" yaml:"fileName"`
// Specifies a list of glob patterns that match TypeScript files to be included in compilation.
// Default: - all .ts files recursively
//
// Experimental.
Include *[]*string `field:"optional" json:"include" yaml:"include"`
}
Experimental.
type UpdateSnapshot ¶
type UpdateSnapshot string
Experimental.
const ( // Always update snapshots in "test" task. // Experimental. UpdateSnapshot_ALWAYS UpdateSnapshot = "ALWAYS" // Never update snapshots in "test" task and create a separate "test:update" task. // Experimental. UpdateSnapshot_NEVER UpdateSnapshot = "NEVER" )
type UpgradeDependencies ¶
type UpgradeDependencies interface {
projen.Component
// Container definitions for the upgrade workflow.
// Experimental.
ContainerOptions() *workflows.ContainerOptions
// Experimental.
SetContainerOptions(val *workflows.ContainerOptions)
// A task run after the upgrade task.
// Experimental.
PostUpgradeTask() projen.Task
// Experimental.
Project() projen.Project
// The upgrade task.
// Experimental.
UpgradeTask() projen.Task
// The workflows that execute the upgrades.
//
// One workflow per branch.
// Experimental.
Workflows() *[]github.GithubWorkflow
// Add steps to execute a successful build.
// Experimental.
AddPostBuildSteps(steps ...*workflows.JobStep)
// Called after synthesis.
//
// Order is *not* guaranteed.
// Experimental.
PostSynthesize()
// Called before synthesis.
// Experimental.
PreSynthesize()
// Synthesizes files to the project output directory.
// Experimental.
Synthesize()
}
Upgrade node project dependencies. Experimental.
func NewUpgradeDependencies ¶
func NewUpgradeDependencies(project NodeProject, options *UpgradeDependenciesOptions) UpgradeDependencies
Experimental.
type UpgradeDependenciesOptions ¶
type UpgradeDependenciesOptions struct {
// List of package names to exclude during the upgrade.
// Default: - Nothing is excluded.
//
// Experimental.
Exclude *[]*string `field:"optional" json:"exclude" yaml:"exclude"`
// List of package names to include during the upgrade.
// Default: - Everything is included.
//
// Experimental.
Include *[]*string `field:"optional" json:"include" yaml:"include"`
// Title of the pull request to use (should be all lower-case).
// Default: "upgrade dependencies".
//
// Experimental.
PullRequestTitle *string `field:"optional" json:"pullRequestTitle" yaml:"pullRequestTitle"`
// 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.
// See: https://github.com/raineorshine/npm-check-updates#peer
//
// Default: true.
//
// Experimental.
SatisfyPeerDependencies *bool `field:"optional" json:"satisfyPeerDependencies" yaml:"satisfyPeerDependencies"`
// The semantic commit type.
// Default: 'chore'.
//
// Experimental.
SemanticCommit *string `field:"optional" json:"semanticCommit" yaml:"semanticCommit"`
// Add Signed-off-by line by the committer at the end of the commit log message.
// Default: true.
//
// Experimental.
Signoff *bool `field:"optional" json:"signoff" yaml:"signoff"`
// Determines the target version to upgrade dependencies to.
// See: https://github.com/raineorshine/npm-check-updates#target
//
// Default: "minor".
//
// Experimental.
Target *string `field:"optional" json:"target" yaml:"target"`
// The name of the task that will be created.
//
// This will also be the workflow name.
// Default: "upgrade".
//
// Experimental.
TaskName *string `field:"optional" json:"taskName" yaml:"taskName"`
// Specify which dependency types the upgrade should operate on.
// Default: - All dependency types.
//
// Experimental.
Types *[]projen.DependencyType `field:"optional" json:"types" yaml:"types"`
// 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.
// Default: - true for root projects, false for sub-projects.
//
// Experimental.
Workflow *bool `field:"optional" json:"workflow" yaml:"workflow"`
// Options for the github workflow.
//
// Only applies if `workflow` is true.
// Default: - default options.
//
// Experimental.
WorkflowOptions *UpgradeDependenciesWorkflowOptions `field:"optional" json:"workflowOptions" yaml:"workflowOptions"`
}
Options for `UpgradeDependencies`. Experimental.
type UpgradeDependenciesSchedule ¶
type UpgradeDependenciesSchedule interface {
// Experimental.
Cron() *[]*string
}
How often to check for new versions and raise pull requests for version upgrades. Experimental.
func UpgradeDependenciesSchedule_DAILY ¶
func UpgradeDependenciesSchedule_DAILY() UpgradeDependenciesSchedule
func UpgradeDependenciesSchedule_Expressions ¶
func UpgradeDependenciesSchedule_Expressions(cron *[]*string) UpgradeDependenciesSchedule
Create a schedule from a raw cron expression. Experimental.
func UpgradeDependenciesSchedule_MONTHLY ¶
func UpgradeDependenciesSchedule_MONTHLY() UpgradeDependenciesSchedule
func UpgradeDependenciesSchedule_NEVER ¶
func UpgradeDependenciesSchedule_NEVER() UpgradeDependenciesSchedule
func UpgradeDependenciesSchedule_WEEKDAY ¶
func UpgradeDependenciesSchedule_WEEKDAY() UpgradeDependenciesSchedule
func UpgradeDependenciesSchedule_WEEKLY ¶
func UpgradeDependenciesSchedule_WEEKLY() UpgradeDependenciesSchedule
type UpgradeDependenciesWorkflowOptions ¶
type UpgradeDependenciesWorkflowOptions struct {
// Assignees to add on the PR.
// Default: - no assignees.
//
// Experimental.
Assignees *[]*string `field:"optional" json:"assignees" yaml:"assignees"`
// List of branches to create PR's for.
// Default: - All release branches configured for the project.
//
// Experimental.
Branches *[]*string `field:"optional" json:"branches" yaml:"branches"`
// Job container options.
// Default: - defaults.
//
// Experimental.
Container *workflows.ContainerOptions `field:"optional" json:"container" yaml:"container"`
// The git identity to use for commits.
// Default: "github-actions@github.com"
//
// Experimental.
GitIdentity *github.GitIdentity `field:"optional" json:"gitIdentity" yaml:"gitIdentity"`
// Labels to apply on the PR.
// Default: - no labels.
//
// Experimental.
Labels *[]*string `field:"optional" json:"labels" yaml:"labels"`
// 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 }`.
// Default: `{ contents: JobPermission.READ }`
//
// Experimental.
Permissions *workflows.JobPermissions `field:"optional" json:"permissions" yaml:"permissions"`
// 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.
// See: https://github.com/peter-evans/create-pull-request/issues/48
//
// Default: - personal access token named PROJEN_GITHUB_TOKEN.
//
// Experimental.
ProjenCredentials github.GithubCredentials `field:"optional" json:"projenCredentials" yaml:"projenCredentials"`
// Github Runner selection labels.
// Default: ["ubuntu-latest"].
//
// Experimental.
RunsOn *[]*string `field:"optional" json:"runsOn" yaml:"runsOn"`
// Github Runner Group selection options.
// Experimental.
RunsOnGroup *projen.GroupRunnerOptions `field:"optional" json:"runsOnGroup" yaml:"runsOnGroup"`
// Schedule to run on.
// Default: UpgradeDependenciesSchedule.DAILY
//
// Experimental.
Schedule UpgradeDependenciesSchedule `field:"optional" json:"schedule" yaml:"schedule"`
}
Options for `UpgradeDependencies.workflowOptions`. Experimental.
type WatchPlugin ¶
type WatchPlugin interface {
}
Experimental.
func NewWatchPlugin ¶
func NewWatchPlugin(name *string, options interface{}) WatchPlugin
Experimental.
Source Files
¶
- AddBundleOptions.go
- ArrowParens.go
- AutoRelease.go
- Bundle.go
- Bundler.go
- BundlerOptions.go
- Bundler__checks.go
- BundlingOptions.go
- CodeArtifactAuthProvider.go
- CodeArtifactOptions.go
- CoverageThreshold.go
- EmbeddedLanguageFormatting.go
- EndOfLine.go
- Eslint.go
- EslintOptions.go
- EslintOverride.go
- Eslint__checks.go
- HTMLWhitespaceSensitivity.go
- HasteConfig.go
- Jest.go
- JestConfigOptions.go
- JestOptions.go
- JestReporter.go
- JestReporter__checks.go
- Jest__checks.go
- NodePackage.go
- NodePackageManager.go
- NodePackageOptions.go
- NodePackage__checks.go
- NodeProject.go
- NodeProjectOptions.go
- NodeProject__checks.go
- NpmAccess.go
- NpmConfig.go
- NpmConfigOptions.go
- NpmConfig__checks.go
- PeerDependencyOptions.go
- Prettier.go
- PrettierOptions.go
- PrettierOverride.go
- PrettierSettings.go
- Prettier__checks.go
- Projenrc.go
- ProjenrcOptions.go
- Projenrc__checks.go
- ProseWrap.go
- QuoteProps.go
- RenderWorkflowSetupOptions.go
- ScopedPackagesOptions.go
- TrailingComma.go
- Transform.go
- Transform__checks.go
- TypeScriptCompilerOptions.go
- TypeScriptImportsNotUsedAsValues.go
- TypeScriptJsxMode.go
- TypeScriptModuleResolution.go
- TypescriptConfig.go
- TypescriptConfigExtends.go
- TypescriptConfigExtends__checks.go
- TypescriptConfigOptions.go
- TypescriptConfig__checks.go
- UpdateSnapshot.go
- UpgradeDependencies.go
- UpgradeDependenciesOptions.go
- UpgradeDependenciesSchedule.go
- UpgradeDependenciesSchedule__checks.go
- UpgradeDependenciesWorkflowOptions.go
- UpgradeDependencies__checks.go
- WatchPlugin.go
- WatchPlugin__checks.go
- main.go