yarn - install dependencies
yarn start:dev - start server + frontend project in dev mode
yarn start
- Running a frontend project on webpack dev serveryarn start:dev
- Running a frontend project on webpack dev server + backendyarn start:dev:server
- Running backend serveryarn build
- Build in dev mode (not minimized)yarn build:production
- Build in prod modeyarn lint:ts
- Checking ts files with linteryarn lint:ts:fix
- Fix ts files with linteryarn lint:scss
- Checking style scss files with a linteryarn lint:scss:fix
- Fix scss style files with a linteryarn test:unit
- Running unit tests with jestyarn test:ui
- Running screenshot tests with lokiyarn test:e2e
- Running e2e testing with cypressyarn test:ui:approve
- Running screenshot tests with lokiyarn test:ui:report
- Generating a full report for screenshot testsyarn test:ui:json
- Generating a JSON report for screenshot testsyarn test:ui:html
- Generating HTML report for screenshot testsyarn storybook
- Running a storybookyarn build:storybook
- Build storybookyarn analyze:dev
- Bundle size report in dev modeyarn analyze:prod
- Bundle size report in prod modeyarn generate:fsd:slice
- Script for generating FSD slicesyarn refactor:update:imports
- Script for updating project imports
The project was written in accordance with the Feature Sliced Design methodology.
Link to documentation - Feature Sliced Design
The project uses the i18next library to work with translations. Translation files are stored in public/locales.
Link to i18next document - i18next
The project uses 3 types of tests:
- Unit tests with jest -
yarn test:unit
- Component tests with React testing library -
yarn test:unit
- Screenshot testing with loki -
yarn test:ui
- e2e testing with cypress -
yarn test:e2e
The project uses eslint to check typescript code and stylelint to check style files.
Also for strict control of the main architectural principles uses its own eslint plugin eslint-plugin-feature-sliced-design-path-checker, which contains 3 rules:
-
path-checker - prohibits use of absolute imports within one module
-
layer-imports - checks the correct use of layers in terms of FSD (for example widgets cannot be used in features and entitites)
-
public-api-imports - allows import from other modules only from public api. Has auto fix
yarn lint:ts
- Checking ts files with linteryarn lint:ts:fix
- Fix ts files with linteryarn lint:scss
- Checking style scss files with a linteryarn lint:scss:fix
- Fix scss style files with a linter
The project describes story cases for each component.
A file with story cases is created next to the component with extension .stories.tsx
You can run storybook with the command:
yarn storybook
Example:
import type { Meta, StoryObj } from '@storybook/react'
import { Theme } from '@/shared/constants/theme'
import { ThemeDecorator } from '@/shared/config/storybook'
import { Button } from './Button'
const meta: Meta<typeof Button> = {
title: 'shared/Button',
component: Button,
parameters: {},
argTypes: {}
}
export default meta
type Story = StoryObj<typeof Button>;
export const TextLight: Story = {
args: {
children: 'Text button'
}
}
export const TextInverted: Story = {
args: {
children: 'Text button',
variant: 'textInverted'
}
}
export const OutlinedLight: Story = {
args: {
children: 'Outlined button',
variant: 'outlined'
}
}
For development, the project contains webpack.
Bundler is adapted to the main features of the application.
All configuration is stored in config:
- Babel - Babel config
- Webpack - Webpack config
- Unit tests - Test environment config
- Storybook - Storybook config
The scripts
folder contains various scripts for refactoring/simplifying code writing\generating reports, etc.
The github actions configuration is located in pipeline. All types of tests, project and storybook assembly, and linting are run in ci.
In pre-commit hooks check the project with linters, config in husky.
Interaction with data is carried out using the redux toolkit. If possible, reused entities should be normalized using EntityAdapter.
Requests to the server are sent using RTK query.
For asynchronous connection of reducers (so as not to pull them into a common bundle) it is used hook useDynamicModuleLoader.