@platform/react.ssr
Version:
A lightweight SSR (server-side-rendering) system for react apps bundled with ParcelJS and hosted on S3.
74 lines (73 loc) • 3.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var config_1 = require("../config");
var common_1 = require("./common");
function run(args) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var cli, config, _a, manifest;
var _this = this;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
cli = args.cli;
_a = args.config;
if (_a) return [3, 2];
return [4, config_1.Config.create()];
case 1:
_a = (_b.sent());
_b.label = 2;
case 2:
config = _a;
common_1.log.info();
return [4, cli
.task('pull manifest', function (e) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, config.manifest.s3.pull({ force: true, loadBundleManifest: true })];
case 1:
manifest = _a.sent();
return [2];
}
});
}); })
.run({ concurrent: true })];
case 3:
_b.sent();
if (!manifest) {
common_1.log.error('\nManifest could not be found.');
common_1.log.info.gray(config.manifest.s3.url);
return [2, cli.exit(1)];
}
return [4, print({ config: config, manifest: manifest })];
case 4:
_b.sent();
return [2];
}
});
});
}
exports.run = run;
function print(args) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var config, manifest;
return tslib_1.__generator(this, function (_a) {
config = args.config, manifest = args.manifest;
common_1.log.info();
common_1.log.info.gray("url: " + config.manifest.s3.url);
common_1.log.info.gray("local: " + config.manifest.local.path);
common_1.log.info();
manifest.sites.forEach(function (site) {
var name = site.name, version = site.version, size = site.size;
var domain = site.domain.join(', ');
common_1.log.info(name);
common_1.log.info.gray(" - version: " + common_1.log.cyan(version));
common_1.log.info.gray(" - size: " + size);
common_1.log.info.gray(" - domain: " + domain);
common_1.log.info();
});
return [2];
});
});
}
exports.print = print;