9bc5486d0d
Created by Github action --------- Co-authored-by: github-actions <github-actions@twenty.com>
97 lines
2.5 KiB
Plaintext
97 lines
2.5 KiB
Plaintext
---
|
|
title: Frontend-komennot
|
|
image: /images/user-guide/create-workspace/workspace-cover.png
|
|
---
|
|
|
|
<Frame>
|
|
<img src="/images/user-guide/create-workspace/workspace-cover.png" alt="Header" />
|
|
</Frame>
|
|
|
|
## Hyödylliset komennot
|
|
|
|
### Sovelluksen käynnistäminen
|
|
|
|
```bash
|
|
npx nx start twenty-front
|
|
```
|
|
|
|
### Uudelleenluo GraphQL-skeema API GraphQL-skeeman perusteella
|
|
|
|
```bash
|
|
npx nx run twenty-front:graphql:generate --configuration=metadata
|
|
```
|
|
|
|
TAI
|
|
|
|
```bash
|
|
npx nx run twenty-front:graphql:generate
|
|
```
|
|
|
|
### Lint
|
|
|
|
```bash
|
|
npx nx run twenty-front:lint # pass --fix to fix lint errors
|
|
```
|
|
|
|
## Käännökset
|
|
|
|
```bash
|
|
npx nx run twenty-front:lingui:extract
|
|
npx nx run twenty-front:lingui:compile
|
|
```
|
|
|
|
### Testi
|
|
|
|
```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)
|
|
```
|
|
|
|
## Tekniikkapino
|
|
|
|
Projektilla on yksinkertainen ja selkeä pino, jossa on minimaalinen määrä mallikoodia.
|
|
|
|
**Sovellus**
|
|
|
|
- [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/)
|
|
|
|
**Testaus**
|
|
|
|
- [Jest](https://jestjs.io/)
|
|
- [Storybook](https://storybook.js.org/)
|
|
|
|
**Työkalut**
|
|
|
|
- [Yarn](https://yarnpkg.com/)
|
|
- [Craco](https://craco.js.org/docs/)
|
|
- [ESLint](https://eslint.org/)
|
|
|
|
## Arkkitehtuuri
|
|
|
|
### Routing
|
|
|
|
[React Router](https://reactrouter.com/) hoitaa reititykset.
|
|
|
|
Välttyäksesi tarpeettomilta [uudelleenpiirroilta](/l/fi/developers/frontend-development/best-practices-front#managing-re-renders), kaikki reitityksen logiikka on `useEffect`-piirissä `PageChangeEffect`-komponentissa.
|
|
|
|
### Tilanhallinta
|
|
|
|
[Recoil](https://recoiljs.org/docs/introduction/core-concepts) vastaa tilanhallinnasta.
|
|
|
|
Katso [best practices](/l/fi/developers/frontend-development/best-practices-front#state-management) saadaksesi lisätietoa tilanhallinnasta.
|
|
|
|
## Testaus
|
|
|
|
[Jest](https://jestjs.io/) toimii yksikkötestauksen työkaluna, kun taas [Storybook](https://storybook.js.org/) vastaa komponenttien testaamisesta.
|
|
|
|
Jest on ensisijaisesti hyötyfunktioiden testaukseen, ei varsinaisten komponenttien.
|
|
|
|
Storybook vastaa eristettyjen komponenttien käyttäytymisen testaamisesta ja suunnittelujärjestelmän esittämisestä.
|
|
|