Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
b295f3d7e3 | |||
c8438069d3 | |||
af212b068d | |||
ed87cdb101 |
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@pushrocks/smartversion",
|
||||
"version": "3.0.0",
|
||||
"version": "3.0.2",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@pushrocks/smartversion",
|
||||
"version": "3.0.0",
|
||||
"version": "3.0.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/semver": "^7.3.9",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartversion",
|
||||
"version": "3.0.0",
|
||||
"version": "3.0.2",
|
||||
"private": false,
|
||||
"description": "handle semver with ease",
|
||||
"main": "dist_ts/index.js",
|
||||
|
11
ts/00_commitinfo_data.ts
Normal file
11
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
*/
|
||||
export const name: string = '@pushrocks/smartversion';
|
||||
export const version: string = '3.0.2';
|
||||
export const description: string = 'handle semver with ease'
|
||||
export const commitinfo = {
|
||||
name: '@pushrocks/smartversion',
|
||||
version: '3.0.2',
|
||||
description: 'handle semver with ease'
|
||||
}
|
17
ts/index.ts
17
ts/index.ts
@ -76,12 +76,25 @@ export class SmartVersion {
|
||||
}
|
||||
|
||||
public getNewMinorVersion() {
|
||||
const newInstance = new SmartVersion(`${this.semver.major}.${this.semver.minor + 1}.${this.semver.patch}`);
|
||||
const newInstance = new SmartVersion(`${this.semver.major}.${this.semver.minor + 1}.${0}`);
|
||||
return newInstance;
|
||||
}
|
||||
|
||||
public getNewMajorVersion() {
|
||||
const newInstance = new SmartVersion(`${this.semver.major + 1}.${this.semver.minor}.${this.semver.patch}`);
|
||||
const newInstance = new SmartVersion(`${this.semver.major + 1}.${0}.${0}`);
|
||||
return newInstance;
|
||||
}
|
||||
|
||||
public getNewVersion(typeArg: 'patch' | 'minor' | 'major') {
|
||||
switch (typeArg) {
|
||||
case 'patch':
|
||||
return this.getNewPatchVersion();
|
||||
case 'minor':
|
||||
return this.getNewMinorVersion();
|
||||
case 'major':
|
||||
return this.getNewMajorVersion();
|
||||
default:
|
||||
throw new Error('unknown new version type.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user