update powershell file for windows
This commit is contained in:
@@ -36,7 +36,7 @@
|
|||||||
"build": "npm run tauri build --release",
|
"build": "npm run tauri build --release",
|
||||||
"build:mac": "npm run tauri build -- --target universal-apple-darwin",
|
"build:mac": "npm run tauri build -- --target universal-apple-darwin",
|
||||||
"build:all-unix": "chmod +x ./script/build.sh && ./script/build.sh",
|
"build:all-unix": "chmod +x ./script/build.sh && ./script/build.sh",
|
||||||
"build:all-windows": "pwsh .\\script\\build.ps1",
|
"build:all-windows": "pwsh ./script/build.ps1",
|
||||||
"tauri": "tauri",
|
"tauri": "tauri",
|
||||||
"cli": "rollup -c rollup.config.js --watch",
|
"cli": "rollup -c rollup.config.js --watch",
|
||||||
"cli:build": "cross-env NODE_ENV=production rollup -c rollup.config.js",
|
"cli:build": "cross-env NODE_ENV=production rollup -c rollup.config.js",
|
||||||
|
|||||||
54
script/build.ps1
vendored
54
script/build.ps1
vendored
@@ -10,6 +10,9 @@ if (-not (Test-Path output)) {
|
|||||||
|
|
||||||
if (-not (Test-Path output\windows)) {
|
if (-not (Test-Path output\windows)) {
|
||||||
New-Item -ItemType Directory -Path output\windows
|
New-Item -ItemType Directory -Path output\windows
|
||||||
|
} else {
|
||||||
|
Remove-Item output\windows -Recurse -Force
|
||||||
|
New-Item -ItemType Directory -Path output\windows
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "`n======================="
|
Write-Host "`n======================="
|
||||||
@@ -41,7 +44,7 @@ ForEach ($line in (Get-Content -Path .\app.csv | Select-Object -Skip 1)) {
|
|||||||
Write-Host "=========================="
|
Write-Host "=========================="
|
||||||
# -- replace url --
|
# -- replace url --
|
||||||
# clear url with regex
|
# clear url with regex
|
||||||
(Get-Content -Path $common_conf_path -Raw) -replace '"url":\s*"[^"]*"', '"url": ""' | Set-Content -Path $common_conf_path
|
.\script\sd.exe "`"url`":\s`"(.*?)`"" '"url": ""' $common_conf_path
|
||||||
# replace url with no regex
|
# replace url with no regex
|
||||||
.\script\sd.exe -s '"url": ""' "`"url`": `"${url}`"" $common_conf_path
|
.\script\sd.exe -s '"url": ""' "`"url`": `"${url}`"" $common_conf_path
|
||||||
|
|
||||||
@@ -53,19 +56,22 @@ ForEach ($line in (Get-Content -Path .\app.csv | Select-Object -Skip 1)) {
|
|||||||
|
|
||||||
# -- replace icon --
|
# -- replace icon --
|
||||||
# clear icon path with regex
|
# clear icon path with regex
|
||||||
(Get-Content -Path $windows_conf_path -Raw) -replace '(?s)"icon":\s*\[[^\]]*\]', '"icon": []' | Set-Content -Path $windows_conf_path
|
# (Get-Content -Path $windows_conf_path -Raw) -replace '(?s)"icon":\s*\[[^\]]*\]', '"icon": []' | Set-Content -Path $windows_conf_path
|
||||||
|
.\script\sd.exe "`"icon`":\s(.*)`]" '"icon": []' $windows_conf_path
|
||||||
# replace icon path with no regex
|
# replace icon path with no regex
|
||||||
.\script\sd.exe -s '"icon": []' "`"icon`": [`"png/${name}_256.ico`", `"png/${name}_32.ico`"]" $windows_conf_path
|
.\script\sd.exe -s '"icon": []' "`"icon`": [`"png/${name}_256.ico`", `"png/${name}_32.ico`"]" $windows_conf_path
|
||||||
|
|
||||||
# -- replace identifier --
|
# -- replace identifier --
|
||||||
# clear identifier with regex
|
# clear identifier with regex
|
||||||
(Get-Content -Path $windows_conf_path -Raw) -replace '"identifier":\s*"[^"]*"', '"identifier": ""' | Set-Content -Path $windows_conf_path
|
# (Get-Content -Path $windows_conf_path -Raw) -replace '"identifier":\s*"[^"]*"', '"identifier": ""' | Set-Content -Path $windows_conf_path
|
||||||
|
.\script\sd.exe "`"identifier`":\s`"(.*?)`"" '"identifier": ""' $windows_conf_path
|
||||||
# -- replace identifier with no regex --
|
# -- replace identifier with no regex --
|
||||||
.\script\sd.exe -s '"identifier": ""' "`"identifier`": `"${identifier_prefix}.${name}`"" $windows_conf_path
|
.\script\sd.exe -s '"identifier": ""' "`"identifier`": `"${identifier_prefix}.${name}`"" $windows_conf_path
|
||||||
|
|
||||||
# -- replace icon resources --
|
# -- replace icon resources --
|
||||||
# clear resources with regex
|
# clear resources with regex
|
||||||
(Get-Content -Path $windows_conf_path -Raw) -replace '(?s)"resources":\s*\[[^\]]*\]', '"resources": []' | Set-Content -Path $windows_conf_path
|
#(Get-Content -Path $windows_conf_path -Raw) -replace '(?s)"resources":\s*\[[^\]]*\]', '"resources": []' | Set-Content -Path $windows_conf_path
|
||||||
|
.\script\sd.exe "`"resources`":\s(.*)`]" '"resources": []' $windows_conf_path
|
||||||
# replace resources with no regex
|
# replace resources with no regex
|
||||||
.\script\sd.exe -s '"resources": []' "`"resources`": [`"png/${name}_32.ico`"]" $windows_conf_path
|
.\script\sd.exe -s '"resources": []' "`"resources`": [`"png/${name}_32.ico`"]" $windows_conf_path
|
||||||
|
|
||||||
@@ -93,27 +99,27 @@ ForEach ($line in (Get-Content -Path .\app.csv | Select-Object -Skip 1)) {
|
|||||||
Write-Host "package build success!"
|
Write-Host "package build success!"
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
$index++
|
$index++
|
||||||
# strip blank line for common_conf_path
|
# # strip blank line for common_conf_path
|
||||||
$lines = Get-Content ${common_conf_path}
|
# $lines = Get-Content ${common_conf_path}
|
||||||
$lastNonEmptyLineIndex = ($lines.Count - 1)
|
# $lastNonEmptyLineIndex = ($lines.Count - 1)
|
||||||
while ($lastNonEmptyLineIndex -ge 0 -and -not $lines[$lastNonEmptyLineIndex].Trim()) {
|
# while ($lastNonEmptyLineIndex -ge 0 -and -not $lines[$lastNonEmptyLineIndex].Trim()) {
|
||||||
$lastNonEmptyLineIndex--
|
# $lastNonEmptyLineIndex--
|
||||||
}
|
# }
|
||||||
if ($lastNonEmptyLineIndex -lt ($lines.Count - 1)) {
|
# if ($lastNonEmptyLineIndex -lt ($lines.Count - 1)) {
|
||||||
$lines = $lines[0..$lastNonEmptyLineIndex]
|
# $lines = $lines[0..$lastNonEmptyLineIndex]
|
||||||
}
|
# }
|
||||||
Set-Content -Path ${common_conf_path} -Value $lines
|
# Set-Content -Path ${common_conf_path} -Value $lines
|
||||||
|
|
||||||
# strip blank line for windows conf_path
|
# # strip blank line for windows conf_path
|
||||||
$lines = Get-Content ${windows_conf_path}
|
# $lines = Get-Content ${windows_conf_path}
|
||||||
$lastNonEmptyLineIndex = ($lines.Count - 1)
|
# $lastNonEmptyLineIndex = ($lines.Count - 1)
|
||||||
while ($lastNonEmptyLineIndex -ge 0 -and -not $lines[$lastNonEmptyLineIndex].Trim()) {
|
# while ($lastNonEmptyLineIndex -ge 0 -and -not $lines[$lastNonEmptyLineIndex].Trim()) {
|
||||||
$lastNonEmptyLineIndex--
|
# $lastNonEmptyLineIndex--
|
||||||
}
|
# }
|
||||||
if ($lastNonEmptyLineIndex -lt ($lines.Count - 1)) {
|
# if ($lastNonEmptyLineIndex -lt ($lines.Count - 1)) {
|
||||||
$lines = $lines[0..$lastNonEmptyLineIndex]
|
# $lines = $lines[0..$lastNonEmptyLineIndex]
|
||||||
}
|
# }
|
||||||
Set-Content -Path ${windows_conf_path} -Value $lines
|
# Set-Content -Path ${windows_conf_path} -Value $lines
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "output dir is output\windows"
|
Write-Host "output dir is output\windows"
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"package": {
|
"package": {
|
||||||
"productName": "",
|
"productName": "WeRead",
|
||||||
"version": "1.0.0"
|
"version": "1.0.0"
|
||||||
},
|
},
|
||||||
"tauri": {
|
"tauri": {
|
||||||
"windows": [
|
"windows": [
|
||||||
{
|
{
|
||||||
"url": "https://riju.codes/",
|
"url": "https://weread.qq.com/",
|
||||||
"transparent": true,
|
"transparent": true,
|
||||||
"fullscreen": false,
|
"fullscreen": false,
|
||||||
"width": 1200,
|
"width": 1200,
|
||||||
@@ -28,5 +28,3 @@
|
|||||||
"beforeDevCommand": ""
|
"beforeDevCommand": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
{
|
{
|
||||||
"tauri": {
|
"tauri": {
|
||||||
"bundle": {
|
"bundle": {
|
||||||
"icon": ["png/coderunner_256.ico", "png/coderunner_32.ico"],
|
"icon": ["png/weread_256.ico", "png/weread_32.ico"],
|
||||||
"identifier": "com.tw93.coderunner",
|
"identifier": "com.tw93.weread",
|
||||||
"active": true,
|
"active": true,
|
||||||
"category": "DeveloperTool",
|
"category": "DeveloperTool",
|
||||||
"copyright": "",
|
"copyright": "",
|
||||||
"externalBin": [],
|
"externalBin": [],
|
||||||
"longDescription": "",
|
"longDescription": "",
|
||||||
"resources": ["png/coderunner_32.ico"],
|
"resources": ["png/weread_32.ico"],
|
||||||
"shortDescription": "",
|
"shortDescription": "",
|
||||||
"targets": ["msi"],
|
"targets": ["msi"],
|
||||||
"windows": {
|
"windows": {
|
||||||
|
|||||||
Reference in New Issue
Block a user