5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-09 05:00:43 +08:00

Adding name and author, also found out while trying to find options for value escaping the string conversion isnt needed :)

Signed-off-by: Snider <snider@lt.hn>
This commit is contained in:
Snider 2021-11-24 18:50:26 +00:00
parent deb1156916
commit dcef8679d2
2 changed files with 6 additions and 5 deletions

View File

@ -1,4 +1,6 @@
{ {
"name": "{{.ProjectName}}",
"author": "",
"private": true, "private": true,
"scripts": { "scripts": {
"install": "go install github.com/wailsapp/wails/v2/cmd/wails@latest", "install": "go install github.com/wailsapp/wails/v2/cmd/wails@latest",

View File

@ -158,18 +158,17 @@ func processPackageJSON(frontendDir string) error {
return nil return nil
} }
data, err := os.ReadFile(packageJSON) json, err := os.ReadFile(packageJSON)
if err != nil { if err != nil {
return err return err
} }
json := string(data)
// We will ignore these errors - it's not critical // We will ignore these errors - it's not critical
println("Updating package.json data...") println("Updating package.json data...")
json, _ = sjson.Set(json, "name", "{{.ProjectName}}") json, _ = sjson.SetBytes(json, "name", "{{.ProjectName}}")
json, _ = sjson.Set(json, "author", "{{.AuthorName}}") json, _ = sjson.SetBytes(json, "author", "{{.AuthorName}}")
err = os.WriteFile(packageJSON, []byte(json), 0644) err = os.WriteFile(packageJSON, json, 0644)
if err != nil { if err != nil {
return err return err
} }