UNPKG

@nestjs/cli

Version:

The Nest CLI: create NestJS applications, generate modules, controllers and CRUD resources, and build, run and watch projects and monorepos.

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; }