Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Commit

Permalink
chore: update cra (#78)
Browse files Browse the repository at this point in the history
* chore: update cra

* style: prettier

* chore: husky, lint-staged and prettier
  • Loading branch information
franklinjavier authored Oct 23, 2020
1 parent c02efed commit 5f8ff25
Show file tree
Hide file tree
Showing 13 changed files with 25,493 additions and 63 deletions.
27 changes: 21 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
build
node_modules
logs
*.log
*.log.*
coverage
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
12 changes: 10 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
"singleQuote": true,
"trailingComma": "none",
"jsxBracketSameLine": false,
"parser": "babylon",
"semi": false
"parser": "babel",
"semi": false,
"overrides": [
{
"files": "*.css",
"options": {
"parser": "css"
}
}
]
}
14,454 changes: 14,454 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

48 changes: 36 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,48 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.12.0",
"react-dom": "^16.12.0"
},
"devDependencies": {
"react-scripts": "3.3.0"
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "3.4.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test"
"test": "react-scripts test",
"coverage": "react-scripts test --coverage --watchAll=false",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
"lint-staged": {
"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": [
"prettier --write"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"husky": "^4.3.0",
"lint-staged": "^10.4.2",
"prettier": "^2.1.2"
}
}
10 changes: 6 additions & 4 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="https://res.cloudinary.com/beleza-na-web/image/upload/f_png,w_57,h_57,fl_progressive,q_auto:eco/v1/blz/assets-store/0.0.46/images/store/1/icon.svg" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
name="description"
content="Web site created using create-react-app"
/>
<meta name="theme-color" content="#000000" />
<link rel="apple-touch-icon" href="https://res.cloudinary.com/beleza-na-web/image/upload/f_png,w_57,h_57,fl_progressive,q_auto:eco/v1/blz/assets-store/0.0.46/images/store/1/icon.svg" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
Expand Down
12 changes: 11 additions & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,19 @@
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"src": "https://res.cloudinary.com/beleza-na-web/image/upload/f_png,w_57,h_57,fl_progressive,q_auto:eco/v1/blz/assets-store/0.0.46/images/store/1/icon.svg",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "https://res.cloudinary.com/beleza-na-web/image/upload/f_png,w_192,h_192,fl_progressive,q_auto:eco/v1/blz/assets-store/0.0.46/images/store/1/icon.svg",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "https://res.cloudinary.com/beleza-na-web/image/upload/f_png,w_512,h_512,fl_progressive,q_auto:eco/v1/blz/assets-store/0.0.46/images/store/1/icon.svg",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
Expand Down
3 changes: 3 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
15 changes: 0 additions & 15 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,3 @@
font-size: calc(10px + 2vmin);
color: white;
}

.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 40vmin;
pointer-events: none;
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
7 changes: 1 addition & 6 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import React from 'react'
import logo from './logo.svg'
import './App.css'

const App = () => (
<div className="App">
<img src={logo} className="App-logo" alt="logo" />
</div>
)
const App = () => <div className="App">Boa sorte! 🚀</div>

export default App
10 changes: 5 additions & 5 deletions src/App.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react'
import ReactDOM from 'react-dom'
import { render } from '@testing-library/react'
import App from './App'

it('renders without crashing', () => {
const div = document.createElement('div')
ReactDOM.render(<App />, div)
ReactDOM.unmountComponentAtNode(div)
test('renders learn react link', () => {
const { getByText } = render(<App />)
const linkElement = getByText(/beleza/i)
expect(linkElement).toBeInTheDocument()
})
26 changes: 14 additions & 12 deletions src/serviceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ const isLocalhost = Boolean(
window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' ||
// 127.0.0.1/8 is considered localhost for IPv4.
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
// 127.0.0.0/8 are considered localhost for IPv4.
window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)
)

export function register(config) {
Expand All @@ -27,7 +25,7 @@ export function register(config) {
if (publicUrl.origin !== window.location.origin) {
// Our service worker won't work if PUBLIC_URL is on a different origin
// from what our page is served on. This might happen if a CDN is used to
// serve assets see https://github.com/facebook/create-react-app/issues/2374
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
return
}

Expand Down Expand Up @@ -100,7 +98,9 @@ function registerValidSW(swUrl, config) {

function checkValidServiceWorker(swUrl, config) {
// Check if the service worker can be found. If it can't reload the page.
fetch(swUrl)
fetch(swUrl, {
headers: { 'Service-Worker': 'script' }
})
.then(response => {
// Ensure service worker exists, and that we really are getting a JS file.
const contentType = response.headers.get('content-type')
Expand All @@ -120,16 +120,18 @@ function checkValidServiceWorker(swUrl, config) {
}
})
.catch(() => {
console.log(
'No internet connection found. App is running in offline mode.'
)
console.log('No internet connection found. App is running in offline mode.')
})
}

export function unregister() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(registration => {
registration.unregister()
})
navigator.serviceWorker.ready
.then(registration => {
registration.unregister()
})
.catch(error => {
console.error(error.message)
})
}
}
1 change: 1 addition & 0 deletions src/setupTests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/jest-dom/extend-expect'
Loading

0 comments on commit 5f8ff25

Please sign in to comment.