1 | /// <reference types="node" />
|
2 |
|
3 | import { Config } from "conventional-changelog-config-spec";
|
4 |
|
5 | declare function standardVersion(options: Options): Promise<void>;
|
6 |
|
7 | declare namespace standardVersion {
|
8 | interface Options extends Config {
|
9 | /**
|
10 | * @default
|
11 | * [
|
12 | * 'package.json',
|
13 | * 'bower.json',
|
14 | * 'manifest.json',
|
15 | * 'composer.json'
|
16 | * ]
|
17 | */
|
18 | packageFiles?: Array<string | Options.VersionFile> | undefined;
|
19 |
|
20 | /**
|
21 | * @default
|
22 | * [
|
23 | * 'package-lock.json',
|
24 | * 'npm-shrinkwrap.json',
|
25 | * 'composer.lock'
|
26 | * ]
|
27 | */
|
28 | bumpFiles?: Array<string | Options.VersionFile> | undefined;
|
29 |
|
30 | /**
|
31 | * Specify the release type manually (like npm version <major|minor|patch>).
|
32 | */
|
33 | releaseAs?: string | undefined;
|
34 |
|
35 | /**
|
36 | * Make a pre-release with optional option value to specify a tag id.
|
37 | */
|
38 | prerelease?: string | undefined;
|
39 |
|
40 | /**
|
41 | * Read the CHANGELOG from this file.
|
42 | *
|
43 | * @default
|
44 | * 'CHANGELOG.md'
|
45 | */
|
46 | infile?: string | Buffer | URL | number | undefined;
|
47 |
|
48 | /**
|
49 | * Commit message, replaces %s with new version.
|
50 | *
|
51 | * @deprecated
|
52 | * This option will be removed in the next major version, please use
|
53 | * `releaseCommitMessageFormat`.
|
54 | */
|
55 | message?: string | undefined;
|
56 |
|
57 | /**
|
58 | * Is this the first release?
|
59 | *
|
60 | * @default
|
61 | * false
|
62 | */
|
63 | firstRelease?: boolean | undefined;
|
64 |
|
65 | /**
|
66 | * Should the git commit and tag be signed?
|
67 | *
|
68 | * @default
|
69 | * false
|
70 | */
|
71 | sign?: boolean | undefined;
|
72 |
|
73 | /**
|
74 | * Bypass pre-commit or commit-msg git hooks during the commit phase.
|
75 | *
|
76 | * @default
|
77 | * false
|
78 | */
|
79 | noVerify?: boolean | undefined;
|
80 |
|
81 | /**
|
82 | * Commit all staged changes, not just files affected by standard-version.
|
83 | *
|
84 | * @default
|
85 | * false
|
86 | */
|
87 | commitAll?: boolean | undefined;
|
88 |
|
89 | /**
|
90 | * Don't print logs and errors.
|
91 | *
|
92 | * @default
|
93 | * false
|
94 | */
|
95 | silent?: boolean | undefined;
|
96 |
|
97 | /**
|
98 | * Set a custom prefix for the git tag to be created.
|
99 | *
|
100 | * @default
|
101 | * 'v'
|
102 | */
|
103 | tagPrefix?: string | undefined;
|
104 |
|
105 | /**
|
106 | * Provide scripts to execute for lifecycle events (prebump, precommit, etc.,).
|
107 | *
|
108 | * @default
|
109 | * {}
|
110 | */
|
111 | scripts?: Options.Scripts | undefined;
|
112 |
|
113 | /**
|
114 | * Map of steps in the release process that should be skipped.
|
115 | *
|
116 | * @default
|
117 | * {}
|
118 | */
|
119 | skip?: Options.Skip | undefined;
|
120 |
|
121 | /**
|
122 | * See the commands that running standard-version would run.
|
123 | *
|
124 | * @default
|
125 | * false
|
126 | */
|
127 | dryRun?: boolean | undefined;
|
128 |
|
129 | /**
|
130 | * Fallback to git tags for version, if no meta-information file is found (e.g.,
|
131 | * package.json).
|
132 | *
|
133 | * @default
|
134 | * true
|
135 | */
|
136 | gitTagFallback?: boolean | undefined;
|
137 |
|
138 | /**
|
139 | * Only populate commits made under this path.
|
140 | */
|
141 | path?: string | undefined;
|
142 |
|
143 | /**
|
144 | * Use a custom header when generating and updating changelog.
|
145 | *
|
146 | * @deprecated
|
147 | * This option will be removed in the next major version, please use `header`.
|
148 | */
|
149 | changelogHeader?: string | undefined;
|
150 |
|
151 | /**
|
152 | * Commit message guideline preset.
|
153 | *
|
154 | * @default
|
155 | * require.resolve('conventional-changelog-conventionalcommits')
|
156 | */
|
157 | preset?: string | undefined;
|
158 | }
|
159 |
|
160 | namespace Options {
|
161 | interface Updater {
|
162 | /**
|
163 | * This method is used to read the version from the provided file contents.
|
164 | *
|
165 | * @param contents provided file content
|
166 | * @return semantic version string
|
167 | */
|
168 | readVersion(contents: string): string;
|
169 |
|
170 | /**
|
171 | * This method is used to write the version to the provided contents.
|
172 | *
|
173 | * @param contents provided file content
|
174 | * @param version new semantic version string to write
|
175 | * @return value that will be written directly (overwrite) to the provided file
|
176 | */
|
177 | writeVersion(contents: string, version: string): string;
|
178 | }
|
179 |
|
180 | interface VersionFile {
|
181 | /**
|
182 | * path to the file you want to "bump"
|
183 | *
|
184 | * If no type or updater provided, type will be inferred from file extension
|
185 | */
|
186 | filename: string;
|
187 |
|
188 | /**
|
189 | * Built-in file types
|
190 | *
|
191 | * The `plain-text` updater assumes the file contents represents the version.
|
192 | *
|
193 | * The `json` updater assumes the version is available under a `version` key in the provided JSON document.
|
194 | */
|
195 | type?: "plain-text" | "json";
|
196 |
|
197 | /**
|
198 | * An updater is expected to be a Javascript module with atleast two methods exposed: readVersion and writeVersion
|
199 | * or the path to require it.
|
200 | */
|
201 | updater?: string | Updater;
|
202 | }
|
203 |
|
204 | interface Scripts {
|
205 | /**
|
206 | * Executed before anything happens. If the `prerelease` script returns a
|
207 | * non-zero exit code, versioning will be aborted, but it has no other effect on
|
208 | * the process.
|
209 | */
|
210 | prerelease?: string | undefined;
|
211 |
|
212 | /**
|
213 | * Executed before the version is bumped. If the `prebump` script returns a
|
214 | * version #, it will be used rather than the version calculated by
|
215 | * `standard-version`.
|
216 | */
|
217 | prebump?: string | undefined;
|
218 |
|
219 | /**
|
220 | * Executed after the version is bumped.
|
221 | */
|
222 | postbump?: string | undefined;
|
223 |
|
224 | /**
|
225 | * Executes before the CHANGELOG is generated.
|
226 | */
|
227 | prechangelog?: string | undefined;
|
228 |
|
229 | /**
|
230 | * Executes after the CHANGELOG is generated.
|
231 | */
|
232 | postchangelog?: string | undefined;
|
233 |
|
234 | /**
|
235 | * Called before the commit step.
|
236 | */
|
237 | precommit?: string | undefined;
|
238 |
|
239 | /**
|
240 | * Called after the commit step.
|
241 | */
|
242 | postcommit?: string | undefined;
|
243 |
|
244 | /**
|
245 | * Called before the tagging step.
|
246 | */
|
247 | pretag?: string | undefined;
|
248 |
|
249 | /**
|
250 | * Called after the tagging step.
|
251 | */
|
252 | posttag?: string | undefined;
|
253 | }
|
254 |
|
255 | type Skip = Partial<Record<"bump" | "changelog" | "commit" | "tag", boolean>>;
|
256 | }
|
257 | }
|
258 |
|
259 | type Options = standardVersion.Options;
|
260 |
|
261 | export = standardVersion;
|