UNPKG

@platform/react.ssr

Version:

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

58 lines (57 loc) 1.71 kB
import * as bundle from './cmd.bundle'; import * as pull from './cmd.pull'; import * as push from './cmd.push'; import * as release from './cmd.release'; import * as status from './cmd.status'; import { cli } from './common'; const app = cli.create('ssr'); app .command(['status', 's'], 'Current status of the cloud manifest.', yargs => { return yargs; }, async (argv) => status.run()) .command(['bundle', 'b'], 'Prepare, bundle and push javascript.', 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', }); }, async (argv) => { const { v: version, push } = argv; return bundle.run({ version, push }); }) .command(['push', 'p'], 'Push bundle or manifest to S3.', 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', }); }, async (argv) => { const { bundle, manifest } = argv; if (bundle) { await push.run({ type: 'BUNDLE' }); } if (manifest) { await push.run({ type: 'MANIFEST' }); } if (!bundle && !manifest) { await push.run(); } }) .command(['release', 'r'], 'Change release version of a site.', yargs => { return yargs; }, async (argv) => release.run()) .command(['pull'], 'Pull the latet version of the manifest locally.', yargs => { return yargs; }, async (argv) => pull.run()); app.run();