Created by Github action --------- Co-authored-by: github-actions <github-actions@twenty.com>
97 lines
2.3 KiB
Plaintext
97 lines
2.3 KiB
Plaintext
---
|
|
title: Frontend-kommandoer
|
|
image: /images/user-guide/create-workspace/workspace-cover.png
|
|
---
|
|
|
|
<Frame>
|
|
<img src="/images/user-guide/create-workspace/workspace-cover.png" alt="Header" />
|
|
</Frame>
|
|
|
|
## Nyttige kommandoer
|
|
|
|
### Start af appen
|
|
|
|
```bash
|
|
npx nx start twenty-front
|
|
```
|
|
|
|
### Gengenerér graphql-skema baseret på API graphql-skema
|
|
|
|
```bash
|
|
npx nx run twenty-front:graphql:generate --configuration=metadata
|
|
```
|
|
|
|
ELLER
|
|
|
|
```bash
|
|
npx nx run twenty-front:graphql:generate
|
|
```
|
|
|
|
### Lint
|
|
|
|
```bash
|
|
npx nx run twenty-front:lint # pass --fix to fix lint errors
|
|
```
|
|
|
|
## Oversættelser
|
|
|
|
```bash
|
|
npx nx run twenty-front:lingui:extract
|
|
npx nx run twenty-front:lingui:compile
|
|
```
|
|
|
|
### Test
|
|
|
|
```bash
|
|
npx nx run twenty-front:test # run jest tests
|
|
npx nx run twenty-front:storybook:serve:dev # run storybook
|
|
npx nx run twenty-front:storybook:test # run tests # (needs yarn storybook:serve:dev to be running)
|
|
npx nx run twenty-front:storybook:coverage # (needs yarn storybook:serve:dev to be running)
|
|
```
|
|
|
|
## Tek Stack
|
|
|
|
Projektet har en ren og simpel stack, med minimal boilerplate kode.
|
|
|
|
**App**
|
|
|
|
- [React](https://react.dev/)
|
|
- [Apollo](https://www.apollographql.com/docs/)
|
|
- [GraphQL Codegen](https://the-guild.dev/graphql/codegen)
|
|
- [Recoil](https://recoiljs.org/docs/introduction/core-concepts)
|
|
- [TypeScript](https://www.typescriptlang.org/)
|
|
|
|
**Testning**
|
|
|
|
- [Jest](https://jestjs.io/)
|
|
- [Storybook](https://storybook.js.org/)
|
|
|
|
**Værktøjer**
|
|
|
|
- [Yarn](https://yarnpkg.com/)
|
|
- [Craco](https://craco.js.org/docs/)
|
|
- [ESLint](https://eslint.org/)
|
|
|
|
## Arkitektur
|
|
|
|
### Routing
|
|
|
|
[React Router](https://reactrouter.com/) håndterer rutingen.
|
|
|
|
For at undgå unødvendige [re-renders](/l/da/developers/frontend-development/best-practices-front#managing-re-renders) er al rutelogik i en `useEffect` i `PageChangeEffect`.
|
|
|
|
### State Management
|
|
|
|
[Recoil](https://recoiljs.org/docs/introduction/core-concepts) håndterer tilstandsadministration.
|
|
|
|
Se [best practices](/l/da/developers/frontend-development/best-practices-front#state-management) for mere information om tilstandsadministration.
|
|
|
|
## Testning
|
|
|
|
[Jest](https://jestjs.io/) bruges som værktøj til enhedstest, mens [Storybook](https://storybook.js.org/) er til komponenttest.
|
|
|
|
Jest er primært til test af hjælpefunktioner, og ikke komponenterne selv.
|
|
|
|
Storybook er til at teste opførselen af isolerede komponenter, samt vise design systemet.
|
|
|