LoginSignup
4
4

More than 5 years have passed since last update.

npm で似たような名前のパッケージを DRY にインストールする

Last updated at Posted at 2016-05-10

Bash のブレース展開を使います。

例えば Babel plugin

ちょうどいい preset があればそれを使えばいいのですが、一個一個入れるのは面倒です。

Before:

npm install -D babel-plugin-transform-foo babel-plugin-transform-bar babel-plugin-transform-baz

After:

npm install -D babel-plugin-transform-{foo,bar,baz}

そもそもそれなりに使われてそうな組み合わせなら、preset を作ると他の人の役に立つかも?

Scoped packages(例えば Angular 2)

Angular 2 は beta までは angular2 という一つのパッケージでしたが、rc.0 から scoped package を採用するようになり、モジュールが分割されました。これ自体は喜ばしいことと思いますが、いかんせんインストールが面倒ですね。

Before:

npm install -S @angular/core @angular/common @angular/compiler @angualar/platform-browser @angular/platform-browser-dynamic @angular/router

After:

npm install -S @angular/{core,common,compiler,platform-browser,platform-browser-dynamic,router}
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4