@darkobits/re-pack
Version:
Utility for managing NPM package contents.
34 lines (33 loc) • 1.27 kB
TypeScript
/**
* Returns a list of files that should be packed by `npm pack`.
*/
export declare function getPackList(cwd: string): Promise<Array<string>>;
/**
* Runs `npm link` from the provided directory.Because NPM 7+ no longer honors
* --ignore-scripts when linking packages, this function will temporarily remove
* the "prepare" script, link the package, and then re-add it. This is janky,
* but necessary.
*/
export declare function linkPackage(cwd: string): Promise<void>;
export interface RunLifecycleScriptOptions {
cwd: string;
scriptName: string;
}
/**
* Runs the indicated NPM lifecycle script from the indicated directory.
*/
export declare function runLifecycleScript(opts: RunLifecycleScriptOptions): Promise<void>;
export interface PublishOptions {
cwd: string;
dryRun?: boolean | undefined;
tag?: string | undefined;
}
/**
* Publishes the NPM package from the directory indicated by `cwd`. Optional
* `dryRun` and `tag` options may be provided as well.
*
* This command is always run with the --ignore-scripts flag as it is run from
* the re-pack workspace, and re-pack explicitly runs lifecycle scripts from the
* package root.
*/
export declare function publishPackage({ cwd, tag, dryRun }: PublishOptions): Promise<void>;