Last change
on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
950 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
---|
| 4 | value: true
|
---|
| 5 | });
|
---|
| 6 | exports.prettifyVersion = prettifyVersion;
|
---|
| 7 | exports.prettifyTargets = prettifyTargets;
|
---|
| 8 |
|
---|
| 9 | var _semver = require("semver");
|
---|
| 10 |
|
---|
| 11 | var _targets = require("./targets");
|
---|
| 12 |
|
---|
| 13 | function prettifyVersion(version) {
|
---|
| 14 | if (typeof version !== "string") {
|
---|
| 15 | return version;
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | const parts = [_semver.major(version)];
|
---|
| 19 |
|
---|
| 20 | const minor = _semver.minor(version);
|
---|
| 21 |
|
---|
| 22 | const patch = _semver.patch(version);
|
---|
| 23 |
|
---|
| 24 | if (minor || patch) {
|
---|
| 25 | parts.push(minor);
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | if (patch) {
|
---|
| 29 | parts.push(patch);
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | return parts.join(".");
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | function prettifyTargets(targets) {
|
---|
| 36 | return Object.keys(targets).reduce((results, target) => {
|
---|
| 37 | let value = targets[target];
|
---|
| 38 | const unreleasedLabel = _targets.unreleasedLabels[target];
|
---|
| 39 |
|
---|
| 40 | if (typeof value === "string" && unreleasedLabel !== value) {
|
---|
| 41 | value = prettifyVersion(value);
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | results[target] = value;
|
---|
| 45 | return results;
|
---|
| 46 | }, {});
|
---|
| 47 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.