It is similar to npx
but cached.
Each use of npx
downloads the package from internet while npxm
keeps used packages in its cache. So repeated use of the same package is instant.
# this will always download fresh package - take your time
npx gatsby new gatsby-site
# first time download is necesasary
npxm gatsby new gatsby-site
# second time download is omited and task is ran instantly
npxm gatsby new gatsby-second-site
Do you want to use multiple versions of mango-cli
? Be sure to start with mango-cli uninstalled.
npm i -g npxm
npxm
#> This is [email protected]
npxm --install mango-cli
#> [npxm] Adding mango-cli
#> [npxm] Downloading [email protected]
#> …
npxm mango-cli --version
#> [npxm] Adding mango-cli
#> [npxm] [email protected] already installed.
#> [npxm] Running `mango --version` ([email protected] at /Users/viliamkopecky/www/npxm/installed/mango-cli/3.1.2)
#> 3.1.2
npxm mango-cli@2 --version
#> [npxm] Adding mango-cli@2
#> [npxm] Downloading [email protected]
#> …
#> [npxm] Running `mango --version` ([email protected] at /Users/viliamkopecky/www/npxm/installed/mango-cli/2.7.1)
2.7.1
# In your project directory…
npxm mango-cli@1 install
#> [npxm] Adding mango-cli@1
#> [npxm] Downloading [email protected]
npxm mango-cli@1 build
#> [npxm] Adding mango-cli@1
#> [npxm] [email protected] already installed.
#> [npxm] Running `mango build` ([email protected] at /Users/viliamkopecky/www/npxm/installed/mango-cli/1.8.1)
#> mango-cli v1.8.1
#> …
Using npm link
.
mango --version
#> command not found: mango
# Links a package as global
npxm --link mango-cli@2
#> [npxm] Adding mango-cli@2
#> [npxm] [email protected] already installed.
#> [npxm] Linking mango-cli@2
#> …
mango --version
#> 2.7.1
# Cleans cache
npxm --cleanup