Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
taricov committed Jun 18, 2023
0 parents commit c1fad5b
Show file tree
Hide file tree
Showing 47 changed files with 1,254 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Setup
VITE_APP_NAME="Restart"

# Transmart
VITE_APP_OPENAI_API_KEY=""
45 changes: 45 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
sourceType: "module",
ecmaVersion: "latest",
project: "tsconfig.json",
},
ignorePatterns: [
".eslintrc.cjs",
"vite.config.ts",
"postcss.config.cjs",
"prettier.config.cjs",
"tailwind.config.cjs",
"transmart.config.cjs",
"commitlint.config.cjs",
],
env: {
browser: true,
es2021: true,
},
settings: {
react: {
version: "detect",
},
},
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"standard-with-typescript",
"prettier",
],
plugins: ["react", "prettier"],
overrides: [],
rules: {
"prettier/prettier": "error",
"react/react-in-jsx-scope": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/consistent-type-definitions": "off",
"@typescript-eslint/promise-function-async": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/triple-slash-reference": "off",
},
};
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# App
.env
package-lock.json
3 changes: 3 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

npx commitlint --config commitlint.config.cjs --edit "$1"
3 changes: 3 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

npm run lint
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore artifacts:
dist
coverage
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Webtre Technologies

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
89 changes: 89 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
## Features (included)

- ⚡️ [React 18](https://github.com/facebook/react/), [TailwindCSS](https://github.com/tailwindlabs/tailwindcss), and [Vite](https://github.com/vitejs/vite)

- 🌍 [I18n ready](./src/i18n) — includes internationalization

- 📑 [Layout System](./src/layouts) — with multiple layout support

- 💮 [State Management via Redux](./src/redux) — with hooks and logging for development

- 🔗 Routing via [`react-router`](./src/router) — with lazy loading and protected routes support

- ⛔ Error handling with [`error-boundary`](https://github.com/bvaughn/react-error-boundary) — can also be used for logging to third-party services

- 🎨 [DaisyUI](https://github.com/saadeghi/daisyui) and [react-daisyui](https://github.com/daisyui/react-daisyui) — the most popular Tailwind CSS component library.

- 📲 [Theme System](./src/components/ThemeChanger.tsx) — with default `light`, `dark`, and `auto detect` mode

- 🗂 Absolute import — Import folders and files using the `@` prefix

- 🤖 [Transmart](./transmart.config.cjs) — translate your i18n language files with AI

- 😃 [Use icons from popular icon packs](https://github.com/react-icons/react-icons)

- 🚓 Commitlint — Lint commit messages

- 📏 ESLint — Pluggable JavaScript linter

- 💖 Prettier — Opinionated Code Formatter

- 🦾 Strongly Typed: written in [TypeScript](https://github.com/microsoft/TypeScript)

### Plugins

- [`vite-plugin-ejs`](https://github.com/trapcodeio/vite-plugin-ejs) - use ejs in your HTML

## Checklist

When you use this template, follow the checklist to update your info properly

- [ ] Create a `.env` file from `.env.example`
- [ ] Change the favicon in `public`
- [ ] Clean up `README.md`

## Todo

- [ ] Add unit test via [`vitest`](https://github.com/vitest-dev/vitest)

## Usage

### Installation

```bash
npm install
```

### Development

Run and visit http://localhost:5173

```bash
npm run start:dev
```

### Build

To build the App, run

```bash
npm run build
```

### Preview

To preview the App, run

```bash
npm run preview
```

### Test

```bash
npm test
```

## License

[MIT](./LICENSE) License © 2022 [Webtre Technologies](https://github.com/webtretech)
24 changes: 24 additions & 0 deletions commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const defaultConfig = require('@commitlint/config-conventional');

module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
...defaultConfig.rules,
'type-enum': [
2,
'always',
[
'fix',
'test',
'tooling',
'refactor',
'revert',
'example',
'docs',
'format',
'feat',
'chore',
],
],
},
};
17 changes: 17 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en" data-theme="light">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="description"
content="Batteries included React + TailwindCSS + Vite starter template."
/>
<title><%= env.VITE_APP_NAME %></title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
82 changes: 82 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"name": "restart",
"private": true,
"description": "Batteries included React + Tailwind + Vite starter template.",
"version": "0.0.0",
"type": "module",
"engines": {
"node": ">=18"
},
"scripts": {
"start:dev": "vite",
"translate": "transmart",
"build": "tsc && vite build",
"preview": "vite preview",
"lint": "eslint \"src/**/*.{ts,tsx}\" --fix"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"dependencies": {
"@reduxjs/toolkit": "^1.9.3",
"clsx": "^1.2.1",
"i18next": "^22.4.13",
"i18next-browser-languagedetector": "^7.0.1",
"react": "^18.2.0",
"react-daisyui": "^3.0.3",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.2",
"react-i18next": "^12.2.0",
"react-icons": "^4.8.0",
"react-loader-spinner": "^5.3.4",
"react-redux": "^8.0.5",
"react-router-dom": "^6.9.0",
"react-use": "^17.4.0",
"tailwind-merge": "^1.10.0",
"theme-change": "^2.5.0"
},
"devDependencies": {
"@commitlint/cli": "^17.5.0",
"@commitlint/config-conventional": "^17.4.4",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/typography": "^0.5.9",
"@transmart/cli": "^0.1.0",
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@types/redux-logger": "^3.0.9",
"@typescript-eslint/eslint-plugin": "^5.56.0",
"@typescript-eslint/parser": "^5.56.0",
"@vitejs/plugin-react": "^2.2.0",
"autoprefixer": "^10.4.14",
"daisyui": "^2.51.5",
"dotenv": "^16.0.3",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.8.0",
"eslint-config-standard-with-typescript": "^34.0.1",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.6.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.32.2",
"husky": "^8.0.3",
"postcss": "^8.4.21",
"prettier": "^2.8.6",
"prettier-plugin-tailwindcss": "^0.2.5",
"redux-logger": "^3.0.6",
"tailwindcss": "^3.2.7",
"tailwindcss-children": "^2.1.0",
"typescript": "^4.9.5",
"vite": "^3.2.5",
"vite-plugin-ejs": "^1.6.4"
}
}
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: {},
},
}
11 changes: 11 additions & 0 deletions prettier.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
pluginSearchDirs: false,
plugins: [
require("@trivago/prettier-plugin-sort-imports"),
require("prettier-plugin-tailwindcss"), // MUST come last
],
tailwindConfig: "./tailwind.config.cjs",
importOrder: ["^@core/(.*)$", "^@server/(.*)$", "^@ui/(.*)$", "^[./]"],
importOrderSeparation: true,
importOrderSortSpecifiers: true,
};
2 changes: 2 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-agent: *
Disallow:
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.
20 changes: 20 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import router from "@/router";
import { useEffect } from "react";
import { RouterProvider } from "react-router-dom";
import i18n from "@/i18n";
import { useAppSelector } from "@/hooks/redux";
import { getLanguage } from "@/redux/app/appSelector";

export default function App(): JSX.Element {
const language = useAppSelector(getLanguage);

useEffect(() => {
void i18n.changeLanguage(language);
}, [language]);

return (
<div className="min-h-screen w-full">
<RouterProvider router={router} />
</div>
);
}
Loading

0 comments on commit c1fad5b

Please sign in to comment.