* npm-scriptsで指定したコマンドにオプションを渡す [#a4a0b674]


  "scripts": {
      "tsc" : "tsc",
      "test": "echo \"Error: no test specified\" && exit 1"
  },

- package.jsonが上のような状態とする。

 SHELL> tsc -v
 Version 2.9.2
 SHELL> npm -v
 5.6.0
 
 SHELL> npm run tsc -v       (1)
 5.6.0
 SHELL> npm run tsc -- -v    (2)
 Version 2.9.2

- (1)のようにすると-vはnpmコマンドに渡る。
- よって、(2)のように--の後にオプションを渡す。

** 参考 [#f87c0ba5]

https://stackoverflow.com/questions/38030078/how-to-install-and-run-typescript-locally-in-npm

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS