Download next.js/packages/next/src/lib/helpers/get-npx-command.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 432 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/lib/helpers/get-npx-command.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/packages/next/src/lib/helpers/get-npx-command.ts
-
curl -L -o get-npx-command.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/lib/helpers/get-npx-command.ts
432 Bytes
| import { execSync } from 'child_process' | |
| import { getPkgManager } from './get-pkg-manager' | |
| export function getNpxCommand(baseDir: string) { | |
| const pkgManager = getPkgManager(baseDir) | |
| let command = 'npx' | |
| if (pkgManager === 'pnpm') { | |
| command = 'pnpm dlx' | |
| } else if (pkgManager === 'yarn') { | |
| try { | |
| execSync('yarn dlx --help', { stdio: 'ignore' }) | |
| command = 'yarn dlx' | |
| } catch {} | |
| } | |
| return command | |
| } | |