create-nx-workspace
Version:
36 lines (35 loc) • 1.3 kB
TypeScript
export declare const packageManagerList: readonly ["pnpm", "yarn", "npm", "bun"];
export type PackageManager = (typeof packageManagerList)[number];
export declare function detectPackageManager(dir?: string): PackageManager;
/**
* Returns commands for the package manager used in the workspace.
* By default, the package manager is derived based on the lock file,
* but it can also be passed in explicitly.
*
* Example:
*
* ```javascript
* execSync(`${getPackageManagerCommand().addDev} my-dev-package`);
* ```
*
*/
export declare function getPackageManagerCommand(packageManager?: PackageManager): {
install: string;
exec: string;
preInstall?: string;
globalAdd: string;
getRegistryUrl?: string;
};
export declare function generatePackageManagerFiles(root: string, packageManager?: PackageManager): void;
export declare function getPackageManagerVersion(packageManager: PackageManager, cwd?: string): string;
/**
* Detects which package manager was used to invoke create-nx-{plugin|workspace} command
* based on the main Module process that invokes the command
* - npx returns 'npm'
* - pnpx returns 'pnpm'
* - yarn create returns 'yarn'
* - bunx returns 'bun'
*
* Default to 'npm'
*/
export declare function detectInvokedPackageManager(): PackageManager;