Skip to content

Commit

Permalink
chore: run ncc
Browse files Browse the repository at this point in the history
  • Loading branch information
peaceiris committed Dec 30, 2019
1 parent 07a85d8 commit 67247b8
Showing 1 changed file with 28 additions and 22 deletions.
50 changes: 28 additions & 22 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2840,6 +2840,15 @@ function coerce (version, options) {

"use strict";

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
Expand Down Expand Up @@ -2878,19 +2887,21 @@ function getLatest(api, data) {
return latestVersion;
}
function getLatestVersion(org, repo, api) {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
const url = getURL(org, repo, api);
xhr.open('GET', url);
xhr.send();
xhr.onload = () => {
const result = JSON.parse(xhr.responseText);
const latestVersion = getLatest(api, result);
resolve(latestVersion);
};
xhr.onerror = () => {
reject(`ERROR: got status ${xhr.status} of ${url}`);
};
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
const url = getURL(org, repo, api);
xhr.open('GET', url);
xhr.send();
xhr.onload = () => {
const result = JSON.parse(xhr.responseText);
const latestVersion = getLatest(api, result);
resolve(latestVersion);
};
xhr.onerror = () => {
reject(`ERROR: got status ${xhr.status} of ${url}`);
};
});
});
}
exports.default = getLatestVersion;
Expand Down Expand Up @@ -3562,15 +3573,10 @@ function run() {
try {
const mdbookVersion = core.getInput('mdbook-version');
if (mdbookVersion === '' || mdbookVersion === 'latest') {
get_latest_version_1.default('rust-lang', 'mdbook', 'brew').then(function (latestVersion) {
return __awaiter(this, void 0, void 0, function* () {
console.log(`mdbook version: ${latestVersion} (${mdbookVersion})`);
yield installer_1.default(latestVersion);
yield showVersion();
});
}, function (error) {
core.setFailed(error);
});
const latestVersion = yield get_latest_version_1.default('rust-lang', 'mdbook', 'brew');
console.log(`mdbook version: ${latestVersion} (${mdbookVersion})`);
yield installer_1.default(latestVersion);
yield showVersion();
}
else {
console.log(`mdbook version: ${mdbookVersion}`);
Expand Down

0 comments on commit 67247b8

Please sign in to comment.