{"id":373660,"date":"2024-05-21T05:41:22","date_gmt":"2024-05-21T05:41:22","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=373660"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=373660","title":{"rendered":"<span>\u0412\u044b\u043a\u0438\u043d\u044c\u0442\u0435 \u0441\u0432\u043e\u0439 husky<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f67\/63b\/59f\/f6763b59fdd2270962ae87d8c265a45c.png\" alt=\"44 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0439 \u0432 \u043c\u0435\u0441\u044f\u0446\" title=\"44 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0439 \u0432 \u043c\u0435\u0441\u044f\u0446\" width=\"908\" height=\"456\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f67\/63b\/59f\/f6763b59fdd2270962ae87d8c265a45c.png\"\/><\/p>\n<div><figcaption>44 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0439 \u0432 \u043c\u0435\u0441\u044f\u0446<\/figcaption><\/div>\n<\/figure>\n<p>\u0412 git \u0434\u0430\u0432\u043d\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0435 <a href=\"https:\/\/git-scm.com\/book\/en\/v2\/Customizing-Git-Git-Hooks\" rel=\"noopener noreferrer nofollow\">\u0445\u0443\u043a\u0438<\/a>, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0432\u0435\u0441\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043b\u0438\u043d\u0442\u0438\u043d\u0433\u0430). \u041e\u043d\u0438 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0443\u0436\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 \u043b\u044e\u0431\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043d\u0438\u0445, \u0435\u0441\u043b\u0438 \u0437\u0430\u0439\u0442\u0438 \u0432 <code>.git\/hooks<\/code> <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/96a\/357\/b64\/96a357b64941d8113b5d40fd8a8d2e0e.png\" alt=\"\u044d\u0442\u043e \u0432\u0441\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0445\u0443\u043a\u0438, \u043e\u043d\u0438 \u0441\u0440\u0430\u0437\u0443 \u043d\u0430\u0447\u043d\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0435\u0441\u043b\u0438 \u0443\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0444\u0438\u043a\u0441 .sample\" title=\"\u044d\u0442\u043e \u0432\u0441\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0445\u0443\u043a\u0438, \u043e\u043d\u0438 \u0441\u0440\u0430\u0437\u0443 \u043d\u0430\u0447\u043d\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0435\u0441\u043b\u0438 \u0443\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0444\u0438\u043a\u0441 .sample\" width=\"1504\" height=\"174\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/96a\/357\/b64\/96a357b64941d8113b5d40fd8a8d2e0e.png\"\/><\/p>\n<div><figcaption>\u044d\u0442\u043e \u0432\u0441\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0445\u0443\u043a\u0438, \u043e\u043d\u0438 \u0441\u0440\u0430\u0437\u0443 \u043d\u0430\u0447\u043d\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0435\u0441\u043b\u0438 \u0443\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0444\u0438\u043a\u0441 .sample<\/figcaption><\/div>\n<\/figure>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0441\u0432\u043e\u0439 pre-commit \u0445\u0443\u043a, \u043d\u043e \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0448\u0430\u0440\u0438\u043b\u0441\u044f. \u0417\u0430\u0432\u0435\u0434\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>.git-hooks<\/code>, \u0438 \u043f\u0443\u0441\u0442\u044c \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432 \u043a\u043e\u0440\u043d\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043d\u0435\u0435 \u0444\u0430\u0439\u043b\u0438\u043a \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>pre-commit<\/code>, \u0434\u0435\u043b\u0430\u0435\u043c \u0435\u043c\u0443 <code>chmod +x<\/code>, \u043f\u0438\u0448\u0435\u043c \u0432 \u043d\u0435\u0433\u043e \u0432\u0441\u0435 \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c:<\/p>\n<pre><code class=\"bash\"> #!\/bin\/sh touch PreCommitHookRan<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0447\u0442\u043e\u0431\u044b \u0443 \u0432\u0441\u0435\u0445 \u043a\u043e\u043d\u0442\u0440\u0438\u0431\u044c\u044e\u0442\u043e\u0440\u043e\u0432 git \u0437\u043d\u0430\u043b \u0433\u0434\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0444\u0430\u0439\u043b\u044b-\u0445\u0443\u043a\u0438, \u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a\u043e\u0439 npm-\u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<pre><code class=\"bash\">... \"prepare\": \"git config core.hooksPath .git-hooks || echo 'Not in a git repo'\", ...<\/code><\/pre>\n<p><strong>\u042d\u0442\u043e \u0432\u0441\u0451. \u0411\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e. \u0413\u043e\u0442\u043e\u0432\u043e.<\/strong><\/p>\n<p>\u0412\u044b \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u0435, \u0438 \u0447\u0442\u043e \u0436\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u043e\u0433\u0434\u0430 \u0434\u0435\u043b\u0430\u0435\u0442 husky?<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9c3\/fc4\/0c6\/9c3fc40c630bc01c881cc8ee7f21c8dd.png\" alt=\"?\" title=\"?\" width=\"2578\" height=\"1344\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9c3\/fc4\/0c6\/9c3fc40c630bc01c881cc8ee7f21c8dd.png\"\/><\/p>\n<div><figcaption>?<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/cf3\/d0b\/979\/cf3d0b979c063a501c4ec8b09dca7250.png\" alt=\"?\" title=\"?\" width=\"2562\" height=\"1426\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cf3\/d0b\/979\/cf3d0b979c063a501c4ec8b09dca7250.png\"\/><\/p>\n<div><figcaption>?<\/figcaption><\/div>\n<\/figure>\n<p><strong>\u041d\u0438-\u0447\u0435-\u0433\u043e.<\/strong><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/807763\/\"> https:\/\/habr.com\/ru\/articles\/807763\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\">\n<div><figcaption>44 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0439 \u0432 \u043c\u0435\u0441\u044f\u0446<\/figcaption><\/div>\n<\/figure>\n<p>\u0412 git \u0434\u0430\u0432\u043d\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0435 <a href=\"https:\/\/git-scm.com\/book\/en\/v2\/Customizing-Git-Git-Hooks\" rel=\"noopener noreferrer nofollow\">\u0445\u0443\u043a\u0438<\/a>, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0432\u0435\u0441\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043b\u0438\u043d\u0442\u0438\u043d\u0433\u0430). \u041e\u043d\u0438 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0443\u0436\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 \u043b\u044e\u0431\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043d\u0438\u0445, \u0435\u0441\u043b\u0438 \u0437\u0430\u0439\u0442\u0438 \u0432 <code>.git\/hooks<\/code> <\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u044d\u0442\u043e \u0432\u0441\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0445\u0443\u043a\u0438, \u043e\u043d\u0438 \u0441\u0440\u0430\u0437\u0443 \u043d\u0430\u0447\u043d\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0435\u0441\u043b\u0438 \u0443\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0444\u0438\u043a\u0441 .sample<\/figcaption><\/div>\n<\/figure>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0441\u0432\u043e\u0439 pre-commit \u0445\u0443\u043a, \u043d\u043e \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0448\u0430\u0440\u0438\u043b\u0441\u044f. \u0417\u0430\u0432\u0435\u0434\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>.git-hooks<\/code>, \u0438 \u043f\u0443\u0441\u0442\u044c \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432 \u043a\u043e\u0440\u043d\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043d\u0435\u0435 \u0444\u0430\u0439\u043b\u0438\u043a \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>pre-commit<\/code>, \u0434\u0435\u043b\u0430\u0435\u043c \u0435\u043c\u0443 <code>chmod +x<\/code>, \u043f\u0438\u0448\u0435\u043c \u0432 \u043d\u0435\u0433\u043e \u0432\u0441\u0435 \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c:<\/p>\n<pre><code class=\"bash\"> #!\/bin\/sh touch PreCommitHookRan<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0447\u0442\u043e\u0431\u044b \u0443 \u0432\u0441\u0435\u0445 \u043a\u043e\u043d\u0442\u0440\u0438\u0431\u044c\u044e\u0442\u043e\u0440\u043e\u0432 git \u0437\u043d\u0430\u043b \u0433\u0434\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0444\u0430\u0439\u043b\u044b-\u0445\u0443\u043a\u0438, \u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a\u043e\u0439 npm-\u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<pre><code class=\"bash\">... \"prepare\": \"git config core.hooksPath .git-hooks || echo 'Not in a git repo'\", ...<\/code><\/pre>\n<p><strong>\u042d\u0442\u043e \u0432\u0441\u0451. \u0411\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e. \u0413\u043e\u0442\u043e\u0432\u043e.<\/strong><\/p>\n<p>\u0412\u044b \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u0435, \u0438 \u0447\u0442\u043e \u0436\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u043e\u0433\u0434\u0430 \u0434\u0435\u043b\u0430\u0435\u0442 husky?<\/p>\n<figure class=\"full-width\">\n<div><figcaption>?<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\">\n<div><figcaption>?<\/figcaption><\/div>\n<\/figure>\n<p><strong>\u041d\u0438-\u0447\u0435-\u0433\u043e.<\/strong><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/807763\/\"> https:\/\/habr.com\/ru\/articles\/807763\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-373660","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/373660","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=373660"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/373660\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=373660"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=373660"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=373660"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}