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: Comandos de Frontend
|
|
image: /images/user-guide/create-workspace/workspace-cover.png
|
|
---
|
|
|
|
<Frame>
|
|
<img src="/images/user-guide/create-workspace/workspace-cover.png" alt="Header" />
|
|
</Frame>
|
|
|
|
## Comandos úteis
|
|
|
|
### Iniciando o app
|
|
|
|
```bash
|
|
npx nx start twenty-front
|
|
```
|
|
|
|
### Regenerate graphql schema based on API graphql schema
|
|
|
|
```bash
|
|
npx nx run twenty-front:graphql:generate --configuration=metadata
|
|
```
|
|
|
|
OU
|
|
|
|
```bash
|
|
npx nx run twenty-front:graphql:generate
|
|
```
|
|
|
|
### Lint
|
|
|
|
```bash
|
|
npx nx run twenty-front:lint # pass --fix to fix lint errors
|
|
```
|
|
|
|
## Traduções
|
|
|
|
```bash
|
|
npx nx run twenty-front:lingui:extract
|
|
npx nx run twenty-front:lingui:compile
|
|
```
|
|
|
|
### Teste
|
|
|
|
```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)
|
|
```
|
|
|
|
## Pilha Tecnológica
|
|
|
|
O projeto tem uma pilha limpa e simples, com código boilerplate mínimo.
|
|
|
|
**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/)
|
|
|
|
**Testes**
|
|
|
|
- [Jest](https://jestjs.io/)
|
|
- [Storybook](https://storybook.js.org/)
|
|
|
|
**Ferramentas**
|
|
|
|
- [Yarn](https://yarnpkg.com/)
|
|
- [Craco](https://craco.js.org/docs/)
|
|
- [ESLint](https://eslint.org/)
|
|
|
|
## Arquitetura
|
|
|
|
### Roteamento
|
|
|
|
[React Router](https://reactrouter.com/) lida com o roteamento.
|
|
|
|
Para evitar [re-renderizações](/l/pt/developers/frontend-development/best-practices-front#managing-re-renders) desnecessárias, toda a lógica de roteamento está em um `useEffect` em `PageChangeEffect`.
|
|
|
|
### Gerenciamento de Estado
|
|
|
|
[Recoil](https://recoiljs.org/docs/introduction/core-concepts) lida com o gerenciamento de estado.
|
|
|
|
Veja [melhores práticas](/l/pt/developers/frontend-development/best-practices-front#state-management) para mais informações sobre o gerenciamento de estado.
|
|
|
|
## Testes
|
|
|
|
[Jest](https://jestjs.io/) serve como ferramenta para testes unitários enquanto [Storybook](https://storybook.js.org/) é para testes de componentes.
|
|
|
|
Jest é utilizado principalmente para testar funções utilitárias, não os próprios componentes.
|
|
|
|
Storybook destina-se a testar o comportamento de componentes isolados, bem como a exibir o sistema de design.
|
|
|