-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
75 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ d: | |
|
||
# 更新版本 | ||
v: | ||
lua ./script/version.lua | ||
deno run -A script/version.ts | ||
|
||
# 更新 GUI 依赖 | ||
up: | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
console.log("Start confirm language"); | ||
|
||
const lang_short = ["zh", "en", "jp",] | ||
const lang_long = ["Chinese", "English", "Japanese",] | ||
|
||
const lang = Deno.env.get("MATRIX_LANG") | ||
const langs = lang!.split("_") | ||
|
||
const first_short = langs[0] | ||
const first_long = lang_long[lang_short.indexOf(first_short)] | ||
const first_long_lower = first_long.toLowerCase() | ||
|
||
const second_short = langs[1] | ||
const second_long = lang_long[lang_short.indexOf(second_short)] | ||
const second_long_lower = second_long.toLowerCase() | ||
|
||
let context = await Deno.readTextFile("src-tauri/Cargo.toml"); | ||
context = context.replace("chinese", first_long_lower); | ||
context = context.replace("english", second_long_lower); | ||
await Deno.writeTextFile("src-tauri/Cargo.toml", context); | ||
|
||
context = await Deno.readTextFile("src-tauri/src/lang.rs"); | ||
context = context.replace("zh", first_short); | ||
context = context.replace("en", second_short); | ||
context = context.replaceAll("Chinese", first_long); | ||
context = context.replaceAll("English", second_long); | ||
await Deno.writeTextFile("src-tauri/src/lang.rs", context); | ||
|
||
console.log("End confirm language"); | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const dirs = ["msi", "nsis", "deb", "appimage", "dmg", "macos",] | ||
|
||
const lang = Deno.env.get("MATRIX_LANG") | ||
|
||
for (const dir of dirs) { | ||
if (Deno.statSync(`./${dir}`).isDirectory) { | ||
for await (const file of Deno.readDir(dir)) { | ||
if (file.isFile && file.name.startsWith("tran")) { | ||
let name = file.name | ||
name = name.replace("tran", "tran" + "_" + lang) | ||
Deno.renameSync(`./${dir}/${file.name}`, `./${dir}/${name}`) | ||
console.log(`./${dir}/${name}`) | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
let context = await Deno.readTextFile("src-tauri/tauri.conf.json"); | ||
const last_version = context.match(/"version": "([\d+.]*\d+)"/)?.[1]; | ||
|
||
console.log("Last version: " + last_version); | ||
const new_version = prompt("New version:") | ||
|
||
// 更新 tauri.conf.json 文件中的版本号 | ||
context = context.replace(/"version": "([\d+.]*\d+)"/, `"version": "${new_version}"`); | ||
await Deno.writeTextFile("src-tauri/tauri.conf.json", context); | ||
|
||
// 更新 Cargo.toml 文件中的版本号 | ||
context = await Deno.readTextFile("src-tauri/Cargo.toml"); | ||
context = context.replace(/version = "([\d+.]*\d+)"/, `version = "${new_version}"`); | ||
await Deno.writeTextFile("src-tauri/Cargo.toml", context); | ||
|
||
// 更新 package.json 文件中的版本号 | ||
context = await Deno.readTextFile("package.json"); | ||
context = context.replace(/"version": "([\d+.]*\d+)"/, `"version": "${new_version}"`); | ||
await Deno.writeTextFile("package.json", context); |