UNPKG

@platform/react.ssr

Version:

A lightweight SSR (server-side-rendering) system for react apps bundled with ParcelJS and hosted on S3.

86 lines (85 loc) 3.12 kB
"use strict"; var _this = this; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var bundle = require("./cmd.bundle"); var pull = require("./cmd.pull"); var push = require("./cmd.push"); var release = require("./cmd.release"); var status = require("./cmd.status"); var common_1 = require("./common"); var app = common_1.cli.create('ssr'); app .command(['status', 's'], 'Current status of the cloud manifest.', function (yargs) { return yargs; }, function (argv) { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { return [2, status.run()]; }); }); }) .command(['bundle', 'b'], 'Prepare, bundle and push javascript.', function (yargs) { return yargs .option('v', { describe: 'The bundle version to push.', type: 'string', }) .option('push', { alias: 'p', describe: 'Push the bundle to S3.', type: 'boolean', }); }, function (argv) { return tslib_1.__awaiter(_this, void 0, void 0, function () { var version, push; return tslib_1.__generator(this, function (_a) { version = argv.v, push = argv.push; return [2, bundle.run({ version: version, push: push })]; }); }); }) .command(['push', 'p'], 'Push bundle or manifest to S3.', function (yargs) { return yargs .option('manifest', { alias: 'm', describe: 'Push the local manifest to S3.', type: 'boolean', }) .option('bundle', { alias: 'b', describe: 'Push a bundle to S3.', type: 'boolean', }); }, function (argv) { return tslib_1.__awaiter(_this, void 0, void 0, function () { var bundle, manifest; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: bundle = argv.bundle, manifest = argv.manifest; if (!bundle) return [3, 2]; return [4, push.run({ type: 'BUNDLE' })]; case 1: _a.sent(); _a.label = 2; case 2: if (!manifest) return [3, 4]; return [4, push.run({ type: 'MANIFEST' })]; case 3: _a.sent(); _a.label = 4; case 4: if (!(!bundle && !manifest)) return [3, 6]; return [4, push.run()]; case 5: _a.sent(); _a.label = 6; case 6: return [2]; } }); }); }) .command(['release', 'r'], 'Change release version of a site.', function (yargs) { return yargs; }, function (argv) { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { return [2, release.run()]; }); }); }) .command(['pull'], 'Pull the latet version of the manifest locally.', function (yargs) { return yargs; }, function (argv) { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { return [2, pull.run()]; }); }); }); app.run();