npx is cool
Jul 17, 2018 · 1 分钟阅读

About

npx is a tool intended to help round out the experience of using packages from the npm registry — the same way npm makes it super easy to install and manage dependencies hosted on the registry, npx makes it easy to use CLI tools and other executables hosted on the registry. It greatly simplifies a number of things that, until now, required a bit of ceremony to do with plain npm.

Easily run commands

❯ npx cowsay hello
npx: installed 10 in 3.659s
 ____________
< hello >
 ------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Run local commands

❯ yarn add atomic-algolia -D
❯ npx atomic-algolia
[Algolia] Adding 25 hits to algolia
[Algolia] Updating 0 hits to algolia
[Algolia] Removing 25 hits from algolia
[Algolia] 113 hits unchanged in algolia
{
  objectIDs: [...],
  taskID: { algolia: 5366258650 }
}

Run commands with different Node.js versions

❯ npx -p node@7 node -v
v7.10.1

Run GitHub source code

❯ npx github:piuccio/cowsay hello
❯ npx https://gist.github.com/zkat/4bc19503fe9e9309e2bfaa2c58074d32

Run http-server

❯ npx http-server -p 4000
npx: installed 27 in 9.767s
Starting up http-server, serving ./
Available on:
  http://127.0.0.1:4000
  http://192.168.0.100:4000
Hit CTRL-C to stop the server

see also: awesome-npx

← Previous Post Next Post →

Ryun的博客
与其感慨路难行,不如马上出发。

atom css design git html javascript jekyll laravel life mac mobile optimization sublime tool vscode vue
mac

About

你好,❤朋友

这里是 Ryun 的博客 📝

📝记录了我学习 🔎的过程

作为一名前端攻城狮 🦁

希望能和大家一起 🔎

共同进步 🏃

🦁的特长:

  • HTML5
  • CSS3
  • JavaScript
  • Vue.js
  • 微信小程序
  • 熟练配合 Node.js、PHP 和 Laravel
  • 熟练使用各种开发和设计工具

🦁喜欢 🆒🆒的东西

对提升效率和美感的事物有兴趣 😋

欢迎 👏交流


see this hugo-theme-dream-ink