piral-cli
Version:
The standard CLI for creating and building a Piral instance or a Pilet.
88 lines (87 loc) • 2.55 kB
TypeScript
import { LogLevels, PiletBuildType, PiletSchemaVersion } from '../types';
export interface BuildPiletOptions {
/**
* Sets the name of the Piral instance.
*/
app?: string;
/**
* The source index file (e.g. index.tsx) for collecting all the information
* @example './src/index'
*/
entry?: string | Array<string>;
/**
* The target file of bundling.
* @example './dist/index.js'
*/
target?: string;
/**
* Sets the public URL (path) of the bundle. Only for release output.
*/
publicUrl?: string;
/**
* States if minifaction or other post-bundle transformations should be performed.
*/
minify?: boolean;
/**
* Indicates if a declaration file should be generated.
*/
declaration?: boolean;
/**
* Sets the maximum number of parallel build processes.
*/
concurrency?: number;
/**
* Sets the log level to use (1-5).
*/
logLevel?: LogLevels;
/**
* States if the target directory should be removed before building.
*/
fresh?: boolean;
/**
* States if source maps should be created for the bundles.
*/
sourceMaps?: boolean;
/**
* States if the build should run continuously and re-build when files change.
*/
watch?: boolean;
/**
* Sets the bundler to use for building, if any specific.
*/
bundlerName?: string;
/**
* States if a content hash should be appended to the side-bundle files
*/
contentHash?: boolean;
/**
* Selects the target type of the build (e.g. 'release'). "all" builds all target types.
*/
type?: PiletBuildType;
/**
* States if the node modules should be included for target transpilation
*/
optimizeModules?: boolean;
/**
* The schema to be used when bundling the pilets.
* @example 'v1'
*/
schemaVersion?: PiletSchemaVersion;
/**
* Additional arguments for a specific bundler.
*/
_?: Record<string, any>;
/**
* Hooks to be triggered at various stages.
*/
hooks?: {
onBegin?(e: any): Promise<void>;
beforeBuild?(e: any): Promise<void>;
afterBuild?(e: any): Promise<void>;
beforeDeclaration?(e: any): Promise<void>;
afterDeclaration?(e: any): Promise<void>;
onEnd?(e: any): Promise<void>;
};
}
export declare const buildPiletDefaults: BuildPiletOptions;
export declare function buildPilet(baseDir?: string, options?: BuildPiletOptions): Promise<void>;