npm install - install dependency
npm run start:dev or npm run start:dev:vite - project interface + storybook in dev mode
It is recommended to use node version >=v18.16.0
npm run start- Start the frontend of the project on the webpack development servernpm run start:vite- Start project frontend on vitenpm run start:dev- Start project frontend on webpack development server + storybooknpm run build:dev- Build in dev mode (not minified)npm run build:analyzed- Build in dev mode with the analyzernpm run build:prod- Build in prod modenpm run eslint- Check ts files with linternpm run eslint:fix- Fix ts files with linternpm run prettier- Fix ts files with prettiernpm run lint:scss- Checking scss file styles with linternpm run lint:scss:fix- Fixing scss file styles with linterlint-staged- Quick check staged files by eslint & prettier & stylelintnpm run test:unit- Start unit tests with jestnpm run test:ui- Start screenshot tests from lokinpm run test:ui:approve- Confirm new screenshotsnpm run test:ui:ci- Run screenshot tests in CInpm run test:ui:json- Generate json's report for screenshot testsnpm run test:ui:html- Generate HTML's report for screenshot testsnpm run test:ui:report- Generate full report for screenshot testsnpm run storybook- run Storybookstorybook:build- build Storybooknpm run fix:absolute:imports- Adding alias to absolute importsnpm run postinstall- Removes .cache's directory from node_modules every time we install some package
The project is written in accordance with the methodology Sliced design features
Documentation link - sliced design
The project uses the i18next library to work with translations. Translation files are found in public/locales.
i18next documentation - https://react.i18next.com/
The project uses 4 types of tests:
- Usual jest unit tests -
npm run test:unit - Component tests with React testing library -
npm run test:unit - Screenshot testing with loki
npm run test:ui - E2E testing with cypress
npm run test:e2e
The project uses eslint to check typescript code and stylelint to check files with styles.
npm run eslint- Check ts files with linternpm run eslint:fix- Fix ts files with linternpm run lint:scss- Checking scss file styles with linternpm run lint:scss:fix- Fixing scss file styles with linter
In the project, case stories are compiled for everyone. Server requests are mocked using storybook-addon-mock.
The soricase file is created next to the component with the extension .stories.tsx
You can start history with the command:
npm run storybook
Example:
import React from "react";
import { ComponentStory, ComponentMeta } from '@storybook/react';
import {ThemeDecorator} from '@/shared/config/storybook/ThemeDecorator/ThemeDecorator';
import {Button, ButtonSize, ButtonTheme} from './Button';
import { Theme } from '@/shared/const/theme';
export default {
title: 'general/button',
Component: Button,
argument types: {
backgroundColor: {control: 'color'},
},
} as ComponentMeta<typeofButton>;
const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />;
export const Primary = Template.bind({});
primary.arguments = {
children: "Text"
};
export constant Clear = Template.bind({});
Clear.args = {
children: "Text"
theme:ButtonTheme.CLEAR,
};For project development, there are 2 configs:
- Webpack - ./config/build
- Vite - vite.config.ts
Both collectors have been adapted to the main features of the application.
All found in /config
- /config/babel - babel
- /config/build - webpack configuration
- /config/jest - test environment setup
- /config/storybook - storybook settings
The scripts folder contains various scripts for refactoring\simplification of writing code\report generation, etc.
The github actions configuration is located in /.github/workflows. In ci, all types of tests, project and storybook assembly, linting are run.
In precommit hooks, we check the project with linters, the config is in /.husky
Interaction with data is carried out using the redux toolkit. Whenever possible, reusable entities should be normalized using the EntityAdapter
Server requests are sent using RTK query
For asynchronous connection of reducers (so as not to pull them into a common bundle), use DynamicModuleLoader
AboutPageMainPageProfilePageAdminPageUserSettingsArticleDetailsPageArticlesPageCreateArticlePageEditArticlePageErrorPageForbiddenPageNotFound
ArticleDetailsAdditionalInfoArticleEditingArticleInfiniteListArticlesFiltersArticleTypeCategoriesEditArticleToolsPageLoaderPageWrapperScrollToolbarUserActivity
UserProfileArticleCommentRatingCountryCurrencyNotificationAddNewCommentArticleCategoryArticleTypeTabsClickableAvatarSortSelector
ArticleCommentsArticleDetailsArticleRatingArticleRecommendationsListAuthByUsernameAuthorArticleTextListAuthorCommentsListAuthorRatingListAvatarDropdownEditableArticleEditableProfileCardLanguageTogglerLatestArticlesListMobileNotificationDrawerNotificationPopupScrollToTopThemeTogglerUiDesignTogglerViewToggler
deprecated componentsredesigned components