{"id":8084,"date":"2019-12-08T10:22:06","date_gmt":"2019-12-08T01:22:06","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=8084"},"modified":"2023-05-27T20:59:17","modified_gmt":"2023-05-27T11:59:17","slug":"%e3%80%90javascript%e3%80%91%e3%80%8cpackage-json%e3%80%8d%e3%81%a8%e3%81%af%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=8084","title":{"rendered":"\u3010JavaScript\u3011\u300cpackage.json\u300d\u3068\u306f\uff1f"},"content":{"rendered":"<h2>package.json\u3068\u306f\uff1f<\/h2>\n<p>Npm\u3084Yarn\u7b49\u306eJavaScript\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u304c\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5b9a\u7fa9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3067\u3059\u3002<span style=\"color: #ff0000;\"><strong>\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u7fa4\u304c\u4e00\u3064\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u306a\u308a\u307e\u3059\u3002<\/strong><\/span>\u540d\u524d\u306e\u901a\u308a\u7d14\u7c8b\u306aJSON\u5f62\u5f0f\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u306a\u3063\u3066\u304a\u308a\u624b\u52d5\u3067\u8a18\u8ff0\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002\u3053\u3053\u306b\u8ffd\u52a0\u3055\u308c\u305f\u30d1\u30c3\u30b1\u30fc\u30b8\u306f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u304c\u4f9d\u5b58\u3059\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u3044\u3046\u610f\u5473\u3067<span style=\"color: #ff0000;\"><strong>\u4f9d\u5b58\u30d1\u30c3\u30b1\u30fc\u30b8<\/strong><\/span>\u3068\u547c\u3073\u307e\u3059\u3002<\/p>\n<h2>\u5229\u7528\u3055\u308c\u308b\u30d1\u30c3\u30b1\u30fc\u30b8\u30de\u30cd\u30fc\u30b8\u30e3\u30fc<\/h2>\n<ul>\n<li>npm<\/li>\n<li>Yarn<\/li>\n<\/ul>\n<p>npm\u3084Yarn\u3067\u3082\u3069\u3061\u3089\u3067\u3082\u300cpackage.json\u300d\u306f\u5229\u7528\u3055\u308c\u3066\u304a\u308a\u5171\u901a\u306e\u4ed5\u7d44\u307f\u306b\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u3002\u3080\u3057\u308dnpm\u306e\u898f\u683c\u3068\u3055\u308c\u3053\u306e\u4ed5\u7d44\u307f\u306b\u6cbf\u3063\u305f\u30d1\u30c3\u30b1\u30fc\u30b8\u306f\u300cnpm\u30d1\u30c3\u30b1\u30fc\u30b8\u300d\u3068\u547c\u3070\u308c\u307e\u3059\u3002<\/p>\n<h2>package.json\u306e\u4f5c\u6210\u65b9\u6cd5<\/h2>\n<p>npm\u3067\u306f\u4e0b\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3067\u81ea\u52d5\u751f\u6210\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">npm init -y<\/pre>\n<h2>\u30bf\u30b0\u4e00\u89a7<\/h2>\n<h3>script<\/h3>\n<p>\u30bf\u30b9\u30af\u306e\u30b7\u30e7\u30fc\u30c8\u30ab\u30c3\u30c8\u3092\u767b\u9332\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u767b\u9332\u3057\u305f\u30b7\u30e7\u30fc\u30c8\u30ab\u30c3\u30c8\u306f<span style=\"color: #ff0000;\"><strong>\u300cnpm run \u30b7\u30e7\u30fc\u30c8\u30ab\u30c3\u30c8\u300d<\/strong><\/span>\u306b\u3066\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30a8\u30a4\u30ea\u30a2\u30b9\u304c\u4f7f\u308f\u308c\u308b\u3053\u3068\u304c\u4e00\u822c\u7684\u3067\u3059\u3002\u958b\u767a\u74b0\u5883\u306b\u3088\u3063\u3066\u306f\u304b\u306a\u308a\u7d30\u304b\u304f\u30b9\u30af\u30ea\u30d7\u30c8\u304c\u5206\u304b\u308c\u3066\u3044\u305f\u308a\u3059\u308b\u306e\u3067\u90fd\u5ea6\u52c9\u5f37\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h4>start<\/h4>\n<p>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u5b9f\u884c<\/p>\n<h4>build<\/h4>\n<p>\u672c\u756a\u30b3\u30fc\u30c9\u306e\u30d3\u30eb\u30c9(webpack\u306a\u3069)<\/p>\n<h4>test<\/h4>\n<p>\u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\u306e\u5b9f\u884c<\/p>\n<h3><strong>dependencies<\/strong><\/h3>\n<p>\u672c\u756a\u74b0\u5883\u3084\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u3069\u3061\u3089\u3067\u3082\u5229\u7528\u3059\u308b\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001React\u306a\u3069\u3002<\/p>\n<pre class=\"lang:default decode:true \">npm install \u30d1\u30c3\u30b1\u30fc\u30b8\u540d@\u30d0\u30fc\u30b8\u30e7\u30f3<\/pre>\n<p>\u4e0a\u8a18\u306e\u3088\u3046\u306b\u6307\u5b9a\u3059\u308c\u3070\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u81ea\u52d5\u3067\u8ffd\u52a0\u3055\u308c\u307e\u3059\u3002(\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u7701\u7565\u3057\u305f\u5834\u5408\u306f\u6700\u65b0\u7248\u304c\u81ea\u52d5\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u307e\u3059\u3002\uff09<\/p>\n<h3>devDependencies<\/h3>\n<p>\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u3084\u30c6\u30b9\u30c8\u74b0\u5883\u3067\u5229\u7528\u3059\u308b\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001eslint\u3084jest\u306a\u3069\u304c\u4ee3\u8868\u4f8b\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \">npm install \u30d1\u30c3\u30b1\u30fc\u30b8\u540d --save-dev(or -D)<\/pre>\n<p>\u4e0a\u8a18\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u3053\u3053\u306b\u81ea\u52d5\u3067\u8a18\u8ff0\u3055\u308c\u307e\u3059\u3002<\/p>\n<h2>package-lock.json<\/h2>\n<p>yarn install\u3084npm install\u306a\u3069\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3068\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u751f\u6210\u3055\u308c\u307e\u3059\u3002\u5b9f\u969b\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u8a73\u7d30\u60c5\u5831\u304c\u8a18\u8ff0\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>node_modules\u306e\u30d5\u30a9\u30eb\u30c0\u306b\u5927\u91cf\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u5b9f\u30b3\u30fc\u30c9\u304c\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3055\u308c\u308b\u306e\u3067\u3059\u304c\u305d\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306a\u3069\u306e\u60c5\u5831\u304c\u4e00\u89a7\u3067\u8a18\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"package.json\u3068\u306f\uff1f Npm\u3084Yarn\u7b49\u306eJavaScript\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u304c\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5b9a\u7fa9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3067\u3059\u3002\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u7fa4\u304c\u4e00\u3064\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u306a\u308a\u307e\u3059\u3002\u540d\u524d\u306e\u901a\u308a\u7d14\u7c8b\u306aJ [&hellip;]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/8084"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8084"}],"version-history":[{"count":7,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/8084\/revisions"}],"predecessor-version":[{"id":20293,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/8084\/revisions\/20293"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8084"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8084"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8084"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}