hackmud-script-manager
Version:
Script manager for game hackmud, with minification, TypeScript support, and player script type definition generation.
38 lines (37 loc) • 1.76 kB
TypeScript
import type { LaxPartial } from "@samual/lib";
import type { Info } from ".";
export type PushOptions = LaxPartial<{
/** whether to do the minify step (defaults to `true`) */ minify: boolean;
/** whether to mangle function and class names (defaults to `false`) */ mangleNames: boolean;
/** array of scripts in the format `foo.bar`
*
* also accepts wild card (`*`) e.g. `*.bar` or `foo.*`
*
* pushes everything by default (`*.*`) */
scripts: string[];
/** callback called on script push */ onPush: (info: Info) => void;
/** when set to `true` forces use of quine cheats
*
* when set to `false` forces quine cheats not to be used
*
* when left unset or set to `undefined`, automatically uses or doesn't use quine cheats based on character count
*/
forceQuineCheats: boolean;
rootFolderPath: string;
}>;
export declare class MissingSourceFolderError extends Error {
}
export declare class MissingHackmudFolderError extends Error {
}
export declare class NoUsersError extends Error {
}
export declare class NoScriptsError extends Error {
}
/** Push scripts from a source directory to the hackmud directory.
*
* Pushes files directly in the source folder to all users
* @param sourcePath directory containing source code
* @param hackmudPath directory created by hackmud containing user data including scripts
* @param options {@link PushOptions details}
* @returns array of info on pushed scripts */
export declare function push(sourcePath: string, hackmudPath: string, { scripts, onPush, minify, mangleNames, forceQuineCheats, rootFolderPath }?: PushOptions): Promise<MissingSourceFolderError | MissingHackmudFolderError | NoUsersError | NoScriptsError | Info[]>;