Merge branch 'master' into conditional-style

This commit is contained in:
Filip Bachul 2023-02-28 09:53:17 +01:00
commit 3e505d3d5e
10 changed files with 139 additions and 70 deletions

View File

@ -41,7 +41,7 @@
"target/"
],
"plugins": [
"https://github.com/dprint/dprint-plugin-typescript/releases/download/0.80.2/plugin.wasm",
"https://github.com/dprint/dprint-plugin-typescript/releases/download/0.83.0/plugin.wasm",
"https://github.com/dprint/dprint-plugin-json/releases/download/0.17.0/plugin.wasm",
"https://github.com/dprint/dprint-plugin-markdown/releases/download/0.15.2/plugin.wasm",
"https://github.com/dprint/dprint-plugin-toml/releases/download/0.5.4/plugin.wasm"

View File

@ -14,7 +14,7 @@ jobs:
- name: Setup | Checkout
uses: actions/checkout@v3
- name: Docs | Format
uses: dprint/check@v2.1
uses: dprint/check@v2.2
# Validate preset files
taplo:

View File

@ -230,10 +230,12 @@ jobs:
if: matrix.os == 'windows-latest' && matrix.rust == 'stable'
run: |
# Setup dummy release artifacts
New-Item -ItemType Directory -Path ./starship-x86_64-pc-windows-msvc
New-Item -ItemType Directory -Path ./starship-i686-pc-windows-msvc
New-Item -ItemType File -Path ./starship-x86_64-pc-windows-msvc/starship-x86_64-pc-windows-msvc.zip
New-Item -ItemType File -Path ./starship-i686-pc-windows-msvc/starship-i686-pc-windows-msvc.zip
foreach ($arch in @("aarch64", "i686", "x86_64")) {
foreach ($ext in @("zip", "msi")) {
New-Item -ItemType Directory -Path ./starship-$arch-pc-windows-msvc.$ext
New-Item -ItemType File -Path ./starship-$arch-pc-windows-msvc.$ext/starship-$arch-pc-windows-msvc.$ext
}
}
# Build package
pwsh ./install/windows/choco/update.ps1
env:

24
Cargo.lock generated
View File

@ -283,9 +283,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.1.6"
version = "4.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0b0588d44d4d63a87dbd75c136c166bbfd9a86a31cb89e09906521c7d3f5e3"
checksum = "2f3061d6db6d8fcbbd4b05e057f2acace52e64e96b498c08c2d7a4e65addd340"
dependencies = [
"bitflags",
"clap_derive",
@ -300,18 +300,18 @@ dependencies = [
[[package]]
name = "clap_complete"
version = "4.1.3"
version = "4.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0012995dc3a54314f4710f5631d74767e73c534b8757221708303e48eef7a19b"
checksum = "501ff0a401473ea1d4c3b125ff95506b62c5bc5768d818634195fbb7c4ad5ff4"
dependencies = [
"clap",
]
[[package]]
name = "clap_derive"
version = "4.1.0"
version = "4.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8"
checksum = "34d122164198950ba84a918270a3bb3f7ededd25e15f7451673d986f55bd2667"
dependencies = [
"heck 0.4.0",
"proc-macro-error",
@ -2528,9 +2528,9 @@ dependencies = [
[[package]]
name = "schemars"
version = "0.8.11"
version = "0.8.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a5fb6c61f29e723026dc8e923d94c694313212abbecbbe5f55a7748eec5b307"
checksum = "02c613288622e5f0c3fdc5dbd4db1c5fbe752746b1d1a56a0630b78fd00de44f"
dependencies = [
"dyn-clone",
"indexmap",
@ -2541,9 +2541,9 @@ dependencies = [
[[package]]
name = "schemars_derive"
version = "0.8.11"
version = "0.8.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f188d036977451159430f3b8dc82ec76364a42b7e289c2b18a9a18f4470058e9"
checksum = "109da1e6b197438deb6db99952990c7f959572794b80ff93707d55a232545e7c"
dependencies = [
"proc-macro2",
"quote",
@ -2696,9 +2696,9 @@ dependencies = [
[[package]]
name = "shadow-rs"
version = "0.20.1"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0942b9991e2cfab3d5059e508d517c66bc460b302a2a8187a90d0aae4f08531d"
checksum = "427f07ab5f873000cf55324882e12a88c0a7ea7025df4fc1e7e35e688877a583"
dependencies = [
"const_format",
"is_debug",

View File

@ -43,8 +43,8 @@ gix-faster = ["gix-features/zlib-stock", "gix/fast-sha1"]
[dependencies]
chrono = { version = "0.4.23", default-features = false, features = ["clock", "std", "wasmbind"] }
clap = { version = "4.1.6", features = ["derive", "cargo", "unicode"] }
clap_complete = "4.1.3"
clap = { version = "4.1.7", features = ["derive", "cargo", "unicode"] }
clap_complete = "4.1.4"
dirs-next = "2.0.0"
dunce = "1.0.3"
gethostname = "0.4.1"
@ -73,7 +73,7 @@ semver = "1.0.16"
serde = { version = "1.0.152", features = ["derive"] }
serde_json = "1.0.93"
sha1 = "0.10.5"
shadow-rs = { version = "0.20.1", default-features = false }
shadow-rs = { version = "0.21.0", default-features = false }
# battery is optional (on by default) because the crate doesn't currently build for Termux
# see: https://github.com/svartalf/rust-battery/issues/33
starship-battery = { version = "0.7.9", optional = true }
@ -96,7 +96,7 @@ home = "0.5.4"
shell-words = "1.1.0"
[dependencies.schemars]
version = "0.8.11"
version = "0.8.12"
optional = true
features = ["preserve_order", "indexmap"]
@ -117,7 +117,7 @@ features = [
nix = { version = "0.26.2", default-features = false, features = ["feature", "fs", "user"] }
[build-dependencies]
shadow-rs = { version = "0.20.1", default-features = false }
shadow-rs = { version = "0.21.0", default-features = false }
dunce = "1.0.3"
[target.'cfg(windows)'.build-dependencies]

View File

@ -0,0 +1,25 @@
$ErrorActionPreference = 'Stop'
$packageName = $env:ChocolateyPackageName
$url_x86_64_msi = ''
$url_i686_msi = ''
$checksum_x86_64_msi = ''
$checksum_i686_msi = ''
$packageArgs = @{
packageName = $packageName
fileType = 'msi'
url = $url_i686_msi
url64bit = $url_x86_64_msi
checksum = $checksum_i686_msi
checksum64 = $checksum_x86_64_msi
checksumType = 'sha256'
softwareName = 'starship*'
silentArgs = "/qn /norestart /l*v `"$($env:TEMP)\$($packageName).$($env:chocolateyPackageVersion).MsiInstall.log`""
validExitCodes = @(0, 3010, 1641)
}
Install-ChocolateyPackage @packageArgs
# Add to Profile
Write-Host "Add the following to the end of ~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 'Invoke-Expression (&starship init powershell)'"

View File

@ -0,0 +1,24 @@
$ErrorActionPreference = 'Stop'
$packageName = $env:ChocolateyPackageName
$url_x86_64_zip = ''
$url_i686_zip = ''
$checksum_x86_64_zip = ''
$checksum_i686_zip = ''
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$packageArgs = @{
packageName = $packageName
fileType = 'zip'
url = $url_i686_zip
url64bit = $url_x86_64_zip
checksum = $checksum_i686_zip
checksum64 = $checksum_x86_64_zip
checksumType = 'sha256'
unzipLocation = $toolsDir
}
Install-ChocolateyZipPackage @packageArgs
# Add to Profile
Write-Host "Add the following to the end of ~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 'Invoke-Expression (&starship init powershell)'"

View File

@ -1,22 +0,0 @@
$ErrorActionPreference = 'Stop'
$packageName = 'starship'
$url_x86_64_zip = ''
$url_i686_zip = ''
$checksum_x86_64_zip = ''
$checksum_i686_zip = ''
$checksumType = 'sha256'
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
Install-ChocolateyZipPackage -PackageName "$packageName" `
-Url "$url_i686_zip" `
-Url64 "$url_x86_64_zip" `
-UnzipLocation "$toolsDir" `
-Checksum "$checksum_i686_zip" `
-Checksum64 "$checksum_x86_64_zip" `
-ChecksumType "$checksumType"
# Add to Profile
Write-Host "Add the following to the end of ~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 'Invoke-Expression (&starship init powershell)'"

View File

@ -16,10 +16,13 @@
<projectSourceUrl>https://github.com/starship/starship</projectSourceUrl>
<iconUrl>https://starship.rs/icon.png</iconUrl>
<tags>powershell prompt starship pwsh</tags>
<copyright>© 2022 Starship Contributors</copyright>
<copyright>© 2023 Starship Contributors</copyright>
<licenseUrl>https://github.com/starship/starship/blob/master/LICENSE</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<releaseNotes></releaseNotes>
<dependencies>
<dependency id="chocolatey" version="0.9.9" />
</dependencies>
</metadata>
<files>
<file src="tools\**" target="tools" />

View File

@ -17,40 +17,77 @@ $nuspec_file.package.metadata.version = $versionNumber
$changelog = (Get-Content -Path ./CHANGELOG.md | Out-String)
$nuspec_file.package.metadata.releaseNotes = $changelog
# Create variant nuspec files
$nuspec_file.package.metadata.id = "starship.portable"
$nuspec_file.Save("./starship.portable.nuspec")
$nuspec_file.package.metadata.id = "starship.install"
$nuspec_file.Save("./starship.install.nuspec")
# Have metapackage depend on starship.install
$nuspec_file.package.metadata.id = "starship"
$dep = $nuspec_file.createelement("dependency")
$dep.SetAttribute("id", "starship.install")
$dep.SetAttribute("version", "[$versionNumber]")
$nuspec_file.package.metadata.dependencies.AppendChild($dep)
$nuspec_file.Save("./starship.nuspec")
$url_x86_64_zip = "https://github.com/starship/starship/releases/download/$version/starship-x86_64-pc-windows-msvc.zip"
$url_i686_zip = "https://github.com/starship/starship/releases/download/$version/starship-i686-pc-windows-msvc.zip"
$url_x86_64_msi = "https://github.com/starship/starship/releases/download/$version/starship-x86_64-pc-windows-msvc.msi"
$url_i686_msi = "https://github.com/starship/starship/releases/download/$version/starship-i686-pc-windows-msvc.msi"
$checksum_x86_64_zip = Get-FileHash -Algorithm SHA256 -Path "./starship-x86_64-pc-windows-msvc/starship-x86_64-pc-windows-msvc.zip" | Select-Object -ExpandProperty Hash
$checksum_i686_zip = Get-FileHash -Algorithm SHA256 -Path "./starship-i686-pc-windows-msvc/starship-i686-pc-windows-msvc.zip" | Select-Object -ExpandProperty Hash
$checksum_x86_64_zip = Get-FileHash -Algorithm SHA256 -Path "./starship-x86_64-pc-windows-msvc.zip/starship-x86_64-pc-windows-msvc.zip" | Select-Object -ExpandProperty Hash
$checksum_i686_zip = Get-FileHash -Algorithm SHA256 -Path "./starship-i686-pc-windows-msvc.zip/starship-i686-pc-windows-msvc.zip" | Select-Object -ExpandProperty Hash
$checksum_x86_64_msi = Get-FileHash -Algorithm SHA256 -Path "./starship-x86_64-pc-windows-msvc.msi/starship-x86_64-pc-windows-msvc.msi" | Select-Object -ExpandProperty Hash
$checksum_i686_msi = Get-FileHash -Algorithm SHA256 -Path "./starship-i686-pc-windows-msvc.msi/starship-i686-pc-windows-msvc.msi" | Select-Object -ExpandProperty Hash
if (!(Test-Path "./tools")) {
New-Item -ItemType Directory -Path "./tools"
if (Test-Path "./tools") {
Remove-Item -Path "./tools" -Recurse -Force
}
New-Item -ItemType Directory -Path "./tools"
Get-Content ./install/windows/choco/chocolateyInstall.ps1 | ForEach-Object {
if ($_ -match '^\$url_x86_64_zip = (.*)') {
"`$url_x86_64_zip = '$url_x86_64_zip'"
}
elseif ($_ -match '^\$url_i686_zip = (.*)') {
"`$url_i686_zip = '$url_i686_zip'"
}
elseif ($_ -match '^\$checksum_x86_64_zip = (.*)') {
"`$checksum_x86_64_zip = '$checksum_x86_64_zip'"
}
elseif ($_ -match '^\$checksum_i686_zip = (.*)') {
"`$checksum_i686_zip = '$checksum_i686_zip'"
}
else {
$_
}
} | Set-Content ./tools/chocolateyInstall.ps1
# Pack the metapackage as-is without install script
choco pack ./starship.nuspec
if ($null -ne $Env:PUSH_TOKEN) {
choco push starship.$versionNumber.nupkg --key $ENV:PUSH_TOKEN
foreach ($install_type in @('portable', 'install')) {
Get-Content ./install/windows/choco/chocolateyInstall.$install_type.ps1 | ForEach-Object {
if ($_ -match '^\$url_x86_64_zip = (.*)') {
"`$url_x86_64_zip = '$url_x86_64_zip'"
}
elseif ($_ -match '^\$url_i686_zip = (.*)') {
"`$url_i686_zip = '$url_i686_zip'"
}
elseif ($_ -match '^\$url_x86_64_msi = (.*)') {
"`$url_x86_64_msi = '$url_x86_64_msi'"
}
elseif ($_ -match '^\$url_i686_msi = (.*)') {
"`$url_i686_msi = '$url_i686_msi'"
}
elseif ($_ -match '^\$checksum_x86_64_zip = (.*)') {
"`$checksum_x86_64_zip = '$checksum_x86_64_zip'"
}
elseif ($_ -match '^\$checksum_i686_zip = (.*)') {
"`$checksum_i686_zip = '$checksum_i686_zip'"
}
elseif ($_ -match '^\$checksum_x86_64_msi = (.*)') {
"`$checksum_x86_64_msi = '$checksum_x86_64_msi'"
}
elseif ($_ -match '^\$checksum_i686_msi = (.*)') {
"`$checksum_i686_msi = '$checksum_i686_msi'"
}
else {
$_
}
} | Set-Content ./tools/chocolateyInstall.ps1
choco pack ./starship.$install_type.nuspec
}
if ($null -ne $ENV:PUSH_TOKEN) {
choco push starship.portable.$versionNumber.nupkg --key $ENV:PUSH_TOKEN
choco push starship.install.$versionNumber.nupkg --key $ENV:PUSH_TOKEN
choco push starship.$versionNumber.nupkg --key $ENV:PUSH_TOKEN
}
else {
Write-Host "No API key provided, skipping push"