Skip to content

Commit

Permalink
upgrade the template
Browse files Browse the repository at this point in the history
  • Loading branch information
backmeupplz committed Jun 25, 2023
1 parent 05ee478 commit ba58ea8
Show file tree
Hide file tree
Showing 23 changed files with 970 additions and 10,134 deletions.
3 changes: 1 addition & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
"eslint:recommended",
"plugin:react/jsx-runtime",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:valtio/recommended"
"plugin:prettier/recommended"
],
"rules": {
"no-relative-import-paths/no-relative-import-paths": [
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deployflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: 'docs'
path: 'dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.DS_Store
node_modules
docs
dist
stats.html

# local env files
Expand Down
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"hnw.vscode-auto-open-markdown-preview",

This comment has been minimized.

Copy link
@T-Damer

T-Damer Jun 25, 2023

Contributor

Oh yes, newer used it :)

"bradlc.vscode-tailwindcss",
"naumovs.color-highlight",
"oderwat.indent-rainbow"
Expand Down
8 changes: 7 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,11 @@
"javascriptreact",
"typescript",
"typescriptreact"
]
],
"files.associations": {
"*.css": "tailwindcss"
},
"editor.quickSuggestions": {
"strings": true
}
}
555 changes: 278 additions & 277 deletions .yarn/releases/yarn-3.5.0.cjs → .yarn/releases/yarn-3.6.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ plugins:
- path: .yarn/plugins/yarn-up-all-plugin.cjs
spec: "https://github.com/e5mode/yarn-up-all/releases/download/1.1.0/index.js"

yarnPath: .yarn/releases/yarn-3.5.0.cjs
yarnPath: .yarn/releases/yarn-3.6.0.cjs
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Borodutch
Copyright (c) 2021-present Borodutch

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
15 changes: 4 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Frontend code template in React
# Frontend code template in `preact`

This template is to be used for frontend applications.

## Features

- State management + persistence with `valtio` and `PersistableStore`
- Around 15.17kb after brotli compression (this includes **everything**) 😱
- State management with `jotai`
- Around 13.53kb after brotli compression (this includes **everything**) 😱
- `preact` under the hood with `preact/compat` makes it compatible with virtually any `react` library but still makes it faster
- Full TypeScript support — no dangling types
- `vite` packager and devtools make building and development lightning fast
- `tailwind-css` built-in with type-safe class names
- `tailwind-css` built-in with 'daisyui'
- GitHub Actions that lint and check the code on pull requests
- `prettier` and `eslint` configured, enabled and formatting your code on save
- List of recommended extensions for VSCode
Expand All @@ -19,10 +19,3 @@ This template is to be used for frontend applications.

1. Install dependencies with `yarn`
2. Run the server with `yarn start`

## Available Scripts

- `yarn build` — builds the app for production to the `docs` folder
- `yarn lint` — checks if the code is linted and formatted
- `yarn start` — runs the app in the development mode
- `yarn generate-css-types` — generates the CSS types for `tailwind-css`
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Frontend Starter preact</title>
<meta name="description" content="Frontend Starter example" />
<title>Frontend starter preact</title>
<meta name="description" content="Frontend starter example" />
</head>
<body class="bg-black-background">
<body>
<noscript>Please, turn on JavaScript to see this page.</noscript>
<div id="root"></div>
<div id="root" />
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
51 changes: 19 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,42 @@
"version": "1.0.0",
"license": "MIT",
"scripts": {
"start": "yarn generate-css-types && vite",
"build": "yarn generate-css-types && cross-env NODE_ENV=production tsc && vite build",
"start": "vite",
"build": "cross-env NODE_ENV=production tsc && vite build",
"pretty": "prettier --check src",
"lint": "yarn pretty && eslint --max-warnings 0 --ext ts,tsx,json src",
"generate-css-types": "tailwindcss-classnames -o src/classnames/tailwind.ts && prettier --write src/classnames/tailwind.ts",
"preview": "yarn build && yarn vite preview"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"dependencies": {
"@vitejs/plugin-react": "^3.1.0",
"preact": "^10.13.1",
"valtio": "^1.10.3"
"jotai": "^2.2.1",
"preact": "^10.15.1"
},
"devDependencies": {
"@preact/preset-vite": "^2.5.0",
"@types/node": "^18.15.7",
"@typescript-eslint/eslint-plugin": "^5.56.0",
"@typescript-eslint/parser": "^5.56.0",
"@tailwindcss/typography": "^0.5.9",
"@types/node": "^20.3.1",
"@typescript-eslint/eslint-plugin": "^5.60.0",
"@typescript-eslint/parser": "^5.60.0",
"@vitejs/plugin-react": "^4.0.1",
"autoprefixer": "^10.4.14",
"cross-env": "^7.0.3",
"eslint": "^8.36.0",
"daisyui": "latest",
"eslint": "^8.43.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-no-relative-import-paths": "^1.5.2",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
"eslint-plugin-valtio": "^0.6.2",
"postcss": "^8.4.21",
"prettier": "^2.8.7",
"postcss": "^8.4.24",
"prettier": "^2.8.8",
"react-scripts": "^5.0.1",
"rollup-plugin-visualizer": "^5.9.0",
"tailwindcss": "^3.2.7",
"tailwindcss-classnames": "^3.0.7",
"typescript": "^5.0.2",
"vite": "^4.2.1",
"vite-tsconfig-paths": "^4.0.7"
"rollup-plugin-visualizer": "^5.9.2",
"tailwindcss": "^3.3.2",
"typescript": "^5.1.3",
"vite": "^4.3.9",
"vite-tsconfig-paths": "^4.2.0"
},
"packageManager": "yarn@3.5.0"
"packageManager": "yarn@3.6.0"
}
13 changes: 8 additions & 5 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import MainBlock from 'components/MainBlock'
import Root from 'components/Root'
import { Suspense } from 'preact/compat'
import UserCount from 'components/UserCount'

export default function () {
return (
<Root>
<MainBlock />
</Root>
<div className="container mx-auto max-w-prose p-10 prose">
<h1>Frontend template</h1>
<Suspense fallback={<p>Loading...</p>}>
<UserCount />
</Suspense>
</div>
)
}
4 changes: 4 additions & 0 deletions src/atoms/userCount.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { atom } from 'jotai'
import getUserCount from 'helpers/getUserCount'

export default atom(getUserCount())
Loading

0 comments on commit ba58ea8

Please sign in to comment.