mirror of
https://github.com/sern-handler/cli
synced 2026-06-05 17:06:50 +00:00
fix: no more crashing cli if yarn isnt present (#24)
* fix: no more crashing cli if yarn isnt present * chore: add .idea to gitignore * chore: fix position of .idea Co-authored-by: jacoobes <jacobnguyend@gmail.com>
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -9,8 +9,9 @@ lerna-debug.log*
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# VSCode
|
||||
# Editor Files
|
||||
.vscode
|
||||
.idea
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
@@ -113,4 +114,4 @@ dist
|
||||
|
||||
# Yarn files
|
||||
.yarn/install-state.gz
|
||||
.yarn/build-state.yml
|
||||
.yarn/build-state.yml
|
||||
|
||||
@@ -47,7 +47,7 @@ export async function init({ flags }) {
|
||||
} else {
|
||||
data = await prompt([name, lang, main_dir, cmds_dir, default_prefix]);
|
||||
git_init = (await prompt([gitInit])).gitinit;
|
||||
await npm();
|
||||
pm = await npm();
|
||||
}
|
||||
|
||||
if (Object.keys(data).length < 5) process.exit(1);
|
||||
|
||||
@@ -5,10 +5,10 @@ import { execa } from 'execa';
|
||||
* @returns A promise that resolves to a string.
|
||||
*/
|
||||
export async function npm() {
|
||||
const npm = await execa('npm', ['-v']);
|
||||
const npm = await execa('npm', ['-v']).catch(() => null);
|
||||
const npm_version = npm?.stdout;
|
||||
|
||||
const yarn = await execa('yarn', ['-v']);
|
||||
const yarn = await execa('yarn', ['-v']).catch(() => null);
|
||||
const yarn_version = yarn?.stdout;
|
||||
|
||||
if (npm_version && !yarn_version) {
|
||||
|
||||
Reference in New Issue
Block a user