diff --git a/examples/sample-program/README.md b/examples/sample-program/README.md index 6a3e6f8..93cafbc 100644 --- a/examples/sample-program/README.md +++ b/examples/sample-program/README.md @@ -55,7 +55,7 @@ Usage of ./test_program: You'll need to have the make utility and npm installed for the demo. -The Makefile for the sample project is pretty full featured, since I use it to test this module. Some feature you might find useful to test your own project: +The Makefile for the sample project is pretty full featured, since I use it to test this module. Some features you might find useful to test your own project: | Make Invocation | What It Does | |:--- |:--- | diff --git a/utils.go b/utils.go index 2880493..b26cd86 100644 --- a/utils.go +++ b/utils.go @@ -55,11 +55,7 @@ func (vc *ViteConfig) parsePackageJSON() (*PackageJSON, error) { } func analyzePackageJSON(pkgJSON *PackageJSON) *JSAppParams { - semVer, err := regexp.Compile(`^\^((\d+)\.\d+\.\d+)$`) - if err != nil { - // remove once we verify the regexp - panic(err) - } + semVer := regexp.MustCompile(`^[\^]*((\d+)\.\d+\.\d+)$`) // parse for a ver; return the full version, // and the major version. Empty strings if @@ -69,8 +65,8 @@ func analyzePackageJSON(pkgJSON *PackageJSON) *JSAppParams { var major string var fullVers string if matches != nil { - major = matches[1] - fullVers = matches[2] + major = matches[2] + fullVers = matches[1] } return major, fullVers }