UNPKG

piral-cli

Version:

The standard CLI for creating and building a Piral instance or a Pilet.

84 lines 3.05 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.clients = void 0; exports.isWrapperClient = isWrapperClient; exports.isDirectClient = isDirectClient; exports.detectDirectClients = detectDirectClients; exports.detectWrapperClients = detectWrapperClients; const path_1 = require("path"); const io_1 = require("../common/io"); const lerna = __importStar(require("./lerna")); const npm = __importStar(require("./npm")); const pnp = __importStar(require("./pnp")); const pnpm = __importStar(require("./pnpm")); const rush = __importStar(require("./rush")); const yarn = __importStar(require("./yarn")); const bun = __importStar(require("./bun")); exports.clients = { lerna, npm, pnp, pnpm, rush, yarn, bun, }; const directClients = ['npm', 'pnp', 'yarn', 'pnpm', 'bun']; const wrapperClients = ['lerna', 'rush']; function isWrapperClient(client) { return wrapperClients.includes(client); } function isDirectClient(client) { return directClients.includes(client); } async function detectClients(root, clientNames) { const packageJson = await (0, io_1.findFile)((0, path_1.resolve)(root, '..'), 'package.json'); const stopDir = packageJson ? (0, path_1.dirname)(packageJson) : undefined; return await Promise.all(clientNames.map(async (client) => { const result = await exports.clients[client].detectClient(root, stopDir); return { client, result, }; })); } function detectDirectClients(root) { return detectClients(root, directClients); } function detectWrapperClients(root) { return detectClients(root, wrapperClients); } //# sourceMappingURL=index.js.map