diff --git a/bun.lockb b/bun.lockb index bcebcce..949e947 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts index 4bb6082..deb3228 100644 --- a/packages/server/src/index.ts +++ b/packages/server/src/index.ts @@ -14,7 +14,7 @@ import { TRPCBuilder } from "./trpc/TRPCBuilder" import { TRPCContextCreator } from "./trpc/TRPCContextCreator" -const ServerLive = ExpressHTTPServer.Live.pipe( +const ServerDev = ExpressHTTPServer.Live.pipe( Layer.provide(RPCServer.Live), Layer.provide(RPCPlayground.Dev), Layer.provide(RPCRouter.Live), @@ -70,7 +70,7 @@ const main = Effect.gen(function*() { // ) // yield* Fiber.join(watcher) - yield* Layer.launch(ServerLive) + yield* Layer.launch(ServerDev) }) BunRuntime.runMain(main.pipe( diff --git a/packages/webui/.eslintrc.cjs b/packages/webui/.eslintrc.cjs new file mode 100644 index 0000000..d6c9537 --- /dev/null +++ b/packages/webui/.eslintrc.cjs @@ -0,0 +1,18 @@ +module.exports = { + root: true, + env: { browser: true, es2020: true }, + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:react-hooks/recommended', + ], + ignorePatterns: ['dist', '.eslintrc.cjs'], + parser: '@typescript-eslint/parser', + plugins: ['react-refresh'], + rules: { + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], + }, +} diff --git a/packages/webui/README.md b/packages/webui/README.md new file mode 100644 index 0000000..0d6babe --- /dev/null +++ b/packages/webui/README.md @@ -0,0 +1,30 @@ +# React + TypeScript + Vite + +This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. + +Currently, two official plugins are available: + +- [@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 + +## 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 { + // other rules... + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + project: ['./tsconfig.json', './tsconfig.node.json'], + tsconfigRootDir: __dirname, + }, +} +``` + +- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked` +- Optionally add `plugin:@typescript-eslint/stylistic-type-checked` +- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list diff --git a/packages/webui/index.html b/packages/webui/index.html new file mode 100644 index 0000000..74f12a5 --- /dev/null +++ b/packages/webui/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite + React + TS + + +
+ + + diff --git a/packages/webui/package.json b/packages/webui/package.json index d83a81b..5838bed 100644 --- a/packages/webui/package.json +++ b/packages/webui/package.json @@ -1,5 +1,27 @@ { "name": "@todo-tests/webui", "type": "module", - "private": true + "private": true, + "scripts": { + "dev": "vite", + "build": "tsc -b && vite build", + "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", + "preview": "vite preview" + }, + "dependencies": { + "react": "^18.3.1", + "react-dom": "^18.3.1" + }, + "devDependencies": { + "@todo-tests/common": "workspace:*", + "@types/react": "^18.3.3", + "@types/react-dom": "^18.3.0", + "@typescript-eslint/eslint-plugin": "^7.13.1", + "@typescript-eslint/parser": "^7.13.1", + "@vitejs/plugin-react": "^4.3.1", + "eslint": "^8.57.0", + "eslint-plugin-react-hooks": "^4.6.2", + "eslint-plugin-react-refresh": "^0.4.7", + "vite": "^5.3.1" + } } diff --git a/packages/webui/public/vite.svg b/packages/webui/public/vite.svg new file mode 100644 index 0000000..e7b8dfb --- /dev/null +++ b/packages/webui/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/webui/src/App.tsx b/packages/webui/src/App.tsx new file mode 100644 index 0000000..f8540ab --- /dev/null +++ b/packages/webui/src/App.tsx @@ -0,0 +1,23 @@ +import { useState } from "react" + + +export function App() { + const [count, setCount] = useState(0) + + return ( + <> +

Vite + React

+
+ +

+ Edit src/App.tsx and save to test HMR +

+
+

+ Click on the Vite and React logos to learn more +

+ + ) +} diff --git a/packages/webui/src/main.tsx b/packages/webui/src/main.tsx new file mode 100644 index 0000000..58d7399 --- /dev/null +++ b/packages/webui/src/main.tsx @@ -0,0 +1,10 @@ +import React from "react" +import ReactDOM from "react-dom/client" +import { App } from "./App" + + +ReactDOM.createRoot(document.getElementById("root")!).render( + + + , +) diff --git a/packages/webui/src/vite-env.d.ts b/packages/webui/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/packages/webui/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/packages/webui/tsconfig.app.json b/packages/webui/tsconfig.app.json new file mode 100644 index 0000000..d739292 --- /dev/null +++ b/packages/webui/tsconfig.app.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "composite": true, + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", + "target": "ES2020", + "useDefineForClassFields": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + "jsx": "react-jsx", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src"] +} diff --git a/packages/webui/tsconfig.json b/packages/webui/tsconfig.json new file mode 100644 index 0000000..ea9d0cd --- /dev/null +++ b/packages/webui/tsconfig.json @@ -0,0 +1,11 @@ +{ + "files": [], + "references": [ + { + "path": "./tsconfig.app.json" + }, + { + "path": "./tsconfig.node.json" + } + ] +} diff --git a/packages/webui/tsconfig.node.json b/packages/webui/tsconfig.node.json new file mode 100644 index 0000000..3afdd6e --- /dev/null +++ b/packages/webui/tsconfig.node.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "composite": true, + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + "skipLibCheck": true, + "module": "ESNext", + "moduleResolution": "bundler", + "allowSyntheticDefaultImports": true, + "strict": true, + "noEmit": true + }, + "include": ["vite.config.ts"] +} diff --git a/packages/webui/vite.config.ts b/packages/webui/vite.config.ts new file mode 100644 index 0000000..5a33944 --- /dev/null +++ b/packages/webui/vite.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [react()], +})