MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / Files

Method Files

tools/mage/version.go:45–73  ·  view source on GitHub ↗

Files writes given version to files that contain version info

()

Source from the content-addressed store, hash-verified

43
44// Files writes given version to files that contain version info
45func (Version) Files() error {
46 if mg.Verbose() {
47 fmt.Println("Enter new version")
48 }
49 reader := bufio.NewReader(os.Stdin)
50 version, err := reader.ReadString('\n')
51 if err != nil {
52 return err
53 }
54 version = strings.TrimPrefix(strings.TrimSpace(version), "v")
55 _, err = semver.Parse(version)
56 if err != nil {
57 return err
58 }
59 err = os.WriteFile(goVersionFilePath, []byte(fmt.Sprintf(goVersionFile, version)), 0o644)
60 if err != nil {
61 return err
62 }
63 for _, packageJSONFile := range packageJSONFilePaths {
64 if err = runYarn("run", "json",
65 "-f", packageJSONFile,
66 "-I",
67 "-e", fmt.Sprintf(`this.version="%s"`, version),
68 ); err != nil {
69 return err
70 }
71 }
72 return nil
73}

Callers

nothing calls this directly

Calls 4

runYarnFunction · 0.85
TrimPrefixMethod · 0.80
WriteFileMethod · 0.80
ParseMethod · 0.65

Tested by

no test coverage detected