[conventional-changelog] Added and updated type definitions (#41639)

* [conventional-commits-parser] Added type definitions for conventional-commits-parser

* [git-raw-commits] Added type definitions for git-raw-commits

* [conventional-commits-parser] Updated conventionalCommitsParser.Commit

* [conventional-changelog-writer] Added type definitions for conventional-changelog-writer

* [conventional-changelog-writer] Updated conventionalChangelogWriter.Options.Sort

* [conventional-commits-parser] Removed spaces

* [conventional-changelog-writer] Fixed typing

* [conventional-changelog-writer] Updated generics

* [conventional-changelog-writer] Updated names of interfaces and types

* [conventional-commits-parser] Updated tests

* [conventional-changelog-core] Added type definitions

* [conventional-changelog-preset-loader] Added type definitions

* [conventional-recommended-bump] Added type definitions

* [conventional-changelog-core] Relocated `// $ExpectType`; altered the name of the namespace

* [conventional-changelog-preset-loader] Altered the name of the namespace

* [conventional-commits-parser] Altered the name of the namespace

* [conventional-recommended-bump] Altered the name of the namespace

* [conventional-changelog-core] Removed the extra `// $ExpectType`

* [conventional-changelog-core] Added `recommendedBumpOpts` to `conventionalChangelogCore.Options.Config.Object`

* [conventional-changelog-core] Updated some generics

* [conventional-changelog-preset-loader] Added `conventionalChangelogPresetLoader.Builder`

* [conventional-changelog-config-spec] Added type definitions

* [conventional-changelog-core] Rearranged `import`s

* [conventional-changelog] Added type definitions

* [standard-version] Added type definitions

* [conventional-changelog-config-spec] Added  `OTHER_FILES.txt`

* [conventional-changelog-config] Updated `OTHER_FILES.txt`

* [conventional-changelog-preset-loader] Removed default value for some type parameters
This commit is contained in:
Kwok Chi Leong 2020-01-18 01:46:38 +08:00 committed by Eli Barzilay
parent cae514c1f7
commit 40e813b932
18 changed files with 889 additions and 12 deletions

View File

@ -0,0 +1,2 @@
versions/1.0.0/schema.json.d.ts
versions/2.0.0/schema.json.d.ts

View File

@ -0,0 +1,35 @@
/* tslint:disable:no-mergeable-namespace no-namespace */
"use strict";
import ConventionalChangelogConfigSpec from "conventional-changelog-config-spec";
namespace Module {
// $ExpectType JSONSchema7
ConventionalChangelogConfigSpec;
}
namespace Module.Config {
declare const config: ConventionalChangelogConfigSpec.Config;
// $ExpectType Config
config;
config.commitUrlFormat; // $ExpectType string | undefined
config.compareUrlFormat; // $ExpectType string | undefined
config.header; // $ExpectType string | undefined
config.issuePrefixes; // $ExpectType string[] | undefined
config.issueUrlFormat; // $ExpectType string | undefined
config.preMajor; // $ExpectType boolean | undefined
config.releaseCommitMessageFormat; // $ExpectType string | undefined
config.types; // $ExpectType Type[] | undefined
config.userUrlFormat; // $ExpectType string | undefined
}
namespace Module.Config.Type {
declare const type: ConventionalChangelogConfigSpec.Config.Type;
// $ExpectType Type
type;
type.hidden; // $ExpectType boolean | undefined
type.section; // $ExpectType string | undefined
type.type; // $ExpectType string
}

View File

@ -0,0 +1,9 @@
// Type definitions for conventional-changelog-config-spec 2.1
// Project: https://github.com/conventional-changelog/conventional-changelog-config-spec#readme
// Definitions by: Jason Kwok <https://github.com/JasonHK>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.9
import * as ConventionalChangelogConfigSpec from "./versions/2.1.0/schema.json";
export = ConventionalChangelogConfigSpec;

View File

@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"esModuleInterop": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"conventional-changelog-config-spec-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@ -0,0 +1,131 @@
import { JSONSchema7 } from "json-schema";
declare const ConventionalChangelogConfigSpec: JSONSchema7;
declare namespace ConventionalChangelogConfigSpec {
/**
* Describes the configuration options supported by conventional-config for
* upstream tooling.
*/
interface Config {
/**
* An array of `type` objects representing the explicitly supported commit
* message types, and whether they should show up in generated `CHANGELOG`s.
*
* @default
* [
* { "type": "feat", "section": "Features" },
* { "type": "fix", "section": "Bug Fixes" },
* { "type": "test", "section": "Tests" },
* { "type": "build", "section": "Build System" },
* { "type": "ci", "hidden": true }
* ]
*/
types?: Config.Type[];
/**
* Boolean indicating whether or not the action being run (generating CHANGELOG,
* recommendedBump, etc.) is being performed for a pre-major release (<1.0.0).
*
* This config setting will generally be set by tooling and not a user.
*
* @default
* false
*/
preMajor?: boolean;
/**
* A URL representing a specific commit at a hash.
*
* @default
* "{{host}}/{{owner}}/{{repository}}/commit/{{hash}}"
*/
commitUrlFormat?: string;
/**
* A URL representing the comparison between two git SHAs.
*
* @default
* "{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}"
*/
compareUrlFormat?: string;
/**
* A URL representing the issue format (allowing a different URL format to be
* swapped in for Gitlab, Bitbucket, etc).
*
* @default
* "{{host}}/{{owner}}/{{repository}}/issues/{{id}}"
*/
issueUrlFormat?: string;
/**
* A URL representing the a user's profile URL on GitHub, Gitlab, etc. This URL
* is used for substituting @bcoe with https://github.com/bcoe in commit
* messages.
*
* @default
* "{{host}}/{{user}}"
*/
userUrlFormat?: string;
/**
* A string to be used to format the auto-generated release commit message.
*
* @default
* "chore(release): {{currentTag}}"
*/
releaseCommitMessageFormat?: string;
}
namespace Config {
/**
* An object that describes a commit type's settings in the CHANGELOG.
*/
type Type = Type.WithSection | Type.WithHidden;
namespace Type {
/**
* An object that describes a commit type's settings in the CHANGELOG.
*/
interface Base {
/**
* A string used to match <type>s used in the Conventional Commits convention.
*/
type: string;
/**
* The section where the matched commit type will display in the CHANGELOG.
*/
section?: string;
/**
* Set to `true` to hide matched commit types in the CHANGELOG.
*/
hidden?: boolean;
}
/**
* An object that describes a commit type's settings in the CHANGELOG.
*/
interface WithSection extends Base {
/**
* The section where the matched commit type will display in the CHANGELOG.
*/
section: string;
}
/**
* An object that describes a commit type's settings in the CHANGELOG.
*/
interface WithHidden extends Base {
/**
* Set to `true` to hide matched commit types in the CHANGELOG.
*/
hidden: boolean;
}
}
}
}
export = ConventionalChangelogConfigSpec;

View File

@ -0,0 +1,142 @@
import { JSONSchema7 } from "json-schema";
declare const ConventionalChangelogConfigSpec: JSONSchema7;
declare namespace ConventionalChangelogConfigSpec {
/**
* Describes the configuration options supported by conventional-config for
* upstream tooling.
*/
interface Config {
/**
* A string to be used as the main header section of the CHANGELOG.
*
* @default
* "# Changelog\n\n"
*/
header?: string;
/**
* An array of `type` objects representing the explicitly supported commit
* message types, and whether they should show up in generated `CHANGELOG`s.
*
* @default
* [
* { "type": "feat", "section": "Features" },
* { "type": "fix", "section": "Bug Fixes" },
* { "type": "chore", "hidden": true },
* { "type": "docs", "hidden": true },
* { "type": "style", "hidden": true },
* { "type": "refactor", "hidden": true },
* { "type": "perf", "hidden": true },
* { "type": "test", "hidden": true }
* ]
*/
types?: Config.Type[];
/**
* Boolean indicating whether or not the action being run (generating CHANGELOG,
* recommendedBump, etc.) is being performed for a pre-major release (<1.0.0).
*
* This config setting will generally be set by tooling and not a user.
*
* @default
* false
*/
preMajor?: boolean;
/**
* A URL representing a specific commit at a hash.
*
* @default
* "{{host}}/{{owner}}/{{repository}}/commit/{{hash}}"
*/
commitUrlFormat?: string;
/**
* A URL representing the comparison between two git SHAs.
*
* @default
* "{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}"
*/
compareUrlFormat?: string;
/**
* A URL representing the issue format (allowing a different URL format to be
* swapped in for Gitlab, Bitbucket, etc).
*
* @default
* "{{host}}/{{owner}}/{{repository}}/issues/{{id}}"
*/
issueUrlFormat?: string;
/**
* A URL representing the a user's profile URL on GitHub, Gitlab, etc. This URL
* is used for substituting @bcoe with https://github.com/bcoe in commit
* messages.
*
* @default
* "{{host}}/{{user}}"
*/
userUrlFormat?: string;
/**
* A string to be used to format the auto-generated release commit message.
*
* @default
* "chore(release): {{currentTag}}"
*/
releaseCommitMessageFormat?: string;
}
namespace Config {
/**
* An object that describes a commit type's settings in the CHANGELOG.
*/
type Type = Type.WithSection | Type.WithHidden;
namespace Type {
/**
* An object that describes a commit type's settings in the CHANGELOG.
*/
interface Base {
/**
* A string used to match <type>s used in the Conventional Commits convention.
*/
type: string;
/**
* The section where the matched commit type will display in the CHANGELOG.
*/
section?: string;
/**
* Set to `true` to hide matched commit types in the CHANGELOG.
*/
hidden?: boolean;
}
/**
* An object that describes a commit type's settings in the CHANGELOG.
*/
interface WithSection extends Base {
/**
* The section where the matched commit type will display in the CHANGELOG.
*/
section: string;
}
/**
* An object that describes a commit type's settings in the CHANGELOG.
*/
interface WithHidden extends Base {
/**
* Set to `true` to hide matched commit types in the CHANGELOG.
*/
hidden: boolean;
}
}
}
}
export = ConventionalChangelogConfigSpec;

View File

@ -0,0 +1,150 @@
import { JSONSchema7 } from "json-schema";
declare const ConventionalChangelogConfigSpec: JSONSchema7;
declare namespace ConventionalChangelogConfigSpec {
/**
* Describes the configuration options supported by conventional-config for
* upstream tooling.
*/
interface Config {
/**
* A string to be used as the main header section of the CHANGELOG.
*
* @default
* "# Changelog\n\n"
*/
header?: string;
/**
* An array of `type` objects representing the explicitly supported commit
* message types, and whether they should show up in generated `CHANGELOG`s.
*
* @default
* [
* { "type": "feat", "section": "Features" },
* { "type": "fix", "section": "Bug Fixes" },
* { "type": "chore", "hidden": true },
* { "type": "docs", "hidden": true },
* { "type": "style", "hidden": true },
* { "type": "refactor", "hidden": true },
* { "type": "perf", "hidden": true },
* { "type": "test", "hidden": true }
* ]
*/
types?: Config.Type[];
/**
* Boolean indicating whether or not the action being run (generating CHANGELOG,
* recommendedBump, etc.) is being performed for a pre-major release (<1.0.0).
*
* This config setting will generally be set by tooling and not a user.
*
* @default
* false
*/
preMajor?: boolean;
/**
* A URL representing a specific commit at a hash.
*
* @default
* "{{host}}/{{owner}}/{{repository}}/commit/{{hash}}"
*/
commitUrlFormat?: string;
/**
* A URL representing the comparison between two git SHAs.
*
* @default
* "{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}"
*/
compareUrlFormat?: string;
/**
* A URL representing the issue format (allowing a different URL format to be
* swapped in for Gitlab, Bitbucket, etc).
*
* @default
* "{{host}}/{{owner}}/{{repository}}/issues/{{id}}"
*/
issueUrlFormat?: string;
/**
* A URL representing the a user's profile URL on GitHub, Gitlab, etc. This URL
* is used for substituting @bcoe with https://github.com/bcoe in commit
* messages.
*
* @default
* "{{host}}/{{user}}"
*/
userUrlFormat?: string;
/**
* A string to be used to format the auto-generated release commit message.
*
* @default
* "chore(release): {{currentTag}}"
*/
releaseCommitMessageFormat?: string;
/**
* An array of prefixes used to detect references to issues.
*
* @default
* ["#"]
*/
issuePrefixes?: string[];
}
namespace Config {
/**
* An object that describes a commit type's settings in the CHANGELOG.
*/
type Type = Type.WithSection | Type.WithHidden;
namespace Type {
/**
* An object that describes a commit type's settings in the CHANGELOG.
*/
interface Base {
/**
* A string used to match <type>s used in the Conventional Commits convention.
*/
type: string;
/**
* The section where the matched commit type will display in the CHANGELOG.
*/
section?: string;
/**
* Set to `true` to hide matched commit types in the CHANGELOG.
*/
hidden?: boolean;
}
/**
* An object that describes a commit type's settings in the CHANGELOG.
*/
interface WithSection extends Base {
/**
* The section where the matched commit type will display in the CHANGELOG.
*/
section: string;
}
/**
* An object that describes a commit type's settings in the CHANGELOG.
*/
interface WithHidden extends Base {
/**
* Set to `true` to hide matched commit types in the CHANGELOG.
*/
hidden: boolean;
}
}
}
}
export = ConventionalChangelogConfigSpec;

View File

@ -8,9 +8,17 @@
import * as Stream from "stream";
import { Commit, Options as BaseParserOptions } from "conventional-commits-parser";
import { Context as BaseContext, Options as BaseWriterOptions } from "conventional-changelog-writer";
import {
Context as BaseContext,
Options as BaseWriterOptions,
} from "conventional-changelog-writer";
import {
Commit,
Options as BaseParserOptions,
} from "conventional-commits-parser";
import { Options as RecommendedBumpOptions } from "conventional-recommended-bump";
import { GitOptions as BaseGitRawCommitsOptions } from "git-raw-commits";
import { Package } from "normalize-package-data";
/**
@ -139,7 +147,7 @@ declare namespace conventionalChangelogCore {
debug?: BaseGitRawCommitsOptions["debug"];
}
type MergedContext<T extends BaseContext> = T & MergedContext.ExtraContext;
type MergedContext<T extends BaseContext = BaseContext> = T & MergedContext.ExtraContext;
namespace MergedContext {
interface ExtraContext {
@ -155,7 +163,7 @@ declare namespace conventionalChangelogCore {
}
}
interface Options<TCommit extends Commit = Commit, TContext extends BaseContext = Context> {
interface Options<TCommit extends Commit = Commit, TContext extends BaseContext = BaseContext> {
/**
* This should serve as default values for other arguments of
* `conventionalChangelogCore` so you don't need to rewrite the same or similar
@ -245,19 +253,21 @@ declare namespace conventionalChangelogCore {
}
namespace Options {
type Config<TCommit extends Commit, TContext extends BaseContext> = Promise<Config.Object<TCommit, TContext>> | Config.Function<TCommit, TContext> | Config.Object<TCommit, TContext>;
// tslint:disable-next-line max-line-length
type Config<TCommit extends Commit = Commit, TContext extends BaseContext = BaseContext> = Promise<Config.Object<TCommit, TContext>> | Config.Function<TCommit, TContext> | Config.Object<TCommit, TContext>;
namespace Config {
type FunctionType<TCommit extends Commit, TContext extends BaseContext> = (callback: FunctionType.Callback<TCommit, TContext>) => void;
type FunctionType<TCommit extends Commit = Commit, TContext extends BaseContext = BaseContext> = (callback: FunctionType.Callback<TCommit, TContext>) => void;
namespace FunctionType {
type Callback<TCommit extends Commit, TContext extends BaseContext> = (error: any, config: ObjectType<TCommit, TContext>) => void;
type Callback<TCommit extends Commit = Commit, TContext extends BaseContext = BaseContext> = (error: any, config: ObjectType<TCommit, TContext>) => void;
}
interface ObjectType<TCommit extends Commit, TContext extends BaseContext> {
interface ObjectType<TCommit extends Commit = Commit, TContext extends BaseContext = BaseContext> {
context?: Partial<TContext>;
gitRawCommitsOpts?: GitRawCommitsOptions;
parserOpts?: ParserOptions;
recommendedBumpOpts?: RecommendedBumpOptions;
writerOpts?: WriterOptions<TCommit, TContext>;
}
@ -316,7 +326,7 @@ declare namespace conventionalChangelogCore {
warn?: BaseParserOptions["warn"];
}
interface WriterOptions<TCommit extends Commit = Commit, TContext extends BaseContext = Context> extends BaseWriterOptions<TCommit, MergedContext<TContext>> {
interface WriterOptions<TCommit extends Commit = Commit, TContext extends BaseContext = BaseContext> extends BaseWriterOptions<TCommit, MergedContext<TContext>> {
/**
* Last chance to modify your context before generating a changelog.
*
@ -360,8 +370,8 @@ declare namespace conventionalChangelogCore {
type Context = conventionalChangelogCore.Context;
type GitRawCommitsOptions = conventionalChangelogCore.GitRawCommitsOptions;
type Options<TCommit extends Commit, TContext extends BaseContext> = conventionalChangelogCore.Options<TCommit, TContext>;
type Options<TCommit extends Commit = Commit, TContext extends BaseContext = BaseContext> = conventionalChangelogCore.Options<TCommit, TContext>;
type ParserOptions = conventionalChangelogCore.ParserOptions;
type WriterOptions<TCommit extends Commit = Commit, TContext extends BaseContext = Context> = conventionalChangelogCore.WriterOptions<TCommit, TContext>;
type WriterOptions<TCommit extends Commit = Commit, TContext extends BaseContext = BaseContext> = conventionalChangelogCore.WriterOptions<TCommit, TContext>;
export = conventionalChangelogCore;

View File

@ -24,7 +24,7 @@ import { Context as WriterContext } from "conventional-changelog-writer";
*
* @param path
*/
declare function conventionalChangelogPresetLoader(path: string | Config): CoreOptions.Config<Commit, WriterContext>;
declare function conventionalChangelogPresetLoader(path: string | Config): CoreOptions.Config;
declare namespace conventionalChangelogPresetLoader {
function presetLoader(requireMethod: presetLoader.RequireMethod): typeof conventionalChangelogPresetLoader;
@ -33,6 +33,8 @@ declare namespace conventionalChangelogPresetLoader {
type RequireMethod = (id: string) => any;
}
type Builder = (config: CoreOptions.Config.Object & Config) => CoreOptions.Config;
interface Config {
/**
* The string that is passed to the preset loader is manipulated by prepending

View File

@ -0,0 +1,26 @@
/* tslint:disable:no-mergeable-namespace no-namespace */
"use strict";
import conventionalChangelog from "conventional-changelog";
import conventionalChangelogCore from "conventional-changelog-core";
namespace Module {
declare const context: conventionalChangelogCore.Context;
declare const gitRawCommitsOpts: conventionalChangelogCore.GitRawCommitsOptions;
declare const options: conventionalChangelog.Options;
declare const parserOpts: conventionalChangelogCore.ParserOptions;
declare const writerOpts: conventionalChangelogCore.WriterOptions;
// $ExpectType Readable
conventionalChangelog();
// $ExpectType Readable
conventionalChangelog(options);
// $ExpectType Readable
conventionalChangelog(options, context);
// $ExpectType Readable
conventionalChangelog(options, context, gitRawCommitsOpts);
// $ExpectType Readable
conventionalChangelog(options, context, gitRawCommitsOpts, parserOpts);
// $ExpectType Readable
conventionalChangelog(options, context, gitRawCommitsOpts, parserOpts, writerOpts);
}

56
types/conventional-changelog/index.d.ts vendored Normal file
View File

@ -0,0 +1,56 @@
// Type definitions for conventional-changelog 3.1
// Project: https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog#readme
// Definitions by: Jason Kwok <https://github.com/JasonHK>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.9
/// <reference types="node" />
import * as Stream from "stream";
import {
Context,
GitRawCommitsOptions,
ParserOptions,
WriterOptions,
Options as BaseOptions,
} from "conventional-changelog-core";
import { Context as WriterContext } from "conventional-changelog-writer";
import { Commit } from "conventional-commits-parser";
/**
* Returns a readable stream.
*
* @param options
* @param context
* @param gitRawCommitsOpts
* @param parserOpts
* @param writerOpts
*/
// tslint:disable-next-line max-line-length
declare function conventionalChangelog<TCommit extends Commit = Commit, TContext extends WriterContext = Context>(options?: Options<TCommit, TContext>, context?: Partial<TContext>, gitRawCommitsOpts?: GitRawCommitsOptions, parserOpts?: ParserOptions, writerOpts?: WriterOptions<TCommit, TContext>): Stream.Readable;
declare namespace conventionalChangelog {
/**
* See the [conventional-changelog-core](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-core)
* docs. The API is the same with the following changes or additions:
*/
interface Options<TCommit extends Commit = Commit, TContext extends WriterContext = WriterContext> extends BaseOptions<TCommit, TContext> {
/**
* It's recommended to use a preset so you don't have to define everything
* yourself. Presets are names of built-in `config`.
*
* A scoped preset package such as `@scope/conventional-changelog-custom-preset`
* can be used by passing `@scope/custom-preset` to this option.
*
* @remarks
* `options.config` will be overwritten by the values of preset. You should use
* either `preset` or `config`, but not both.
*/
preset?: string;
}
}
type Options<TCommit extends Commit = Commit, TContext extends WriterContext = WriterContext> = conventionalChangelog.Options<TCommit, TContext>;
export = conventionalChangelog;

View File

@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"esModuleInterop": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"conventional-changelog-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

224
types/standard-version/index.d.ts vendored Normal file
View File

@ -0,0 +1,224 @@
// Type definitions for standard-version 7.0
// Project: https://github.com/conventional-changelog/standard-version#readme
// Definitions by: Jason Kwok <https://github.com/JasonHK>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.9
/// <reference types="node" />
import { Config } from "conventional-changelog-config-spec";
declare function standardVersion(options: Options): Promise<void>;
declare namespace standardVersion {
interface Options extends Config {
/**
* @default
* [
* 'package.json',
* 'bower.json',
* 'manifest.json',
* 'composer.json'
* ]
*/
packageFiles?: string[];
/**
* @default
* [
* 'package-lock.json',
* 'npm-shrinkwrap.json',
* 'composer.lock'
* ]
*/
bumpFiles?: string[];
/**
* Specify the release type manually (like npm version <major|minor|patch>).
*/
releaseAs?: string;
/**
* Make a pre-release with optional option value to specify a tag id.
*/
prerelease?: string;
/**
* Read the CHANGELOG from this file.
*
* @default
* 'CHANGELOG.md'
*/
infile?: string | Buffer | URL | number;
/**
* Commit message, replaces %s with new version.
*
* @deprecated
* This option will be removed in the next major version, please use
* `releaseCommitMessageFormat`.
*/
message?: string;
/**
* Is this the first release?
*
* @default
* false
*/
firstRelease?: boolean;
/**
* Should the git commit and tag be signed?
*
* @default
* false
*/
sign?: boolean;
/**
* Bypass pre-commit or commit-msg git hooks during the commit phase.
*
* @default
* false
*/
noVerify?: boolean;
/**
* Commit all staged changes, not just files affected by standard-version.
*
* @default
* false
*/
commitAll?: boolean;
/**
* Don't print logs and errors.
*
* @default
* false
*/
silent?: boolean;
/**
* Set a custom prefix for the git tag to be created.
*
* @default
* 'v'
*/
tagPrefix?: string;
/**
* Provide scripts to execute for lifecycle events (prebump, precommit, etc.,).
*
* @default
* {}
*/
scripts?: Options.Scripts;
/**
* Map of steps in the release process that should be skipped.
*
* @default
* {}
*/
skip?: Options.Skip;
/**
* See the commands that running standard-version would run.
*
* @default
* false
*/
dryRun?: boolean;
/**
* Fallback to git tags for version, if no meta-information file is found (e.g.,
* package.json).
*
* @default
* true
*/
gitTagFallback?: boolean;
/**
* Only populate commits made under this path.
*/
path?: string;
/**
* Use a custom header when generating and updating changelog.
*
* @deprecated
* This option will be removed in the next major version, please use `header`.
*/
changelogHeader?: string;
/**
* Commit message guideline preset.
*
* @default
* require.resolve('conventional-changelog-conventionalcommits')
*/
preset?: string;
}
namespace Options {
interface Scripts {
/**
* Executed before anything happens. If the `prerelease` script returns a
* non-zero exit code, versioning will be aborted, but it has no other effect on
* the process.
*/
prerelease?: string;
/**
* Executed before the version is bumped. If the `prebump` script returns a
* version #, it will be used rather than the version calculated by
* `standard-version`.
*/
prebump?: string;
/**
* Executed after the version is bumped.
*/
postbump?: string;
/**
* Executes before the CHANGELOG is generated.
*/
prechangelog?: string;
/**
* Executes after the CHANGELOG is generated.
*/
postchangelog?: string;
/**
* Called before the commit step.
*/
precommit?: string;
/**
* Called after the commit step.
*/
postcommit?: string;
/**
* Called before the tagging step.
*/
pretag?: string;
/**
* Called after the tagging step.
*/
posttag?: string;
}
type Skip = Partial<Record<"bump" | "changelog" | "commit" | "tag", boolean>>;
}
}
type Options = standardVersion.Options;
export = standardVersion;

View File

@ -0,0 +1,14 @@
/* tslint:disable:no-mergeable-namespace no-namespace */
"use strict";
import standardVersion from "standard-version";
namespace Module {
declare const options: standardVersion.Options;
// $ExpectType Promise<void>
standardVersion(options);
// $ExpectError
standardVersion();
}

View File

@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"dom",
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"esModuleInterop": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"standard-version-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }