Skip to content

Commit e26c97e

Browse files
Rajgupta36arkid15r
andauthored
Add Turbo for Faster Compilation, Testing, and Build Times (OWASP#1415)
* added turbo for improving build speed * update * rm dup * Update code --------- Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
1 parent fd7b995 commit e26c97e

File tree

9 files changed

+54
-37
lines changed

9 files changed

+54
-37
lines changed

cspell/custom-dict.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ owasppcitoolkit
7777
owtf
7878
pentest
7979
pentesting
80+
pnpmrc
8081
psycopg
8182
pygithub
8283
pygoat
@@ -95,6 +96,7 @@ speakerdeck
9596
superfences
9697
tiktok
9798
tsc
99+
turbopack
98100
usefixtures
99101
winsrdf
100102
wsgi

frontend/.pnpmrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
legacy-peer-deps=true
2+
public-hoist-pattern[]=*import-in-the-middle*
3+
public-hoist-pattern[]=*require-in-the-middle*
4+
save-exact=true

frontend/docker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ RUN npm install --ignore-scripts -g pnpm
1111
COPY --chmod=444 package.json pnpm-lock.yaml ./
1212
RUN pnpm install --frozen-lockfile --ignore-scripts
1313

14-
COPY --chmod=444 .env next.config.ts postcss.config.js tailwind.config.js tsconfig.json ./
14+
COPY --chmod=444 .env .pnpmrc next.config.ts postcss.config.js tailwind.config.js tsconfig.json ./
1515
COPY --chmod=555 public public
1616
COPY --chmod=555 src src
1717

@@ -28,7 +28,7 @@ ENV NEXT_TELEMETRY_DISABLED=1
2828
ENV NODE_ENV=production
2929

3030
RUN addgroup --system --gid 1001 nodejs && \
31-
adduser --system --uid 1001 -G nodejs nextjs
31+
adduser --system --uid 1001 -G nodejs nextjs
3232
# Copying files with root as owner, so that executing user cannot change the container.
3333
COPY --from=builder --chown=root:root --chmod=555 /app/public public
3434

frontend/docker/Dockerfile.e2e.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ RUN npm install --ignore-scripts -g pnpm && \
1010

1111
COPY __tests__/e2e __tests__/e2e
1212
COPY __tests__/unit/data __tests__/unit/data
13-
COPY next.config.ts postcss.config.js playwright.config.ts tailwind.config.js tsconfig.json ./
13+
COPY .pnpmrc next.config.ts postcss.config.js playwright.config.ts tailwind.config.js tsconfig.json ./
1414
COPY public public
1515
COPY src src

frontend/docker/Dockerfile.unit.test

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ RUN npm install --ignore-scripts -g pnpm && \
1010
chown node:node /app
1111

1212
COPY __tests__/unit __tests__/unit
13-
COPY jest.config.ts jest.config.ts
14-
COPY jest.setup.ts jest.setup.ts
13+
COPY .pnpmrc jest.config.ts jest.setup.ts tsconfig.json ./
1514
COPY public public
1615
COPY src src
17-
COPY tsconfig.json tsconfig.json
1816

1917
USER node

frontend/next.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { NextConfig } from 'next'
44
const isLocal = process.env.NEXT_PUBLIC_ENVIRONMENT === 'local'
55

66
const nextConfig: NextConfig = {
7+
devIndicators: false,
78
images: {
89
// This is a list of remote patterns that Next.js will use to determine
910
// if an image is allowed to be loaded from a remote source.
@@ -26,7 +27,10 @@ const nextConfig: NextConfig = {
2627
},
2728
],
2829
},
29-
devIndicators: false,
30+
serverExternalPackages: ['import-in-the-middle', 'require-in-the-middle'],
31+
turbopack: {
32+
resolveExtensions: ['.ts', '.tsx', '.mjs', '.json', '.yaml', '.js', '.jsx'],
33+
},
3034
...(isLocal ? {} : { output: 'standalone' }),
3135
}
3236

frontend/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
6-
"dev": "next dev --port 3000",
76
"build": "next build",
7+
"build:turbo": "next build --turbo",
8+
"dev": "next dev --port 3000",
89
"format": "prettier --log-level warn --write .",
910
"format:check": "prettier --check .",
1011
"lint": "eslint . --config eslint.config.mjs --fix --max-warnings=0",
@@ -91,13 +92,15 @@
9192
"eslint-plugin-react-hooks": "^5.2.0",
9293
"globals": "^16.0.0",
9394
"identity-obj-proxy": "^3.0.0",
95+
"import-in-the-middle": "^1.13.1",
9496
"jest": "^29.7.0",
9597
"jest-axe": "^10.0.0",
9698
"jest-environment-jsdom": "^29.7.0",
9799
"open": "^10.1.1",
98100
"postcss": "^8.5.3",
99101
"prettier": "^3.5.3",
100102
"prettier-plugin-tailwindcss": "^0.6.11",
103+
"require-in-the-middle": "^7.5.2",
101104
"tailwindcss": "^3.4.17",
102105
"ts-jest": "^29.3.2",
103106
"ts-node": "^10.9.2",

frontend/playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default defineConfig({
2626
trace: 'off',
2727
},
2828
webServer: {
29-
command: 'pnpm run build && pnpm run start',
29+
command: 'pnpm run build:turbo && pnpm run start',
3030
timeout: 120_000,
3131
url: 'http://localhost:3000',
3232
},

frontend/pnpm-lock.yaml

Lines changed: 34 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)