{"id":315428,"date":"2020-12-23T21:01:11","date_gmt":"2020-12-23T21:01:11","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=315428"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2020-12-23T21:01:11","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=315428","title":{"rendered":"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 React-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Hygen"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<blockquote><p>\u0412\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043a\u043e\u0433\u0434\u0430-\u043d\u0438\u0431\u0443\u0434\u044c <a href=\"http:\/\/www.hygen.io\/\">Hygen<\/a>, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043a\u043e\u0434\u0430? \u0415\u0441\u043b\u0438 \u0435\u0449\u0435 \u043d\u0435\u0442, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u0448 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u043e\u0442\u043a\u0440\u043e\u0435\u0442 \u0434\u043b\u044f \u0432\u0430\u0441 \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442.<\/p><\/blockquote>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/95\/vj\/9z\/95vj9zoryvlhh2ucuc2jgkvx6ds.png\" width=\"300\"><\/div>\n<p>  <a name=\"habracut\"><\/a><br \/>  \u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043d\u0430 React \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0444\u0430\u0439\u043b\u043e\u0432, \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u0440\u0430\u0441\u0442\u0435\u0442 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0444\u0430\u0439\u043b Storybook, \u0444\u0430\u0439\u043b c \u0442\u0435\u0441\u0442\u0430\u043c\u0438, \u043c\u043e\u0434\u0443\u043b\u044c CSS).<\/p>\n<p>  \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0447\u0442\u043e \u043e\u0434\u0438\u043d \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438\u043c\u0435\u0435\u0442 \u0442\u0430\u043a\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/af\/qi\/sp\/afqisp5eckolxo6-sxn3wq6w1o8.png\"><\/p>\n<p>  <a href=\"https:\/\/github.com\/jondot\/hygen\">Hygen<\/a> \u2014 \u044d\u0442\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043a\u043e\u0434\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Node.js, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0440\u0443\u0442\u0438\u043d\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u043a\u043e\u0434\u043e\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0432\u044b \u0443\u0437\u043d\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c React-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Hygen.<\/p>\n<p>  \u041e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u0434\u043e\u0432\u0430\u044f \u0431\u0430\u0437\u0430 \u043d\u0430 GitHub \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043f\u043e <a href=\"https:\/\/github.com\/manakuro\/hygen-example-with-react\">\u044d\u0442\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0435<\/a>.<\/p>\n<h3>\u041e\u0431\u0437\u043e\u0440<\/h3>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c Hygen, \u043c\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c React-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f:<\/p>\n<ol>\n<li>\u0421\u043e\u0437\u0434\u0430\u0442\u044c React-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/li>\n<li>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c Hygen<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0448\u0430\u0431\u043b\u043e\u043d\u0430<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0432 <b>package.json<\/b>.<\/li>\n<\/ol>\n<h3>1. \u0421\u043e\u0437\u0434\u0430\u0442\u044c React-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/github.com\/facebook\/create-react-app\">create-react-app<\/a> \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f React:<\/p>\n<pre><code class=\"bash\">npx create-react-app hygen-app --template typescript<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c dev-\u0441\u0435\u0440\u0432\u0435\u0440, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u044d\u0442\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code class=\"bash\">yarn start<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/8c\/o7\/df\/8co7dfuj0x2v3cp-naoyuuqgc8k.png\"><\/p>\n<p>  2. \u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c Hygen<br \/>  \u0414\u0430\u043b\u0435\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c Hygen \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0435\u0433\u043e.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c Hygen:<\/p>\n<pre><code class=\"bash\">yarn add -D hygen<\/code><\/pre>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433: \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b\u044b \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f React-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e Hygen \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u0430\u043f\u043a\u0443 <b>_templates<\/b> \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u0430\u043f\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 <b>.hygen.js<\/b> \u0432 \u043a\u043e\u0440\u0435\u043d\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n<pre><code class=\"javascript\">module.exports = {   templates: `${__dirname}\/.hygen`, }<\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442 \u043f\u0443\u0442\u044c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e (<b>_templates<\/b>) \u043d\u0430 \u043f\u0430\u043f\u043a\u0443 <b>.hygen<\/b>.<\/p>\n<p>  \u0418 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 <b>new\/components<\/b> \u0432 \u043f\u0430\u043f\u043a\u0443 <b>.hygen<\/b>:<\/p>\n<p>  <code>.hygen<br \/>  \u2514\u2500\u2500 new<br \/>  &nbsp;&nbsp; &nbsp;\u2514\u2500\u2500 component<br \/>  <\/code><\/p>\n<h3>3. \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432<\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 Hygen, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432:<\/p>\n<ul>\n<li><b>index.ts<\/b><\/li>\n<li>React-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 <\/li>\n<li>\u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b<\/li>\n<li>\u0424\u0430\u0439\u043b Storybook<\/li>\n<li>\u041c\u043e\u0434\u0443\u043b\u044c CSS<\/li>\n<\/ul>\n<h4>index.ts<\/h4>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f <b>index.ts<\/b>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0430\u043f\u043a\u0438.<\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 <b>index.tsx.ejs.t<\/b> \u0432 <b>.hygen\/new\/component<\/b>:<\/p>\n<pre><code class=\"javascript\">--- to: &lt;%= absPath %&gt;\/index.tsx --- export * from '.\/&lt;%= component_name %&gt;';<\/code><\/pre>\n<p>  Hygen \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 Frontmatter \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0434\u0432\u0438\u0436\u043e\u043a EJS \u0434\u043b\u044f \u0442\u0435\u043b\u0430.<\/p>\n<p>  \u0412 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 \u043c\u044b \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <b>to<\/b>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0443\u0442\u0438 \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<p>  \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0432\u0441\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0432 <a href=\"http:\/\/www.hygen.io\/docs\/templates\/#frontmatter\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/km\/xb\/bc\/kmxbbcza03fa717vy9qx21akii0.png\"><\/p>\n<p>  <b>&lt;%= absPath %&gt;<\/b> \u2014 \u044d\u0442\u043e \u0442\u0435\u0433 <a href=\"https:\/\/github.com\/mde\/ejs\">EJS<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043c\u044b \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u043c <b>src\/components\/atom\/Button<\/b> \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <b>absPath<\/b>, \u043f\u0443\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0438\u043c: <b>src\/components\/atom\/Button\/index.tsx<\/b>.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c <b>index.js<\/b> \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c. \u041f\u043e\u0437\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0434\u0435\u043b \u0432 \u0444\u0430\u0439\u043b\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/p>\n<h4>React-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b <\/h4>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f React-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430.<\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 <b>component.tsx.ejs.t<\/b> \u0432 <b>.hygen\/new\/component<\/b>:<\/p>\n<pre><code class=\"javascript\">--- to: &lt;%= absPath %&gt;\/&lt;%= component_name %&gt;.tsx --- import React from 'react'; import styles from '.\/style.module.css';  type Props = {};  export const &lt;%= component_name %&gt;: React.FC&lt;Props&gt; = (props) =&gt; {   return &lt;div className={styles.container} data-testid=&quot;test&quot; \/&gt;; };<\/code><\/pre>\n<h4>Test-\u0444\u0430\u0439\u043b<\/h4>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f Test-\u0444\u0430\u0439\u043b\u0430.<\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 <b>test.tsx.ejs.t<\/b> \u0432 <b>.hygen\/new\/component<\/b>:<\/p>\n<pre><code class=\"javascript\">--- to: &lt;%= absPath %&gt;\/__tests__\/&lt;%= component_name %&gt;.test.tsx --- import React from 'react'; import { render, screen } from '@testing-library\/react'; import { &lt;%= component_name %&gt; } from '..\/';  test('renders component successfully', () =&gt; {   render(&lt;&lt;%= component_name %&gt;  \/&gt;);   const element = screen.getByTestId(\/test\/i);   expect(element).toBeInTheDocument(); });<\/code><\/pre>\n<h4>\u0424\u0430\u0439\u043b Storybook<\/h4>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u0430 Storybook.<\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 <b>stories.tsx.ejs.t<\/b> \u0432 <b>.hygen\/new\/component<\/b>:<\/p>\n<pre><code class=\"javascript\">--- to: &lt;%= absPath %&gt;\/&lt;%= component_name %&gt;.stories.tsx --- import React from 'react'; import { &lt;%= component_name %&gt; } from '.\/'; import { Story, Meta } from '@storybook\/react\/types-6-0';  type Props = React.ComponentProps&lt;typeof &lt;%= component_name %&gt;&gt;  const csf: Meta = {   title: '&lt;%= category %&gt;\/&lt;%= component_name %&gt;', }  const Template: Story&lt;Props&gt; = (args) =&gt; &lt;&lt;%= component_name %&gt; {...args} \/&gt;;  export const c1 = Template.bind({}); c1.storyName = 'default'  export default csf<\/code><\/pre>\n<h4>\u041c\u043e\u0434\u0443\u043b\u044c CSS<\/h4>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u043c\u043e\u0434\u0443\u043b\u044f CSS.<\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 <b>style.module.css.ejs.t<\/b> \u0432 <b>.hygen\/new\/component<\/b>:<\/p>\n<pre><code class=\"javascript\">--- to: &lt;%= absPath %&gt;\/style.module.css --- .container {}<\/code><\/pre>\n<h3>4. \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438<\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f Hygen.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c <b>index.js<\/b> \u0432 <b>.hygen\/new\/component<\/b>:<\/p>\n<pre><code class=\"javascript\">module.exports = {   prompt: ({ inquirer }) =&gt; {     const questions = [       {         type: 'select',         name: 'category',         message: 'Which Atomic design level?',         choices: ['atoms', 'molecules', 'organisms', 'templates', 'pages']       },       {         type: 'input',         name: 'component_name',         message: 'What is the component name?'       },       {         type: 'input',         name: 'dir',         message: 'Where is the directory(Optional)',       },     ]     return inquirer       .prompt(questions)       .then(answers =&gt; {         const { category, component_name, dir } = answers         const path = `${category}\/${ dir ? `${dir}\/` : `` }${component_name}`         const absPath = `src\/components\/${path}`         return { ...answers, path, absPath, category }       })   } }<\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0437\u0430\u0434\u0430\u0435\u0442 \u0432\u0430\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0432\u0441\u0451, \u0447\u0442\u043e \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435.<\/p>\n<p>  <b>prompt<\/b> \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u0430 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u0445. \u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0432\u044b\u0448\u0435, \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0432 \u0444\u0430\u0439\u043b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 EJS.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 EJS \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f <b>answers<\/b>, <b>path<\/b>, <b>absPath<\/b> \u0438 <b>category<\/b>.<\/p>\n<p>  \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0430 <a href=\"https:\/\/github.com\/jondot\/hygen\/blob\/404e2350d153e3e1364c443aaa060b68f6212fc7\/hygen.io\/docs\/generators.md\">GitHub<\/a>.<\/p>\n<h3>5. \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0432 <b>package.json<\/b><\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c Hygen, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0432 <b>package.json<\/b>:<\/p>\n<pre><code class=\"json\">&quot;scripts&quot;: {   &quot;start&quot;: &quot;react-scripts start&quot;,   &quot;build&quot;: &quot;react-scripts build&quot;,   &quot;test&quot;: &quot;react-scripts test&quot;,   &quot;eject&quot;: &quot;react-scripts eject&quot;,    &quot;new:component&quot;: &quot;hygen new component&quot; \/\/ Add here },<\/code><\/pre>\n<p>  Hygen \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0441\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u043f\u0430\u043f\u043e\u043a \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0435\u0435. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c <b>new component<\/b> \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u043f\u0430\u043f\u043e\u043a:<\/p>\n<p>  <code>.hygen<br \/>  \u2514\u2500\u2500 new<br \/>  &nbsp;&nbsp; &nbsp;\u2514\u2500\u2500 component<br \/>  <\/code><br \/>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c!<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 <b>Button<\/b>:<\/p>\n<pre><code class=\"bash\">yarn new:component<\/code><\/pre>\n<p>  \u041f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0441 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0432\u0430\u0448\u0438\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/84\/0i\/sd\/840isd2yavscjvw_gk4a50yrg6e.gif\"><\/p>\n<p>  \u041c\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0432 \u043f\u0430\u043f\u043a\u0443 <b>src\/components<\/b>:<\/p>\n<p>  <code>\u251c\u2500\u2500 components<br \/>  \u2502 &nbsp; \u2514\u2500\u2500 atoms<br \/>  \u2502 &nbsp; &nbsp; &nbsp; \u2514\u2500\u2500 Button<br \/>  \u2502 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u251c\u2500\u2500 Button.stories.tsx<br \/>  \u2502 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u251c\u2500\u2500 Button.tsx<br \/>  \u2502 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u251c\u2500\u2500 __tests__<br \/>  \u2502 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u2502 &nbsp; \u2514\u2500\u2500 Button.test.tsx<br \/>  \u2502 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u251c\u2500\u2500 index.tsx<br \/>  \u2502 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u2514\u2500\u2500 style.module.css<br \/>  <\/code><\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0451! \u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438, \u043a\u0430\u043a \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430 React \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Hygen. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0438 \u043a \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Vue.js \u0438\u043b\u0438 Angular.<\/p>\n<p>  Hygen \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0433\u0438\u0431\u043e\u043a, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438 \u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u043f\u043e\u0434 \u043b\u044e\u0431\u044b\u0435 \u0441\u0432\u043e\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u0418\u0442\u0430\u043a, <a href=\"https:\/\/github.com\/manakuro\/hygen-example-with-react\">\u0437\u0434\u0435\u0441\u044c<\/a> \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u0434\u043e\u0432\u0430\u044f \u0431\u0430\u0437\u0430. \u041e\u043d\u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 Storybook.<\/p>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u043d\u0430\u0439\u0442\u0438 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u0435. \u0423\u0434\u0430\u0447\u0438!<\/p><\/div>\n<p> \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\/company\/timeweb\/blog\/534686\/\"> https:\/\/habr.com\/ru\/company\/timeweb\/blog\/534686\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<blockquote><p>\u0412\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043a\u043e\u0433\u0434\u0430-\u043d\u0438\u0431\u0443\u0434\u044c <a href=\"http:\/\/www.hygen.io\/\">Hygen<\/a>, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043a\u043e\u0434\u0430? \u0415\u0441\u043b\u0438 \u0435\u0449\u0435 \u043d\u0435\u0442, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u0448 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u043e\u0442\u043a\u0440\u043e\u0435\u0442 \u0434\u043b\u044f \u0432\u0430\u0441 \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442.<\/p><\/blockquote>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/95\/vj\/9z\/95vj9zoryvlhh2ucuc2jgkvx6ds.png\" width=\"300\"><\/div>\n<p>  <\/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-315428","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/315428","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=315428"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/315428\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=315428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=315428"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=315428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}