Skip to content

Commit

Permalink
fix(#2192): Optimize and fix vulnerabilities in frontend and metadata…
Browse files Browse the repository at this point in the history
… services
  • Loading branch information
MSzalowski committed Dec 9, 2024
1 parent 60a7bb1 commit 3628df4
Show file tree
Hide file tree
Showing 49 changed files with 6,230 additions and 34,135 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/code_check_frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.NPMRC_TOKEN }}

- name: 🧪 Test
env:
NODE_OPTIONS: "--max_old_space_size=8192"
run: |
npm run test
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/frontend_sonar_scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:
- name: 🧪 Test
working-directory: govtool/frontend
env:
NODE_OPTIONS: "--max_old_space_size=6144"
NODE_AUTH_TOKEN: ${{ secrets.NPMRC_TOKEN }}
run: |
npm ci
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test_storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 16
node-version-file: "govtool/frontend/.nvmrc"
- name: Install dependencies
run: |
npm config set @intersect.mbo:registry "https://registry.npmjs.org/" --location=global
Expand All @@ -27,7 +27,7 @@ jobs:
- name: Install Playwright
run: npx playwright install --with-deps
- name: Build Storybook
run: NODE_OPTIONS="--max-old-space-size=8046" npm run build:storybook --quiet
run: npm run build:storybook --quiet
- name: Serve Storybook and run tests
run: |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ changes.

### Fixed

-
- Fix vulnerabilities in dependencies [Issue 2192](https://github.com/IntersectMBO/govtool/issues/2192)
- Optimize resources usage in frontend service build [Issue 2192](https://github.com/IntersectMBO/govtool/issues/2192)

### Changed

Expand Down
8 changes: 3 additions & 5 deletions govtool/frontend/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ import type { StorybookConfig } from "@storybook/react-vite";
const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-jest",
"@storybook/addon-links",
"@storybook/addon-onboarding",
"@storybook/addon-interactions",
],
framework: {
name: "@storybook/react-vite",
options: {},
},
docs: {
autodocs: "tag",
},
docs: {},
};
export default config;
47 changes: 25 additions & 22 deletions govtool/frontend/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { MemoryRouter, Route, Routes } from "react-router-dom";
import { FeatureFlagProvider } from "../src/context/featureFlag";
import { AppContextProvider } from "../src/context/appContext";
import { ModalProvider } from "../src/context/modal";
import { CardanoProvider } from "../src/context/wallet";
import i18n from "../src/i18n";
import { theme } from "../src/theme";

Expand All @@ -29,28 +30,30 @@ const preview: Preview = {
<AppContextProvider>
<FeatureFlagProvider>
<ThemeProvider theme={theme}>
<ModalProvider>
<I18nextProvider i18n={i18n}>
<MemoryRouter>
<Routes>
<Route
path="/*"
element={
<div
style={{
margin: "0px",
padding: "0px",
position: "relative",
}}
>
<Story />
</div>
}
/>
</Routes>
</MemoryRouter>
</I18nextProvider>
</ModalProvider>
<CardanoProvider>
<ModalProvider>
<I18nextProvider i18n={i18n}>
<MemoryRouter>
<Routes>
<Route
path="/*"
element={
<div
style={{
margin: "0px",
padding: "0px",
position: "relative",
}}
>
<Story />
</div>
}
/>
</Routes>
</MemoryRouter>
</I18nextProvider>
</ModalProvider>
</CardanoProvider>
</ThemeProvider>
</FeatureFlagProvider>
</AppContextProvider>
Expand Down
13 changes: 0 additions & 13 deletions govtool/frontend/.storybook/test-runner-jest.js

This file was deleted.

4 changes: 2 additions & 2 deletions govtool/frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ RUN \
: "${VITE_IPFS_GATEWAY:?Build argument VITE_IPFS_GATEWAY is not set}" && \
: "${VITE_IPFS_PROJECT_ID:?Build argument VITE_IPFS_PROJECT_ID is not set}"

ENV NODE_OPTIONS=--max_old_space_size=8192

WORKDIR /src

# Set npm configuration settings using environment variables
RUN npm config set @intersect.mbo:registry "https://registry.npmjs.org/" --location=global
RUN npm config set //registry.npmjs.org/:_authToken ${NPMRC_TOKEN} --location=global

COPY package.json package-lock.json ./
COPY patches ./patches

RUN npm install
COPY . .
RUN npm run build
Expand Down
4 changes: 2 additions & 2 deletions govtool/frontend/Dockerfile.qovery
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ ARG VITE_PDF_API_URL
ARG VITE_IPFS_GATEWAY
ARG VITE_IPFS_PROJECT_ID

ENV NODE_OPTIONS=--max_old_space_size=8192

WORKDIR /src

# Set npm configuration settings using environment variables
RUN npm config set @intersect.mbo:registry "https://registry.npmjs.org/" --location=global
RUN npm config set //registry.npmjs.org/:_authToken ${NPMRC_TOKEN} --location=global

COPY package.json package-lock.json ./
COPY patches ./patches

RUN npm install
COPY . .
RUN npm run build
Expand Down
Loading

0 comments on commit 3628df4

Please sign in to comment.