You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
I copied package.json from another project and now want to bump all of the dependencies to their latest versions since this is a fresh project and I don't mind fixing something if it breaks. What's the easiest way to do this? The best way I know is to run npm info express version and then update each dependency in package.json manually. There must be a better way. { "name": "myproject", "descripti
npmで色々コードを書いていると、以下のような依存関係ができてしまうことがある*1。 a +-- b <-- depends on c@1.0.x | `-- c@1.0.3 `-- d <-- depends on c@~1.0.9 `-- c@1.0.10このように「bが依存するc」と「dが依存するc」が異なるものになってしまうと、(2回cがロードされる分)プログラムが無駄に大きなものになってしまったり、(bとdがお互いで生成したcを使う場合に)片方で生成されたcのインスタンスをもう片方で「instanceof c」してもfalseが返ってきてしまう、などの問題が発生する。 この問題を解決するために、npmはsemantic versioningという枠組みとnpm dedupeというコマンドを提供していて、両者を使うことで、依存構造を以下のような形に変換して問題を回避することができる
Noderは、よくnpm testとかでテストを簡単に実行するために、package.jsonにscriptsを書いていると思います。 で、今まではpackage.jsonに "scripts": { "test": "./node_modules/.bin/mocha" } と書いてたのですが、Building CLI Tools with Node.jsを最後まで読んだところ、 "scripts": { "test": "mocha" } でも動作するというのを知りましたorz 上記でローカルにインストールしたmochaが実行できます。 Windowsだとmocha.cmdを実行しないといけないですが、この記法だとそういうのもやってくれるみたいです。 いつからこの記法出来るようになったんですかねえ…… ってかなり初期から一番上の書き方しか知らなかったのでもしかしたら最初からできてたのか
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く