UNPKG

@vortex.so/cli

Version:

CLI to interact with Vortex.

32 lines (26 loc) 889 B
'use strict'; const node_child_process = require('node:child_process'); const fs$1 = require('fs-extra'); const pathe = require('pathe'); const fs = require('../fs.cjs'); function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; } const fs__default = /*#__PURE__*/_interopDefaultCompat(fs$1); const locks = { yarn: "yarn.lock", npm: "package-lock.json", pnpm: "pnpm-lock.yaml" }; function getPackageManager(root) { return fs.findup(root, (dir) => { for (const name in locks) { if (fs__default.existsSync(pathe.resolve(dir, locks[name]))) { return name; } } }); } function getPackageManagerVersion(name) { return node_child_process.execSync(`${name} --version`).toString("utf8").trim(); } exports.getPackageManager = getPackageManager; exports.getPackageManagerVersion = getPackageManagerVersion;