UNPKG

@nestjs/cli

Version:

Nest - modern, fast, powerful node.js web framework (@cli)

13 lines (12 loc) 516 B
import { existsSync } from 'fs'; import { join } from 'path'; import { pathToFileURL } from 'url'; const localBinPathSegments = [process.cwd(), 'node_modules', '@nestjs', 'cli']; export function localBinExists() { return existsSync(join(...localBinPathSegments)); } export async function loadLocalBinCommandLoader() { const commandsPath = join(...localBinPathSegments, 'commands', 'index.js'); const commandsFile = await import(pathToFileURL(commandsPath).href); return commandsFile.CommandLoader; }