create-nx-workspace
Version:
47 lines • 1.91 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;
/**
* Converts an array of workspace globs to pnpm-workspace.yaml content.
*/
export declare function workspacesToPnpmYaml(workspaces: string[]): string;
/**
* Converts "*" dependencies to "workspace:*" in all workspace package.json files.
* This is needed for pnpm, yarn, and bun to properly symlink workspace packages.
*/
export declare function convertStarToWorkspaceProtocol(root: string): void;
export declare function findAllWorkspacePackageJsons(root: string, maxDepth?: number): string[];
export declare function findWorkspacePackages(root: string): string[];
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;
//# sourceMappingURL=package-manager.d.ts.map