UNPKG

@taiga-ui/cdk

Version:

Base library for creating Angular components and applications using Taiga UI principles regarding of actual visual appearance

16 lines 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.detectPackageManager = detectPackageManager; function detectPackageManager(tree) { var _a, _b, _c, _d, _e, _f; const packageJson = (_a = tree.read('package.json')) === null || _a === void 0 ? void 0 : _a.toString(); const pkg = packageJson ? JSON.parse(packageJson) : {}; const packageManagerField = (_b = pkg.packageManager) !== null && _b !== void 0 ? _b : ''; const managers = [ { name: 'pnpm', lock: 'pnpm-lock.yaml' }, { name: 'yarn', lock: 'yarn.lock' }, { name: 'npm', lock: 'package-lock.json' }, ]; return ((_f = (_d = (_c = managers.find(({ name }) => packageManagerField.startsWith(name))) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : (_e = managers.find(({ lock }) => tree.exists(lock))) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : 'npm'); } //# sourceMappingURL=detect-package-manager.js.map