@adpt/cloud
Version:
AdaptJS cloud component library
76 lines • 2.17 kB
TypeScript
import Adapt, { SFCDeclProps } from "@adpt/core";
import { HttpServerProps } from "../http";
import { NodeImageBuildOptions } from "./LocalNodeImage";
/**
* Props for {@link nodejs.ReactApp}.
* @public
*/
export interface ReactAppProps {
/**
* The source code directory to build.
* @remarks
* This directory should contain the `package.json` file for the React
* app.
*/
srcDir: string;
/**
* Options to be passed to the `LocalNodeImage` prop called `options`.
*/
buildOptions: NodeImageBuildOptions;
/**
* Options to be passed to the `HttpServer` component.
*/
httpOptions: Partial<HttpServerProps>;
}
declare const defaultOptions: {
buildOptions: {};
httpOptions: {};
};
/**
* A partially abstract component that builds
* {@link https://reactjs.org | ReactJS} source code and serves the resulting
* files via an {@link http.HttpServer}.
*
* @remarks
* To use this component, the `srcDir` prop must be the path to the root of
* a ReactJS project, which contains a package.json file. The component will
* build a Docker container image by:
*
* - starting with an official Node.js base image
*
* - copying `srcDir` into the container image
*
* - executing `yarn run build`
*
* It will then copy the resulting `build` directory into an {@link http.HttpServer}
* component.
*
* Abstract components:
*
* This component uses the following abstract components (via
* {@link http.HttpServer})which must be replaced via style sheet rules:
*
* - {@link Service}
*
* - {@link NetworkService}
*
* - {@link Container}
*
* The {@link NetworkService} and {@link Container} components are both
* children of the {@link Service} component.
*
* Instance methods:
*
* - hostname(): string | undefined
*
* Returns the hostname of the NetworkService, once it is known.
*
* - port(): number | undefined
*
* Returns the port number of the NetworkService, once it is known.
*
* @public
*/
export declare function ReactApp(props: SFCDeclProps<ReactAppProps, typeof defaultOptions>): Adapt.AdaptElement<Adapt.AnyProps>;
export {};
//# sourceMappingURL=ReactApp.d.ts.map