import type ChangelogRenderer from '../../release/changelog-renderer'; import type { ChangelogRenderOptions } from '../../release/changelog-renderer'; import type { validReleaseVersionPrefixes } from '../command-line/release/utils/release-graph'; import type { PackageManager } from '../utils/package-manager'; import type { InputDefinition, TargetConfiguration, TargetDependencyConfig } from './workspace-json-project-json'; export type ImplicitDependencyEntry = { [key: string]: T | ImplicitJsonSubsetDependency; }; export interface ImplicitJsonSubsetDependency { [key: string]: T | ImplicitJsonSubsetDependency; } /** * @deprecated Use {@link NxJsonConfiguration#defaultBase } instead */ export interface NxAffectedConfig { /** * Default based branch used by affected commands. */ defaultBase?: string; } export type TargetDefaults = Record>; export type TargetDependencies = Record; export interface NrwlJsPluginConfig { analyzeSourceFiles?: boolean; analyzePackageJson?: boolean; analyzeLockfile?: boolean; projectsAffectedByDependencyUpdates?: 'all' | 'auto' | string[]; } interface NxInstallationConfiguration { /** * Version used for Nx */ version: string; /** * Record. e.g. * plugins: { '@nx/angular': '1.0.0' } */ plugins?: Record; } export type ManifestRootToUpdate = string | { path: string; preserveLocalDependencyProtocols: boolean; }; export interface NxReleaseDockerConfiguration { /** * A command to run after validation of nx release configuration, but before docker versioning begins. * Useful for preparing docker build artifacts. If --dry-run is passed, the command is still executed, * but with the NX_DRY_RUN environment variable set to 'true'. */ preVersionCommand?: string; /** * Projects which should use a no-op VersionActions implementation rather than any potentially inferred by default or via Inference Plugins. * Can be an array of project names (subset of projects in the release setup/release group) or a boolean (true means all projects). * e.g. * Consider a node application called `api` that does not require its `package.json` file to be versioned yet builds versioned docker images. * To ensure that JS Versioning does not take place, the following would be set in the `docker` config in `nx.release` * ``` * "docker": { * "skipVersionActions": ["api"] * } * ``` * Note: if you are using {versionActionsVersion} in your docker version scheme you should not skip version actions for that project * as the docker versioning will not be able to resolve the {versionActionsVersion} placeholder. */ skipVersionActions?: string[] | boolean; /** * Record of named version patterns to choose between when versioning docker projects. * * e.g. * ``` * "production": "{currentDate|YYMM.DD}.{shortCommitSha}", * "hotfix": "{currentDate|YYMM.DD}-hotfix" * ``` */ versionSchemes?: Record; /** * Repository name for the image on the configured registry */ repositoryName?: string; /** * Url of the Docker Image/Container Registry to push images to. * Defaults to Docker Hub. */ registryUrl?: string; } export interface NxReleaseVersionConfiguration { /** * Shorthand for enabling the current version of projects to be resolved from git tags, * and the next version to be determined by analyzing commit messages according to the * Conventional Commits specification. */ conventionalCommits?: boolean; /** * A command to run after validation of nx release configuration, but before versioning begins. * Useful for preparing build artifacts. If --dry-run is passed, the command is still executed, * but with the NX_DRY_RUN environment variable set to 'true'. */ preVersionCommand?: string; /** * The source to use for determining the specifier to use when versioning. * 'prompt' is the default and will interactively prompt the user for an explicit/imperative specifier. * 'conventional-commits' will attempt determine a specifier from commit messages conforming to the Conventional Commits specification. * 'version-plans' will determine the specifier from the version plan files available on disk. */ specifierSource?: 'prompt' | 'conventional-commits' | 'version-plans'; /** * A list of directories containing manifest files (such as package.json) to apply updates to when versioning. * * By default, only the project root will be used, but you could customize this to only version a manifest in a * dist directory, or even version multiple manifests in different directories, such as both source and dist. * * For more advanced scenarios, the preserveLocalDependencyProtocols can be overridden per manifest by providing * and object instead of a string. */ manifestRootsToUpdate?: ManifestRootToUpdate[]; /** * The resolver to use for determining the current version of a project during versioning. * This is needed for versioning approaches which involve relatively modifying a current version * to arrive at a new version, such as semver bumps like 'patch', 'minor' etc. * * Using 'none' explicitly declares that the current version is not needed to compute the new version, and * should only be used with appropriate version actions implementations that support it. */ currentVersionResolver?: 'registry' | 'disk' | 'git-tag' | 'none'; /** * Metadata to provide to the configured currentVersionResolver to help it in determining the current version. * What to pass here is specific to each resolver. */ currentVersionResolverMetadata?: Record; /** * The fallback version resolver to use when the configured currentVersionResolver fails to resolve the current version. */ fallbackCurrentVersionResolver?: 'disk'; /** * Whether or not this is the first release of one of more projects. * This removes certain validation checks that are not possible to enforce if the project has never been released before. */ firstRelease?: boolean; /** * The prefix to use when versioning dependencies. * This can be one of the following: auto, '', '~', '^', '=', where auto means the existing prefix will be preserved. */ versionPrefix?: (typeof validReleaseVersionPrefixes)[number]; /** * Whether to delete the processed version plans file after versioning is complete. This is false by default because the * version plans are also needed for changelog generation. */ deleteVersionPlans?: boolean; /** * When versioning independent projects, this controls whether to update their dependents (i.e. the things that depend on them). * - 'never' means no dependents will be updated (unless they happen to be versioned directly as well). * - 'always' is the default and will cause dependents to be updated (a patch version bump) when a dependency is versioned, even if they are not included in the group or projects filter. * - 'auto' will cause dependents to be updated (a patch version bump) when a dependency is versioned, as long as a * group or projects filter is not applied that does not include them. */ updateDependents?: 'auto' | 'always' | 'never'; /** * Whether to log projects that have not changed during versioning. */ logUnchangedProjects?: boolean; /** * The path to the version actions implementation to use for releasing all projects by default. * This can also be overridden on the release group and project levels. */ versionActions?: string; /** * The specific options that are defined by each version actions implementation. * They will be passed to the version actions implementation when running a release. */ versionActionsOptions?: Record; /** * Whether to preserve local dependency protocols (e.g. file references, or the `workspace:` protocol in package.json files) * of local dependencies when updating them during versioning. */ preserveLocalDependencyProtocols?: boolean; /** * Whether to preserve matching dependency ranges when updating them during versioning. * e.g. * The new version will be "1.2.0" and the current version range in dependents is already "^1.0.0" * Therefore, the manifest file is not updated. * * This is false by default. */ preserveMatchingDependencyRanges?: boolean | Array<'dependencies' | 'devDependencies' | 'peerDependencies' | 'optionalDependencies'>; /** * Whether to strictly follow SemVer V2 spec for 0.x versions where breaking changes * bump the minor version (instead of major), and new features bump the patch version * (instead of minor). * * When enabled: * - 'major' bumps become 'minor' bumps for 0.x versions * - 'minor' bumps become 'patch' bumps for 0.x versions * - 'premajor' becomes 'preminor' for 0.x versions * - 'preminor' becomes 'prepatch' for 0.x versions * * Versions 1.0.0 and above are unaffected. * * This is false by default for backward compatibility. */ adjustSemverBumpsForZeroMajorVersion?: boolean; /** * Whether to apply the --preid value to the implicit patch bumps given to * dependents (and other projects in a fixed release group) when a dependency * is versioned. When true, those dependents are bumped as a prepatch using * the same preid, so a dependency moving to "1.2.3-rc.0" will bump its * dependents to "1.0.1-rc.0" instead of "1.0.1". * * This is false by default for backward compatibility — consuming an RC of a * dependency does not necessarily mean the consumer itself is an RC. */ applyPreidToDependents?: boolean; } export interface NxReleaseChangelogConfiguration { /** * Optionally create a release containing all relevant changes on a supported version control system, it * is false by default. * * NOTE: if createRelease is set on a group of projects, it will cause the default releaseTagPattern of * "{projectName}@{version}" to be used for those projects, even when versioning everything together. */ createRelease?: false | 'github' | 'gitlab' | { provider: 'github-enterprise-server'; hostname: string; /** * If not set, this will default to `https://${hostname}/api/v3` */ apiBaseUrl?: string; } | { provider: 'gitlab'; hostname: string; /** * If not set, this will default to `https://${hostname}/api/v4` */ apiBaseUrl?: string; }; /** * This can either be set to a string value that will be written to the changelog file(s) * at the workspace root and/or within project directories, or set to `false` to specify * that no changelog entry should be made when there are no code changes. * * NOTE: The string value has a sensible default value and supports interpolation of * {projectName} when generating for project level changelogs. * * E.g. for a project level changelog you could customize the message to something like: * "entryWhenNoChanges": "There were no code changes for {projectName}" */ entryWhenNoChanges?: string | false; /** * This is either a workspace path where the changelog markdown file will be created and read from, * or set to false to disable file creation altogether (e.g. if only using Github releases). * * Interpolation of {projectName}, {projectRoot} and {workspaceRoot} is supported. * * The defaults are: * - "{workspaceRoot}/CHANGELOG.md" at the workspace level * - "{projectRoot}/CHANGELOG.md" at the project level */ file?: string | false; /** * If using nx.json, this can be a path to a valid changelog renderer function used to transform commit messages and * other metadata into the final changelog (usually in markdown format). Its output can be modified using the optional * `renderOptions`. * * If configuring using a custom `ReleaseClient` via the programmatic API, you can either provide a path or directly * provide the implementation class itself. * * By default, the renderer is set to the DefaultChangelogRenderer implementation from "nx/release/changelog-renderer", * which nx provides out of the box. */ renderer?: string | typeof ChangelogRenderer; renderOptions?: ChangelogRenderOptions; } export interface NxReleaseGitConfiguration { /** * Whether or not to automatically commit the changes made by current command */ commit?: boolean; /** * Custom git commit message to use when committing the changes made by this command {version} will be dynamically interpolated when performing fixed releases, interpolated tags will be appended to the commit body when performing independent releases. */ commitMessage?: string; /** * Additional arguments (added after the --message argument, which may or may not be customized with --git-commit-message) to pass to the `git commit` command invoked behind the scenes. May be a string or array of strings. */ commitArgs?: string | string[]; /** * Whether or not to stage the changes made by this command. Always treated as true if commit is true. */ stageChanges?: boolean; /** * Whether or not to automatically tag the changes made by this command */ tag?: boolean; /** * Custom git tag message to use when tagging the changes made by this command. This defaults to be the same value as the tag itself. */ tagMessage?: string; /** * Additional arguments to pass to the `git tag` command invoked behind the scenes. May be a string or array of strings. */ tagArgs?: string | string[]; /** * Whether or not to automatically push the changes made by this command to the remote git repository. */ push?: boolean; /** * Additional arguments to pass to the `git push` command invoked behind the scenes. May be a string or array of strings. */ pushArgs?: string | string[]; } export interface NxReleaseConventionalCommitsConfiguration { /** * Whether or not to rely on commit scope to resolve version specifier. * If set to 'true', then only commits with scope matching projectName and commits without scope affects version determined, rest are assumed as patch change. * If set to 'false', then all commits that affected project used to determine semver change. * If not set, this will default to 'true' */ useCommitScope?: boolean; types?: Record