Skip to content

Commit 03205ad

Browse files
committed
wip setup vite plus
1 parent e6b6dbf commit 03205ad

39 files changed

Lines changed: 946 additions & 1117 deletions

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
/.vscode/*
2424
!/.vscode/extensions.json
2525
.idea/
26-
.eslintcache
2726
.db
2827
.git
2928

.github/actions/setup-playwright/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ runs:
2222
shell: bash
2323
env:
2424
BROWSERS: ${{ inputs.browsers }}
25-
run: pnpm exec playwright install $BROWSERS --with-deps
25+
run: vp exec playwright install $BROWSERS --with-deps
2626

2727
- name: Install Playwright system deps
2828
if: steps.playwright-cache.outputs.cache-hit == 'true'
2929
shell: bash
3030
env:
3131
BROWSERS: ${{ inputs.browsers }}
32-
run: pnpm exec playwright install-deps $BROWSERS
32+
run: vp exec playwright install-deps $BROWSERS
Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Setup pnpm
2-
description: Install pnpm, setup Node.js with cache, and install dependencies
2+
description: Setup Vite+ (vp), Node.js, dependency cache, and install dependencies
33

44
inputs:
55
node-version:
@@ -10,18 +10,8 @@ inputs:
1010
runs:
1111
using: composite
1212
steps:
13-
- name: Install pnpm
14-
uses: pnpm/action-setup@v4
15-
with:
16-
version: 10
17-
run_install: false
18-
19-
- name: Setup Node.js
20-
uses: actions/setup-node@v4
13+
- name: Setup Vite+
14+
uses: voidzero-dev/setup-vp@v1
2115
with:
2216
node-version: ${{ inputs.node-version }}
23-
cache: 'pnpm'
24-
25-
- name: Install deps
26-
shell: bash
27-
run: pnpm install --frozen-lockfile
17+
cache: true

.github/workflows/code-quality.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ jobs:
1717

1818
- name: Setup pnpm
1919
uses: ./.github/actions/setup-pnpm
20+
with:
21+
node-version: '22'
2022

2123
- name: Run oxlint
22-
run: pnpm oxlint --deny-warnings .
24+
run: vp lint --deny-warnings .
2325

2426
typescriptChecker:
2527
name: 🟦 TypeScript Checker
@@ -35,7 +37,7 @@ jobs:
3537
node-version: 24
3638

3739
- name: Run Typescript checker
38-
run: pnpm run lint:ts
40+
run: vp run lint:ts
3941

4042
tests:
4143
name: 🔬 Tests
@@ -57,4 +59,4 @@ jobs:
5759
uses: ./.github/actions/setup-playwright
5860

5961
- name: Run tests
60-
run: SKIP_ENV_VALIDATION=true pnpm run test:ci
62+
run: SKIP_ENV_VALIDATION=true vp run test:ci

.github/workflows/e2e-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@ jobs:
113113
mc anonymous set download minio/$S3_BUCKET_NAME
114114
115115
- name: Migrate database
116-
run: pnpm db:push
116+
run: vp run db:push
117117

118118
- name: Add default data into database
119-
run: pnpm db:seed
119+
run: vp run db:seed
120120

121121
- name: Run Playwright tests
122-
run: pnpm exec playwright test --project=${{ matrix.browser }}
122+
run: vp exec playwright test --project=${{ matrix.browser }}
123123

124124
- uses: actions/upload-artifact@v4
125125
if: always()

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
.DS_Store
2222
*.pem
2323
.idea/
24-
.eslintcache
2524
.db
2625
tsconfig.tsbuildinfo
2726

.oxfmtrc.json

Lines changed: 0 additions & 30 deletions
This file was deleted.

.oxlintrc.json

Lines changed: 0 additions & 103 deletions
This file was deleted.

.storybook/preview.tsx

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import type { Preview } from '@storybook/react-vite';
2+
import {
3+
createMemoryHistory,
4+
createRootRoute,
5+
createRouter,
6+
RouterProvider,
7+
} from '@tanstack/react-router';
28
import { useDarkMode } from '@vueless/storybook-dark-mode';
3-
import { StrictMode, useEffect } from 'react';
4-
import { ReactNode } from 'react';
9+
import type { ReactNode } from 'react';
10+
import { createContext, StrictMode, useContext, useEffect, useMemo } from 'react';
511
import { useTranslation } from 'react-i18next';
612
import { StoryContext } from 'storybook/internal/csf';
713

@@ -15,6 +21,33 @@ import {
1521
import i18nGlobal from '../src/lib/i18n/index';
1622
import { Providers } from '../src/providers';
1723

24+
const StorybookStorySlotContext = createContext<ReactNode>(null);
25+
26+
function StorybookStorySlotRoot() {
27+
const slot = useContext(StorybookStorySlotContext);
28+
return <>{slot}</>;
29+
}
30+
31+
/** Minimal router so components using useRouter() work in Storybook. */
32+
function StorybookTanStackRouter({ children }: { children: ReactNode }) {
33+
const router = useMemo(() => {
34+
const rootRoute = createRootRoute({
35+
component: StorybookStorySlotRoot,
36+
});
37+
const routeTree = rootRoute.addChildren([]);
38+
return createRouter({
39+
routeTree,
40+
history: createMemoryHistory({ initialEntries: ['/'] }),
41+
});
42+
}, []);
43+
44+
return (
45+
<StorybookStorySlotContext.Provider value={children}>
46+
<RouterProvider router={router} />
47+
</StorybookStorySlotContext.Provider>
48+
);
49+
}
50+
1851
const DocumentationWrapper = ({
1952
children,
2053
context,
@@ -77,12 +110,14 @@ const preview: Preview = {
77110
return (
78111
<Providers forcedTheme={isDarkMode ? 'dark' : 'light'}>
79112
<StrictMode>
80-
<DocumentationWrapper context={context}>
81-
{/* Calling as a function to avoid errors. Learn more at:
82-
* https://github.com/storybookjs/storybook/issues/15223#issuecomment-1092837912
83-
*/}
84-
{story(context)}
85-
</DocumentationWrapper>
113+
<StorybookTanStackRouter>
114+
<DocumentationWrapper context={context}>
115+
{/* Calling as a function to avoid errors. Learn more at:
116+
* https://github.com/storybookjs/storybook/issues/15223#issuecomment-1092837912
117+
*/}
118+
{story(context)}
119+
</DocumentationWrapper>
120+
</StorybookTanStackRouter>
86121
</StrictMode>
87122
</Providers>
88123
);

.vscode/extensions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"recommendations": [
33
"lokalise.i18n-ally",
4-
"dbaeumer.vscode-eslint",
54
"oxc.oxc-vscode",
65
"ms-playwright.playwright",
7-
"Prisma.prisma"
6+
"Prisma.prisma",
7+
"VoidZero.vite-plus-extension-pack"
88
]
99
}

0 commit comments

Comments
 (0)