Skip to content

Commit

Permalink
Merge branch 'develop' into 5-criando-componentes
Browse files Browse the repository at this point in the history
  • Loading branch information
lboaventura25 committed Sep 7, 2021
2 parents e8abbe0 + 421ba4a commit 705ebb2
Show file tree
Hide file tree
Showing 26 changed files with 4,547 additions and 3,205 deletions.
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
npm-debug.log
Dockerfile*
docker-compose*
.dockerignore
.git
.gitignore
README.md
LICENSE
.vscode
6 changes: 1 addition & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
FROM node:alpine

ARG YARN_PARAMS

ENV YARN_COMMAND=$YARN_PARAMS

WORKDIR /app

COPY frontend/package.json /app
Expand All @@ -16,4 +12,4 @@ COPY frontend/ /app

EXPOSE 3000

CMD yarn $YARN_COMMAND
CMD [ "/bin/sh", "-c", "yarn build && yarn serve" ]
42 changes: 31 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,41 @@ Se SIM, insira um manual (ou um script) para auxiliar ainda mais os interessados

## Informações Complementares

## Como rodar
## Ambientes
### Local
**[Disponível na porta 3000.](http://localhost:3000/)**

#### Build
### Ambiente de homologação
**[Disponível no Heroku]()**

```bash
$ docker-compose build
```
### Ambiente de produção
**[Disponível no Heroku]()**

***
## Colocando no ar localmente

#### Run service
- Caso esteja utilizando o vscode para desenvolver:
1. Instalar as dependências da aplicação:
```shell
yarn
```
2. Rodar a aplicação:
```shell
yarn start
```

```bash
$ docker-compose up
- Caso esteja utilizando outras formas para desenvolver ou queira somente rodar a aplicação:
1. Build:
```shell
docker-compose build
```
2. Rodar a aplicação:
```shell
docker-compose up
```

#### Parar o docker
## Rodando os testes

```bash
$ docker-compose down
```shell
yarn test
```
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ services:
build:
context: .
dockerfile: Dockerfile
args:
YARN_PARAMS: start
environment:
CHOKIDAR_USEPOLLING: "true"
stdin_open: true
volumes:
- /app/node_modules
- ./frontend:/app
ports:
- 3000:3000
command: /bin/sh -c "yarn start"
9 changes: 9 additions & 0 deletions frontend/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
6 changes: 6 additions & 0 deletions frontend/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**/*.js
node_modules
build
/src/react-app-env.d.ts
/src/reportWebVitals.ts
/*.js
65 changes: 65 additions & 0 deletions frontend/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"env": {
"browser": true,
"es6": true,
"jest": true
},
"extends": [
"plugin:react/recommended",
"airbnb",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": ["react", "react-hooks", "@typescript-eslint", "prettier"],
"rules": {
"prettier/prettier": "error",
"react/jsx-one-expression-per-line": "off",
"react/jsx-props-no-spreading": "off",
"react/prop-types": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"no-unused-expressions": "off",
"react/jsx-filename-extension": [1, { "extensions": [".tsx"] }],
"import/prefer-default-export": "off",
"import/no-duplicates": "off",
"@typescript-eslint/interface-name-prefix": [
"error",
{
"prefixWithI": "always"
}
],
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowExpressions": true
}
],
"import/extensions": [
"error",
"ignorePackages",
{
"ts": "never",
"tsx": "never"
}
]
},
"settings": {
"import/resolver": {
"typescript": {}
}
}
}
9 changes: 9 additions & 0 deletions frontend/config-overrides.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const jestConfig = require('./jest.config');

module.exports = {
jest(config) {
config.preset = jestConfig.preset;
config.reporters = jestConfig.reporters;
return config;
},
};
10 changes: 10 additions & 0 deletions frontend/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
preset: 'ts-jest',
setupFilesAfterEnv: ['@testing-library/jest-native/extend-expect'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
setupFiles: ['./jest.setup.js'],
moduleNameMapper: {
'\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/src/__mocks__/fileMock.ts',
},
};
73 changes: 48 additions & 25 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,59 @@
{
"name": "my-app",
"name": "ta-na-mesa",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"@types/jest": "^27.0.1",
"@types/node": "^16.6.2",
"@types/react": "^17.0.19",
"@types/react-dom": "^17.0.9",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"styled-components": "^5.3.1",
"typescript": "^4.3.5",
"web-vitals": "^1.0.1"
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"@types/jest": "^24.0.0",
"@types/node": "^12.0.0",
"@types/react": "^16.9.0",
"@types/react-dom": "^16.9.0",
"@types/react-modal": "^3.10.5",
"@unform/core": "^2.1.0",
"@unform/web": "^2.1.0",
"axios": "^0.19.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-icons": "^3.10.0",
"react-modal": "^3.11.2",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1",
"styled-components": "^5.1.0",
"typescript": "~3.7.2",
"yup": "^0.29.0"
},
"devDependencies": {
"@types/react-router-dom": "^5.1.4",
"@types/styled-components": "^5.1.0",
"@types/yup": "^0.26.36",
"@typescript-eslint/eslint-plugin": "^2.28.0",
"@typescript-eslint/parser": "^2.28.0",
"axios-mock-adapter": "^1.18.1",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-config-prettier": "^6.10.1",
"eslint-import-resolver-typescript": "^2.0.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^2.5.0",
"jest-environment-jsdom-sixteen": "^1.0.3",
"json-server": "^0.16.1",
"prettier": "^2.0.4",
"react-app-rewired": "^2.1.6",
"ts-jest": "^26.0.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"start": "react-app-rewired start",
"build": "rm -rf build && react-app-rewired build",
"serve": "serve -s build",
"test": "react-app-rewired test --watchAll --passWithNoTests",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
"extends": "react-app"
},
"browserslist": {
"production": [
Expand All @@ -40,8 +66,5 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@types/styled-components": "^5.1.13"
}
}
7 changes: 7 additions & 0 deletions frontend/prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
singleQuote: true,
trailingComma: 'all',
arrowParens: 'avoid',
tabWidth: 2,
semi: true
}
4 changes: 3 additions & 1 deletion frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">

<title>Tá na Mesa</title>
</head>
<body>
Expand Down
7 changes: 3 additions & 4 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React from 'react';

import GlobalStyle from 'styles/global';

import NavBar from 'components/NavBar';
import Routes from './routes/index';
import GlobalStyle from './styles/global';

const App: React.FC = () => {
return (
<>
<NavBar />
<Routes />
<GlobalStyle />
</>
);
Expand Down
11 changes: 11 additions & 0 deletions frontend/src/__tests__/pages/App.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';
import { render } from '@testing-library/react';
import App from '../../App';

describe('App', () => {
it('render ta na mesa application name', () => {
const { getByText } = render(<App />);
const linkElement = getByText('Tá Na Mesa');
expect(linkElement).toBeInTheDocument();
});
});
Empty file added frontend/src/assets/.gitkeep
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion frontend/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
document.getElementById('root'),
);
11 changes: 11 additions & 0 deletions frontend/src/pages/Home/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';

const Home: React.FC = () => {
return (
<>
<h1>Tá na Mesa</h1>
</>
);
};

export default Home;
1 change: 1 addition & 0 deletions frontend/src/pages/Home/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import styled from 'styled-components';
16 changes: 16 additions & 0 deletions frontend/src/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';
import { BrowserRouter, Switch, Route } from 'react-router-dom';

import Home from '../pages/Home';

const Routes: React.FC = () => {
return (
<BrowserRouter>
<Switch>
<Route exact path="/" component={Home} />
</Switch>
</BrowserRouter>
);
};

export default Routes;
Empty file added frontend/src/services/.gitkeep
Empty file.
2 changes: 1 addition & 1 deletion frontend/src/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';
import '@testing-library/jest-dom/extend-expect';
Loading

0 comments on commit 705ebb2

Please sign in to comment.