forked from Azure/azure-sdk-for-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate SDK regeneration (Azure#212)
* Add Version class * Bootstrap packages regeneration * Fix missing closing brace * Improve branch handling * Working version * Fix branch creation * Change commit story * Add version skipping
- Loading branch information
Showing
6 changed files
with
274 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for | ||
* license information. | ||
*/ | ||
|
||
export class Version { | ||
major: number; | ||
minor: number; | ||
patch: number; | ||
suffix?: string; | ||
|
||
constructor(version: string) { | ||
const parts = version.split("-"); | ||
this.suffix = parts[1]; | ||
|
||
const numbers = parts[0].split("."); | ||
this.major = Number.parseInt(numbers[0]); | ||
this.minor = Number.parseInt(numbers[1]); | ||
this.patch = Number.parseInt(numbers[2]); | ||
} | ||
|
||
static parse(version: string) { | ||
return new Version(version); | ||
} | ||
|
||
bumpMajor() { | ||
this.major = this.major + 1; | ||
} | ||
|
||
bumpMinor() { | ||
this.minor = this.minor + 1; | ||
} | ||
|
||
bumpPath() { | ||
this.patch = this.patch + 1; | ||
} | ||
|
||
toString(): string { | ||
const suffix = this.suffix ? `-${this.suffix}` : ""; | ||
return `${this.major}.${this.minor}.${this.patch}${suffix}`; | ||
} | ||
} |
Oops, something went wrong.