mirror of
https://github.com/taigrr/wails.git
synced 2026-04-02 05:08:54 -07:00
Merge pull request #974 from letheanVPN/npm-json-update
Adding name and author, + json handling improvement
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
{
|
||||
"name": "{{.ProjectName}}",
|
||||
"author": "",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"install": "go install github.com/wailsapp/wails/v2/cmd/wails@latest",
|
||||
|
||||
@@ -158,18 +158,17 @@ func processPackageJSON(frontendDir string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
data, err := os.ReadFile(packageJSON)
|
||||
json, err := os.ReadFile(packageJSON)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
json := string(data)
|
||||
|
||||
// We will ignore these errors - it's not critical
|
||||
println("Updating package.json data...")
|
||||
json, _ = sjson.Set(json, "name", "{{.ProjectName}}")
|
||||
json, _ = sjson.Set(json, "author", "{{.AuthorName}}")
|
||||
json, _ = sjson.SetBytes(json, "name", "{{.ProjectName}}")
|
||||
json, _ = sjson.SetBytes(json, "author", "{{.AuthorName}}")
|
||||
|
||||
err = os.WriteFile(packageJSON, []byte(json), 0644)
|
||||
err = os.WriteFile(packageJSON, json, 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user