Mojo::Alien::npm - Runs the external nodejs program npm
use Mojo::Alien::npm; my $npm = Mojo::Alien::npm->new; $npm->init; $npm->install;
Mojo::Alien::webpack is a class for runnig the external nodejs program npm.
$array_ref = $npm->binary; $npm = $npm->binary(['npm']);
The path to the npm executable. Default is "npm" unless the MOJO_NPM_BINARY environment variable has been set. This can also be set to "pnpm" in case you prefer https://pnpm.io/.
MOJO_NPM_BINARY
$path = $npm->config; $npm = $npm->config(path->to_abs->child('package.json'));
Holds an /absolute path to "package.json".
$str = $npm->mode; $npm = $npm->mode('development');
Should be either "development" or "production". Will be used as "NODE_ENV" environment variable when calling "npm".
$dependencies = $npm->dependencies;
Used to get dependencies from "config" combined with information from npm ls. The returned hash-ref looks like this:
npm ls
{ "package-name" => { required => $str, # version from package.json type => $str, # dev, optional or prod version => $str, # installed version ... }, ... }
$npm->init;
Used to create a default "config" file.
$npm->install; $npm->install('package-name'); $npm->install('package-name', {type => 'prod', version => '0.1.2'});
Installs either all modules from "config" or a given package by name. An additional $info hash can also be provided.
$info
Mojolicious::Plugin::Webpack.
To install Mojolicious::Plugin::Webpack, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::Webpack
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::Webpack
For more information on module installation, please visit the detailed CPAN module installation guide.