diff --git a/.bump-version.json b/.bump-version.json index ee465be..ad3a164 100644 --- a/.bump-version.json +++ b/.bump-version.json @@ -1,11 +1,15 @@ { - "target" : { - "module" : { "name" : "bump-version" } - }, "strategy" : { "semvar" : { - "preRelease" : { "strategy": { "gitTag" : {} } }, - "strategy" : { "gitTag": { "exactMatch": false } } + "allowPreRelease" : true, + "strategy" : { + "command" : { + "arguments" : [ + "my-command", + "--some-option" + ] + } + } } } -} +} \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..5354e34 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +**/*.docc/*.md diff --git a/.spi.yml b/.spi.yml index 1d6c3ad..1259242 100644 --- a/.spi.yml +++ b/.spi.yml @@ -1,4 +1,4 @@ version: 1 builder: configs: - - documentation_targets: [CliVersion] + - documentation_targets: [BumpVersion] diff --git a/Makefile b/Makefile deleted file mode 100644 index 6b7a541..0000000 --- a/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -PLATFORM_MACOS = macOS -CONFIG := debug -DOCC_TARGET ?= CliClient -DOCC_BASEPATH = $(shell basename "$(PWD)") -DOCC_DIR ?= ./docs -SWIFT_VERSION ?= "5.10" - -clean: - rm -rf .build - -build-documentation: - swift package \ - --allow-writing-to-directory "$(DOCC_DIR)" \ - generate-documentation \ - --target "$(DOCC_TARGET)" \ - --disable-indexing \ - --transform-for-static-hosting \ - --hosting-base-path "$(DOCC_BASEPATH)" \ - --output-path "$(DOCC_DIR)" - -preview-documentation: - swift package \ - --disable-sandbox \ - preview-documentation \ - --target "$(DOCC_TARGET)" - -test-linux: - docker run --rm \ - --volume "$(PWD):$(PWD)" \ - --workdir "$(PWD)" \ - "swift:$(SWIFT_VERSION)" \ - swift test - -test-library: - swift test -c $(CONFIG) - -update-version: - swift package \ - --disable-sandbox \ - --allow-writing-to-package-directory \ - update-version \ - git-version diff --git a/Package.swift b/Package.swift index cf08477..e85c382 100644 --- a/Package.swift +++ b/Package.swift @@ -8,7 +8,7 @@ let package = Package( .macOS(.v13) ], products: [ - .executable(name: "bump-version", targets: ["bump-version"]), + .executable(name: "bump-version", targets: ["BumpVersion"]), .library(name: "CliClient", targets: ["CliClient"]), .library(name: "ConfigurationClient", targets: ["ConfigurationClient"]), .library(name: "FileClient", targets: ["FileClient"]), @@ -28,7 +28,7 @@ let package = Package( ], targets: [ .executableTarget( - name: "bump-version", + name: "BumpVersion", dependencies: [ "CliClient", .product(name: "ArgumentParser", package: "swift-argument-parser"), @@ -96,7 +96,7 @@ let package = Package( name: "BuildWithVersionPlugin", capability: .buildTool(), dependencies: [ - "bump-version" + "BumpVersion" ] ), .plugin( @@ -111,7 +111,7 @@ let package = Package( ] ), dependencies: [ - "bump-version" + "BumpVersion" ] ) ] diff --git a/Sources/bump-version/Application.swift b/Sources/BumpVersion/Application.swift similarity index 100% rename from Sources/bump-version/Application.swift rename to Sources/BumpVersion/Application.swift diff --git a/Sources/bump-version/Commands/BuildCommand.swift b/Sources/BumpVersion/Commands/BuildCommand.swift similarity index 100% rename from Sources/bump-version/Commands/BuildCommand.swift rename to Sources/BumpVersion/Commands/BuildCommand.swift diff --git a/Sources/bump-version/Commands/BumpCommand.swift b/Sources/BumpVersion/Commands/BumpCommand.swift similarity index 100% rename from Sources/bump-version/Commands/BumpCommand.swift rename to Sources/BumpVersion/Commands/BumpCommand.swift diff --git a/Sources/bump-version/Commands/ConfigCommand.swift b/Sources/BumpVersion/Commands/ConfigCommand.swift similarity index 98% rename from Sources/bump-version/Commands/ConfigCommand.swift rename to Sources/BumpVersion/Commands/ConfigCommand.swift index 5bcc83b..b0a02fc 100644 --- a/Sources/bump-version/Commands/ConfigCommand.swift +++ b/Sources/BumpVersion/Commands/ConfigCommand.swift @@ -150,6 +150,7 @@ extension ConfigCommand { } // TODO: Add verbose. + // TODO: Need to be able to generate a branch style config file. @dynamicMemberLookup struct ConfigCommandOptions: ParsableArguments { diff --git a/Sources/bump-version/Commands/GenerateCommand.swift b/Sources/BumpVersion/Commands/GenerateCommand.swift similarity index 100% rename from Sources/bump-version/Commands/GenerateCommand.swift rename to Sources/BumpVersion/Commands/GenerateCommand.swift diff --git a/Sources/BumpVersion/Documentation.docc/Articles/BasicConfiguration.md b/Sources/BumpVersion/Documentation.docc/Articles/BasicConfiguration.md new file mode 100644 index 0000000..f344cb4 --- /dev/null +++ b/Sources/BumpVersion/Documentation.docc/Articles/BasicConfiguration.md @@ -0,0 +1,101 @@ +# Basic Configuration + +Basic configuration examples. + +## Overview + +Generating a configuration file for your application is the easiest way to use the command-line +tool. The configuration specifies the location of the version file, either by a path to the file or +by the module that a `Version.swift` file resides in. It also declares the strategy for generating +new versions. + +The command-line tool comes with a command to generate the configuration file for you, this should +be ran from the root of your project. + +```bash +bump-version config generate --target-module my-tool +``` + +The above command produces the following in a file named `.bump-version.json` with the generated +default settings. This will generate semvar style version (example: `1.0.0`). + +```json +{ + "strategy": { + "semvar": { + "allowPreRelease": true, + "strategy": { + "gitTag": { + "exactMatch": false + } + } + } + }, + "target": { + "module": { + "name": "my-tool" + } + } +} +``` + +> Note: The above does not add a pre-release strategy although it "allows" it if you pass an option +> to command later, if you set "allowPreRelease" to false it will ignore any attempts to add a +> pre-release strategy when bumping the version. + +Most commands accept the same options for configuration as the above `config generate` command. +Those get merged with your project configuration when calling a command, that allows you to override +any of your defaults depending on your use case. You can also generate several configuration files +and specify them by passing the `-f | --configuration-file` to the command. + +## Inspecting parsed configuration. + +You can inspect the configuration that get's parsed by using the `config dump` command. The dump +command will print the parsed `json` to `stdout`, which can be helpful in confirming that your +configuration is valid and does not work unexpectedly. + +```bash +bump-version config dump +``` + +The dump command can also be used to generate a different configuration that is merged with your +default. + +```bash +bump-version config dump --pre-release-git-tag-style > .bump-version.prerelease.json +``` + +Which would produce the following in `.bump-version.prerelease.json` + +```json +{ + "strategy": { + "semvar": { + "allowPreRelease": true, + "preRelease": { + "strategy": { + "gitTag": {} + } + }, + "strategy": { + "gitTag": { + "exactMatch": false + } + } + } + }, + "target": { + "module": { + "name": "my-tool" + } + } +} +``` + +You could then use this file when bumping your version. + +```bash +bump-version bump -f .bump-version.prerelease.json +``` + +> See Also: diff --git a/Sources/BumpVersion/Documentation.docc/Articles/CommandReference.md b/Sources/BumpVersion/Documentation.docc/Articles/CommandReference.md new file mode 100644 index 0000000..c749634 --- /dev/null +++ b/Sources/BumpVersion/Documentation.docc/Articles/CommandReference.md @@ -0,0 +1,108 @@ +# Command Reference + +Learn about the provided commands. + +## Overview + +The command-line tool provides the following commands. + +> See Also: +> +> 1. +> 1. + +All commands output the path of the file they generate or write to, to allow them to be piped into +other commands, however this will not work if you specify `--verbose` because then other output is +also written to `stdout`. + +### Bump Command + +This bumps the version to the next version based on the project configuration or passed in options. +This is the default command when calling the `bump-version` tool, so specifying the `bump` command +is not required, but will be shown in examples below for clarity. + +> See Also: + +The following options are used to declare which part of a semvar to bump to the next version, they +are ignored if your configuration or options specify to use a `branch` strategy. + +| Long | Description | +| ------------- | --------------------------------------- | +| --major | Bump the major portion of the semvar | +| --minor | Bump the minor portion of the semvar | +| --patch | Bump the patch portion of the semvar | +| --pre-release | Bump the pre-release suffix of a semvar | + +#### Bump Command Usage Examples + +```bash +bump-version bump --minor +``` + +Show the output, but don't update the version file. + +```bash +bump-version bump --major --dry-run +``` + +### Generate Command + +This generates a version file based on your configuration, setting it's initial value based on your +projects configuration strategy. This is generally only ran once after setting up a project. + +```bash +bump-version generate +``` + +### Configuration Commands + +The following commands are used to work with project configuration. + +#### Generate Command + +Generates a configuration file based on the passed in options. + +> See Also: + +The following options are used to declare strategy used for deriving the version. + +| Long | Description | +| -------- | ------------------------------------------------------- | +| --branch | Use the branch strategy | +| --semvar | Use the semvar strategy (default) | +| --print | Print the output to stdout instead of generating a file | + +##### Generate Configuration Example + +```bash +bump-version config generate -m my-tool +``` + +The above generates a configuration file using the default version strategy for a target module +named 'my-tool'. + +#### Dump Command + +Dumps the parsed configuration to `stdout`. + +> See Also: + +The following options are used to declare what output gets printed. + +| Long | Description | +| ------- | -------------------- | +| --json | Print json (default) | +| --swift | Print swift struct | + +##### Dump Configuration Example + +```bash +bump-version config dump --disable-pre-release +``` + +This command can also be used to extend a configuration file with new configuration by sending the +output to a new file. + +```bash +bump-version config dump --disable-pre-release > .bump-version.prod.json +``` diff --git a/Sources/BumpVersion/Documentation.docc/Articles/ConfigurationReference.md b/Sources/BumpVersion/Documentation.docc/Articles/ConfigurationReference.md new file mode 100644 index 0000000..e2b62f3 --- /dev/null +++ b/Sources/BumpVersion/Documentation.docc/Articles/ConfigurationReference.md @@ -0,0 +1,225 @@ +# Configuration Reference + +Learn about the configuration. + +## Target + +The target declares where a version file lives that can be bumped by the command-line tool. + +A target can be specified either as a path from the root of the project to a file that contains the +version or as a module that contains the version file. + +> Note: A version file should not contain any other code aside from the version as the entire file +> contents get over written when bumping the version. + +### Target - Path Example + +```json +{ + "target": { + "path": "Sources/my-tool/Version.swift" + } +} +``` + +### Target - Module Example + +When using the module style a file name is not required if you use the default file name of +`Version.swift`, however it can be customized in your target specification. + +```json +{ + "target": { + "module": { + "fileName": "CustomVersion.swift", + "name": "my-tool" + } + } +} +``` + +The above will parse the path to the file as `Sources/my-tool/CustomVersion.swift`. + +## Strategy + +The strategy declares how to generate the next version of your project. There are currently two +strategies, `branch` and `semvar`, that we will discuss. + +### Branch Strategy + +This is the most basic strategy, which will derive the version via the git branch and optionally the +short version of the commit sha. + +An example of this style may look like: `main-8d73287a60`. + +```json +{ + "strategy": { + "branch": { + "includeCommitSha": true + } + } +} +``` + +If you set `'"includeCommitSha" : false'` then only the branch name will be used. + +### Semvar Strategy + +This is the most common strategy to use. It has support for generating the next version using either +`gitTag` or a custom `command` strategy. + +#### Git Tag Strategy + +The `gitTag` strategy derives the next version using the output of `git describe --tags` command. +This requires a commit to have a semvar style tag in it's history, otherwise we will use `0.0.0` as +the tag until a commit is tagged. + +```json +{ + "strategy": { + "semvar": { + "allowPreRelease": true, + "strategy": { + "gitTag": { + "exactMatch": false + } + } + } + } +} +``` + +If you set `'"exactMatch": true'` then bumping the version will fail on commits that are not +specifically tagged. + +#### Custom Command Strategy + +The custom `command` strategy allows you to call an external command to derive the next version. The +external command should return something that can be parsed as a semvar. + +```json +{ + "strategy": { + "semvar": { + "allowPreRelease": true, + "strategy": { + "command": { + "arguments": ["my-command", "--some-option", "foo"] + } + } + } + } +} +``` + +> Note: All arguments to custom commands need to be a separate string in the arguments array +> otherwise they may not get passed appropriately to the command, so +> `"my-command --some-option foo"` will likely not work as expected. + +#### Pre-Release + +Semvar strategies can also include a pre-release strategy that adds a suffix to the semvar version +that can be used. In order for pre-release suffixes to be allowed the `'"allowPreRelease": true'` +must be set on the semvar strategy, you must also supply a pre-release strategy either when calling +the bump-version command or in your configuration. + +Currently there are three pre-release strategies, `branch`, `gitTag`, and custom `command`, which we +will discuss. + +A pre-release semvar example: `1.0.0-1-8d73287a60` + +##### Branch + +This will use the branch and optionally short version of the commit sha in order to derive the +pre-release suffix. + +```json +{ + "strategy": { + "semvar": { + "allowPreRelease": true, + "preRelease": { + "strategy": { + "branch": { + "includeCommitSha": true + } + } + }, + ... + } + } +} +``` + +This would produce something similar to: `1.0.0-main-8d73287a60` + +##### Git Tag + +This will use the full output of `git describe --tags` to include the pre-release suffix. + +```json +{ + "strategy" : { + "semvar" : { + "allowPreRelease" : true, + "preRelease" : { + "strategy" : { + "gitTag" : {} + } + }, + ... + } + } +} +``` + +This would produce something similar to: `1.0.0-10-8d73287a60` + +##### Custom Command + +This allows you to call an external command to generate the pre-release suffix. We will use whatever +the output is as the suffix. + +```json +{ + "strategy": { + "semvar": { + "allowPreRelease": true, + "preRelease": { + "strategy": { + "command": { + "arguments": ["my-command", "--some-option", "foo"] + } + } + } + } + } +} +``` + +> Note: All arguments to custom commands need to be a separate string in the arguments array +> otherwise they may not get passed appropriately to the command, so +> `"my-command --some-option foo"` will likely not work as expected. + +##### Pre-Release Prefixes + +All pre-release strategies can also accept a `prefix` that will appended prior to the generated +pre-release suffix. This can also be used without providing a pre-release strategy to only append +the `prefix` to the semvar. + +```json +{ + "strategy" : { + "semvar" : { + "allowPreRelease" : true, + "preRelease" : { + "prefix": "rc" + }, + ... + } + } +} +``` + +This would produce something similar to: `1.0.0-rc` diff --git a/Sources/BumpVersion/Documentation.docc/Articles/OptionsReference.md b/Sources/BumpVersion/Documentation.docc/Articles/OptionsReference.md new file mode 100644 index 0000000..7614a35 --- /dev/null +++ b/Sources/BumpVersion/Documentation.docc/Articles/OptionsReference.md @@ -0,0 +1,47 @@ +# Options Reference + +Common options used for the commands. + +## Overview + +The commands mostly all accept similar options, below is a list of those options and a description +of their usage. + +### General Options + +| Short | Long | Argument | Description | +| ----- | --------------- | -------- | -------------------------------------------------------------------- | +| N/A | --dry-run | N/A | Perform the command, but don't write any output files | +| N/A | --git-directory | | The path to the root of your project, defaults to current directory | +| -h | --help | N/A | Show help for a command | +| -v | --verbose | N/A | Increase logging level, can be passed multiple times (example: -vvv) | +| N/A | --version | N/A | Show the version of the command line tool | + +### Configuration Options + +| Short | Long | Argument | Description | +| ----- | ---------------------------------- | ----------- | ---------------------------------------------------------------------------------- | +| -f | --configuration-file | | The path to the configuration to use. | +| -m | --target-module | | The target module name inside your project | +| -n | --target-file-name | | The file name for the version to be found inside the module | +| -p | --target-file-path | | Path to a version file in your project | +| N/A | --enable-git-tag/--disable-git-tag | N/A | Use the git-tag version strategy | +| N/A | --require-exact-match | N/A | Fail if a tag is not specifically set on the commit | +| N/A | --require-existing-semvar | N/A | Fail if an existing semvar is not found in the version file. | +| -c | --custom-command | | Use a custom command strategy for the version (any options need to proceed a '--') | +| N/A | --commit-sha/--no-commit-sha | N/A | Use the commit sha with branch version or pre-release strategy | + +#### Pre-Release Options + +| Short | Long | Argument | Description | +| ----- | ---------------------------- | ----------- | ------------------------------------------------------------ | +| -d | --disable-pre-release | N/A | Disable pre-relase suffixes from being used | +| -b | --pre-release-branch-style | N/A | Use the branch and commit sha style for pre-release suffixes | +| N/A | --commit-sha/--no-commit-sha | N/A | Use the commit sha with branch pre-release strategy | +| -g | --pre-release-git-tag-style | N/A | Use the git tag style for pre-release suffixes | +| N/A | --pre-release-prefix | | A prefix to use before a pre-release suffix | +| N/A | --custom-pre-release | | Use custom command strategy for pre-release suffix | + +> Note: When using one of the `--custom-*` options then any arguments passed will be used for +> arguments when calling your custom strategy, if the external tool you use requires options they +> must proceed a '--' otherwise you will get an error that an 'unexpected option' is being used. diff --git a/Sources/BumpVersion/Documentation.docc/Articles/PluginsReference.md b/Sources/BumpVersion/Documentation.docc/Articles/PluginsReference.md new file mode 100644 index 0000000..7623b5a --- /dev/null +++ b/Sources/BumpVersion/Documentation.docc/Articles/PluginsReference.md @@ -0,0 +1,77 @@ +# Plugins Reference + +Learn about using the provided package plugins. + +## Overview + +There are two provided plugins that can be used, this describes their usage. + +### Build with Version + +The `BuildWithVersion` plugin uses your project configuration to automatically generate a version +file when swift builds your project. You can use the plugin by declaring it as dependency in your +project. + +```swift +// swift-tools-version: 5.10 + +import PackageDescription + +let package = Package( + platforms:[.macOS(.v13)], + dependencies: [ + ..., + .package(url: "https://github.com/m-housh/swift-bump-version.git", from: "0.2.0") + ], + targets: [ + .executableTarget( + name: "", + dependencies: [...], + plugins: [ + .plugin(name: "BuildWithVersionPlugin", package: "swift-bump-version") + ] + ) + ] +) +``` + +### Manual Plugin + +There is also a `BumpVersionPlugin` that allows you to run the `bump-version` tool without +installing the command-line tool on your system, however it does make the usage much more verbose. + +Include as dependency in your project. + +```swift +// swift-tools-version: 5.10 + +import PackageDescription + +let package = Package( + platforms:[.macOS(.v13)], + dependencies: [ + ..., + .package(url: "https://github.com/m-housh/swift-bump-version.git", from: "0.2.0") + ], + targets: [ + ... + ] +) +``` + +Then you can use the manual plugin. + +``` +swift package \ + --disable-sandbox \ + --allow-writing-to-package-directory \ + bump-version \ + bump \ + --minor +``` + +> Note: Anything after the `'bump-version'` in the above get's passed directly to the bump-version +> command-line tool, so you can use this to run any of the provided commands, the above shows +> bumping the minor semvar as a reference example. +> +> See Also: diff --git a/Sources/BumpVersion/Documentation.docc/BumpVersion.md b/Sources/BumpVersion/Documentation.docc/BumpVersion.md new file mode 100644 index 0000000..ddef5f0 --- /dev/null +++ b/Sources/BumpVersion/Documentation.docc/BumpVersion.md @@ -0,0 +1,62 @@ +# ``BumpVersion`` + +@Metadata { + @DisplayName("bump-version") + @DocumentationExtension(mergeBehavior: override) +} + +A command-line tool for managing swift application versions. + +## Overview + +This tool aims to provide a way to manage application versions in your build +pipeline. It can be used as a stand-alone command-line tool or by using one of +the provided swift package plugins. + +## Installation + +The command-line tool can be installed via homebrew. + +```bash +brew tap m-housh/formula +brew install bump-version +``` + +## Package Plugins + +Package plugins can be used in a swift package manager project. + +```swift +// swift-tools-version: 5.10 + +import PackageDescription + +let package = Package( + platforms:[.macOS(.v13)], + dependencies: [ + ..., + .package(url: "https://github.com/m-housh/swift-bump-version.git", from: "0.2.0") + ], + targets: [ + .executableTarget( + name: "", + dependencies: [...], + plugins: [ + .plugin(name: "BuildWithVersionPlugin", package: "swift-bump-version") + ] + ) + ] +) +``` + +> See Also: + +## Topics + +### Articles + +- +- +- +- +- diff --git a/Sources/bump-version/GlobalOptions.swift b/Sources/BumpVersion/GlobalOptions.swift similarity index 100% rename from Sources/bump-version/GlobalOptions.swift rename to Sources/BumpVersion/GlobalOptions.swift diff --git a/Sources/bump-version/Helpers/DocHelpers.swift b/Sources/BumpVersion/Helpers/DocHelpers.swift similarity index 100% rename from Sources/bump-version/Helpers/DocHelpers.swift rename to Sources/BumpVersion/Helpers/DocHelpers.swift diff --git a/Sources/bump-version/Helpers/GlobalOptions+run.swift b/Sources/BumpVersion/Helpers/GlobalOptions+run.swift similarity index 100% rename from Sources/bump-version/Helpers/GlobalOptions+run.swift rename to Sources/BumpVersion/Helpers/GlobalOptions+run.swift diff --git a/Sources/bump-version/Version.swift b/Sources/BumpVersion/Version.swift similarity index 100% rename from Sources/bump-version/Version.swift rename to Sources/BumpVersion/Version.swift diff --git a/Sources/CliClient/CliClient.swift b/Sources/CliClient/CliClient.swift index 1b530a1..c4a6d4b 100644 --- a/Sources/CliClient/CliClient.swift +++ b/Sources/CliClient/CliClient.swift @@ -9,6 +9,7 @@ import ShellClient public extension DependencyValues { + /// The cli-client that runs the command line tool commands. var cliClient: CliClient { get { self[CliClient.self] } set { self[CliClient.self] = newValue } @@ -70,6 +71,7 @@ public struct CliClient: Sendable { } extension CliClient: DependencyKey { + public static let testValue: CliClient = Self() public static func live(environment: [String: String]) -> Self { diff --git a/Sources/CliClient/Documentation.docc/Articles/ManualPlugins.md b/Sources/CliClient/Documentation.docc/Articles/ManualPlugins.md index 814ed2d..16c2ed3 100644 --- a/Sources/CliClient/Documentation.docc/Articles/ManualPlugins.md +++ b/Sources/CliClient/Documentation.docc/Articles/ManualPlugins.md @@ -1,12 +1,12 @@ # Manual Plugins -There are two plugins that are included that can be ran manually, if the build tool plugin does not fit -your use case. +There are two plugins that are included that can be ran manually, if the build tool plugin does not +fit your use case. ## Generate Version -The `generate-version` plugin will create a `Version.swift` file in the given target. You can -run it by running the following command. +The `generate-version` plugin will create a `Version.swift` file in the given target. You can run it +by running the following command. ```bash swift package --disable-sandbox \ @@ -32,16 +32,17 @@ swift package --disable-sandbox \ ## Options -Both manual versions also allow the following options to customize the operation, the -options need to come after the plugin name. +Both manual versions also allow the following options to customize the operation, the options need +to come after the plugin name. -| Option | Description | -| ------ | ----------- | -| --dry-run | Do not write to any files, but describe where values would be written | -| --filename | Override the file name to be written in the target directory | -| --verbose | Increase the logging output | +| Option | Description | +| ---------- | --------------------------------------------------------------------- | +| --dry-run | Do not write to any files, but describe where values would be written | +| --filename | Override the file name to be written in the target directory | +| --verbose | Increase the logging output | ### Example with options + ```bash swift package \ --allow-writing-to-package-directory \ diff --git a/Sources/CliClient/Documentation.docc/CliVersion.md b/Sources/CliClient/Documentation.docc/CliClient.md similarity index 63% rename from Sources/CliClient/Documentation.docc/CliVersion.md rename to Sources/CliClient/Documentation.docc/CliClient.md index 6f17203..190618c 100644 --- a/Sources/CliClient/Documentation.docc/CliVersion.md +++ b/Sources/CliClient/Documentation.docc/CliClient.md @@ -1,4 +1,4 @@ -# CliClient +# ``CliClient`` Derive a version for a command-line tool from git tags or a git sha. @@ -9,8 +9,8 @@ Derive a version for a command-line tool from git tags or a git sha. ## Overview This tool exposes several plugins that can be used to derive a version for a command line program at -build time or by manually running the plugin. The version is derived from git tags and falling back -to the branch and git sha if a tag is not set for the current worktree state. +build time or by manually running the plugin. The version is generally derived from git tags, +however it can be configured to run custom commands. ## Articles diff --git a/Sources/CliClient/Internal/Constants.swift b/Sources/CliClient/Internal/Constants.swift deleted file mode 100644 index 6be6d11..0000000 --- a/Sources/CliClient/Internal/Constants.swift +++ /dev/null @@ -1,3 +0,0 @@ -enum Constants { - static let defaultFileName = "Version.swift" -} diff --git a/Sources/ConfigurationClient/Configuration.swift b/Sources/ConfigurationClient/Configuration.swift index 9821741..13f49ba 100644 --- a/Sources/ConfigurationClient/Configuration.swift +++ b/Sources/ConfigurationClient/Configuration.swift @@ -117,8 +117,8 @@ public extension Configuration { public init( allowPreRelease: Bool? = true, preRelease: PreRelease? = nil, - requireExistingFile: Bool? = true, - requireExistingSemVar: Bool? = true, + requireExistingFile: Bool? = false, + requireExistingSemVar: Bool? = false, strategy: Strategy? = nil ) { self.allowPreRelease = allowPreRelease diff --git a/Sources/bump-version/Documentation.docc/Application.md b/Sources/bump-version/Documentation.docc/Application.md deleted file mode 100644 index db8e1b6..0000000 --- a/Sources/bump-version/Documentation.docc/Application.md +++ /dev/null @@ -1,5 +0,0 @@ -# Application - -## Articles - -- diff --git a/Sources/bump-version/Documentation.docc/Articles/Installation.md b/Sources/bump-version/Documentation.docc/Articles/Installation.md deleted file mode 100644 index a123882..0000000 --- a/Sources/bump-version/Documentation.docc/Articles/Installation.md +++ /dev/null @@ -1,3 +0,0 @@ -# Installation - -You can install the command-line application by... diff --git a/justfile b/justfile index 583b56a..f5a3d95 100644 --- a/justfile +++ b/justfile @@ -72,3 +72,21 @@ get-release-sha prefix="": (build "release") stripped="${sha% *}" && \ echo "$stripped" | pbcopy && \ echo "Copied sha to clipboard: $stripped" + +# Preview the documentation locally. +preview-documentation target="BumpVersion": + swift package \ + --disable-sandbox \ + preview-documentation \ + --target {{target}} + +# Preview the documentation locally. +build-documentation dir="./docs" target="BumpVersion" basePath="bump-version": + swift package \ + --allow-writing-to-directory {{dir}} \ + generate-documentation \ + --target {{target}} \ + --disable-indexing \ + --transform-for-static-hosting \ + --hosting-base-path {{basePath}} \ + --output-path {{dir}}