-
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.
Merge pull request #1 from posaune0423/feat/use-deno
feat: use deno for sample
- Loading branch information
Showing
23 changed files
with
628 additions
and
3,011 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
|
@@ -10,6 +10,7 @@ lerna-debug.log* | |
node_modules | ||
dist | ||
dist-ssr | ||
.vite | ||
*.local | ||
|
||
# Editor directories and files | ||
|
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 @@ | ||
{ | ||
"recommendations": ["denoland.vscode-deno"] | ||
} |
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 |
---|---|---|
@@ -1,50 +1,19 @@ | ||
# React + TypeScript + Vite | ||
# Vite + Deno + React + TypeScript | ||
|
||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. | ||
## Running | ||
|
||
Currently, two official plugins are available: | ||
You need to have Deno v2.0.0 or later installed to run this repo. | ||
|
||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh | ||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh | ||
Start a dev server: | ||
|
||
## Expanding the ESLint configuration | ||
|
||
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: | ||
|
||
- Configure the top-level `parserOptions` property like this: | ||
|
||
```js | ||
export default tseslint.config({ | ||
languageOptions: { | ||
// other options... | ||
parserOptions: { | ||
project: ['./tsconfig.node.json', './tsconfig.app.json'], | ||
tsconfigRootDir: import.meta.dirname, | ||
}, | ||
}, | ||
}) | ||
``` | ||
$ deno task dev | ||
``` | ||
|
||
- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked` | ||
- Optionally add `...tseslint.configs.stylisticTypeChecked` | ||
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config: | ||
## Deploy | ||
|
||
```js | ||
// eslint.config.js | ||
import react from 'eslint-plugin-react' | ||
Build production assets: | ||
|
||
export default tseslint.config({ | ||
// Set the react version | ||
settings: { react: { version: '18.3' } }, | ||
plugins: { | ||
// Add the react plugin | ||
react, | ||
}, | ||
rules: { | ||
// other rules... | ||
// Enable its recommended rules | ||
...react.configs.recommended.rules, | ||
...react.configs['jsx-runtime'].rules, | ||
}, | ||
}) | ||
``` | ||
$ deno task 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,25 @@ | ||
{ | ||
"tasks": { | ||
"dev": "deno run -A --node-modules-dir npm:vite", | ||
"build": "deno run -A --node-modules-dir npm:vite build", | ||
"preview": "deno run -A --node-modules-dir npm:vite preview", | ||
"serve": "deno run --allow-net --allow-read jsr:@std/http@1/file-server dist/" | ||
}, | ||
"compilerOptions": { | ||
"lib": ["ES2020", "DOM", "DOM.Iterable"], | ||
"jsx": "react-jsx", | ||
"jsxImportSource": "react", | ||
"jsxImportSourceTypes": "@types/react" | ||
}, | ||
"nodeModulesDir": "auto", | ||
"imports": { | ||
"@deno/vite-plugin": "npm:@deno/vite-plugin@^1.0.0", | ||
"@types/react": "npm:@types/react@^18.3.12", | ||
"@types/react-dom": "npm:@types/react-dom@^18.3.1", | ||
"@vitejs/plugin-react-swc": "npm:@vitejs/plugin-react-swc@^3.7.1", | ||
"react": "npm:react@^18.3.1", | ||
"react-dom": "npm:react-dom@^18.3.1", | ||
"use-haptic": "npm:use-haptic@^1.0.1", | ||
"vite": "npm:vite@^6.0.1" | ||
} | ||
} |
Oops, something went wrong.