Skip to content

Commit

Permalink
chore: project base
Browse files Browse the repository at this point in the history
  • Loading branch information
flamarionfagundes committed Sep 24, 2022
0 parents commit 6930ea5
Show file tree
Hide file tree
Showing 60 changed files with 13,672 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
ident_style = spaces
ident_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
40 changes: 40 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"env": {
"browser": true,
"es2021": true,
"jest": true,
"node": true
},
"settings": {
"react": {
"version": "detect"
}
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint",
"react-hooks"
],
"rules": {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react/prop-types": "off",
"react/react-in-jsx-scope": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/explicit-module-boundary-types": "off"
}
}
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# testing
coverage

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint --fix
yarn test
1 change: 1 addition & 0 deletions .jest/setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/jest-dom'
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"printWidth": 100,
"semi": true,
"singleQuote": true,
"endOfLine": "auto"
}
26 changes: 26 additions & 0 deletions .storybook/main.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
"stories": [
"../src/components/**/*.stories.tsx",
"../src/pages/**/*.stories.tsx"
],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
{
name: "@storybook/addon-postcss",
options: {
postcssLoaderOptions: {
implementation: require("postcss"),
},
},
},
],
"framework": "@storybook/react",
"core": {
"builder": "@storybook/builder-vite"
},
"features": {
"storyStoreV7": true
}
}
5 changes: 5 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<link href="/styles/roboto.css" rel="stylesheet">

<script>
window.global = window;
</script>
11 changes: 11 additions & 0 deletions .storybook/preview.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import '../src/styles/global.css';

export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}
29 changes: 29 additions & 0 deletions generators/plopfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export default function (plop) {
plop.setGenerator('component', {
description: 'application component logic',
prompts: [
{
type: 'input',
name: 'name',
message: 'Nome do componente',
},
],
actions: [
{
type: 'add',
path: '../src/components/{{pascalCase name}}/{{pascalCase name}}.tsx',
templateFile: 'templates/component.tsx.hbs',
},
{
type: 'add',
path: '../src/components/{{pascalCase name}}/{{pascalCase name}}.stories.tsx',
templateFile: 'templates/stories.tsx.hbs',
},
{
type: 'add',
path: '../src/components/{{pascalCase name}}/{{pascalCase name}}.test.tsx',
templateFile: 'templates/test.ts.hbs',
},
],
});
}
9 changes: 9 additions & 0 deletions generators/templates/component.tsx.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as S from './{{pascalCase name}}.styles';

export const {{pascalCase name}} = () => {
return (
<S.Wrapper>
<h1>{{pascalCase name}}</h1>
</S.Wrapper>
);
};
13 changes: 13 additions & 0 deletions generators/templates/stories.tsx.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import { Story } from '@storybook/react';
import { {{pascalCase name}} } from './{{pascalCase name}}';

const Template: Story = (args) => <{{pascalCase name}} {...args} />;

export const Default = Template.bind({});
Default.args = {};

export default {
title: 'components/{{pascalCase name}}',
component: {{pascalCase name}},
};
10 changes: 10 additions & 0 deletions generators/templates/test.ts.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { render, screen } from '@testing-library/react';
import { {{pascalCase name}} } from './{{pascalCase name}}';

describe('Testing the {{pascalCase name}} component', () => {
it('should render correctly', () => {
render(<{{pascalCase name}} />);

expect(screen.getByRole('div')).toBeInTheDocument();
});
});
14 changes: 14 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link href="/styles/roboto.css" rel="stylesheet">
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
10 changes: 10 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default {
testEnvironment: 'jsdom',
testPathIgnorePatterns: ['/node_modules/', '/.next/'],
collectCoverage: true,
collectCoverageFrom: ['src/**/*.ts(x)'],
setupFilesAfterEnv: ['<rootDir>/.jest/setup.ts'],
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
};
63 changes: 63 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"name": "vite-react-main-boilerplate",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"lint": "eslint src --max-warnings=0",
"test": "jest",
"test:watch": "yarn test --watch",
"prepare": "husky install",
"generate": "yarn plop --plopfile ./generators/plopfile.js",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
},
"dependencies": {
"beautiful-react-hooks": "^3.11.1",
"radash": "^7.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.3.0"
},
"devDependencies": {
"@babel/core": "^7.18.10",
"@storybook/addon-actions": "^6.5.10",
"@storybook/addon-essentials": "^6.5.10",
"@storybook/addon-interactions": "^6.5.12",
"@storybook/addon-links": "^6.5.10",
"@storybook/builder-vite": "^0.2.2",
"@storybook/react": "^6.5.10",
"@storybook/testing-library": "^0.0.13",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.3.0",
"@types/jest": "^28.1.7",
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.6",
"@typescript-eslint/eslint-plugin": "^5.33.0",
"@typescript-eslint/parser": "^5.33.0",
"@vitejs/plugin-react": "^2.0.1",
"autoprefixer": "^10.4.12",
"babel-loader": "^8.2.5",
"eslint": "8.21.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-storybook": "^0.6.4",
"husky": "^8.0.0",
"jest": "^28.1.3",
"jest-environment-jsdom": "^28.1.3",
"plop": "^3.1.1",
"postcss": "^8.4.16",
"prettier": "2.7.1",
"tailwindcss": "^3.1.8",
"ts-jest": "^28.0.8",
"ts-node": "^10.9.1",
"typescript": "^4.6.4",
"vite": "^3.0.7",
"vite-tsconfig-paths": "^3.5.0"
}
}
6 changes: 6 additions & 0 deletions postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
Binary file added public/fonts/Roboto-Black.ttf
Binary file not shown.
Binary file added public/fonts/Roboto-BlackItalic.ttf
Binary file not shown.
Binary file added public/fonts/Roboto-Bold.ttf
Binary file not shown.
Binary file added public/fonts/Roboto-BoldItalic.ttf
Binary file not shown.
Binary file added public/fonts/Roboto-Italic.ttf
Binary file not shown.
Binary file added public/fonts/Roboto-Light.ttf
Binary file not shown.
Binary file added public/fonts/Roboto-LightItalic.ttf
Binary file not shown.
Binary file added public/fonts/Roboto-Medium.ttf
Binary file not shown.
Binary file added public/fonts/Roboto-MediumItalic.ttf
Binary file not shown.
Binary file added public/fonts/Roboto-Regular.ttf
Binary file not shown.
Binary file added public/fonts/Roboto-Thin.ttf
Binary file not shown.
Binary file added public/fonts/Roboto-ThinItalic.ttf
Binary file not shown.
Binary file added public/images/typescript-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
83 changes: 83 additions & 0 deletions public/styles/roboto.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
@font-face {
font-family: 'Roboto';
src: url('../fonts/Roboto-Thin.ttf') format('truetype');
font-weight: 100;
font-style: normal;
}

@font-face {
font-family: 'Roboto';
src: url('../fonts/Roboto-ThinItalic.ttf') format('truetype');
font-weight: 100;
font-style: italic;
}

@font-face {
font-family: 'Roboto';
src: url('../fonts/Roboto-Light.ttf') format('truetype');
font-weight: 300;
font-style: normal;
}

@font-face {
font-family: 'Roboto';
src: url('../fonts/Roboto-LightItalic.ttf') format('truetype');
font-weight: 300;
font-style: italic;
}

@font-face {
font-family: 'Roboto';
src: url('../fonts/Roboto-Regular.ttf') format('truetype');
font-weight: 400;
font-style: normal;
}

@font-face {
font-family: 'Roboto';
src: url('../fonts/Roboto-Italic.ttf') format('truetype');
font-weight: 400;
font-style: italic;
}

@font-face {
font-family: 'Roboto';
src: url('../fonts/Roboto-Medium.ttf') format('truetype');
font-weight: 500;
font-style: normal;
}

@font-face {
font-family: 'Roboto';
src: url('../fonts/Roboto-MediumItalic.ttf') format('truetype');
font-weight: 500;
font-style: italic;
}

@font-face {
font-family: 'Roboto';
src: url('../fonts/Roboto-Bold.ttf') format('truetype');
font-weight: 700;
font-style: normal;
}

@font-face {
font-family: 'Roboto';
src: url('../fonts/Roboto-BoldItalic.ttf') format('truetype');
font-weight: 700;
font-style: italic;
}

@font-face {
font-family: 'Roboto';
src: url('../fonts/Roboto-Black.ttf') format('truetype');
font-weight: 900;
font-style: normal;
}

@font-face {
font-family: 'Roboto';
src: url('../fonts/Roboto-BlackItalic.ttf') format('truetype');
font-weight: 900;
font-style: italic;
}
1 change: 1 addition & 0 deletions public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Vite React Main Boilerplate using Typescript + Tailwind CSS.
5 changes: 5 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Routes from './routes';

export default function App() {
return <Routes />;
}
Loading

0 comments on commit 6930ea5

Please sign in to comment.