#!/usr/bin/env perl
# Node dependency manager. Never wonder whether to use `yarn` or `npm` again.
# Usage:
# np --> runs `yarn` or `npm i`
# np <args> --> runs `yarn <args>` or `npm run <args>`
use strict;
use warnings;
if (!-e 'package.json') {
print "No package.json found. Exiting.\n";
exit;
}
if (-e 'package-lock.json') {
if (@ARGV) {
system('npm run ' . join(' ', @ARGV));
} else {
system('npm i');
}
} else {
system('yarn ' . join(' ', @ARGV));
}