forked from Won-Games/client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit badbf4a
Showing
39 changed files
with
15,329 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"plugins": [ | ||
[ | ||
"babel-plugin-styled-components", | ||
{ | ||
"ssr": true | ||
} | ||
] | ||
], | ||
"presets": ["next/babel", "@babel/preset-typescript"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = spaces | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
!.storybook | ||
!.jest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2020": true, | ||
"jest": true, | ||
"node": true | ||
}, | ||
"settings": { | ||
"react": { | ||
"version": "detect" | ||
} | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:react/recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:prettier/recommended" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaFeatures": { | ||
"jsx": true | ||
}, | ||
"ecmaVersion": 11, | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["react", "react-hooks", "@typescript-eslint"], | ||
"rules": { | ||
"react-hooks/rules-of-hooks": "error", | ||
"react-hooks/exhaustive-deps": "warn", | ||
"react/prop-types": "off", | ||
"react/react-in-jsx-scope": "off", | ||
"@typescript-eslint/explicit-module-boundary-types": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: ci | ||
on: [pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14.x | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Linting | ||
run: yarn lint | ||
|
||
- name: Test | ||
run: yarn test | ||
|
||
- name: Build | ||
run: yarn build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# local env files | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# sw stuff | ||
public/sw.js | ||
public/workbox-*.js | ||
|
||
# storybook | ||
storybook-static |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import '@testing-library/jest-dom' | ||
import 'jest-styled-components' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
!.storybook | ||
!.jest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"trailingComma": "none", | ||
"semi": false, | ||
"singleQuote": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
stories: ['../src/components/**/stories.tsx'], | ||
addons: ['@storybook/addon-essentials'] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import GlobalStyles from '../src/styles/global' | ||
|
||
export const decorators = [ | ||
(Story) => ( | ||
<> | ||
<GlobalStyles /> | ||
<Story /> | ||
</> | ||
) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"editor.formatOnSave": false, | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
 | ||
|
||
This is a [Next.js](https://nextjs.org/) boilerplate to be used in a course called [React Avançado](https://reactavancado.com.br/). | ||
 | ||
## What is inside? | ||
|
||
This project uses lot of stuff as: | ||
|
||
- [TypeScript](https://www.typescriptlang.org/) | ||
- [NextJS](https://nextjs.org/) | ||
- [Styled Components](https://styled-components.com/) | ||
- [Jest](https://jestjs.io/) | ||
- [React Testing Library](https://testing-library.com/docs/react-testing-library/intro) | ||
- [Storybook](https://storybook.js.org/) | ||
- [Eslint](https://eslint.org/) | ||
- [Prettier](https://prettier.io/) | ||
- [Husky](https://github.com/typicode/husky) | ||
|
||
## Getting Started | ||
|
||
First, run the development server: | ||
|
||
```bash | ||
npm run dev | ||
# or | ||
yarn dev | ||
``` | ||
|
||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. | ||
|
||
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file. | ||
|
||
## Commands | ||
|
||
- `dev`: runs your application on `localhost:3000` | ||
- `build`: creates the production build version | ||
- `start`: starts a simple server with the build production code | ||
- `lint`: runs the linter in all components and pages | ||
- `test`: runs jest to test all components and pages | ||
- `test:watch`: runs jest in watch mode | ||
- `storybook`: runs storybook on `localhost:6006` | ||
- `build-storybook`: create the build version of storybook | ||
|
||
## Learn More | ||
|
||
To learn more about Next.js, take a look at the following resources: | ||
|
||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. | ||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. | ||
|
||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! | ||
|
||
## Deploy on Vercel | ||
|
||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/import?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. | ||
|
||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module.exports = (plop) => { | ||
plop.setGenerator('component', { | ||
description: 'Create a component', | ||
prompts: [ | ||
{ | ||
type: 'input', | ||
name: 'name', | ||
message: 'What is your component name?' | ||
} | ||
], | ||
actions: [ | ||
{ | ||
type: 'add', | ||
path: '../src/components/{{pascalCase name}}/index.tsx', | ||
templateFile: 'templates/Component.tsx.hbs' | ||
}, | ||
{ | ||
type: 'add', | ||
path: '../src/components/{{pascalCase name}}/styles.ts', | ||
templateFile: 'templates/styles.ts.hbs' | ||
}, | ||
{ | ||
type: 'add', | ||
path: '../src/components/{{pascalCase name}}/stories.tsx', | ||
templateFile: 'templates/stories.tsx.hbs' | ||
}, | ||
{ | ||
type: 'add', | ||
path: '../src/components/{{pascalCase name}}/test.tsx', | ||
templateFile: 'templates/test.tsx.hbs' | ||
} | ||
] | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import * as S from './styles' | ||
|
||
const {{pascalCase name}} = () => ( | ||
<S.Wrapper> | ||
<h1>{{pascalCase name}}</h1> | ||
</S.Wrapper> | ||
) | ||
|
||
export default {{pascalCase name}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Story, Meta } from '@storybook/react/types-6-0' | ||
import {{pascalCase name}} from '.' | ||
|
||
export default { | ||
title: '{{pascalCase name}}', | ||
component: {{pascalCase name}} | ||
} as Meta | ||
|
||
export const Default: Story = () => <{{pascalCase name}} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import styled from 'styled-components' | ||
|
||
export const Wrapper = styled.main`` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { render, screen } from '@testing-library/react' | ||
|
||
import {{pascalCase name}} from '.' | ||
|
||
describe('<{{pascalCase name}} />', () => { | ||
it('should render the heading', () => { | ||
const { container } = render(<{{pascalCase name}} />) | ||
|
||
expect(screen.getByRole('heading', { name: /{{pascalCase name}}/i })).toBeInTheDocument() | ||
|
||
expect(container.firstChild).toMatchSnapshot() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
testEnvironment: 'jsdom', | ||
testPathIgnorePatterns: ['/node_modules/', '/.next/'], | ||
collectCoverage: true, | ||
collectCoverageFrom: ['src/**/*.ts(x)?', '!src/**/stories.tsx'], | ||
setupFilesAfterEnv: ['<rootDir>/.jest/setup.ts'], | ||
modulePaths: ['<rootDir>/src/'] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/types/global" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const withPWA = require('next-pwa') | ||
const isProd = process.env.NODE_ENV === 'production' | ||
|
||
module.exports = withPWA({ | ||
pwa: { | ||
dest: 'public', | ||
disable: !isProd | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
"name": "react-avancado-boilerplate", | ||
"version": "1.0.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "next dev", | ||
"build": "next build", | ||
"start": "next start", | ||
"lint": "eslint src --max-warnings=0", | ||
"test": "jest", | ||
"test:watch": "yarn test --watch", | ||
"generate": "yarn plop --plopfile generators/plopfile.js", | ||
"storybook": "start-storybook -s ./public -p 6006", | ||
"build-storybook": "build-storybook -s ./public" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"lint-staged": { | ||
"src/**/*": [ | ||
"yarn lint --fix", | ||
"yarn test --findRelatedTests --bail" | ||
] | ||
}, | ||
"dependencies": { | ||
"next": "9.5.2", | ||
"next-pwa": "^3.1.1", | ||
"react": "16.13.1", | ||
"react-dom": "16.13.1", | ||
"styled-components": "^5.1.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.11.4", | ||
"@babel/preset-typescript": "^7.10.4", | ||
"@storybook/addon-essentials": "6.0.16", | ||
"@storybook/react": "6.0.16", | ||
"@testing-library/jest-dom": "^5.11.3", | ||
"@testing-library/react": "^10.4.9", | ||
"@types/jest": "^26.0.10", | ||
"@types/node": "^14.6.0", | ||
"@types/react": "^16.9.46", | ||
"@types/styled-components": "^5.1.2", | ||
"@typescript-eslint/eslint-plugin": "^3.9.1", | ||
"@typescript-eslint/parser": "^3.9.1", | ||
"babel-loader": "^8.1.0", | ||
"babel-plugin-styled-components": "^1.11.1", | ||
"eslint": "^7.7.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"eslint-plugin-react": "^7.20.6", | ||
"eslint-plugin-react-hooks": "^4.1.0", | ||
"husky": "^4.2.5", | ||
"jest": "^26.4.1", | ||
"jest-styled-components": "^7.0.3", | ||
"lint-staged": "^10.2.11", | ||
"plop": "^2.7.4", | ||
"prettier": "^2.0.5", | ||
"typescript": "^4.0.2" | ||
} | ||
} |
Oops, something went wrong.