Add 0.x.x edgecase

This commit is contained in:
Fabio Berger 2018-03-29 15:18:42 +02:00
parent 397cd77ef9
commit bd7b5c51b2
3 changed files with 14 additions and 2 deletions

View File

@ -28,7 +28,10 @@ const MONOREPO_ROOT_PATH = path.join(__dirname, '../../..');
}; };
for (const line of lines) { for (const line of lines) {
if (_.startsWith(line, '## ')) { if (_.startsWith(line, '## ')) {
const version = line.substr(4).split(' - ')[0]; let version = line.substr(4).split(' - ')[0];
if (version === '0.x.x') {
version = utils.getNextPatchVersion(lernaPackage.package.version);
}
const dateStr = line.split('_')[1]; const dateStr = line.split('_')[1];
let date; let date;
if (!_.includes(dateStr, 'TBD')) { if (!_.includes(dateStr, 'TBD')) {

View File

@ -1,5 +1,14 @@
import * as _ from 'lodash';
export const utils = { export const utils = {
log(...args: any[]): void { log(...args: any[]): void {
console.log(...args); // tslint:disable-line:no-console console.log(...args); // tslint:disable-line:no-console
}, },
getNextPatchVersion(currentVersion: string): string {
const versionSegments = currentVersion.split('.');
const patch = _.parseInt(_.last(versionSegments) as string);
const newPatch = patch + 1;
const newPatchVersion = `${versionSegments[0]}.${versionSegments[1]}.${newPatch}`;
return newPatchVersion;
},
}; };

View File

@ -1,6 +1,6 @@
[ [
{ {
"version": "0.x.x", "version": "0.0.2",
"changes": [] "changes": []
} }
] ]