diff --git a/types/conventional-changelog-config-spec/OTHER_FILES.txt b/types/conventional-changelog-config-spec/OTHER_FILES.txt new file mode 100644 index 0000000000..a4b8591e51 --- /dev/null +++ b/types/conventional-changelog-config-spec/OTHER_FILES.txt @@ -0,0 +1,2 @@ +versions/1.0.0/schema.json.d.ts +versions/2.0.0/schema.json.d.ts diff --git a/types/conventional-changelog-config-spec/conventional-changelog-config-spec-tests.ts b/types/conventional-changelog-config-spec/conventional-changelog-config-spec-tests.ts new file mode 100644 index 0000000000..dd37e9efd1 --- /dev/null +++ b/types/conventional-changelog-config-spec/conventional-changelog-config-spec-tests.ts @@ -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 +} diff --git a/types/conventional-changelog-config-spec/index.d.ts b/types/conventional-changelog-config-spec/index.d.ts new file mode 100644 index 0000000000..28f67590de --- /dev/null +++ b/types/conventional-changelog-config-spec/index.d.ts @@ -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 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.9 + +import * as ConventionalChangelogConfigSpec from "./versions/2.1.0/schema.json"; + +export = ConventionalChangelogConfigSpec; diff --git a/types/conventional-changelog-config-spec/tsconfig.json b/types/conventional-changelog-config-spec/tsconfig.json new file mode 100644 index 0000000000..5ebc8d26f6 --- /dev/null +++ b/types/conventional-changelog-config-spec/tsconfig.json @@ -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" + ] +} diff --git a/types/conventional-changelog-config-spec/tslint.json b/types/conventional-changelog-config-spec/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/conventional-changelog-config-spec/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/conventional-changelog-config-spec/versions/1.0.0/schema.json.d.ts b/types/conventional-changelog-config-spec/versions/1.0.0/schema.json.d.ts new file mode 100644 index 0000000000..54af0f1ae0 --- /dev/null +++ b/types/conventional-changelog-config-spec/versions/1.0.0/schema.json.d.ts @@ -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 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; diff --git a/types/conventional-changelog-config-spec/versions/2.0.0/schema.json.d.ts b/types/conventional-changelog-config-spec/versions/2.0.0/schema.json.d.ts new file mode 100644 index 0000000000..4661c658ba --- /dev/null +++ b/types/conventional-changelog-config-spec/versions/2.0.0/schema.json.d.ts @@ -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 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; diff --git a/types/conventional-changelog-config-spec/versions/2.1.0/schema.json.d.ts b/types/conventional-changelog-config-spec/versions/2.1.0/schema.json.d.ts new file mode 100644 index 0000000000..61296f3cfb --- /dev/null +++ b/types/conventional-changelog-config-spec/versions/2.1.0/schema.json.d.ts @@ -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 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; diff --git a/types/conventional-changelog-core/index.d.ts b/types/conventional-changelog-core/index.d.ts index 31afb08f08..e6929ec324 100644 --- a/types/conventional-changelog-core/index.d.ts +++ b/types/conventional-changelog-core/index.d.ts @@ -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 & MergedContext.ExtraContext; + type MergedContext = T & MergedContext.ExtraContext; namespace MergedContext { interface ExtraContext { @@ -155,7 +163,7 @@ declare namespace conventionalChangelogCore { } } - interface Options { + interface Options { /** * 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 = Promise> | Config.Function | Config.Object; + // tslint:disable-next-line max-line-length + type Config = Promise> | Config.Function | Config.Object; namespace Config { - type FunctionType = (callback: FunctionType.Callback) => void; + type FunctionType = (callback: FunctionType.Callback) => void; namespace FunctionType { - type Callback = (error: any, config: ObjectType) => void; + type Callback = (error: any, config: ObjectType) => void; } - interface ObjectType { + interface ObjectType { context?: Partial; gitRawCommitsOpts?: GitRawCommitsOptions; parserOpts?: ParserOptions; + recommendedBumpOpts?: RecommendedBumpOptions; writerOpts?: WriterOptions; } @@ -316,7 +326,7 @@ declare namespace conventionalChangelogCore { warn?: BaseParserOptions["warn"]; } - interface WriterOptions extends BaseWriterOptions> { + interface WriterOptions extends BaseWriterOptions> { /** * 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 = conventionalChangelogCore.Options; +type Options = conventionalChangelogCore.Options; type ParserOptions = conventionalChangelogCore.ParserOptions; -type WriterOptions = conventionalChangelogCore.WriterOptions; +type WriterOptions = conventionalChangelogCore.WriterOptions; export = conventionalChangelogCore; diff --git a/types/conventional-changelog-preset-loader/index.d.ts b/types/conventional-changelog-preset-loader/index.d.ts index 89c20fce0a..296a1b42ef 100644 --- a/types/conventional-changelog-preset-loader/index.d.ts +++ b/types/conventional-changelog-preset-loader/index.d.ts @@ -24,7 +24,7 @@ import { Context as WriterContext } from "conventional-changelog-writer"; * * @param path */ -declare function conventionalChangelogPresetLoader(path: string | Config): CoreOptions.Config; +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 diff --git a/types/conventional-changelog/conventional-changelog-tests.ts b/types/conventional-changelog/conventional-changelog-tests.ts new file mode 100644 index 0000000000..69d066ec74 --- /dev/null +++ b/types/conventional-changelog/conventional-changelog-tests.ts @@ -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); +} diff --git a/types/conventional-changelog/index.d.ts b/types/conventional-changelog/index.d.ts new file mode 100644 index 0000000000..0f2fe8fc45 --- /dev/null +++ b/types/conventional-changelog/index.d.ts @@ -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 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.9 + +/// + +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(options?: Options, context?: Partial, gitRawCommitsOpts?: GitRawCommitsOptions, parserOpts?: ParserOptions, writerOpts?: WriterOptions): 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 extends BaseOptions { + /** + * 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 = conventionalChangelog.Options; + +export = conventionalChangelog; diff --git a/types/conventional-changelog/tsconfig.json b/types/conventional-changelog/tsconfig.json new file mode 100644 index 0000000000..b008c9d859 --- /dev/null +++ b/types/conventional-changelog/tsconfig.json @@ -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" + ] +} diff --git a/types/conventional-changelog/tslint.json b/types/conventional-changelog/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/conventional-changelog/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/standard-version/index.d.ts b/types/standard-version/index.d.ts new file mode 100644 index 0000000000..3cacca7e28 --- /dev/null +++ b/types/standard-version/index.d.ts @@ -0,0 +1,224 @@ +// Type definitions for standard-version 7.0 +// Project: https://github.com/conventional-changelog/standard-version#readme +// Definitions by: Jason Kwok +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.9 + +/// + +import { Config } from "conventional-changelog-config-spec"; + +declare function standardVersion(options: Options): Promise; + +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 ). + */ + 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>; + } +} + +type Options = standardVersion.Options; + +export = standardVersion; diff --git a/types/standard-version/standard-version-tests.ts b/types/standard-version/standard-version-tests.ts new file mode 100644 index 0000000000..64e18e7b05 --- /dev/null +++ b/types/standard-version/standard-version-tests.ts @@ -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 + standardVersion(options); + + // $ExpectError + standardVersion(); +} diff --git a/types/standard-version/tsconfig.json b/types/standard-version/tsconfig.json new file mode 100644 index 0000000000..2e9628b411 --- /dev/null +++ b/types/standard-version/tsconfig.json @@ -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" + ] +} diff --git a/types/standard-version/tslint.json b/types/standard-version/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/standard-version/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }