react-code-dataset / tsdx /src /getInstallCmd.ts
Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
raw
history blame
330 Bytes
import execa from 'execa';
let cmd: InstallCommand;
export type InstallCommand = 'yarn' | 'npm';
export default async function getInstallCmd(): Promise<InstallCommand> {
if (cmd) {
return cmd;
}
try {
await execa('yarnpkg', ['--version']);
cmd = 'yarn';
} catch (e) {
cmd = 'npm';
}
return cmd;
}