mirror of
https://github.com/nushell/nu_scripts.git
synced 2024-09-11 13:45:56 +03:00
dfdd5692d7
What it says on the tin. This just updates the `bump-version.nu` script to also edit the version in the new nu_plugin_nu_example plugin, the same way it does for python
50 lines
1.7 KiB
Plaintext
Executable File
50 lines
1.7 KiB
Plaintext
Executable File
#!/usr/bin/env nu
|
|
use std log
|
|
|
|
# bump the minor or patch version of the Nushell project
|
|
def main [
|
|
--patch # update the minor version instead of the minor
|
|
]: nothing -> nothing {
|
|
let version = open Cargo.toml
|
|
| get package.version
|
|
| parse "{major}.{minor}.{patch}"
|
|
| into int major minor patch
|
|
| into record
|
|
|
|
let new_version = if $patch {
|
|
$version | update patch { $in + 1 }
|
|
} else {
|
|
$version | update minor { $in + 1 } | update patch { 0 }
|
|
}
|
|
|
|
let version = $version | transpose | get column1 | str join "."
|
|
let new_version = $new_version | transpose | get column1 | str join "."
|
|
|
|
log info $"bumping all packages and Nushell files in (open Cargo.toml | get package.name) from ($version) to ($new_version)"
|
|
|
|
ls **/Cargo.toml | each {|file|
|
|
log debug $"bumping ($file.name) from ($version) to ($new_version)"
|
|
open --raw $file.name
|
|
| str replace --all $'version = "($version)"' $'version = "($new_version)"'
|
|
| save --force $file.name
|
|
}
|
|
|
|
"crates/nu-utils/src/sample_config/default_{config,env}.nu" | str expand | each {|file|
|
|
log debug $"bumping ($file) from ($version) to ($new_version)"
|
|
open --raw $file
|
|
| str replace --all $'version = "($version)"' $'version = "($new_version)"'
|
|
| save --force $file
|
|
}
|
|
|
|
[
|
|
"crates/nu_plugin_python/nu_plugin_python_example.py"
|
|
"crates/nu_plugin_nu_example/nu_plugin_nu_example.nu"
|
|
] | each {|file|
|
|
log debug $"bumping ($file) from ($version) to ($new_version)"
|
|
open --raw $file
|
|
| str replace --all $'NUSHELL_VERSION = "($version)"' $'NUSHELL_VERSION = "($new_version)"'
|
|
| save --force $file
|
|
}
|
|
null
|
|
}
|