File: npm-install-or-link.pl

package info (click to toggle)
nqp 2024.09%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,972 kB
  • sloc: java: 28,087; perl: 3,479; ansic: 451; makefile: 202; javascript: 68; sh: 1
file content (22 lines) | stat: -rwxr-xr-x 521 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env perl
# Copyright (C) 2013, The Perl Foundation.

use strict;
use warnings;
use 5.008;
use File::Spec;

my ( $where, $install_what, $link_what, $link ) = @ARGV;

unless ( File::Spec->file_name_is_absolute($install_what) ) {
    $install_what = File::Spec->rel2abs($install_what);
}

chdir($where);
my $cmd;
$cmd = $link ? "npm link $link_what" : "npm install $install_what";
system($cmd);
if ( $? != 0 ) {
    print "=== SORRY! === `$cmd` failed with exit code $? (", ( $? >> 8 ), ")\n";
}
exit( $? >> 8 );