fork-version 1.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,290 @@
1
+ import { z } from 'zod';
2
+ import { ReleaseType } from 'semver';
3
+
4
+ declare const ForkConfigSchema: z.ZodObject<{
5
+ /**
6
+ * The path where the changes should be calculated from.
7
+ * @default
8
+ * ```js
9
+ * process.cwd()
10
+ * ```
11
+ */
12
+ changePath: z.ZodString;
13
+ /**
14
+ * The name of the changelog file.
15
+ * @default "CHANGELOG.md"
16
+ */
17
+ changelog: z.ZodString;
18
+ /**
19
+ * Files to be updated.
20
+ * @default
21
+ * ```js
22
+ * ["bower.json", "manifest.json", "npm-shrinkwrap.json", "package-lock.json", "package.json"]
23
+ * ```
24
+ */
25
+ outFiles: z.ZodArray<z.ZodString, "many">;
26
+ /**
27
+ * The header to be used in the changelog.
28
+ * @default
29
+ * ```markdown
30
+ * # Changelog
31
+ *
32
+ * All notable changes to this project will be documented in this file. See [fork-version](https://github.com/eglavin/fork-version) for commit guidelines.
33
+ * ```
34
+ */
35
+ header: z.ZodString;
36
+ /**
37
+ * Specify a prefix for the git tag that will be taken into account during the comparison.
38
+ *
39
+ * For instance if your version tag is prefixed by `version/` instead of `v` you would
40
+ * have to specify `tagPrefix: "version/"`.
41
+ * @default `v`
42
+ */
43
+ tagPrefix: z.ZodString;
44
+ /**
45
+ * Make a pre-release with optional label to specify a tag id.
46
+ * @example true, "alpha", "beta", "rc", etc.
47
+ * @default undefined
48
+ */
49
+ preReleaseTag: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
50
+ /**
51
+ * Commit all staged changes, not just files updated by fork-version.
52
+ * @default false
53
+ */
54
+ commitAll: z.ZodBoolean;
55
+ /**
56
+ * If true, no output will be written to disk or committed.
57
+ * @default false
58
+ */
59
+ dryRun: z.ZodBoolean;
60
+ /**
61
+ * If true and we cant find a version in an `outFiles`, we'll fallback and attempt
62
+ * to use the latest git tag for the current version.
63
+ * @default true
64
+ */
65
+ gitTagFallback: z.ZodBoolean;
66
+ /**
67
+ * Should we sign the git commit using GPG?
68
+ * @see {@link https://git-scm.com/docs/git-commit#Documentation/git-commit.txt--Sltkeyidgt GPG Sign Commits}
69
+ * @default false
70
+ */
71
+ sign: z.ZodBoolean;
72
+ /**
73
+ * If true, no output will be written to stdout.
74
+ * @default false
75
+ */
76
+ silent: z.ZodBoolean;
77
+ /**
78
+ * If true, allow git to run git commit hooks.
79
+ * @default false
80
+ */
81
+ verify: z.ZodBoolean;
82
+ /**
83
+ * If set, we'll use this version number instead of trying to find it in an `outFiles`.
84
+ * @example "1.0.0"
85
+ * @default undefined
86
+ */
87
+ currentVersion: z.ZodOptional<z.ZodString>;
88
+ /**
89
+ * If set, we'll attempt to update the version number to this version.
90
+ * @example "2.0.0"
91
+ * @default undefined
92
+ */
93
+ nextVersion: z.ZodOptional<z.ZodString>;
94
+ /**
95
+ * Override the default conventional-changelog preset configuration.
96
+ */
97
+ changelogPresetConfig: z.ZodObject<{
98
+ /**
99
+ * An array of `type` objects representing the explicitly supported commit message types, and whether they should show up in generated `CHANGELOG`s.
100
+ */
101
+ types: z.ZodOptional<z.ZodArray<z.ZodObject<{
102
+ type: z.ZodString;
103
+ section: z.ZodOptional<z.ZodString>;
104
+ hidden: z.ZodOptional<z.ZodBoolean>;
105
+ }, "strip", z.ZodTypeAny, {
106
+ type: string;
107
+ section?: string | undefined;
108
+ hidden?: boolean | undefined;
109
+ }, {
110
+ type: string;
111
+ section?: string | undefined;
112
+ hidden?: boolean | undefined;
113
+ }>, "many">>;
114
+ /**
115
+ * A URL representing a specific commit at a hash.
116
+ */
117
+ commitUrlFormat: z.ZodOptional<z.ZodString>;
118
+ /**
119
+ * A URL representing the comparison between two git SHAs.
120
+ */
121
+ compareUrlFormat: z.ZodOptional<z.ZodString>;
122
+ /**
123
+ * A URL representing the issue format (allowing a different URL format to be swapped in for Gitlab, Bitbucket, etc).
124
+ */
125
+ issueUrlFormat: z.ZodOptional<z.ZodString>;
126
+ /**
127
+ * 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.
128
+ */
129
+ userUrlFormat: z.ZodOptional<z.ZodString>;
130
+ /**
131
+ * A string to be used to format the auto-generated release commit message.
132
+ */
133
+ releaseCommitMessageFormat: z.ZodOptional<z.ZodString>;
134
+ /**
135
+ * An array of prefixes used to detect references to issues
136
+ */
137
+ issuePrefixes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
138
+ }, "strip", z.ZodTypeAny, {
139
+ types?: {
140
+ type: string;
141
+ section?: string | undefined;
142
+ hidden?: boolean | undefined;
143
+ }[] | undefined;
144
+ commitUrlFormat?: string | undefined;
145
+ compareUrlFormat?: string | undefined;
146
+ issueUrlFormat?: string | undefined;
147
+ userUrlFormat?: string | undefined;
148
+ releaseCommitMessageFormat?: string | undefined;
149
+ issuePrefixes?: string[] | undefined;
150
+ }, {
151
+ types?: {
152
+ type: string;
153
+ section?: string | undefined;
154
+ hidden?: boolean | undefined;
155
+ }[] | undefined;
156
+ commitUrlFormat?: string | undefined;
157
+ compareUrlFormat?: string | undefined;
158
+ issueUrlFormat?: string | undefined;
159
+ userUrlFormat?: string | undefined;
160
+ releaseCommitMessageFormat?: string | undefined;
161
+ issuePrefixes?: string[] | undefined;
162
+ }>;
163
+ }, "strip", z.ZodTypeAny, {
164
+ changePath: string;
165
+ changelog: string;
166
+ outFiles: string[];
167
+ header: string;
168
+ tagPrefix: string;
169
+ commitAll: boolean;
170
+ dryRun: boolean;
171
+ gitTagFallback: boolean;
172
+ sign: boolean;
173
+ silent: boolean;
174
+ verify: boolean;
175
+ changelogPresetConfig: {
176
+ types?: {
177
+ type: string;
178
+ section?: string | undefined;
179
+ hidden?: boolean | undefined;
180
+ }[] | undefined;
181
+ commitUrlFormat?: string | undefined;
182
+ compareUrlFormat?: string | undefined;
183
+ issueUrlFormat?: string | undefined;
184
+ userUrlFormat?: string | undefined;
185
+ releaseCommitMessageFormat?: string | undefined;
186
+ issuePrefixes?: string[] | undefined;
187
+ };
188
+ preReleaseTag?: string | boolean | undefined;
189
+ currentVersion?: string | undefined;
190
+ nextVersion?: string | undefined;
191
+ }, {
192
+ changePath: string;
193
+ changelog: string;
194
+ outFiles: string[];
195
+ header: string;
196
+ tagPrefix: string;
197
+ commitAll: boolean;
198
+ dryRun: boolean;
199
+ gitTagFallback: boolean;
200
+ sign: boolean;
201
+ silent: boolean;
202
+ verify: boolean;
203
+ changelogPresetConfig: {
204
+ types?: {
205
+ type: string;
206
+ section?: string | undefined;
207
+ hidden?: boolean | undefined;
208
+ }[] | undefined;
209
+ commitUrlFormat?: string | undefined;
210
+ compareUrlFormat?: string | undefined;
211
+ issueUrlFormat?: string | undefined;
212
+ userUrlFormat?: string | undefined;
213
+ releaseCommitMessageFormat?: string | undefined;
214
+ issuePrefixes?: string[] | undefined;
215
+ };
216
+ preReleaseTag?: string | boolean | undefined;
217
+ currentVersion?: string | undefined;
218
+ nextVersion?: string | undefined;
219
+ }>;
220
+ type ForkConfig = z.infer<typeof ForkConfigSchema> & {
221
+ /**
222
+ * Log function, can be used to override the default `console.log` function
223
+ * to log to a file or another service.
224
+ * @default console.log
225
+ */
226
+ log: (...args: unknown[]) => void;
227
+ /**
228
+ * Error logger function, can be used to override the default `console.error`
229
+ * function to log to a file or another service.
230
+ * @default console.error
231
+ */
232
+ error: (...args: unknown[]) => void;
233
+ /**
234
+ * Debug logger function, by default this is a noop function, but can be replaced
235
+ * with a custom logger function or `console.info` to print output.
236
+ * @default () => {}
237
+ */
238
+ debug: (...args: unknown[]) => void;
239
+ };
240
+ declare function defineConfig(config: Partial<ForkConfig>): Partial<ForkConfig>;
241
+
242
+ type FileState = {
243
+ name: string;
244
+ path: string;
245
+ type: "package-file" | ({} & string);
246
+ version: string;
247
+ isPrivate: boolean;
248
+ };
249
+ type CurrentVersion = {
250
+ currentVersion: string;
251
+ files: FileState[];
252
+ };
253
+ type NextVersion = {
254
+ nextVersion: string;
255
+ level?: number;
256
+ preMajor?: boolean;
257
+ reason?: string;
258
+ releaseType?: ReleaseType;
259
+ };
260
+ type BumpVersion = CurrentVersion & NextVersion;
261
+ declare function bumpVersion(options: ForkConfig): Promise<BumpVersion>;
262
+
263
+ type CreateChangelog = {
264
+ path: string;
265
+ exists: boolean;
266
+ };
267
+ type UpdateChangelog = {
268
+ changelog: CreateChangelog;
269
+ oldContent: string;
270
+ newContent: string;
271
+ };
272
+ declare function updateChangelog(options: ForkConfig, bumpResult: BumpVersion): Promise<UpdateChangelog>;
273
+
274
+ type CommitChanges = {
275
+ filesToCommit: string[];
276
+ gitAddOutput?: string;
277
+ gitCommitOutput?: string;
278
+ };
279
+ declare function commitChanges(options: ForkConfig, bumpResult: BumpVersion): Promise<CommitChanges>;
280
+
281
+ type TagChanges = {
282
+ gitTagOutput: string;
283
+ currentBranchName: string;
284
+ hasPublicPackageFile: boolean;
285
+ pushMessage: string;
286
+ publishMessage: string;
287
+ };
288
+ declare function tagChanges(options: ForkConfig, bumpResult: BumpVersion): Promise<TagChanges>;
289
+
290
+ export { BumpVersion, ForkConfig, bumpVersion, commitChanges, defineConfig, tagChanges, updateChangelog };
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { bumpVersion, commitChanges, defineConfig, tagChanges, updateChangelog } from './chunk-STAHBMPI.js';
2
+ //# sourceMappingURL=out.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "fork-version",
3
+ "version": "1.4.6",
4
+ "license": "ISC",
5
+ "description": "Replacement for standard version written with modern syntax",
6
+ "homepage": "https://github.com/eglavin/fork-version",
7
+ "bugs": {
8
+ "url": "https://github.com/eglavin/fork-version/issues"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/eglavin/fork-version.git"
13
+ },
14
+ "author": {
15
+ "name": "Eanna Glavin",
16
+ "url": "https://eglavin.com"
17
+ },
18
+ "type": "module",
19
+ "main": "dist/index.cjs",
20
+ "module": "dist/index.js",
21
+ "types": "dist/index.d.ts",
22
+ "exports": {
23
+ ".": {
24
+ "import": "./dist/index.js",
25
+ "require": "./dist/index.cjs",
26
+ "types": "./dist/index.d.ts"
27
+ },
28
+ "./cli": {
29
+ "import": "./dist/cli.js",
30
+ "require": "./dist/cli.cjs",
31
+ "types": "./dist/cli.d.ts"
32
+ },
33
+ "./package.json": "./package.json"
34
+ },
35
+ "bin": {
36
+ "fork-version": "./dist/cli.js"
37
+ },
38
+ "files": [
39
+ "dist"
40
+ ],
41
+ "scripts": {
42
+ "build": "tsup",
43
+ "dev": "tsup --watch",
44
+ "start": "node dist/cli.js",
45
+ "lint:style": "prettier --write \"src/**/*.ts\"",
46
+ "lint:code": "eslint --fix \"src/**/*.ts\""
47
+ },
48
+ "dependencies": {
49
+ "bundle-require": "4.0.1",
50
+ "conventional-changelog": "5.1.0",
51
+ "conventional-changelog-config-spec": "2.1.0",
52
+ "conventional-changelog-conventionalcommits": "7.0.2",
53
+ "conventional-recommended-bump": "9.0.0",
54
+ "detect-indent": "6.1.0",
55
+ "detect-newline": "3.1.0",
56
+ "esbuild": "0.19.3",
57
+ "git-semver-tags": "7.0.1",
58
+ "joycon": "3.1.1",
59
+ "semver": "7.5.4",
60
+ "zod": "3.22.2"
61
+ },
62
+ "devDependencies": {
63
+ "@types/conventional-changelog-config-spec": "2.1.3",
64
+ "@types/git-raw-commits": "2.0.2",
65
+ "@types/json-schema": "7.0.13",
66
+ "@types/node": "20.6.2",
67
+ "@types/semver": "7.5.2",
68
+ "@typescript-eslint/eslint-plugin": "6.7.2",
69
+ "@typescript-eslint/parser": "6.7.2",
70
+ "eslint": "8.49.0",
71
+ "eslint-config-prettier": "9.0.0",
72
+ "eslint-plugin-prettier": "5.0.0",
73
+ "globals": "13.21.0",
74
+ "prettier": "3.0.3",
75
+ "tsup": "7.2.0",
76
+ "typescript": "5.2.2"
77
+ }
78
+ }