Skip to content

Commit 6930ea5

Browse files
author
flamarionfagundes
committed
chore: project base
0 parents  commit 6930ea5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+13672
-0
lines changed

.editorconfig

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
ident_style = spaces
5+
ident_size = 2
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true

.eslintrc.json

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2021": true,
5+
"jest": true,
6+
"node": true
7+
},
8+
"settings": {
9+
"react": {
10+
"version": "detect"
11+
}
12+
},
13+
"extends": [
14+
"eslint:recommended",
15+
"plugin:react/recommended",
16+
"plugin:@typescript-eslint/recommended",
17+
"plugin:prettier/recommended"
18+
],
19+
"parser": "@typescript-eslint/parser",
20+
"parserOptions": {
21+
"ecmaFeatures": {
22+
"jsx": true
23+
},
24+
"ecmaVersion": "latest",
25+
"sourceType": "module"
26+
},
27+
"plugins": [
28+
"react",
29+
"@typescript-eslint",
30+
"react-hooks"
31+
],
32+
"rules": {
33+
"react-hooks/rules-of-hooks": "error",
34+
"react-hooks/exhaustive-deps": "warn",
35+
"react/prop-types": "off",
36+
"react/react-in-jsx-scope": "off",
37+
"@typescript-eslint/no-var-requires": "off",
38+
"@typescript-eslint/explicit-module-boundary-types": "off"
39+
}
40+
}

.gitignore

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# testing
16+
coverage
17+
18+
# Editor directories and files
19+
.vscode/*
20+
!.vscode/extensions.json
21+
.idea
22+
.DS_Store
23+
*.suo
24+
*.ntvs*
25+
*.njsproj
26+
*.sln
27+
*.sw?

.husky/pre-commit

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
yarn lint --fix
5+
yarn test

.jest/setup.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import '@testing-library/jest-dom'

.prettierrc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"trailingComma": "es5",
3+
"tabWidth": 2,
4+
"printWidth": 100,
5+
"semi": true,
6+
"singleQuote": true,
7+
"endOfLine": "auto"
8+
}

.storybook/main.cjs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module.exports = {
2+
"stories": [
3+
"../src/components/**/*.stories.tsx",
4+
"../src/pages/**/*.stories.tsx"
5+
],
6+
"addons": [
7+
"@storybook/addon-links",
8+
"@storybook/addon-essentials",
9+
"@storybook/addon-interactions",
10+
{
11+
name: "@storybook/addon-postcss",
12+
options: {
13+
postcssLoaderOptions: {
14+
implementation: require("postcss"),
15+
},
16+
},
17+
},
18+
],
19+
"framework": "@storybook/react",
20+
"core": {
21+
"builder": "@storybook/builder-vite"
22+
},
23+
"features": {
24+
"storyStoreV7": true
25+
}
26+
}

.storybook/preview-head.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<link href="/styles/roboto.css" rel="stylesheet">
2+
3+
<script>
4+
window.global = window;
5+
</script>

.storybook/preview.cjs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import '../src/styles/global.css';
2+
3+
export const parameters = {
4+
actions: { argTypesRegex: "^on[A-Z].*" },
5+
controls: {
6+
matchers: {
7+
color: /(background|color)$/i,
8+
date: /Date$/,
9+
},
10+
},
11+
}

generators/plopfile.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
export default function (plop) {
2+
plop.setGenerator('component', {
3+
description: 'application component logic',
4+
prompts: [
5+
{
6+
type: 'input',
7+
name: 'name',
8+
message: 'Nome do componente',
9+
},
10+
],
11+
actions: [
12+
{
13+
type: 'add',
14+
path: '../src/components/{{pascalCase name}}/{{pascalCase name}}.tsx',
15+
templateFile: 'templates/component.tsx.hbs',
16+
},
17+
{
18+
type: 'add',
19+
path: '../src/components/{{pascalCase name}}/{{pascalCase name}}.stories.tsx',
20+
templateFile: 'templates/stories.tsx.hbs',
21+
},
22+
{
23+
type: 'add',
24+
path: '../src/components/{{pascalCase name}}/{{pascalCase name}}.test.tsx',
25+
templateFile: 'templates/test.ts.hbs',
26+
},
27+
],
28+
});
29+
}
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import * as S from './{{pascalCase name}}.styles';
2+
3+
export const {{pascalCase name}} = () => {
4+
return (
5+
<S.Wrapper>
6+
<h1>{{pascalCase name}}</h1>
7+
</S.Wrapper>
8+
);
9+
};

generators/templates/stories.tsx.hbs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
import { Story } from '@storybook/react';
3+
import { {{pascalCase name}} } from './{{pascalCase name}}';
4+
5+
const Template: Story = (args) => <{{pascalCase name}} {...args} />;
6+
7+
export const Default = Template.bind({});
8+
Default.args = {};
9+
10+
export default {
11+
title: 'components/{{pascalCase name}}',
12+
component: {{pascalCase name}},
13+
};

generators/templates/test.ts.hbs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { render, screen } from '@testing-library/react';
2+
import { {{pascalCase name}} } from './{{pascalCase name}}';
3+
4+
describe('Testing the {{pascalCase name}} component', () => {
5+
it('should render correctly', () => {
6+
render(<{{pascalCase name}} />);
7+
8+
expect(screen.getByRole('div')).toBeInTheDocument();
9+
});
10+
});

index.html

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link href="/styles/roboto.css" rel="stylesheet">
6+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8+
<title>Vite + React + TS</title>
9+
</head>
10+
<body>
11+
<div id="root"></div>
12+
<script type="module" src="/src/main.tsx"></script>
13+
</body>
14+
</html>

jest.config.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export default {
2+
testEnvironment: 'jsdom',
3+
testPathIgnorePatterns: ['/node_modules/', '/.next/'],
4+
collectCoverage: true,
5+
collectCoverageFrom: ['src/**/*.ts(x)'],
6+
setupFilesAfterEnv: ['<rootDir>/.jest/setup.ts'],
7+
transform: {
8+
'^.+\\.tsx?$': 'ts-jest',
9+
},
10+
};

package.json

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"name": "vite-react-main-boilerplate",
3+
"private": true,
4+
"version": "0.0.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "tsc && vite build",
9+
"preview": "vite preview",
10+
"lint": "eslint src --max-warnings=0",
11+
"test": "jest",
12+
"test:watch": "yarn test --watch",
13+
"prepare": "husky install",
14+
"generate": "yarn plop --plopfile ./generators/plopfile.js",
15+
"storybook": "start-storybook -p 6006",
16+
"build-storybook": "build-storybook"
17+
},
18+
"dependencies": {
19+
"beautiful-react-hooks": "^3.11.1",
20+
"radash": "^7.1.0",
21+
"react": "^18.2.0",
22+
"react-dom": "^18.2.0",
23+
"react-router-dom": "^6.3.0"
24+
},
25+
"devDependencies": {
26+
"@babel/core": "^7.18.10",
27+
"@storybook/addon-actions": "^6.5.10",
28+
"@storybook/addon-essentials": "^6.5.10",
29+
"@storybook/addon-interactions": "^6.5.12",
30+
"@storybook/addon-links": "^6.5.10",
31+
"@storybook/builder-vite": "^0.2.2",
32+
"@storybook/react": "^6.5.10",
33+
"@storybook/testing-library": "^0.0.13",
34+
"@testing-library/jest-dom": "^5.16.5",
35+
"@testing-library/react": "^13.3.0",
36+
"@types/jest": "^28.1.7",
37+
"@types/react": "^18.0.17",
38+
"@types/react-dom": "^18.0.6",
39+
"@typescript-eslint/eslint-plugin": "^5.33.0",
40+
"@typescript-eslint/parser": "^5.33.0",
41+
"@vitejs/plugin-react": "^2.0.1",
42+
"autoprefixer": "^10.4.12",
43+
"babel-loader": "^8.2.5",
44+
"eslint": "8.21.0",
45+
"eslint-config-prettier": "^8.5.0",
46+
"eslint-plugin-prettier": "^4.2.1",
47+
"eslint-plugin-react": "^7.30.1",
48+
"eslint-plugin-react-hooks": "^4.6.0",
49+
"eslint-plugin-storybook": "^0.6.4",
50+
"husky": "^8.0.0",
51+
"jest": "^28.1.3",
52+
"jest-environment-jsdom": "^28.1.3",
53+
"plop": "^3.1.1",
54+
"postcss": "^8.4.16",
55+
"prettier": "2.7.1",
56+
"tailwindcss": "^3.1.8",
57+
"ts-jest": "^28.0.8",
58+
"ts-node": "^10.9.1",
59+
"typescript": "^4.6.4",
60+
"vite": "^3.0.7",
61+
"vite-tsconfig-paths": "^3.5.0"
62+
}
63+
}

postcss.config.cjs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
plugins: {
3+
tailwindcss: {},
4+
autoprefixer: {},
5+
},
6+
}

public/fonts/Roboto-Black.ttf

164 KB
Binary file not shown.

public/fonts/Roboto-BlackItalic.ttf

170 KB
Binary file not shown.

public/fonts/Roboto-Bold.ttf

163 KB
Binary file not shown.

public/fonts/Roboto-BoldItalic.ttf

167 KB
Binary file not shown.

public/fonts/Roboto-Italic.ttf

167 KB
Binary file not shown.

public/fonts/Roboto-Light.ttf

163 KB
Binary file not shown.

public/fonts/Roboto-LightItalic.ttf

169 KB
Binary file not shown.

public/fonts/Roboto-Medium.ttf

165 KB
Binary file not shown.

public/fonts/Roboto-MediumItalic.ttf

169 KB
Binary file not shown.

public/fonts/Roboto-Regular.ttf

164 KB
Binary file not shown.

public/fonts/Roboto-Thin.ttf

165 KB
Binary file not shown.

public/fonts/Roboto-ThinItalic.ttf

169 KB
Binary file not shown.

public/images/typescript-logo.png

5.17 KB
Loading

public/styles/roboto.css

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
@font-face {
2+
font-family: 'Roboto';
3+
src: url('../fonts/Roboto-Thin.ttf') format('truetype');
4+
font-weight: 100;
5+
font-style: normal;
6+
}
7+
8+
@font-face {
9+
font-family: 'Roboto';
10+
src: url('../fonts/Roboto-ThinItalic.ttf') format('truetype');
11+
font-weight: 100;
12+
font-style: italic;
13+
}
14+
15+
@font-face {
16+
font-family: 'Roboto';
17+
src: url('../fonts/Roboto-Light.ttf') format('truetype');
18+
font-weight: 300;
19+
font-style: normal;
20+
}
21+
22+
@font-face {
23+
font-family: 'Roboto';
24+
src: url('../fonts/Roboto-LightItalic.ttf') format('truetype');
25+
font-weight: 300;
26+
font-style: italic;
27+
}
28+
29+
@font-face {
30+
font-family: 'Roboto';
31+
src: url('../fonts/Roboto-Regular.ttf') format('truetype');
32+
font-weight: 400;
33+
font-style: normal;
34+
}
35+
36+
@font-face {
37+
font-family: 'Roboto';
38+
src: url('../fonts/Roboto-Italic.ttf') format('truetype');
39+
font-weight: 400;
40+
font-style: italic;
41+
}
42+
43+
@font-face {
44+
font-family: 'Roboto';
45+
src: url('../fonts/Roboto-Medium.ttf') format('truetype');
46+
font-weight: 500;
47+
font-style: normal;
48+
}
49+
50+
@font-face {
51+
font-family: 'Roboto';
52+
src: url('../fonts/Roboto-MediumItalic.ttf') format('truetype');
53+
font-weight: 500;
54+
font-style: italic;
55+
}
56+
57+
@font-face {
58+
font-family: 'Roboto';
59+
src: url('../fonts/Roboto-Bold.ttf') format('truetype');
60+
font-weight: 700;
61+
font-style: normal;
62+
}
63+
64+
@font-face {
65+
font-family: 'Roboto';
66+
src: url('../fonts/Roboto-BoldItalic.ttf') format('truetype');
67+
font-weight: 700;
68+
font-style: italic;
69+
}
70+
71+
@font-face {
72+
font-family: 'Roboto';
73+
src: url('../fonts/Roboto-Black.ttf') format('truetype');
74+
font-weight: 900;
75+
font-style: normal;
76+
}
77+
78+
@font-face {
79+
font-family: 'Roboto';
80+
src: url('../fonts/Roboto-BlackItalic.ttf') format('truetype');
81+
font-weight: 900;
82+
font-style: italic;
83+
}

public/vite.svg

+1
Loading

readme.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Vite React Main Boilerplate using Typescript + Tailwind CSS.

src/App.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Routes from './routes';
2+
3+
export default function App() {
4+
return <Routes />;
5+
}

0 commit comments

Comments
 (0)