mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 10:02:55 +08:00

* fix(website): fix i18n configuration * feat: add i18n file to auto generate code * feat: move the crowdin configuration file to the website directory * feat(website): add crowdin dependencies and scripts * feat: add COC * feat: use escape hatch syntax to wrap JSX code in MDX files * feat: remove ach language * feat: generate default language configuration * feat: remove compare link * feat: add COC link * feat(website): update documentation * feat: use escape hatch syntax to wrap JSX code in MDX files * style: add prettier * style: format mdx files * chore: remove prettier command * feat: update en docs * feat: sync Chinese documents * feat: update doc * Update website/src/pages/coc.mdx Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
89 lines
2.2 KiB
Go
89 lines
2.2 KiB
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
"os/exec"
|
|
"strconv"
|
|
"strings"
|
|
|
|
"github.com/wailsapp/wails/v2/internal/s"
|
|
)
|
|
|
|
const versionFile = "../../cmd/wails/internal/version.txt"
|
|
|
|
func checkError(err error) {
|
|
if err != nil {
|
|
println(err.Error())
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
|
|
// TODO:This can be replaced with "https://github.com/coreos/go-semver/blob/main/semver/semver.go"
|
|
func updateVersion() string {
|
|
currentVersionData, err := os.ReadFile(versionFile)
|
|
checkError(err)
|
|
currentVersion := string(currentVersionData)
|
|
vsplit := strings.Split(currentVersion, ".")
|
|
minorVersion, err := strconv.Atoi(vsplit[len(vsplit)-1])
|
|
checkError(err)
|
|
minorVersion++
|
|
vsplit[len(vsplit)-1] = strconv.Itoa(minorVersion)
|
|
newVersion := strings.Join(vsplit, ".")
|
|
err = os.WriteFile(versionFile, []byte(newVersion), 0755)
|
|
checkError(err)
|
|
return newVersion
|
|
}
|
|
|
|
func runCommand(name string, arg ...string) {
|
|
cmd := exec.Command(name, arg...)
|
|
cmd.Stdout = os.Stdout
|
|
cmd.Stderr = os.Stderr
|
|
err := cmd.Run()
|
|
checkError(err)
|
|
}
|
|
|
|
func main() {
|
|
var newVersion string
|
|
if len(os.Args) > 1 {
|
|
newVersion = os.Args[1]
|
|
} else {
|
|
newVersion = updateVersion()
|
|
}
|
|
|
|
s.CD("../../../website")
|
|
s.ECHO("Generating new Docs for version: " + newVersion)
|
|
|
|
runCommand("npm", "run", "docusaurus", "docs:version", newVersion)
|
|
|
|
// For the default language identifier, please refer to: https://github.com/facebook/docusaurus/tree/main/packages/docusaurus-theme-translations/locales
|
|
languages := []string{"en", "ja", "ko", "ru", "zh-Hans"}
|
|
|
|
for _, lang := range languages {
|
|
runCommand("npm", "run", "write-translations", "--", "--locale", lang)
|
|
}
|
|
|
|
// Load the version list/*
|
|
versionsData, err := os.ReadFile("versions.json")
|
|
checkError(err)
|
|
var versions []string
|
|
err = json.Unmarshal(versionsData, &versions)
|
|
checkError(err)
|
|
oldestVersion := versions[len(versions)-1]
|
|
s.ECHO(oldestVersion)
|
|
versions = versions[0 : len(versions)-1]
|
|
newVersions, err := json.Marshal(&versions)
|
|
checkError(err)
|
|
err = os.WriteFile("versions.json", newVersions, 0755)
|
|
checkError(err)
|
|
|
|
s.ECHO("Removing old version: " + oldestVersion)
|
|
s.CD("versioned_docs")
|
|
s.RMDIR("version-" + oldestVersion)
|
|
s.CD("../versioned_sidebars")
|
|
s.RM("version-" + oldestVersion + "-sidebars.json")
|
|
s.CD("..")
|
|
|
|
runCommand("npm", "run", "build")
|
|
}
|