@zkochan/cmd-shim
Version:
Used in pnpm for command line application support
75 lines • 2.21 kB
TypeScript
export interface Options {
/**
* If a PowerShell script should be created.
*
* @default true
*/
createPwshFile?: boolean;
/**
* If a Windows Command Prompt script should be created.
*
* @default false
*/
createCmdFile?: boolean;
/**
* If symbolic links should be preserved.
*
* @default false
*/
preserveSymlinks?: boolean;
/**
* The path to the executable file.
*/
prog?: string;
/**
* The arguments to initialize the `node` process with.
*/
args?: string;
/**
* The arguments to initialize the target process with, before the actual CLI arguments
*/
progArgs?: string[];
/**
* The value of the $NODE_PATH environment variable.
*
* The single `string` format is only kept for legacy compatibility,
* and the array form should be preferred.
*/
nodePath?: string | string[];
/**
* fs implementation to use. Must implement node's `fs` module interface.
*/
fs?: typeof import('fs');
nodeExecPath?: string;
prependToPath?: string;
}
/**
* Try to create shims.
*
* @param src Path to program (executable or script).
* @param to Path to shims.
* Don't add an extension if you will create multiple types of shims.
* @param opts Options.
* @throws If `src` is missing.
*/
export declare function cmdShim(src: string, to: string, opts?: Options): Promise<void>;
/**
* Try to create shims.
*
* Does nothing if `src` doesn't exist.
*
* @param src Path to program (executable or script).
* @param to Path to shims.
* Don't add an extension if you will create multiple types of shims.
* @param opts Options.
*/
export declare function cmdShimIfExists(src: string, to: string, opts?: Options): Promise<void>;
/**
* Check whether a shim's content points at the given source path.
*
* @param shimContent The text content of the shim file.
* @param src The expected source path (the executable the shim should point to).
* @return `true` if the shim contains a matching target marker.
*/
export declare function isShimPointingAt(shimContent: string, src: string): boolean;
//# sourceMappingURL=index.d.ts.map