Skip to content

Commit 2082f79

Browse files
committed
chore: bump version to 1.0.1
1 parent f2c286c commit 2082f79

5 files changed

Lines changed: 127 additions & 67 deletions

File tree

UPDATER_SETUP.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,20 @@ Cập nhật version trước:
225225

226226
Nên để cùng một version, ví dụ `1.0.1`.
227227

228+
Bạn có thể sửa tay hoặc dùng script bump version:
229+
230+
[`bump-version.ps1`](/f:/dev-stack/scripts/bump-version.ps1)
231+
232+
```powershell
233+
npm run version:bump -- 1.0.1
234+
```
235+
236+
Script này sẽ cập nhật đồng bộ:
237+
238+
- [`package.json`](/f:/dev-stack/package.json)
239+
- [`src-tauri/Cargo.toml`](/f:/dev-stack/src-tauri/Cargo.toml)
240+
- [`src-tauri/tauri.conf.json`](/f:/dev-stack/src-tauri/tauri.conf.json)
241+
228242
Sau đó tạo tag:
229243

230244
```powershell

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
{
1+
{
22
"name": "tauri-app",
33
"private": true,
4-
"version": "0.1.0",
4+
"version": "1.0.1",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
88
"build": "vite build",
99
"preview": "vite preview",
10-
"tauri": "tauri"
10+
"tauri": "tauri",
11+
"version:bump": "powershell -ExecutionPolicy Bypass -File .\\scripts\\bump-version.ps1"
1112
},
1213
"dependencies": {
1314
"@tanstack/react-query": "^5.90.21",

scripts/bump-version.ps1

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
param(
2+
[Parameter(Mandatory = $true)]
3+
[string]$Version
4+
)
5+
6+
$semverPattern = '^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$'
7+
if ($Version -notmatch $semverPattern) {
8+
throw "Invalid version '$Version'. Expected semver like 1.0.1 or 1.1.0-beta.1"
9+
}
10+
11+
$repoRoot = Split-Path -Parent $PSScriptRoot
12+
$packageJsonPath = Join-Path $repoRoot 'package.json'
13+
$cargoTomlPath = Join-Path $repoRoot 'src-tauri\Cargo.toml'
14+
$tauriConfPath = Join-Path $repoRoot 'src-tauri\tauri.conf.json'
15+
16+
if (-not (Test-Path -LiteralPath $packageJsonPath)) { throw "Missing file: $packageJsonPath" }
17+
if (-not (Test-Path -LiteralPath $cargoTomlPath)) { throw "Missing file: $cargoTomlPath" }
18+
if (-not (Test-Path -LiteralPath $tauriConfPath)) { throw "Missing file: $tauriConfPath" }
19+
20+
$packageJson = Get-Content -LiteralPath $packageJsonPath -Raw | ConvertFrom-Json
21+
$packageJson.version = $Version
22+
$packageJsonJson = $packageJson | ConvertTo-Json -Depth 100
23+
[System.IO.File]::WriteAllText($packageJsonPath, $packageJsonJson, [System.Text.UTF8Encoding]::new($false))
24+
25+
$cargoToml = Get-Content -LiteralPath $cargoTomlPath -Raw
26+
$cargoToml = [regex]::Replace($cargoToml, '(?m)^version\s*=\s*"[^"]+"$', "version = `"$Version`"", 1)
27+
[System.IO.File]::WriteAllText($cargoTomlPath, $cargoToml, [System.Text.UTF8Encoding]::new($false))
28+
29+
$tauriConf = Get-Content -LiteralPath $tauriConfPath -Raw | ConvertFrom-Json
30+
$tauriConf.version = $Version
31+
$tauriConfJson = $tauriConf | ConvertTo-Json -Depth 100
32+
[System.IO.File]::WriteAllText($tauriConfPath, $tauriConfJson, [System.Text.UTF8Encoding]::new($false))
33+
34+
Write-Host "Updated version to $Version in:" -ForegroundColor Green
35+
Write-Host "- $packageJsonPath"
36+
Write-Host "- $cargoTomlPath"
37+
Write-Host "- $tauriConfPath"

src-tauri/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
[package]
1+
[package]
22
name = "tauri-app"
3-
version = "0.1.0"
3+
version = "1.0.1"
44
description = "A Tauri App"
55
authors = ["you"]
66
edition = "2021"

src-tauri/tauri.conf.json

Lines changed: 70 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,71 @@
1-
{
2-
"$schema": "https://schema.tauri.app/config/2",
3-
"productName": "DevStack",
4-
"version": "1.0.0",
5-
"identifier": "com.devstack.desktop",
6-
"build": {
7-
"beforeDevCommand": "npm run dev",
8-
"devUrl": "http://localhost:1420",
9-
"beforeBuildCommand": "npm run build",
10-
"frontendDist": "../dist"
11-
},
12-
"app": {
13-
"windows": [
14-
{
15-
"label": "main",
16-
"title": "DevStack",
17-
"width": 1024,
18-
"height": 720,
19-
"resizable": true,
20-
"fullscreen": false,
21-
"decorations": false,
22-
"zoomHotkeysEnabled": true
23-
}
24-
],
25-
"security": {
26-
"csp": null
27-
},
28-
"trayIcon": {
29-
"iconPath": "icons/icon.ico",
30-
"iconAsTemplate": false,
31-
"menuOnLeftClick": false
32-
}
33-
},
34-
"bundle": {
35-
"active": true,
36-
"createUpdaterArtifacts": true,
37-
"targets": "all",
38-
"icon": [
39-
"icons/32x32.png",
40-
"icons/128x128.png",
41-
"icons/128x128@2x.png",
42-
"icons/icon.icns",
43-
"icons/icon.ico"
44-
],
45-
"windows": {
46-
"nsis": {},
47-
"wix": {}
48-
}
49-
},
50-
"plugins": {
51-
"shell": {},
52-
"fs": {},
53-
"updater": {
54-
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDIwMEI4NDcyNzY2OTMwQ0MKUldUTU1HbDJjb1FMSUNpSmsrZzdGL3hjSDVpaGgwSTFWS3VnclB4ZGR5YTdrYW1CTElWekpPSzQK",
55-
"endpoints": [
56-
"https://github.com/holdon1996/dev-stack/releases/latest/download/latest.json"
57-
],
58-
"windows": {
59-
"installMode": "passive"
60-
}
61-
}
62-
}
1+
{
2+
"$schema": "https://schema.tauri.app/config/2",
3+
"productName": "DevStack",
4+
"version": "1.0.1",
5+
"identifier": "com.devstack.desktop",
6+
"build": {
7+
"beforeDevCommand": "npm run dev",
8+
"devUrl": "http://localhost:1420",
9+
"beforeBuildCommand": "npm run build",
10+
"frontendDist": "../dist"
11+
},
12+
"app": {
13+
"windows": [
14+
{
15+
"label": "main",
16+
"title": "DevStack",
17+
"width": 1024,
18+
"height": 720,
19+
"resizable": true,
20+
"fullscreen": false,
21+
"decorations": false,
22+
"zoomHotkeysEnabled": true
23+
}
24+
],
25+
"security": {
26+
"csp": null
27+
},
28+
"trayIcon": {
29+
"iconPath": "icons/icon.ico",
30+
"iconAsTemplate": false,
31+
"menuOnLeftClick": false
32+
}
33+
},
34+
"bundle": {
35+
"active": true,
36+
"createUpdaterArtifacts": true,
37+
"targets": "all",
38+
"icon": [
39+
"icons/32x32.png",
40+
"icons/128x128.png",
41+
"icons/128x128@2x.png",
42+
"icons/icon.icns",
43+
"icons/icon.ico"
44+
],
45+
"windows": {
46+
"nsis": {
47+
48+
},
49+
"wix": {
50+
51+
}
52+
}
53+
},
54+
"plugins": {
55+
"shell": {
56+
57+
},
58+
"fs": {
59+
60+
},
61+
"updater": {
62+
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDIwMEI4NDcyNzY2OTMwQ0MKUldUTU1HbDJjb1FMSUNpSmsrZzdGL3hjSDVpaGgwSTFWS3VnclB4ZGR5YTdrYW1CTElWekpPSzQK",
63+
"endpoints": [
64+
"https://github.com/holdon1996/dev-stack/releases/latest/download/latest.json"
65+
],
66+
"windows": {
67+
"installMode": "passive"
68+
}
69+
}
70+
}
6371
}

0 commit comments

Comments
 (0)