UNPKG

@webda/shell

Version:

Deploy a Webda app or configure it

164 lines (163 loc) 4.19 kB
import { Configuration, Deployment, GitInformation, UnpackedApplication } from "@webda/core"; import { Compiler } from "./compiler.js"; export declare class SourceApplication extends UnpackedApplication { /** * Flag if application has been compiled already */ protected compiled: boolean; protected compiler: Compiler; getCompiler(): Compiler; /** * Get the Webda namespace */ getNamespace(): string; /** * Retrieve Git Repository information * * {@link GitInformation} for more details on how the information is gathered * @return the git information */ getGitInformation(packageName?: string, version?: string): GitInformation; /** * Set the status of the compilation * * @param compile true will avoid trigger new compilation */ preventCompilation(compile: boolean): void; /** * Generate the module for current application */ generateModule(): Promise<boolean>; /** * Get the application files */ getPackagesLocations(): string[]; /** * Compile the application if it is a Typescript application * Do nothing otherwise */ compile(): boolean; /** * Return the application Configuration for a deployment * * Given this inputs: * * webda.config.json * ```json * { * "parameters": { * "param3": "test" * }, * "services": { * "MyService": { * "param1": { * "sub": "test" * }, * "param2": "value" * } * } * } * ``` * * deployment.json * ```json * { * "parameters": { * "param4": "deployment" * } * "services": { * "MyService": { * "param1": { * "sub2": "deploymentSub" * }, * "param2": "${package.version}" * } * } * } * ``` * * The result would be: * ```json * { * "parameters": { * "param3": "test", * "param4": "deployment" * }, * "services": { * "MyService": { * "param1": { * "sub": "test", * "sub2": "deploymentSub" * }, * "param2": "1.1.0" * } * } * } * ``` * This map can also use parameters {@link replaceVariables} * * @param deploymentName to use for the Configuration */ getConfiguration(deploymentName?: string): Configuration; /** * Return current Configuration of the Application * * Same as calling * * ```js * getConfiguration(this.currentDeployment); * ``` */ getCurrentConfiguration(): Configuration; /** * Get current deployment name */ getCurrentDeployment(): string; /** * Set the current deployment for the application * Call to getCurrentConfiguration will resolve to the computed configuration for the deployment * If needed, you can call the method with undefined to reset to default configuration * * @param deployment to set */ setCurrentDeployment(deployment: string): void; /** * Load a deployment configuration * * @param deploymentName * @returns */ getDeployment(deploymentName?: string): Deployment; /** * Check if a deployment exists for this application * This method cannot be called for a packaged application * as we do not keep deployments files when deployed * * @param deploymentName */ hasDeployment(deploymentName: string): boolean; } /** * Used to generate module * We do not want to load any module, we only compile the sources and then analyze * to generate the webda.module.json */ export declare class BuildSourceApplication extends SourceApplication { /** * Module has been generated */ moduleReady: boolean; /** * @returns */ filterModule(file: any): boolean; /** * Override to empty if moduleReady is false * @returns */ getModulesCache(): any; /** * @override */ generateModule(): Promise<boolean>; }