Skip to content

Commit

Permalink
Merge pull request #14 from binbat/fix/styles-regression
Browse files Browse the repository at this point in the history
refactor(webapp): update dependencies; extract unocss config file
  • Loading branch information
a-wing authored Nov 18, 2024
2 parents 72f6bc5 + 3f8a0c5 commit 509be53
Show file tree
Hide file tree
Showing 7 changed files with 354 additions and 344 deletions.
617 changes: 307 additions & 310 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"copy-to-clipboard": "^3.3.3",
"jotai": "^2.10.1",
"jotai": "^2.10.2",
"jotai-devtools": "^0.10.1",
"jotai-location": "^0.5.5",
"react": "^18.3.1",
Expand All @@ -22,22 +22,22 @@
"whip-whep": "1.2.0"
},
"devDependencies": {
"@eslint/js": "^9.14.0",
"@eslint/js": "^9.15.0",
"@iconify-json/logos": "^1.2.3",
"@stylistic/eslint-plugin-js": "^2.10.1",
"@types/node": "^22.9.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@unocss/preset-attributify": "^0.64.0",
"@unocss/preset-icons": "^0.64.0",
"@unocss/preset-uno": "^0.64.0",
"@unocss/reset": "^0.64.0",
"@unocss/preset-attributify": "^0.64.1",
"@unocss/preset-icons": "^0.64.1",
"@unocss/preset-uno": "^0.64.1",
"@unocss/reset": "^0.64.1",
"@vitejs/plugin-react": "^4.3.3",
"cross-env": "^7.0.3",
"eslint": "^9.14.0",
"typescript": "^5.6.3",
"typescript-eslint": "^8.13.0",
"unocss": "^0.64.0",
"vite": "^5.4.10"
"typescript-eslint": "^8.14.0",
"unocss": "^0.64.1",
"vite": "^5.4.11"
}
}
5 changes: 4 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"skipLibCheck": false
},
"include": ["webapp"],
"exclude": ["**/vite.config.ts"],
"exclude": [
"webapp/vite.config.ts",
"webapp/uno.config.ts"
],
"references": [{ "path": "./tsconfig.node.json" }]
}
5 changes: 4 additions & 1 deletion tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
"allowSyntheticDefaultImports": true,
"strict": true
},
"include": ["webapp/vite.config.ts"]
"include": [
"webapp/vite.config.ts",
"webapp/uno.config.ts"
]
}
8 changes: 5 additions & 3 deletions webapp/main.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import React from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import 'virtual:uno.css'
import App from './app'
import { DevTools } from 'jotai-devtools'

import '@unocss/reset/tailwind-compat.css'
import 'virtual:uno.css'
import 'jotai-devtools/styles.css'

import App from './app'
import './index.css'

const container = document.getElementById('root')
const root = createRoot(container!)
Expand Down
23 changes: 23 additions & 0 deletions webapp/uno.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import {
defineConfig,
presetAttributify,
presetIcons,
presetUno,
} from 'unocss'

export default defineConfig({
shortcuts: [
{ logo: 'i-logos-react w-6em h-6em transform transition-800 hover:rotate-180' },
{ 'btn-primary': 'py-2 px-4 bg-blue-500 duration-500 text-white font-bold rounded-lg shadow-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:ring-opacity-75 disabled:pointer-events-none disabled:bg-slate-300' }
],
presets: [
presetUno(),
presetAttributify(),
presetIcons({
extraProperties: {
'display': 'inline-block',
'vertical-align': 'middle'
}
})
]
})
22 changes: 2 additions & 20 deletions webapp/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { resolve } from 'node:path'

import { defineConfig } from 'vite'
import React from '@vitejs/plugin-react'
import UnoCSS from 'unocss/vite'
import presetAttributify from '@unocss/preset-attributify'
import presetIcons from '@unocss/preset-icons'
import presetUno from '@unocss/preset-uno'
import React from '@vitejs/plugin-react'

const ProjectRoot = resolve(import.meta.dirname, '..')
const WebAppRoot = resolve(ProjectRoot, 'webapp')
Expand All @@ -31,22 +28,7 @@ export default defineConfig({
emptyOutDir: true
},
plugins: [
UnoCSS({
shortcuts: [
{ logo: 'i-logos-react w-6em h-6em transform transition-800 hover:rotate-180' },
{ 'btn-primary': 'py-2 px-4 bg-blue-500 duration-500 text-white font-bold rounded-lg shadow-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:ring-opacity-75 disabled:pointer-events-none disabled:bg-slate-300' }
],
presets: [
presetUno(),
presetAttributify(),
presetIcons({
extraProperties: {
'display': 'inline-block',
'vertical-align': 'middle'
}
})
]
}),
UnoCSS(resolve(WebAppRoot, 'uno.config.ts')),
React()
]
})

0 comments on commit 509be53

Please sign in to comment.