5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-03 04:42:00 +08:00
wails/cmd/semver.go
Lea Anthony 7b603a2776
v1.11.0 (#582)
* v1.10.1

* Fix vue template dependencies versions (fixes #574) (#576)

* resolve angular routing broken when app is built

* Revert "resolve angular routing broken when app is built"

This reverts commit e0aab7c27f.

* Update issue templates

* v1.8.1 (#546)

* resolve angular routing broken when app is built

* Updated contributors

* handle Set error on Update method

* Remove incorrect build flag

* v1.8.1-pre1

* added Get method

* fixed return

* implement gopath handling during cross compilation

* update messages to output xgo version

TODO: allow image override

* use wailsapp/xgo:1.0.1 for cross-compiling

* Support platform list in templates

* Add warnings for windows builds

* add fields Tags to ProjectOptions

* add args tags to func BuildNative

* add tags to func BuildDocker

* delete escape tags

* Update Contributors

* feat: Vue3, Vue Router, Vuex, and Typescript Template

* converted spaces to tabs in vue.config.js

* single quotes and tabs

Converted vue.config.js to using single quotes
Converted example.spec.ts to tabs instead of spaces.

* Added semicolons and mocha import

* Update contributors

* Make vue 3 template linux/mac only

* Add tags to build

* Add v2 artefacts

* Update Vuetify in package.json (#537)

* Update contributors

* Replaced the old v-content tag with the new v-main (#536)

* v1.8.1-pre4

* v1.8.1-pre5

* Update issue templates (#541)

* Updated Contributors

* Remove zero copy string conversion

* v1.8.1-pre6

* Initial support for firebug (#543)

* Initial support for firebug

* Remove windows message

* v1.8.1-pre7

* Update contributors

* Allow use of custom HTML

* Allow use of custom HTML (#545)

* v1.8.1

Co-authored-by: Arthur Wiebe <arthur@artooro.com>
Co-authored-by: Ilgıt Yıldırım <ilgit.yildirim@triplebits.com>
Co-authored-by: Travis McLane <tmclane@gmail.com>
Co-authored-by: Altynbek <go.gelleson@gmail.com>
Co-authored-by: Kyle Muchmore <kyle.muchmore@kickview.com>
Co-authored-by: Balakrishna Prasad Ganne <balkripra.1996@gmail.com>

* v1.10.1 (#572)

* fix dependencies versions

Co-authored-by: Arthur Wiebe <arthur@artooro.com>
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
Co-authored-by: Ilgıt Yıldırım <ilgit.yildirim@triplebits.com>
Co-authored-by: Travis McLane <tmclane@gmail.com>
Co-authored-by: Altynbek <go.gelleson@gmail.com>
Co-authored-by: Kyle Muchmore <kyle.muchmore@kickview.com>
Co-authored-by: Balakrishna Prasad Ganne <balkripra.1996@gmail.com>

* v1.11.0-rc1

* v1.11.0-pre1

* Bump ini from 1.3.5 to 1.3.8 in /runtime/js/runtime (#575)

* resolve angular routing broken when app is built

* Revert "resolve angular routing broken when app is built"

This reverts commit e0aab7c27f.

* Update issue templates

* v1.8.1 (#546)

* resolve angular routing broken when app is built

* Updated contributors

* handle Set error on Update method

* Remove incorrect build flag

* v1.8.1-pre1

* added Get method

* fixed return

* implement gopath handling during cross compilation

* update messages to output xgo version

TODO: allow image override

* use wailsapp/xgo:1.0.1 for cross-compiling

* Support platform list in templates

* Add warnings for windows builds

* add fields Tags to ProjectOptions

* add args tags to func BuildNative

* add tags to func BuildDocker

* delete escape tags

* Update Contributors

* feat: Vue3, Vue Router, Vuex, and Typescript Template

* converted spaces to tabs in vue.config.js

* single quotes and tabs

Converted vue.config.js to using single quotes
Converted example.spec.ts to tabs instead of spaces.

* Added semicolons and mocha import

* Update contributors

* Make vue 3 template linux/mac only

* Add tags to build

* Add v2 artefacts

* Update Vuetify in package.json (#537)

* Update contributors

* Replaced the old v-content tag with the new v-main (#536)

* v1.8.1-pre4

* v1.8.1-pre5

* Update issue templates (#541)

* Updated Contributors

* Remove zero copy string conversion

* v1.8.1-pre6

* Initial support for firebug (#543)

* Initial support for firebug

* Remove windows message

* v1.8.1-pre7

* Update contributors

* Allow use of custom HTML

* Allow use of custom HTML (#545)

* v1.8.1

Co-authored-by: Arthur Wiebe <arthur@artooro.com>
Co-authored-by: Ilgıt Yıldırım <ilgit.yildirim@triplebits.com>
Co-authored-by: Travis McLane <tmclane@gmail.com>
Co-authored-by: Altynbek <go.gelleson@gmail.com>
Co-authored-by: Kyle Muchmore <kyle.muchmore@kickview.com>
Co-authored-by: Balakrishna Prasad Ganne <balkripra.1996@gmail.com>

* v1.10.1 (#572)

* Bump ini from 1.3.5 to 1.3.8 in /runtime/js/runtime

Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.8.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.8)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: Arthur Wiebe <arthur@artooro.com>
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
Co-authored-by: Ilgıt Yıldırım <ilgit.yildirim@triplebits.com>
Co-authored-by: Travis McLane <tmclane@gmail.com>
Co-authored-by: Altynbek <go.gelleson@gmail.com>
Co-authored-by: Kyle Muchmore <kyle.muchmore@kickview.com>
Co-authored-by: Balakrishna Prasad Ganne <balkripra.1996@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ini from 1.3.5 to 1.3.8 in /runtime/js (#573)

* resolve angular routing broken when app is built

* Revert "resolve angular routing broken when app is built"

This reverts commit e0aab7c27f.

* Update issue templates

* v1.8.1 (#546)

* resolve angular routing broken when app is built

* Updated contributors

* handle Set error on Update method

* Remove incorrect build flag

* v1.8.1-pre1

* added Get method

* fixed return

* implement gopath handling during cross compilation

* update messages to output xgo version

TODO: allow image override

* use wailsapp/xgo:1.0.1 for cross-compiling

* Support platform list in templates

* Add warnings for windows builds

* add fields Tags to ProjectOptions

* add args tags to func BuildNative

* add tags to func BuildDocker

* delete escape tags

* Update Contributors

* feat: Vue3, Vue Router, Vuex, and Typescript Template

* converted spaces to tabs in vue.config.js

* single quotes and tabs

Converted vue.config.js to using single quotes
Converted example.spec.ts to tabs instead of spaces.

* Added semicolons and mocha import

* Update contributors

* Make vue 3 template linux/mac only

* Add tags to build

* Add v2 artefacts

* Update Vuetify in package.json (#537)

* Update contributors

* Replaced the old v-content tag with the new v-main (#536)

* v1.8.1-pre4

* v1.8.1-pre5

* Update issue templates (#541)

* Updated Contributors

* Remove zero copy string conversion

* v1.8.1-pre6

* Initial support for firebug (#543)

* Initial support for firebug

* Remove windows message

* v1.8.1-pre7

* Update contributors

* Allow use of custom HTML

* Allow use of custom HTML (#545)

* v1.8.1

Co-authored-by: Arthur Wiebe <arthur@artooro.com>
Co-authored-by: Ilgıt Yıldırım <ilgit.yildirim@triplebits.com>
Co-authored-by: Travis McLane <tmclane@gmail.com>
Co-authored-by: Altynbek <go.gelleson@gmail.com>
Co-authored-by: Kyle Muchmore <kyle.muchmore@kickview.com>
Co-authored-by: Balakrishna Prasad Ganne <balkripra.1996@gmail.com>

* v1.10.1 (#572)

* Bump ini from 1.3.5 to 1.3.8 in /runtime/js

Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.8.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.8)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: Arthur Wiebe <arthur@artooro.com>
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
Co-authored-by: Ilgıt Yıldırım <ilgit.yildirim@triplebits.com>
Co-authored-by: Travis McLane <tmclane@gmail.com>
Co-authored-by: Altynbek <go.gelleson@gmail.com>
Co-authored-by: Kyle Muchmore <kyle.muchmore@kickview.com>
Co-authored-by: Balakrishna Prasad Ganne <balkripra.1996@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Remove debug info

* v1.11.0-pre2

* Limit v1 updates to v1

* v1.11.0-pre3

* Test fix for linux high CPU usage

* v1.11.0

Co-authored-by: Elie Grenon (DrunkenPoney) <elie.grenon.1@gmail.com>
Co-authored-by: Arthur Wiebe <arthur@artooro.com>
Co-authored-by: Ilgıt Yıldırım <ilgit.yildirim@triplebits.com>
Co-authored-by: Travis McLane <tmclane@gmail.com>
Co-authored-by: Altynbek <go.gelleson@gmail.com>
Co-authored-by: Kyle Muchmore <kyle.muchmore@kickview.com>
Co-authored-by: Balakrishna Prasad Ganne <balkripra.1996@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-04 13:50:22 +11:00

107 lines
2.9 KiB
Go

package cmd
import (
"fmt"
"github.com/Masterminds/semver"
)
// SemanticVersion is a struct containing a semantic version
type SemanticVersion struct {
Version *semver.Version
}
// NewSemanticVersion creates a new SemanticVersion object with the given version string
func NewSemanticVersion(version string) (*SemanticVersion, error) {
semverVersion, err := semver.NewVersion(version)
if err != nil {
return nil, err
}
return &SemanticVersion{
Version: semverVersion,
}, nil
}
// IsRelease returns true if it's a release version
func (s *SemanticVersion) IsRelease() bool {
// Limit to v1
if s.Version.Major() != 1 {
return false
}
return len(s.Version.Prerelease()) == 0 && len(s.Version.Metadata()) == 0
}
// IsPreRelease returns true if it's a prerelease version
func (s *SemanticVersion) IsPreRelease() bool {
// Limit to v1
if s.Version.Major() != 1 {
return false
}
return len(s.Version.Prerelease()) > 0
}
func (s *SemanticVersion) String() string {
return s.Version.String()
}
// IsGreaterThan returns true if this version is greater than the given version
func (s *SemanticVersion) IsGreaterThan(version *SemanticVersion) (bool, error) {
// Set up new constraint
constraint, err := semver.NewConstraint("> " + version.Version.String())
if err != nil {
return false, err
}
// Check if the desired one is greater than the requested on
success, msgs := constraint.Validate(s.Version)
if !success {
return false, msgs[0]
}
return true, nil
}
// IsGreaterThanOrEqual returns true if this version is greater than or equal the given version
func (s *SemanticVersion) IsGreaterThanOrEqual(version *SemanticVersion) (bool, error) {
// Set up new constraint
constraint, err := semver.NewConstraint(">= " + version.Version.String())
if err != nil {
return false, err
}
// Check if the desired one is greater than the requested on
success, msgs := constraint.Validate(s.Version)
if !success {
return false, msgs[0]
}
return true, nil
}
// MainVersion returns the main version of any version+prerelease+metadata
// EG: MainVersion("1.2.3-pre") => "1.2.3"
func (s *SemanticVersion) MainVersion() *SemanticVersion {
mainVersion := fmt.Sprintf("%d.%d.%d", s.Version.Major(), s.Version.Minor(), s.Version.Patch())
result, _ := NewSemanticVersion(mainVersion)
return result
}
// SemverCollection is a collection of SemanticVersion objects
type SemverCollection []*SemanticVersion
// Len returns the length of a collection. The number of Version instances
// on the slice.
func (c SemverCollection) Len() int {
return len(c)
}
// Less is needed for the sort interface to compare two Version objects on the
// slice. If checks if one is less than the other.
func (c SemverCollection) Less(i, j int) bool {
return c[i].Version.LessThan(c[j].Version)
}
// Swap is needed for the sort interface to replace the Version objects
// at two different positions in the slice.
func (c SemverCollection) Swap(i, j int) {
c[i], c[j] = c[j], c[i]
}