Skip to content

Commit c58ff76

Browse files
Merge pull request #10 from StreetSupport/staging
Merge staging to main
2 parents 13a8e48 + ed42ad6 commit c58ff76

File tree

470 files changed

+33269
-50
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

470 files changed

+33269
-50
lines changed

.github/workflows/test-and-deploy.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,33 @@
1-
name: Deploy to Staging
1+
name: Test & Deploy
22

33
on:
4-
push:
5-
branches: [staging, main]
64
pull_request:
75
branches: [staging, main]
6+
push:
7+
branches: [staging, main]
88

99
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
name: test
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v3
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: 22
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Run tests and build
27+
run: npm run build
28+
1029
deploy:
30+
needs: test
1131
if: github.ref == 'refs/heads/staging'
1232
runs-on: ubuntu-latest
1333
name: deploy
@@ -40,4 +60,4 @@ jobs:
4060
target_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
4161
description: 'Vercel deployment triggered',
4262
context: 'ci/deployment-triggered'
43-
})
63+
})

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ next-env.d.ts
5555
.vscode/*
5656
!.vscode/extensions.json
5757
# Sentry Config File
58-
.env.sentry-build-plugin
58+
.env.sentry-build-plugin

config/jest.config.cjs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const nextJest = require('next/jest');
2+
3+
const createJestConfig = nextJest({
4+
// Provide the path to your Next.js app to load next.config.js and .env files
5+
dir: './',
6+
});
7+
8+
// Add any custom config to be passed to Jest
9+
const customJestConfig = {
10+
// Ensure <rootDir> is the project root (one level up from /config)
11+
rootDir: '../',
12+
setupFilesAfterEnv: ['<rootDir>/config/jest.setup.js'],
13+
moduleNameMapper: {
14+
// Handle module aliases (this will be automatically configured for you based on your tsconfig.json paths)
15+
'^@/(.*)$': '<rootDir>/src/$1',
16+
},
17+
testEnvironment: 'jest-environment-jsdom',
18+
collectCoverageFrom: [
19+
'src/**/*.{js,jsx,ts,tsx}',
20+
'!src/**/*.d.ts',
21+
'!src/**/*.stories.{js,jsx,ts,tsx}',
22+
'!src/**/index.{js,jsx,ts,tsx}',
23+
],
24+
testPathIgnorePatterns: [
25+
'<rootDir>/.next/',
26+
'<rootDir>/node_modules/',
27+
'<rootDir>/tests/e2e/',
28+
],
29+
transform: {
30+
'^.+\\.(js|jsx|ts|tsx)$': ['babel-jest', { presets: ['next/babel'] }],
31+
},
32+
transformIgnorePatterns: [
33+
'/node_modules/',
34+
'^.+\\.module\\.(css|sass|scss)$',
35+
],
36+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
37+
};
38+
39+
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
40+
module.exports = createJestConfig(customJestConfig);

config/jest.setup.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import '@testing-library/jest-dom';
2+
3+
// Mock Next.js router
4+
jest.mock('next/router', () => ({
5+
useRouter() {
6+
return {
7+
route: '/',
8+
pathname: '/',
9+
query: {},
10+
asPath: '/',
11+
push: jest.fn(),
12+
pop: jest.fn(),
13+
reload: jest.fn(),
14+
back: jest.fn(),
15+
prefetch: jest.fn().mockResolvedValue(undefined),
16+
beforePopState: jest.fn(),
17+
events: {
18+
on: jest.fn(),
19+
off: jest.fn(),
20+
emit: jest.fn(),
21+
},
22+
isFallback: false,
23+
};
24+
},
25+
}));

config/playwright.config.ts

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import { defineConfig, devices } from '@playwright/test';
2+
3+
/**
4+
* @see https://playwright.dev/docs/test-configuration
5+
*/
6+
export default defineConfig({
7+
testDir: '../tests/e2e',
8+
/* Run tests in files in parallel */
9+
fullyParallel: true,
10+
/* Fail the build on CI if you accidentally left test.only in the source code. */
11+
forbidOnly: !!process.env.CI,
12+
/* Retry on CI only */
13+
retries: process.env.CI ? 2 : 0,
14+
/* Opt out of parallel tests on CI. */
15+
workers: process.env.CI ? 1 : undefined,
16+
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
17+
reporter: 'html',
18+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
19+
use: {
20+
/* Base URL to use in actions like `await page.goto('/')`. */
21+
baseURL: 'http://127.0.0.1:3000',
22+
23+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
24+
trace: 'on-first-retry',
25+
},
26+
27+
/* Configure projects for major browsers */
28+
projects: [
29+
{
30+
name: 'chromium',
31+
use: { ...devices['Desktop Chrome'] },
32+
},
33+
34+
{
35+
name: 'firefox',
36+
use: { ...devices['Desktop Firefox'] },
37+
},
38+
39+
{
40+
name: 'webkit',
41+
use: { ...devices['Desktop Safari'] },
42+
},
43+
44+
/* Test against mobile viewports. */
45+
// {
46+
// name: 'Mobile Chrome',
47+
// use: { ...devices['Pixel 5'] },
48+
// },
49+
// {
50+
// name: 'Mobile Safari',
51+
// use: { ...devices['iPhone 12'] },
52+
// },
53+
54+
/* Test against branded browsers. */
55+
// {
56+
// name: 'Microsoft Edge',
57+
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
58+
// },
59+
// {
60+
// name: 'Google Chrome',
61+
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
62+
// },
63+
],
64+
65+
/* Run your local dev server before starting the tests */
66+
webServer: {
67+
command: 'npm run dev',
68+
url: 'http://127.0.0.1:3000',
69+
reuseExistingServer: !process.env.CI,
70+
},
71+
});

eslint.config.mjs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,16 @@ const config = [
6464
"no-console": "off"
6565
}
6666
},
67+
{
68+
files: ['**/*.ts', '**/*.tsx'],
69+
rules: {
70+
"@typescript-eslint/no-empty-interface": "off",
71+
"@typescript-eslint/no-empty-object-type": "off"
72+
}
73+
},
6774
{
6875
ignores: ["**/node_modules/**", "**/.next/**", "**/out/**", "**/public/**", "**/coverage/**"]
6976
}
7077
];
7178

72-
export default config;
79+
export default config;

eslintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ node_modules/
22
.next/
33
out/
44
coverage/
5-
public/
5+
public/

next.config.ts

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
import {withSentryConfig} from '@sentry/nextjs';
2+
import dotenv from 'dotenv';
3+
dotenv.config({ path: '.env.local' });
4+
5+
const nextConfig = {
6+
reactStrictMode: true, // Temporarily disabled for testing
7+
8+
// Enable response compression for better performance
9+
compress: true,
10+
11+
// Performance optimizations
12+
poweredByHeader: false, // Remove X-Powered-By header for security and performance
13+
14+
// Build optimizations (swcMinify is now default in Next.js 15)
15+
16+
images: {
17+
// Enable modern image formats for better compression
18+
formats: ['image/avif', 'image/webp'],
19+
20+
// Allowed remote image sources (domains is deprecated)
21+
remotePatterns: process.env.BLOB_STORAGE_HOSTNAME
22+
? [
23+
{
24+
protocol: 'https',
25+
hostname: process.env.BLOB_STORAGE_HOSTNAME,
26+
pathname: '/**',
27+
},
28+
]
29+
: [],
30+
31+
// Device sizes for responsive images
32+
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048],
33+
34+
// Image sizes for different breakpoints
35+
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
36+
37+
// Minimize layout shift by enforcing size requirements
38+
minimumCacheTTL: 60,
39+
},
40+
41+
// Enable experimental features for better performance
42+
experimental: {
43+
// Optimize server components
44+
optimizeServerReact: true,
45+
},
46+
47+
// Turbopack configuration (moved from experimental.turbo)
48+
turbopack: {
49+
resolveAlias: {
50+
// Reduce bundle size by aliasing large dependencies
51+
'react-icons/lib': 'react-icons',
52+
},
53+
},
54+
55+
// Production optimizations
56+
...(process.env.NODE_ENV === 'production' && {
57+
output: 'standalone', // Optimize for deployment
58+
59+
// Webpack optimizations
60+
webpack: (config: any) => {
61+
// Enable module concatenation for smaller bundles
62+
config.optimization = {
63+
...config.optimization,
64+
usedExports: true,
65+
sideEffects: false,
66+
67+
// Split chunks for better caching
68+
splitChunks: {
69+
...config.optimization?.splitChunks,
70+
chunks: 'all',
71+
cacheGroups: {
72+
...config.optimization?.splitChunks?.cacheGroups,
73+
// Separate vendor chunks
74+
vendor: {
75+
test: /[\\/]node_modules[\\/]/,
76+
name: 'vendors',
77+
chunks: 'all',
78+
priority: 10,
79+
},
80+
},
81+
}
82+
};
83+
84+
return config;
85+
},
86+
}),
87+
};
88+
89+
export default withSentryConfig(nextConfig, {
90+
// For all available options, see:
91+
// https://www.npmjs.com/package/@sentry/webpack-plugin#options
92+
93+
org: process.env.SENTRY_ORG,
94+
95+
project: process.env.SENTRY_PROJECT,
96+
97+
// Only print logs for uploading source maps in CI
98+
silent: !process.env.CI,
99+
100+
// For all available options, see:
101+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
102+
103+
// Upload a larger set of source maps for prettier stack traces (increases build time)
104+
widenClientFileUpload: true,
105+
106+
// Uncomment to route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
107+
// This can increase your server load as well as your hosting bill.
108+
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
109+
// side errors will fail.
110+
// tunnelRoute: "/monitoring",
111+
112+
// Automatically tree-shake Sentry logger statements to reduce bundle size
113+
disableLogger: true,
114+
115+
// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
116+
// See the following for more information:
117+
// https://docs.sentry.io/product/crons/
118+
// https://vercel.com/docs/cron-jobs
119+
automaticVercelMonitors: true,
120+
});

0 commit comments

Comments
 (0)