Skip to content

Commit 141da2a

Browse files
author
R0n0066
committed
update (version): Read version from package.json
1 parent 0731388 commit 141da2a

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

cmd/cmd-packr.go

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/version.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
package cmd
2222

2323
import (
24+
"encoding/json"
2425
"fmt"
2526

27+
"github.com/gobuffalo/packr"
2628
"github.com/spf13/cobra"
2729
)
2830

@@ -32,8 +34,14 @@ var jiraCmd = &cobra.Command{
3234
Short: "Display current version",
3335
Long: `version Display the current version of cmf`,
3436
Run: func(cmd *cobra.Command, args []string) {
37+
box := packr.NewBox("../")
38+
raw := box.Bytes("package.json")
39+
var p struct {
40+
Version string `json:"version"`
41+
}
42+
json.Unmarshal(raw, &p)
3543
fmt.Println("CMF Version:")
36-
fmt.Println("v1.0.0")
44+
fmt.Println("v" + p.Version)
3745
},
3846
}
3947

0 commit comments

Comments
 (0)