LoginSignup
46
40

More than 5 years have passed since last update.

package.json の scripts

Last updated at Posted at 2012-12-26

start, test など決められたものは npm start などで実行できます。詳細は npm のドキュメント を参照のこと。

その他のものを定義した場合は npm run foo で実行します。

この際 dependencies や devDependencies に入っているモジュールの bin は、自動的に PATH に入ります。

そのため

package.json
{
  "scripts": {
    "test": "node_modules/.bin/mocha"
  },
  "devDependencies": {
    "mocha": "~1.7.4"
  }
}

でなく

{
  "scripts": {
    "test": "mocha"
  },
  "devDependencies": {
    "mocha": "~1.7.4"
  }
}

と書けます。

46
40
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
46
40