diff --git a/.github/workflows/dashboard-ci.yml b/.github/workflows/dashboard-ci.yml
@@ -4,11 +4,11 @@ on:
push:
paths:
- - 'app/dashboard/**'
+ - './dashboard/**'
branches: [ "master" ]
pull_request:
paths:
- - 'app/dashboard/**'
+ - './dashboard/**'
jobs:
build:
@@ -17,28 +17,39 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
- working-directory: ./app/dashboard
+ working-directory: ./dashboard
steps:
- uses: actions/checkout@v4
- - name: Use Node.js
- uses: actions/setup-node@v3
+ - uses: pnpm/action-setup@v3
+ name: Install pnpm
with:
- node-version: '20.0'
- cache: 'npm'
- cache-dependency-path: 'app/dashboard/package-lock.json'
+ version: 8
+ run_install: false
+ - name: Get pnpm store directory
+ shell: bash
+ run: |
+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
+
+ - uses: actions/cache@v3
+ name: Setup pnpm cache
+ with:
+ path: ${{ env.STORE_PATH }}
+ key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
+ restore-keys: |
+ ${{ runner.os }}-pnpm-store-
- name: Install dependencies
- run: npm install
+ run: pnpm install
- name: Lint Dashboard
- run: npm run lint
+ run: pnpm lint
- name: Build Dashboard
- run: npm run build --if-present -- --outDir build --base '/dashboard/'
+ run: pnpm build -- --outDir dist --base '/dashboard/'
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4.2.0
with:
name: artifact
- path: app/dashboard/build
+ path: dashboard/dist
diff --git a/dashboard/.eslintrc.cjs b/dashboard/.eslintrc.cjs
@@ -10,9 +10,6 @@ module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
- 'react-refresh/only-export-components': [
- 'warn',
- { allowConstantExport: true },
- ],
+ 'react-refresh/only-export-components': ['off'],
},
}
diff --git a/dashboard/package.json b/dashboard/package.json
@@ -23,6 +23,7 @@
"@radix-ui/react-switch": "^1.0.3",
"@radix-ui/react-toggle": "^1.0.3",
"@radix-ui/react-tooltip": "^1.0.7",
+ "@remix-run/router": "^1.15.3",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/forms": "^0.5.7",
"@tailwindcss/typography": "^0.5.10",
@@ -39,7 +40,6 @@
"react-dom": "^18.2.0",
"react-hook-form": "^7.51.1",
"react-i18next": "^14.1.0",
- "react-native-path": "^0.0.5",
"react-resizable-panels": "^2.0.13",
"sonner": "^1.4.3",
"tailwind-merge": "^2.2.2",
@@ -64,6 +64,7 @@
"postcss": "^8.4.36",
"tailwindcss": "^3.4.1",
"typescript": "^5.2.2",
- "vite": "^5.1.6"
+ "vite": "^5.1.6",
+ "vite-tsconfig-paths": "^4.3.2"
}
}
diff --git a/dashboard/pnpm-lock.yaml b/dashboard/pnpm-lock.yaml
@@ -44,6 +44,9 @@ dependencies:
'@radix-ui/react-tooltip':
specifier: ^1.0.7
version: 1.0.7(@types/react-dom@18.2.21)(@types/react@18.2.64)(react-dom@18.2.0)(react@18.2.0)
+ '@remix-run/router':
+ specifier: ^1.15.3
+ version: 1.15.3
'@tailwindcss/aspect-ratio':
specifier: ^0.4.2
version: 0.4.2(tailwindcss@3.4.1)
@@ -92,9 +95,6 @@ dependencies:
react-i18next:
specifier: ^14.1.0
version: 14.1.0(i18next@23.10.1)(react-dom@18.2.0)(react@18.2.0)
- react-native-path:
- specifier: ^0.0.5
- version: 0.0.5
react-resizable-panels:
specifier: ^2.0.13
version: 2.0.13(react-dom@18.2.0)(react@18.2.0)
@@ -166,6 +166,9 @@ devDependencies:
vite:
specifier: ^5.1.6
version: 5.1.6(@types/node@20.11.29)
+ vite-tsconfig-paths:
+ specifier: ^4.3.2
+ version: 4.3.2(typescript@5.2.2)(vite@5.1.6)
packages:
@@ -1321,6 +1324,11 @@ packages:
'@babel/runtime': 7.24.0
dev: false
+ /@remix-run/router@1.15.3:
+ resolution: {integrity: sha512-Oy8rmScVrVxWZVOpEF57ovlnhpZ8CCPlnIIumVcV9nFdiSIrus99+Lw78ekXyGvVDlIsFJbSfmSovJUhCWYV3w==}
+ engines: {node: '>=14.0.0'}
+ dev: false
+
/@rollup/rollup-android-arm-eabi@4.13.0:
resolution: {integrity: sha512-5ZYPOuaAqEH/W3gYsRkxQATBW3Ii1MfaT4EQstTnLKViLi2gLSQmlmtTpGucNP3sXEpOiI5tdGhjdE111ekyEg==}
cpu: [arm]
@@ -2422,6 +2430,10 @@ packages:
slash: 3.0.0
dev: true
+ /globrex@0.1.2:
+ resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==}
+ dev: true
+
/goober@2.1.14(csstype@3.1.3):
resolution: {integrity: sha512-4UpC0NdGyAFqLNPnhCT2iHpza2q+RAY3GV85a/mRPdzyPQMsj0KmMMuetdIkzWRbJ+Hgau1EZztq8ImmiMGhsg==}
peerDependencies:
@@ -2951,10 +2963,6 @@ packages:
react-dom: 18.2.0(react@18.2.0)
dev: false
- /react-native-path@0.0.5:
- resolution: {integrity: sha512-WJr256xBquk7X2O83QYWKqgLg43Zg3SrgjPc/kr0gCD2LoXA+2L72BW4cmstH12GbGeutqs/eXk3jgDQ2iCSvQ==}
- dev: false
-
/react-remove-scroll-bar@2.3.6(@types/react@18.2.64)(react@18.2.0):
resolution: {integrity: sha512-DtSYaao4mBmX+HDo5YWYdBWQwYIQQshUV/dVxFxK+KM26Wjwp1gZ6rv6OC3oujI6Bfu6Xyg3TwK533AQutsn/g==}
engines: {node: '>=10'}
@@ -3284,6 +3292,19 @@ packages:
/ts-interface-checker@0.1.13:
resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==}
+ /tsconfck@3.0.3(typescript@5.2.2):
+ resolution: {integrity: sha512-4t0noZX9t6GcPTfBAbIbbIU4pfpCwh0ueq3S4O/5qXI1VwK1outmxhe9dOiEWqMz3MW2LKgDTpqWV+37IWuVbA==}
+ engines: {node: ^18 || >=20}
+ hasBin: true
+ peerDependencies:
+ typescript: ^5.0.0
+ peerDependenciesMeta:
+ typescript:
+ optional: true
+ dependencies:
+ typescript: 5.2.2
+ dev: true
+
/tslib@2.6.2:
resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==}
dev: false
@@ -3382,6 +3403,23 @@ packages:
- '@types/react-dom'
dev: false
+ /vite-tsconfig-paths@4.3.2(typescript@5.2.2)(vite@5.1.6):
+ resolution: {integrity: sha512-0Vd/a6po6Q+86rPlntHye7F31zA2URZMbH8M3saAZ/xR9QoGN/L21bxEGfXdWmFdNkqPpRdxFT7nmNe12e9/uA==}
+ peerDependencies:
+ vite: '*'
+ peerDependenciesMeta:
+ vite:
+ optional: true
+ dependencies:
+ debug: 4.3.4
+ globrex: 0.1.2
+ tsconfck: 3.0.3(typescript@5.2.2)
+ vite: 5.1.6(@types/node@20.11.29)
+ transitivePeerDependencies:
+ - supports-color
+ - typescript
+ dev: true
+
/vite@5.1.6(@types/node@20.11.29):
resolution: {integrity: sha512-yYIAZs9nVfRJ/AiOLCA91zzhjsHUgMjB+EigzFb6W2XTLO8JixBCKCjvhKZaye+NKYHCrkv3Oh50dH9EdLU2RA==}
engines: {node: ^18.0.0 || >=20.0.0}
diff --git a/dashboard/src/app.tsx b/dashboard/src/app.tsx
@@ -1,4 +1,4 @@
-import React, { StrictMode } from 'react'
+import { StrictMode } from 'react'
import ReactDOM from 'react-dom/client'
import { RouterProvider, createRouter } from '@tanstack/react-router'
import '@marzneshin/features/i18n'
diff --git a/dashboard/src/features/i18n/index.ts b/dashboard/src/features/i18n/index.ts
@@ -3,7 +3,7 @@ import i18n from 'i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import HttpApi from 'i18next-http-backend';
import { initReactI18next } from 'react-i18next';
-import path from 'react-native-path';
+import { joinPaths } from '@remix-run/router';
declare module 'i18next' {
interface CustomTypeOptions {
@@ -31,7 +31,7 @@ i18n
caches: ['localStorage', 'sessionStorage', 'cookie'],
},
backend: {
- loadPath: path.resolve(import.meta.env.BASE_URL, 'locales/{{lng}}.json'),
+ loadPath: joinPaths([import.meta.env.BASE_URL, 'locales/{{lng}}.json']),
},
},
function() {
diff --git a/dashboard/tsconfig.json b/dashboard/tsconfig.json
@@ -27,12 +27,6 @@
"@marzneshin/*": [
"./src/*"
],
- "@marzneshin/components": [
- "./src/components/*"
- ],
- "@marzneshin/features": [
- "./src/features/*"
- ]
}
},
"include": [
diff --git a/dashboard/vite.config.ts b/dashboard/vite.config.ts
@@ -1,17 +1,23 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import { TanStackRouterVite } from '@tanstack/router-vite-plugin';
-import path from "path";
+import tsconfigPaths from 'vite-tsconfig-paths';
+import path from 'path';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
TanStackRouterVite(),
+ tsconfigPaths(),
react()
],
+ root: '.',
resolve: {
- alias: {
- "@marzneshin": path.resolve(__dirname, "./src"),
- },
+ alias: [
+ {
+ find: '@marzneshin',
+ replacement: path.resolve(__dirname, './src/'),
+ },
+ ],
},
})