@react-spa-scaffold/mcp 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/features/index.d.ts +0 -1
- package/dist/features/index.d.ts.map +1 -1
- package/dist/features/index.js +0 -1
- package/dist/features/index.js.map +1 -1
- package/dist/features/registry.d.ts +4 -0
- package/dist/features/registry.d.ts.map +1 -1
- package/dist/features/registry.js +144 -113
- package/dist/features/registry.js.map +1 -1
- package/dist/features/types.d.ts +12 -2
- package/dist/features/types.d.ts.map +1 -1
- package/dist/tools/get-example.d.ts.map +1 -1
- package/dist/tools/get-example.js +3 -2
- package/dist/tools/get-example.js.map +1 -1
- package/dist/tools/get-features.d.ts.map +1 -1
- package/dist/tools/get-features.js +2 -1
- package/dist/tools/get-features.js.map +1 -1
- package/dist/tools/get-scaffold.d.ts.map +1 -1
- package/dist/tools/get-scaffold.js +12 -64
- package/dist/tools/get-scaffold.js.map +1 -1
- package/dist/utils/examples.d.ts.map +1 -1
- package/dist/utils/examples.js +40 -4
- package/dist/utils/examples.js.map +1 -1
- package/dist/utils/scaffold.d.ts +9 -5
- package/dist/utils/scaffold.d.ts.map +1 -1
- package/dist/utils/scaffold.js +81 -17
- package/dist/utils/scaffold.js.map +1 -1
- package/package.json +1 -1
- package/templates/.github/workflows/ci.yml +35 -63
- package/templates/.github/workflows/release.yml +36 -0
- package/templates/CLAUDE.md +5 -3
- package/templates/docs/ARCHITECTURE.md +0 -1
- package/templates/docs/COMPONENT_GUIDELINES.md +1 -1
- package/templates/docs/E2E_TESTING.md +22 -7
- package/templates/docs/TESTING.md +2 -14
- package/templates/docs/WORKFLOW.md +5 -5
- package/templates/e2e/performance/home.spec.ts +94 -0
- package/templates/e2e/performance/setup.ts +9 -0
- package/templates/e2e/tests/home.spec.ts +2 -2
- package/templates/gitignore +1 -1
- package/templates/package.json +19 -8
- package/templates/playwright.config.ts +15 -3
- package/templates/src/contexts/performanceContext.test.tsx +51 -0
- package/templates/src/contexts/performanceContext.tsx +64 -0
- package/templates/src/main.tsx +5 -2
- package/templates/src/pages/Home.tsx +38 -33
- package/templates/src/test/providers.tsx +5 -1
- package/templates/vitest.config.ts +1 -1
- package/templates/lighthouse-budget.json +0 -17
- package/templates/lighthouserc.json +0 -23
- /package/templates/{tests/unit/components → src/components/layout}/Header.test.tsx +0 -0
- /package/templates/{tests/unit/components → src/components/shared/ErrorBoundary}/ErrorBoundary.test.tsx +0 -0
- /package/templates/{tests/unit/components → src/components/shared/LanguageSwitcher}/LanguageSwitcher.test.tsx +0 -0
- /package/templates/{tests/unit/components → src/components/shared/RegisterForm}/RegisterForm.test.tsx +0 -0
- /package/templates/{tests/unit/components → src/components/shared/SEO}/SEO.test.tsx +0 -0
- /package/templates/{tests/unit/components → src/components/shared/ThemeToggle}/ThemeToggle.test.tsx +0 -0
- /package/templates/{tests/unit/components/Loading.test.tsx → src/components/ui/loading.test.tsx} +0 -0
- /package/templates/{tests/unit → src}/contexts/mobileContext.test.tsx +0 -0
- /package/templates/{tests/unit → src}/hooks/useExampleQuery.test.tsx +0 -0
- /package/templates/{tests/unit → src}/hooks/useLanguage.test.tsx +0 -0
- /package/templates/{tests/unit → src}/hooks/useMediaQuery.test.ts +0 -0
- /package/templates/{tests/unit → src}/hooks/useRegisterForm.test.tsx +0 -0
- /package/templates/{tests/unit → src}/hooks/useThemeEffect.test.ts +0 -0
- /package/templates/{tests/unit → src}/i18n/detectLanguage.test.ts +0 -0
- /package/templates/{tests/unit → src}/i18n/loadCatalog.test.ts +0 -0
- /package/templates/{tests/unit → src}/lib/api.test.ts +0 -0
- /package/templates/{tests/unit → src}/lib/storage.test.ts +0 -0
- /package/templates/{tests/unit → src}/lib/utils.test.ts +0 -0
- /package/templates/{tests/unit → src}/lib/validations.test.ts +0 -0
- /package/templates/{tests/unit → src}/stores/preferencesStore.test.ts +0 -0
package/templates/src/main.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import './index.css';
|
|
|
7
7
|
import { ErrorBoundary } from '@/components/shared';
|
|
8
8
|
import { Toaster } from '@/components/ui/sonner';
|
|
9
9
|
import { MobileProvider } from '@/contexts/mobileContext';
|
|
10
|
+
import { PerformanceProviderWrapper } from '@/contexts/performanceContext';
|
|
10
11
|
import { QueryProvider } from '@/contexts/queryContext';
|
|
11
12
|
import { i18n, initI18n } from '@/i18n';
|
|
12
13
|
import { SENTRY_CONFIG } from '@/lib/config';
|
|
@@ -75,8 +76,10 @@ initI18n().then(() => {
|
|
|
75
76
|
<BrowserRouter>
|
|
76
77
|
<MobileProvider>
|
|
77
78
|
<ErrorBoundary>
|
|
78
|
-
<
|
|
79
|
-
|
|
79
|
+
<PerformanceProviderWrapper>
|
|
80
|
+
<App />
|
|
81
|
+
<Toaster />
|
|
82
|
+
</PerformanceProviderWrapper>
|
|
80
83
|
</ErrorBoundary>
|
|
81
84
|
</MobileProvider>
|
|
82
85
|
</BrowserRouter>
|
|
@@ -1,46 +1,51 @@
|
|
|
1
1
|
import { Trans, useLingui } from '@lingui/react/macro';
|
|
2
|
+
import { Profiler } from 'react';
|
|
2
3
|
|
|
3
4
|
import { RegisterForm, SEO } from '@/components/shared';
|
|
5
|
+
import { usePerformance } from '@/contexts/performanceContext';
|
|
4
6
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
|
5
7
|
|
|
6
8
|
export function HomePage() {
|
|
7
9
|
const { t } = useLingui();
|
|
10
|
+
const { onProfilerRender } = usePerformance();
|
|
8
11
|
|
|
9
12
|
return (
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
<Profiler id="home-page" onRender={onProfilerRender}>
|
|
14
|
+
<div className="container mx-auto max-w-lg px-4 py-8">
|
|
15
|
+
<SEO
|
|
16
|
+
title={t({ message: 'Home', comment: 'Home page title for SEO' })}
|
|
17
|
+
description={t({
|
|
18
|
+
message: 'Welcome to our modern React application',
|
|
19
|
+
comment: 'Home page meta description for SEO',
|
|
20
|
+
})}
|
|
21
|
+
/>
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
<div className="mb-8 text-center">
|
|
24
|
+
<h1 className="text-3xl font-bold">
|
|
25
|
+
<Trans comment="Main heading on the home page">Welcome to My App</Trans>
|
|
26
|
+
</h1>
|
|
27
|
+
<p className="text-muted-foreground mt-2">
|
|
28
|
+
<Trans comment="Instructions for developers on how to start customizing the app">
|
|
29
|
+
Get started by editing <code className="bg-muted rounded px-1">src/App.tsx</code>
|
|
30
|
+
</Trans>
|
|
31
|
+
</p>
|
|
32
|
+
</div>
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
{/* Form validation demo */}
|
|
35
|
+
<Card>
|
|
36
|
+
<CardHeader>
|
|
37
|
+
<CardTitle>
|
|
38
|
+
<Trans comment="Register form card title">Registration Form</Trans>
|
|
39
|
+
</CardTitle>
|
|
40
|
+
<CardDescription>
|
|
41
|
+
<Trans comment="Register form card description">React Hook Form + Zod validation demo</Trans>
|
|
42
|
+
</CardDescription>
|
|
43
|
+
</CardHeader>
|
|
44
|
+
<CardContent>
|
|
45
|
+
<RegisterForm />
|
|
46
|
+
</CardContent>
|
|
47
|
+
</Card>
|
|
48
|
+
</div>
|
|
49
|
+
</Profiler>
|
|
45
50
|
);
|
|
46
51
|
}
|
|
@@ -6,6 +6,7 @@ import { type ReactElement, type ReactNode } from 'react';
|
|
|
6
6
|
import { MemoryRouter } from 'react-router';
|
|
7
7
|
|
|
8
8
|
import { MobileProvider } from '@/contexts/mobileContext';
|
|
9
|
+
import { PerformanceProviderWrapper } from '@/contexts/performanceContext';
|
|
9
10
|
|
|
10
11
|
// Setup empty English catalog for tests
|
|
11
12
|
i18n.loadAndActivate({ locale: 'en', messages: {} });
|
|
@@ -36,11 +37,14 @@ interface WrapperProps {
|
|
|
36
37
|
function AllProviders({ children }: WrapperProps) {
|
|
37
38
|
const queryClient = createTestQueryClient();
|
|
38
39
|
|
|
40
|
+
// Provider order matches main.tsx: Query > I18n > Router > Mobile > Performance
|
|
39
41
|
return (
|
|
40
42
|
<QueryClientProvider client={queryClient}>
|
|
41
43
|
<I18nProvider i18n={i18n}>
|
|
42
44
|
<MemoryRouter>
|
|
43
|
-
<MobileProvider>
|
|
45
|
+
<MobileProvider>
|
|
46
|
+
<PerformanceProviderWrapper>{children}</PerformanceProviderWrapper>
|
|
47
|
+
</MobileProvider>
|
|
44
48
|
</MemoryRouter>
|
|
45
49
|
</I18nProvider>
|
|
46
50
|
</QueryClientProvider>
|
|
@@ -15,7 +15,7 @@ export default defineConfig({
|
|
|
15
15
|
globals: true,
|
|
16
16
|
environment: 'jsdom',
|
|
17
17
|
setupFiles: ['./src/test-setup.ts'],
|
|
18
|
-
include: ['src/**/*.test.{ts,tsx}'
|
|
18
|
+
include: ['src/**/*.test.{ts,tsx}'],
|
|
19
19
|
clearMocks: true,
|
|
20
20
|
restoreMocks: true,
|
|
21
21
|
coverage: {
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"path": "/*",
|
|
4
|
-
"resourceSizes": [
|
|
5
|
-
{ "resourceType": "script", "budget": 500 },
|
|
6
|
-
{ "resourceType": "stylesheet", "budget": 100 },
|
|
7
|
-
{ "resourceType": "total", "budget": 1000 }
|
|
8
|
-
],
|
|
9
|
-
"resourceCounts": [{ "resourceType": "third-party", "budget": 10 }],
|
|
10
|
-
"timings": [
|
|
11
|
-
{ "metric": "first-contentful-paint", "budget": 2000 },
|
|
12
|
-
{ "metric": "interactive", "budget": 5000 },
|
|
13
|
-
{ "metric": "largest-contentful-paint", "budget": 3000 },
|
|
14
|
-
{ "metric": "cumulative-layout-shift", "budget": 0.1 }
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
]
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"ci": {
|
|
3
|
-
"collect": {
|
|
4
|
-
"staticDistDir": "./dist",
|
|
5
|
-
"numberOfRuns": 3,
|
|
6
|
-
"settings": {
|
|
7
|
-
"preset": "desktop",
|
|
8
|
-
"budgetPath": "./lighthouse-budget.json"
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
"assert": {
|
|
12
|
-
"assertions": {
|
|
13
|
-
"categories:performance": ["warn", { "minScore": 0.9 }],
|
|
14
|
-
"categories:accessibility": ["warn", { "minScore": 0.9 }],
|
|
15
|
-
"categories:best-practices": ["warn", { "minScore": 0.9 }],
|
|
16
|
-
"categories:seo": ["warn", { "minScore": 0.9 }]
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"upload": {
|
|
20
|
-
"target": "temporary-public-storage"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/templates/{tests/unit/components → src/components/shared/ThemeToggle}/ThemeToggle.test.tsx
RENAMED
|
File without changes
|
/package/templates/{tests/unit/components/Loading.test.tsx → src/components/ui/loading.test.tsx}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|