fork-version 3.0.2 → 3.1.4
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.
- package/CHANGELOG.md +30 -0
- package/README.md +29 -6
- package/dist/{chunk-YSWJMT7B.cjs → chunk-2VYOEMMB.cjs} +162 -60
- package/dist/chunk-2VYOEMMB.cjs.map +1 -0
- package/dist/{chunk-AZZVHG2X.js → chunk-4NLPWDCQ.js} +159 -61
- package/dist/chunk-4NLPWDCQ.js.map +1 -0
- package/dist/cli.cjs +66 -54
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +63 -51
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +31 -15
- package/dist/index.d.cts +475 -343
- package/dist/index.d.ts +475 -343
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-AZZVHG2X.js.map +0 -1
- package/dist/chunk-YSWJMT7B.cjs.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { getUserConfig, Logger, FileManager, Git,
|
|
2
|
+
import { getUserConfig, Logger, FileManager, Git, main, inspectTag, inspectVersion, validateConfig } from './chunk-4NLPWDCQ.js';
|
|
3
3
|
import { writeFileSync } from 'fs';
|
|
4
4
|
import { join } from 'path';
|
|
5
5
|
import { ZodError } from 'zod';
|
|
6
6
|
import meow from 'meow';
|
|
7
7
|
|
|
8
8
|
var helperText = `Usage:
|
|
9
|
-
$ fork-version [options]
|
|
9
|
+
$ fork-version [command?] [options?]
|
|
10
10
|
|
|
11
11
|
Commands:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
main Bumps the version, update files, generate changelog, commit, and tag. [Default when no command is provided]
|
|
13
|
+
inspect-version Prints the current version and exits.
|
|
14
|
+
inspect-tag Prints the current git tag and exits.
|
|
15
|
+
validate-config Validates the configuration and exits.
|
|
15
16
|
|
|
16
|
-
Options:
|
|
17
|
+
General Options:
|
|
18
|
+
--version Show the current version of Fork-Version and exit.
|
|
19
|
+
--help Show this help message and exit.
|
|
20
|
+
|
|
21
|
+
Location Options:
|
|
17
22
|
--file, -F List of the files to be updated. [Default: ["bower.json", "deno.json", "deno.jsonc", "jsr.json", "jsr.jsonc", "manifest.json", "npm-shrinkwrap.json", "package-lock.json", "package.json"]]
|
|
18
23
|
--glob, -G Glob pattern to match files to be updated.
|
|
19
24
|
--path, -P The path Fork-Version will run from. [Default: process.cwd()]
|
|
25
|
+
|
|
26
|
+
Options:
|
|
20
27
|
--changelog Name of the changelog file. [Default: "CHANGELOG.md"]
|
|
21
28
|
--header The header text for the changelog.
|
|
22
29
|
--tag-prefix Specify a prefix for the created tag. [Default: "v"]
|
|
@@ -56,6 +63,7 @@ Conventional Changelog Overrides:
|
|
|
56
63
|
Exit Codes:
|
|
57
64
|
0: Success
|
|
58
65
|
1: General Error
|
|
66
|
+
2: Unknown Command
|
|
59
67
|
3: Config File Validation Error
|
|
60
68
|
|
|
61
69
|
Examples:
|
|
@@ -69,7 +77,10 @@ Examples:
|
|
|
69
77
|
Run fork-version and update the "package.json" and "MyApi.csproj" files.
|
|
70
78
|
|
|
71
79
|
$ fork-version --glob "*/package.json"
|
|
72
|
-
Run fork-version and update all "package.json" files in subdirectories
|
|
80
|
+
Run fork-version and update all "package.json" files in subdirectories.
|
|
81
|
+
|
|
82
|
+
$ fork-version inspect-version
|
|
83
|
+
Prints the current version and exits.`;
|
|
73
84
|
function getCliArguments() {
|
|
74
85
|
return meow(helperText, {
|
|
75
86
|
importMeta: import.meta,
|
|
@@ -77,6 +88,7 @@ function getCliArguments() {
|
|
|
77
88
|
helpIndent: 0,
|
|
78
89
|
flags: {
|
|
79
90
|
// Commands
|
|
91
|
+
/** @deprecated Set the `inspect-version` command instead. */
|
|
80
92
|
inspectVersion: { type: "boolean" },
|
|
81
93
|
// Options
|
|
82
94
|
files: { type: "string", isMultiple: true, aliases: ["file"], shortFlag: "F" },
|
|
@@ -113,56 +125,59 @@ function getCliArguments() {
|
|
|
113
125
|
releaseCommitMessageFormat: { type: "string" },
|
|
114
126
|
releaseMessageSuffix: { type: "string" }
|
|
115
127
|
}
|
|
116
|
-
})
|
|
128
|
+
});
|
|
117
129
|
}
|
|
118
130
|
|
|
119
131
|
// src/cli.ts
|
|
120
|
-
async function runFork(
|
|
132
|
+
async function runFork() {
|
|
121
133
|
const startTime = Date.now();
|
|
122
|
-
const
|
|
134
|
+
const cliArguments = getCliArguments();
|
|
135
|
+
const config = await getUserConfig(cliArguments);
|
|
123
136
|
const logger = new Logger(config);
|
|
124
137
|
const fileManager = new FileManager(config, logger);
|
|
125
138
|
const git = new Git(config);
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
switch (config.command) {
|
|
140
|
+
case "validate-config": {
|
|
141
|
+
validateConfig(config);
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
case "inspect-version": {
|
|
145
|
+
await inspectVersion(config, logger, fileManager, git);
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
case "inspect-tag": {
|
|
149
|
+
await inspectTag(config, git);
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
case "main": {
|
|
153
|
+
const result = await main(config, logger, fileManager, git);
|
|
154
|
+
const branchName = await git.getBranchName();
|
|
155
|
+
logger.log(
|
|
156
|
+
`
|
|
142
157
|
Run \`git push --follow-tags origin ${branchName}\` to push the changes and the tag.`
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
158
|
+
);
|
|
159
|
+
if (result.current.files.some((file) => file.name === "package.json" && !file.isPrivate)) {
|
|
160
|
+
const npmTag = typeof config.preRelease === "string" ? config.preRelease : "prerelease";
|
|
161
|
+
logger.log(
|
|
162
|
+
`${result.next.releaseType}`.startsWith("pre") ? `Run \`npm publish --tag ${npmTag}\` to publish the package.` : "Run `npm publish` to publish the package."
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
if (!config.dryRun && config.debug) {
|
|
166
|
+
writeFileSync(
|
|
167
|
+
join(config.path, `fork-version-${Date.now()}.debug-log.json`),
|
|
168
|
+
JSON.stringify(result, null, 2)
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
default: {
|
|
174
|
+
console.error(`Unknown command: ${config.command}`);
|
|
175
|
+
process.exit(2);
|
|
176
|
+
}
|
|
149
177
|
}
|
|
150
178
|
logger.debug(`Completed in ${Date.now() - startTime} ms`);
|
|
151
|
-
const result = {
|
|
152
|
-
config,
|
|
153
|
-
current,
|
|
154
|
-
next
|
|
155
|
-
};
|
|
156
|
-
if (!config.dryRun && config.debug) {
|
|
157
|
-
writeFileSync(
|
|
158
|
-
join(config.path, `fork-version-${Date.now()}.debug-log.json`),
|
|
159
|
-
JSON.stringify(result, null, 2)
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
|
-
return result;
|
|
163
179
|
}
|
|
164
|
-
|
|
165
|
-
runFork(cliArguments).catch((error) => {
|
|
180
|
+
runFork().catch((error) => {
|
|
166
181
|
if (error instanceof Error) {
|
|
167
182
|
if (error.cause instanceof ZodError) {
|
|
168
183
|
console.error(error.message);
|
|
@@ -171,11 +186,8 @@ runFork(cliArguments).catch((error) => {
|
|
|
171
186
|
}
|
|
172
187
|
process.exit(3);
|
|
173
188
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
} else {
|
|
177
|
-
console.error(error.message);
|
|
178
|
-
}
|
|
189
|
+
console.error(error.message);
|
|
190
|
+
if (error.stack) console.error(error.stack);
|
|
179
191
|
} else {
|
|
180
192
|
console.error(error);
|
|
181
193
|
}
|
package/dist/cli.js.map
CHANGED
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BAAgB,IAAA,CAAK,GAAA,EAAK,CAAA,eAAA,CAAiB,CAAA;AAAA,MAC7D,IAAA,CAAK,SAAA,CAAU,MAAA,EAAQ,IAAA,EAAM,CAAC;AAAA,KAC/B;AAAA,EACD;AAEA,EAAA,OAAO,MAAA;AACR;AAEA,IAAM,eAAe,eAAA,EAAgB;AAGrC,OAAA,CAAQ,YAAY,CAAA,CAAE,KAAA,CAAM,CAAC,KAAA,KAAuB;AACnD,EAAA,IAAI,iBAAiB,KAAA,EAAO;AAE3B,IAAA,IAAI,KAAA,CAAM,iBAAiB,QAAA,EAAU;AACpC,MAAA,OAAA,CAAQ,KAAA,CAAM,MAAM,OAAO,CAAA;AAC3B,MAAA,KAAA,MAAW,GAAA,IAAO,KAAA,CAAM,KAAA,CAAM,MAAA,EAAQ;AACrC,QAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,EAAG,GAAA,CAAI,IAAA,CAAK,IAAA,CAAK,IAAI,CAAC,CAAA,IAAA,EAAO,GAAA,CAAI,OAAO,CAAA,CAAE,CAAA;AAAA,MACvD;AACA,MAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,IACf;AAEA,IAAA,IAAI,MAAM,KAAA,EAAO;AAChB,MAAA,OAAA,CAAQ,KAAA,CAAM,MAAM,KAAK,CAAA;AAAA,IAC1B,CAAA,MAAO;AACN,MAAA,OAAA,CAAQ,KAAA,CAAM,MAAM,OAAO,CAAA;AAAA,IAC5B;AAAA,EACD,CAAA,MAAO;AACN,IAAA,OAAA,CAAQ,MAAM,KAAK,CAAA;AAAA,EACpB;AACA,EAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AACf,CAAC,CAAA","file":"cli.js","sourcesContent":["import meow from \"meow\";\n//@ts-check\n\n// This file is javascript so the following helper text can be extracted to the readme\n// without the need for a build step, otherwise it would also be typescript...\n\nexport const helperText = `Usage:\n $ fork-version [options]\n\nCommands:\n --help Show this help message.\n --version Show the current version of Fork-Version.\n --inspect-version If set, Fork-Version will print the current project version and exit.\n\nOptions:\n --file, -F List of the files to be updated. [Default: [\"bower.json\", \"deno.json\", \"deno.jsonc\", \"jsr.json\", \"jsr.jsonc\", \"manifest.json\", \"npm-shrinkwrap.json\", \"package-lock.json\", \"package.json\"]]\n --glob, -G Glob pattern to match files to be updated.\n --path, -P The path Fork-Version will run from. [Default: process.cwd()]\n --changelog Name of the changelog file. [Default: \"CHANGELOG.md\"]\n --header The header text for the changelog.\n --tag-prefix Specify a prefix for the created tag. [Default: \"v\"]\n --pre-release Mark this release as a pre-release.\n --pre-release-tag Mark this release with a tagged pre-release. [Example: \"alpha\", \"beta\", \"rc\"]\n --current-version If set, Fork-Version will use this version instead of trying to determine one.\n --next-version If set, Fork-Version will attempt to update to this version, instead of incrementing using \"conventional-commit\".\n --release-as Release as increments the version by the specified level. [Choices: \"major\", \"minor\", \"patch\"]\n\nFlags:\n --allow-multiple-versions Don't throw an error if multiple versions are found in the given files. [Default: true]\n --commit-all Commit all changes, not just files updated by Fork-Version.\n --changelog-all If this flag is set, all default commit types will be added to the changelog.\n --debug Output debug information.\n --dry-run No output will be written to disk or committed.\n --silent Run without logging to the terminal.\n --git-tag-fallback If unable to find a version in the given files, fallback and attempt to use the latest git tag. [Default: true]\n --sign If true, git will sign the commit with the systems GPG key.\n --verify If true, git will run user defined git hooks before committing.\n\n To negate a flag you can prefix it with \"no-\", for example \"--no-git-tag-fallback\" will not fallback to the latest git tag.\n\nSkip Steps:\n --skip-bump Skip the version bump step.\n --skip-changelog Skip updating the changelog.\n --skip-commit Skip committing the changes.\n --skip-tag Skip tagging the commit.\n\nConventional Changelog Overrides:\n --commit-url-format Override the default commit URL format.\n --compare-url-format Override the default compare URL format.\n --issue-url-format Override the default issue URL format.\n --user-url-format Override the default user URL format.\n --release-commit-message-format Override the default release commit message format.\n --release-message-suffix Add a suffix to the end of the release message.\n\nExit Codes:\n 0: Success\n 1: General Error\n 3: Config File Validation Error\n\nExamples:\n $ fork-version\n Run fork-version in the current directory with default options.\n\n $ fork-version --path ./packages/my-package\n Run fork-version in the \"./packages/my-package\" directory.\n\n $ fork-version --file package.json --file MyApi.csproj\n Run fork-version and update the \"package.json\" and \"MyApi.csproj\" files.\n\n $ fork-version --glob \"*/package.json\"\n Run fork-version and update all \"package.json\" files in subdirectories.`;\n\nexport function getCliArguments() {\n\treturn meow(helperText, {\n\t\timportMeta: import.meta,\n\t\tbooleanDefault: undefined,\n\t\thelpIndent: 0,\n\t\tflags: {\n\t\t\t// Commands\n\t\t\tinspectVersion: { type: \"boolean\" },\n\n\t\t\t// Options\n\t\t\tfiles: { type: \"string\", isMultiple: true, aliases: [\"file\"], shortFlag: \"F\" },\n\t\t\tglob: { type: \"string\", shortFlag: \"G\" },\n\t\t\tpath: { type: \"string\", shortFlag: \"P\" },\n\t\t\tchangelog: { type: \"string\" },\n\t\t\theader: { type: \"string\" },\n\t\t\ttagPrefix: { type: \"string\" },\n\t\t\tpreRelease: { type: \"boolean\" },\n\t\t\tpreReleaseTag: { type: \"string\" },\n\t\t\tcurrentVersion: { type: \"string\" },\n\t\t\tnextVersion: { type: \"string\" },\n\t\t\treleaseAs: { type: \"string\", choices: [\"major\", \"minor\", \"patch\"] },\n\n\t\t\t// Flags\n\t\t\tallowMultipleVersions: { type: \"boolean\" },\n\t\t\tcommitAll: { type: \"boolean\" },\n\t\t\tchangelogAll: { type: \"boolean\" },\n\t\t\tdebug: { type: \"boolean\" },\n\t\t\tdryRun: { type: \"boolean\" },\n\t\t\tsilent: { type: \"boolean\" },\n\t\t\tgitTagFallback: { type: \"boolean\" },\n\t\t\tsign: { type: \"boolean\" },\n\t\t\tverify: { type: \"boolean\" },\n\n\t\t\t// Skip Steps\n\t\t\tskipBump: { type: \"boolean\" },\n\t\t\tskipChangelog: { type: \"boolean\" },\n\t\t\tskipCommit: { type: \"boolean\" },\n\t\t\tskipTag: { type: \"boolean\" },\n\n\t\t\t// Changelog Overrides\n\t\t\tcommitUrlFormat: { type: \"string\" },\n\t\t\tcompareUrlFormat: { type: \"string\" },\n\t\t\tissueUrlFormat: { type: \"string\" },\n\t\t\tuserUrlFormat: { type: \"string\" },\n\t\t\treleaseCommitMessageFormat: { type: \"string\" },\n\t\t\treleaseMessageSuffix: { type: \"string\" },\n\t\t},\n\t}).flags;\n}\n","#!/usr/bin/env node\n\nimport { writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { ZodError } from \"zod\";\n\nimport { getCliArguments } from \"./config/cli-arguments\";\nimport { getUserConfig } from \"./config/user-config\";\nimport { Logger } from \"./services/logger\";\nimport { FileManager } from \"./files/file-manager\";\nimport { Git } from \"./services/git\";\n\nimport { getCommitsSinceTag } from \"./process/get-commits\";\nimport { getCurrentVersion } from \"./process/get-current-version\";\nimport { getNextVersion } from \"./process/get-next-version\";\nimport { updateChangelog } from \"./process/changelog\";\nimport { commitChanges } from \"./process/commit\";\nimport { tagChanges } from \"./process/tag\";\n\nasync function runFork(cliArguments: ReturnType<typeof getCliArguments>) {\n\tconst startTime = Date.now();\n\n\tconst config = await getUserConfig(cliArguments);\n\n\tconst logger = new Logger(config);\n\tconst fileManager = new FileManager(config, logger);\n\tconst git = new Git(config);\n\n\tlogger.log(`Running fork-version - ${new Date().toUTCString()}`);\n\tlogger.warn(config.dryRun ? \"[Dry Run] No changes will be written to disk.\\n\" : \"\");\n\n\tconst commits = await getCommitsSinceTag(config, logger, git);\n\n\tconst current = await getCurrentVersion(config, logger, git, fileManager, config.files);\n\tconst next = await getNextVersion(config, logger, commits.commits, current.version);\n\n\tlogger.log(\"Updating files: \");\n\tfor (const outFile of current.files) {\n\t\tlogger.log(` - ${outFile.path}`);\n\n\t\tfileManager.write(outFile, next.version);\n\t}\n\n\tawait updateChangelog(config, logger, next.version);\n\tawait commitChanges(config, logger, git, current.files, next.version);\n\tawait tagChanges(config, logger, git, next.version);\n\n\t// Print git push command\n\tconst branchName = await git.getBranchName();\n\tlogger.log(\n\t\t`\\nRun \\`git push --follow-tags origin ${branchName}\\` to push the changes and the tag.`,\n\t);\n\n\t// Print npm publish command\n\tif (current.files.some((file) => file.name === \"package.json\" && file.isPrivate === false)) {\n\t\tconst npmTag = typeof config.preRelease === \"string\" ? config.preRelease : \"prerelease\";\n\t\tlogger.log(\n\t\t\t`${next.releaseType}`.startsWith(\"pre\")\n\t\t\t\t? `Run \\`npm publish --tag ${npmTag}\\` to publish the package.`\n\t\t\t\t: \"Run `npm publish` to publish the package.\",\n\t\t);\n\t}\n\n\tlogger.debug(`Completed in ${Date.now() - startTime} ms`);\n\n\tconst result = {\n\t\tconfig,\n\t\tcurrent,\n\t\tnext,\n\t};\n\n\tif (!config.dryRun && config.debug) {\n\t\twriteFileSync(\n\t\t\tjoin(config.path, `fork-version-${Date.now()}.debug-log.json`),\n\t\t\tJSON.stringify(result, null, 2),\n\t\t);\n\t}\n\n\treturn result;\n}\n\nconst cliArguments = getCliArguments();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nrunFork(cliArguments).catch((error: Error | any) => {\n\tif (error instanceof Error) {\n\t\t// If the error is a ZodError, print the keys that failed validation\n\t\tif (error.cause instanceof ZodError) {\n\t\t\tconsole.error(error.message);\n\t\t\tfor (const err of error.cause.issues) {\n\t\t\t\tconsole.log(`${err.path.join(\", \")} => ${err.message}`);\n\t\t\t}\n\t\t\tprocess.exit(3);\n\t\t}\n\n\t\tif (error.stack) {\n\t\t\tconsole.error(error.stack);\n\t\t} else {\n\t\t\tconsole.error(error.message);\n\t\t}\n\t} else {\n\t\tconsole.error(error);\n\t}\n\tprocess.exit(1);\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/config/cli-arguments.js","../src/cli.ts"],"names":[],"mappings":";;;;;;;AAMO,IAAM,UAAA,GAAa,CAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AA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AQ,KAAA,CAAM,MAAM,OAAO,CAAA;AAC3B,IAAA,IAAI,KAAA,CAAM,KAAA,EAAO,OAAA,CAAQ,KAAA,CAAM,MAAM,KAAK,CAAA;AAAA,EAC3C,CAAA,MAAO;AACN,IAAA,OAAA,CAAQ,MAAM,KAAK,CAAA;AAAA,EACpB;AACA,EAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AACf,CAAC,CAAA","file":"cli.js","sourcesContent":["import meow from \"meow\";\n//@ts-check\n\n// This file is javascript so the following helper text can be extracted to the readme\n// without the need for a build step, otherwise it would also be typescript...\n\nexport const helperText = `Usage:\n $ fork-version [command?] [options?]\n\nCommands:\n main Bumps the version, update files, generate changelog, commit, and tag. [Default when no command is provided]\n inspect-version Prints the current version and exits.\n inspect-tag Prints the current git tag and exits.\n validate-config Validates the configuration and exits.\n\nGeneral Options:\n --version Show the current version of Fork-Version and exit.\n --help Show this help message and exit.\n\nLocation Options:\n --file, -F List of the files to be updated. [Default: [\"bower.json\", \"deno.json\", \"deno.jsonc\", \"jsr.json\", \"jsr.jsonc\", \"manifest.json\", \"npm-shrinkwrap.json\", \"package-lock.json\", \"package.json\"]]\n --glob, -G Glob pattern to match files to be updated.\n --path, -P The path Fork-Version will run from. [Default: process.cwd()]\n\nOptions:\n --changelog Name of the changelog file. [Default: \"CHANGELOG.md\"]\n --header The header text for the changelog.\n --tag-prefix Specify a prefix for the created tag. [Default: \"v\"]\n --pre-release Mark this release as a pre-release.\n --pre-release-tag Mark this release with a tagged pre-release. [Example: \"alpha\", \"beta\", \"rc\"]\n --current-version If set, Fork-Version will use this version instead of trying to determine one.\n --next-version If set, Fork-Version will attempt to update to this version, instead of incrementing using \"conventional-commit\".\n --release-as Release as increments the version by the specified level. [Choices: \"major\", \"minor\", \"patch\"]\n\nFlags:\n --allow-multiple-versions Don't throw an error if multiple versions are found in the given files. [Default: true]\n --commit-all Commit all changes, not just files updated by Fork-Version.\n --changelog-all If this flag is set, all default commit types will be added to the changelog.\n --debug Output debug information.\n --dry-run No output will be written to disk or committed.\n --silent Run without logging to the terminal.\n --git-tag-fallback If unable to find a version in the given files, fallback and attempt to use the latest git tag. [Default: true]\n --sign If true, git will sign the commit with the systems GPG key.\n --verify If true, git will run user defined git hooks before committing.\n\n To negate a flag you can prefix it with \"no-\", for example \"--no-git-tag-fallback\" will not fallback to the latest git tag.\n\nSkip Steps:\n --skip-bump Skip the version bump step.\n --skip-changelog Skip updating the changelog.\n --skip-commit Skip committing the changes.\n --skip-tag Skip tagging the commit.\n\nConventional Changelog Overrides:\n --commit-url-format Override the default commit URL format.\n --compare-url-format Override the default compare URL format.\n --issue-url-format Override the default issue URL format.\n --user-url-format Override the default user URL format.\n --release-commit-message-format Override the default release commit message format.\n --release-message-suffix Add a suffix to the end of the release message.\n\nExit Codes:\n 0: Success\n 1: General Error\n 2: Unknown Command\n 3: Config File Validation Error\n\nExamples:\n $ fork-version\n Run fork-version in the current directory with default options.\n\n $ fork-version --path ./packages/my-package\n Run fork-version in the \"./packages/my-package\" directory.\n\n $ fork-version --file package.json --file MyApi.csproj\n Run fork-version and update the \"package.json\" and \"MyApi.csproj\" files.\n\n $ fork-version --glob \"*/package.json\"\n Run fork-version and update all \"package.json\" files in subdirectories.\n\n $ fork-version inspect-version\n Prints the current version and exits.`;\n\nexport function getCliArguments() {\n\treturn meow(helperText, {\n\t\timportMeta: import.meta,\n\t\tbooleanDefault: undefined,\n\t\thelpIndent: 0,\n\t\tflags: {\n\t\t\t// Commands\n\t\t\t/** @deprecated Set the `inspect-version` command instead. */\n\t\t\tinspectVersion: { type: \"boolean\" },\n\n\t\t\t// Options\n\t\t\tfiles: { type: \"string\", isMultiple: true, aliases: [\"file\"], shortFlag: \"F\" },\n\t\t\tglob: { type: \"string\", shortFlag: \"G\" },\n\t\t\tpath: { type: \"string\", shortFlag: \"P\" },\n\t\t\tchangelog: { type: \"string\" },\n\t\t\theader: { type: \"string\" },\n\t\t\ttagPrefix: { type: \"string\" },\n\t\t\tpreRelease: { type: \"boolean\" },\n\t\t\tpreReleaseTag: { type: \"string\" },\n\t\t\tcurrentVersion: { type: \"string\" },\n\t\t\tnextVersion: { type: \"string\" },\n\t\t\treleaseAs: { type: \"string\", choices: [\"major\", \"minor\", \"patch\"] },\n\n\t\t\t// Flags\n\t\t\tallowMultipleVersions: { type: \"boolean\" },\n\t\t\tcommitAll: { type: \"boolean\" },\n\t\t\tchangelogAll: { type: \"boolean\" },\n\t\t\tdebug: { type: \"boolean\" },\n\t\t\tdryRun: { type: \"boolean\" },\n\t\t\tsilent: { type: \"boolean\" },\n\t\t\tgitTagFallback: { type: \"boolean\" },\n\t\t\tsign: { type: \"boolean\" },\n\t\t\tverify: { type: \"boolean\" },\n\n\t\t\t// Skip Steps\n\t\t\tskipBump: { type: \"boolean\" },\n\t\t\tskipChangelog: { type: \"boolean\" },\n\t\t\tskipCommit: { type: \"boolean\" },\n\t\t\tskipTag: { type: \"boolean\" },\n\n\t\t\t// Changelog Overrides\n\t\t\tcommitUrlFormat: { type: \"string\" },\n\t\t\tcompareUrlFormat: { type: \"string\" },\n\t\t\tissueUrlFormat: { type: \"string\" },\n\t\t\tuserUrlFormat: { type: \"string\" },\n\t\t\treleaseCommitMessageFormat: { type: \"string\" },\n\t\t\treleaseMessageSuffix: { type: \"string\" },\n\t\t},\n\t});\n}\n","#!/usr/bin/env node\n\nimport { writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { ZodError } from \"zod\";\n\nimport { getCliArguments } from \"./config/cli-arguments\";\nimport { getUserConfig } from \"./config/user-config\";\nimport { Logger } from \"./services/logger\";\nimport { FileManager } from \"./files/file-manager\";\nimport { Git } from \"./services/git\";\n\nimport { validateConfig } from \"./commands/validate-config\";\nimport { inspectVersion } from \"./commands/inspect-version\";\nimport { inspectTag } from \"./commands/inspect-tag\";\nimport { main } from \"./commands/main\";\n\nasync function runFork() {\n\tconst startTime = Date.now();\n\n\tconst cliArguments = getCliArguments();\n\tconst config = await getUserConfig(cliArguments);\n\tconst logger = new Logger(config);\n\tconst fileManager = new FileManager(config, logger);\n\tconst git = new Git(config);\n\n\tswitch (config.command) {\n\t\tcase \"validate-config\": {\n\t\t\tvalidateConfig(config);\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"inspect-version\": {\n\t\t\tawait inspectVersion(config, logger, fileManager, git);\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"inspect-tag\": {\n\t\t\tawait inspectTag(config, git);\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"main\": {\n\t\t\tconst result = await main(config, logger, fileManager, git);\n\n\t\t\t//#region Post-run instructions\n\t\t\tconst branchName = await git.getBranchName();\n\t\t\tlogger.log(\n\t\t\t\t`\\nRun \\`git push --follow-tags origin ${branchName}\\` to push the changes and the tag.`,\n\t\t\t);\n\n\t\t\tif (result.current.files.some((file) => file.name === \"package.json\" && !file.isPrivate)) {\n\t\t\t\tconst npmTag = typeof config.preRelease === \"string\" ? config.preRelease : \"prerelease\";\n\t\t\t\tlogger.log(\n\t\t\t\t\t`${result.next.releaseType}`.startsWith(\"pre\")\n\t\t\t\t\t\t? `Run \\`npm publish --tag ${npmTag}\\` to publish the package.`\n\t\t\t\t\t\t: \"Run `npm publish` to publish the package.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\t//#endregion Post-run instructions\n\n\t\t\tif (!config.dryRun && config.debug) {\n\t\t\t\twriteFileSync(\n\t\t\t\t\tjoin(config.path, `fork-version-${Date.now()}.debug-log.json`),\n\t\t\t\t\tJSON.stringify(result, null, 2),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault: {\n\t\t\tconsole.error(`Unknown command: ${config.command}`);\n\t\t\tprocess.exit(2);\n\t\t}\n\t}\n\n\tlogger.debug(`Completed in ${Date.now() - startTime} ms`);\n}\n\nrunFork().catch((error) => {\n\tif (error instanceof Error) {\n\t\t// If the error is a ZodError, print the keys that failed validation\n\t\tif (error.cause instanceof ZodError) {\n\t\t\tconsole.error(error.message);\n\t\t\tfor (const err of error.cause.issues) {\n\t\t\t\tconsole.log(`${err.path.join(\", \")} => ${err.message}`);\n\t\t\t}\n\t\t\tprocess.exit(3);\n\t\t}\n\n\t\tconsole.error(error.message);\n\t\tif (error.stack) console.error(error.stack);\n\t} else {\n\t\tconsole.error(error);\n\t}\n\tprocess.exit(1);\n});\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk2VYOEMMB_cjs = require('./chunk-2VYOEMMB.cjs');
|
|
4
4
|
|
|
5
5
|
// src/config/define-config.ts
|
|
6
6
|
function defineConfig(config) {
|
|
@@ -9,59 +9,75 @@ function defineConfig(config) {
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "CommitParser", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunk2VYOEMMB_cjs.CommitParser; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "FileManager", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunk2VYOEMMB_cjs.FileManager; }
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "ForkConfigSchema", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunk2VYOEMMB_cjs.ForkConfigSchema; }
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "Git", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunk2VYOEMMB_cjs.Git; }
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "Logger", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunk2VYOEMMB_cjs.Logger; }
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "commitChanges", {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function () { return
|
|
32
|
+
get: function () { return chunk2VYOEMMB_cjs.commitChanges; }
|
|
33
33
|
});
|
|
34
34
|
Object.defineProperty(exports, "createParserOptions", {
|
|
35
35
|
enumerable: true,
|
|
36
|
-
get: function () { return
|
|
36
|
+
get: function () { return chunk2VYOEMMB_cjs.createParserOptions; }
|
|
37
37
|
});
|
|
38
38
|
Object.defineProperty(exports, "filterRevertedCommits", {
|
|
39
39
|
enumerable: true,
|
|
40
|
-
get: function () { return
|
|
40
|
+
get: function () { return chunk2VYOEMMB_cjs.filterRevertedCommits; }
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "getCommitsSinceTag", {
|
|
43
43
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
44
|
+
get: function () { return chunk2VYOEMMB_cjs.getCommitsSinceTag; }
|
|
45
45
|
});
|
|
46
46
|
Object.defineProperty(exports, "getCurrentVersion", {
|
|
47
47
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
48
|
+
get: function () { return chunk2VYOEMMB_cjs.getCurrentVersion; }
|
|
49
49
|
});
|
|
50
50
|
Object.defineProperty(exports, "getNextVersion", {
|
|
51
51
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunk2VYOEMMB_cjs.getNextVersion; }
|
|
53
53
|
});
|
|
54
54
|
Object.defineProperty(exports, "getUserConfig", {
|
|
55
55
|
enumerable: true,
|
|
56
|
-
get: function () { return
|
|
56
|
+
get: function () { return chunk2VYOEMMB_cjs.getUserConfig; }
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(exports, "inspectTag", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: function () { return chunk2VYOEMMB_cjs.inspectTag; }
|
|
61
|
+
});
|
|
62
|
+
Object.defineProperty(exports, "inspectVersion", {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
get: function () { return chunk2VYOEMMB_cjs.inspectVersion; }
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "main", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () { return chunk2VYOEMMB_cjs.main; }
|
|
57
69
|
});
|
|
58
70
|
Object.defineProperty(exports, "tagChanges", {
|
|
59
71
|
enumerable: true,
|
|
60
|
-
get: function () { return
|
|
72
|
+
get: function () { return chunk2VYOEMMB_cjs.tagChanges; }
|
|
61
73
|
});
|
|
62
74
|
Object.defineProperty(exports, "updateChangelog", {
|
|
63
75
|
enumerable: true,
|
|
64
|
-
get: function () { return
|
|
76
|
+
get: function () { return chunk2VYOEMMB_cjs.updateChangelog; }
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, "validateConfig", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () { return chunk2VYOEMMB_cjs.validateConfig; }
|
|
65
81
|
});
|
|
66
82
|
exports.defineConfig = defineConfig;
|
|
67
83
|
//# sourceMappingURL=index.cjs.map
|