Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace CRA with Vite; COUNTRY=cambodia #1210

Merged
merged 74 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from 71 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
00ac909
Add Vite
echaidemenos Apr 29, 2024
7928ab3
Fix eslint
echaidemenos Apr 30, 2024
6e75058
Configure jest
echaidemenos May 1, 2024
c8f2c1b
Bump react to 17
echaidemenos May 1, 2024
e85f277
Merge branch 'master' into vite-migration
echaidemenos May 1, 2024
c47aa6b
merge main
ericboucher Jul 3, 2024
e7d37d1
Remove unused React imports
ericboucher Jul 3, 2024
c8b743d
Update node version
ericboucher Jul 3, 2024
6672efe
Update Dockerfile
ericboucher Jul 3, 2024
5f48abe
Fix a few linting errors
ericboucher Jul 3, 2024
5dbd10d
Fix typos
ericboucher Jul 3, 2024
1a9751d
Fix typos
ericboucher Jul 3, 2024
fe2c866
Fix a few linting errors
ericboucher Jul 3, 2024
3c4e975
Load environment variables
ericboucher Jul 4, 2024
4f99ca1
Fix add layer (to QA)
ericboucher Jul 4, 2024
95fe7d2
Fix menu item console error
ericboucher Jul 4, 2024
808ee29
WIP: Fix build
echaidemenos Jul 4, 2024
a4566c6
Update setupTests.ts
echaidemenos Jul 4, 2024
e514b5d
Merge branch 'master' into vite-migration
ericboucher Jul 4, 2024
7a26116
Fix a few build errors
ericboucher Jul 4, 2024
194bf64
Fix a few more build errors
ericboucher Jul 4, 2024
e3ac705
Fix a few more build errors
ericboucher Jul 4, 2024
7ccad47
Fix a few more build errors
ericboucher Jul 4, 2024
7cacf75
Remove test files from build
ericboucher Jul 4, 2024
0801307
Fix a few more build errors
ericboucher Jul 4, 2024
4fa4bfb
Fix build and lint errors
echaidemenos Jul 5, 2024
4c3b8ec
Re-add missing package commands
ericboucher Jul 5, 2024
1007317
Upgrade react-pdf
ericboucher Jul 5, 2024
6ec6e3c
Update index.tsx
ericboucher Jul 5, 2024
9104439
Update package.json
ericboucher Jul 5, 2024
4bb2e68
Update preprocess-layers.ts
ericboucher Jul 5, 2024
5ef1a4e
Remove files for other countries
ericboucher Jul 5, 2024
f03c895
Update tests
echaidemenos Jul 5, 2024
7ef5839
Merge branch 'vite-migration' of github.com:WFP-VAM/prism-app into vi…
echaidemenos Jul 5, 2024
b58cbaa
Update tests
echaidemenos Jul 5, 2024
1f17a14
Update test
echaidemenos Jul 5, 2024
b7d06b6
Update package.json
ericboucher Jul 5, 2024
1c6dde9
Fix Box style issue
echaidemenos Jul 5, 2024
0783b86
Fix tests
echaidemenos Jul 5, 2024
9f38b95
Update node and host setups for docker
ericboucher Jul 7, 2024
8a8523e
Apply react-refresh/only-export-components
echaidemenos Jul 8, 2024
34969e6
Update .eslintrc.cjs
echaidemenos Jul 8, 2024
464c09b
Update tests
echaidemenos Jul 8, 2024
7bf66d9
Merge branch 'master' into vite-migration
echaidemenos Jul 8, 2024
69f75f4
Fix tests
echaidemenos Jul 8, 2024
adc85b4
Use useMediaQuery
echaidemenos Jul 8, 2024
6d4fe00
Update report
echaidemenos Jul 8, 2024
64374b5
Update package.json
ericboucher Jul 8, 2024
829960d
Fix api report
ericboucher Jul 9, 2024
ca16657
Fix hidden button
ericboucher Jul 9, 2024
b02ae2f
Update server-utils.ts
ericboucher Jul 9, 2024
bc67b5b
Fix tooltip
echaidemenos Jul 9, 2024
98ee745
Update report doc
echaidemenos Jul 9, 2024
92fd8fd
update react-pdf
ericboucher Jul 9, 2024
8a0a4a6
Address comments
ericboucher Jul 10, 2024
f1482e2
Test reinstall canvas
ericboucher Jul 10, 2024
0206c6d
Update no-unused-vars rule
echaidemenos Jul 10, 2024
63d5750
Update package.json
ericboucher Jul 10, 2024
9f6fe25
default-param-last
ericboucher Jul 10, 2024
6bafc2f
Use lint:ci
ericboucher Jul 10, 2024
6cdb26c
Update package.json
ericboucher Jul 10, 2024
b6f75b8
Update frontend.yml
ericboucher Jul 10, 2024
d2971f1
Update frontend.yml
ericboucher Jul 10, 2024
677a685
Update action cache
ericboucher Jul 10, 2024
6b137a2
Update i18n.ts
ericboucher Jul 10, 2024
1d29b00
Update i18n.ts
ericboucher Jul 10, 2024
2b2efed
Merge branch 'master' into vite-migration
ericboucher Jul 11, 2024
eef9d0f
Update frontend.yml
ericboucher Jul 11, 2024
4820bfa
Merge branch 'master' into vite-migration
wadhwamatic Jul 11, 2024
e34274b
Overriding install of optional dependency canvas https://github.com/w…
gislawill Jul 11, 2024
5992c22
Completing removal of canvas
gislawill Jul 11, 2024
90e5963
Update index.tsx
ericboucher Jul 12, 2024
7c11bfc
Update index.tsx
ericboucher Jul 12, 2024
54a6b63
Update index.tsx
ericboucher Jul 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,29 @@ jobs:
os:
- ubuntu-latest
- windows-latest
max-parallel: 2

name: frontend_tests
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Use Node.js 16.x
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20

- uses: actions/cache@v2
- uses: actions/cache@v4
id: yarn-cache
with:
path: |
**/node_modules
**/.eslintcache
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-2024-2-${{ hashFiles('**/frontend/yarn.lock') }}-${{ hashFiles('**/common/yarn.lock') }}
key: ${{ runner.os }}-yarn-2024-7-${{ hashFiles('**/frontend/yarn.lock') }}-${{ hashFiles('**/common/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-2024-2
${{ runner.os }}-yarn-2024-7

- name: Install dependencies if needed.
if: steps.yarn-cache.outputs.cache-hit != 'true'
Expand All @@ -45,10 +46,12 @@ jobs:
yarn setup:common

- name: Lint
run: cd frontend && yarn lint
run: cd frontend && yarn lint:ci

- name: Test
run: cd frontend && yarn test
run: |
cd frontend
yarn test

- name: JSON check
run: cd frontend && yarn prettier:json-check
Expand Down Expand Up @@ -81,21 +84,21 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Use Node.js 16.x
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20

- uses: actions/cache@v2
- uses: actions/cache@v4
id: yarn-cache
with:
path: |
**/node_modules
**/.eslintcache
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-2024-${{ hashFiles('**/frontend/yarn.lock') }}-${{ hashFiles('**/common/yarn.lock') }}
key: ${{ runner.os }}-yarn-2024-7-${{ hashFiles('**/frontend/yarn.lock') }}-${{ hashFiles('**/common/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-2024
${{ runner.os }}-yarn-2024-7

- name: Install dependencies if needed.
if: steps.yarn-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -151,16 +154,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Use Node.js 16.x
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
- uses: actions/cache@v4
id: yarn-cache
with:
path: |
Expand Down
1 change: 0 additions & 1 deletion api/app/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from typing import Final, Optional
from urllib.parse import parse_qs, urlparse

import pytest
from app.caching import CACHE_DIRECTORY
from playwright.async_api import async_playwright, expect

Expand Down
6 changes: 3 additions & 3 deletions common/src/base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class Base {
fetch?: any;
service?: string;
version?: string;
} = { fetch: undefined }
} = { fetch: undefined },
) {
this.debug = debug;
this.fetch = customFetch || fetch;
Expand Down Expand Up @@ -67,13 +67,13 @@ export class Base {

async getLayerNames(): Promise<string[]> {
throw new Error(
`${this.constructor.name} does not implement getLayerNames`
`${this.constructor.name} does not implement getLayerNames`,
);
}

async hasLayerId(
layerId: string,
options?: Parameters<typeof hasLayerId>[2]
options?: Parameters<typeof hasLayerId>[2],
): Promise<boolean> {
return hasLayerId(await this.getLayerIds(), layerId, options);
}
Expand Down
2 changes: 1 addition & 1 deletion common/src/base/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test("Base.getCapabilities", async ({ eq }) => {
{
fetch,
service: "WFS",
}
},
);
const xml3 = await ows.getCapabilities({ debug: true });
const xml4 = await ows.getCapabilities({ debug: true, version: "2.0.0" });
Expand Down
4 changes: 2 additions & 2 deletions common/src/gml/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { findTagByName } from "xml-utils";
import { findTagText } from "../utils";

export function parseEnvelope(
xml: string
xml: string,
): Readonly<[number, number, number, number]> {
const lowerCorner = findTagText(xml, "gml:lowerCorner");
const upperCorner = findTagText(xml, "gml:upperCorner");
Expand All @@ -15,7 +15,7 @@ export function parseEnvelope(
}

export function findAndParseEnvelope(
xml: string
xml: string,
): Readonly<[number, number, number, number]> | undefined {
const envelope = findTagByName(xml, "gml:Envelope")?.outer;
return envelope ? parseEnvelope(envelope) : undefined;
Expand Down
10 changes: 5 additions & 5 deletions common/src/ows/capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function getCapabilitiesUrl(
params?: { [k: string]: number | string };
service?: string;
version?: string;
} = { service: undefined, version: undefined }
} = { service: undefined, version: undefined },
) {
try {
const { origin, pathname, searchParams } = new URL(url);
Expand All @@ -37,7 +37,7 @@ export function getCapabilitiesUrl(
return formatUrl(base, paramsObj);
} catch (error) {
throw Error(
`getCapabilitiesUrl failed to parse "${url}" because of the following error:\n${error}`
`getCapabilitiesUrl failed to parse "${url}" because of the following error:\n${error}`,
);
}
}
Expand All @@ -57,7 +57,7 @@ export async function getCapabilities(
service?: string;
version?: string;
wait?: number;
} = {}
} = {},
): Promise<string> {
const run = async () => {
const capabilitiesUrl = getCapabilitiesUrl(url, {
Expand All @@ -69,7 +69,7 @@ export async function getCapabilities(

if (response.status !== 200) {
throw new Error(
`fetch failed for "${capabilitiesUrl}" returning a status code of ${response.status}`
`fetch failed for "${capabilitiesUrl}" returning a status code of ${response.status}`,
);
}

Expand All @@ -78,7 +78,7 @@ export async function getCapabilities(
const exception = findException(xml);
if (exception) {
throw new Error(
`fetch to "${capabilitiesUrl}" returned the following exception: "${exception}"`
`fetch to "${capabilitiesUrl}" returned the following exception: "${exception}"`,
);
}

Expand Down
2 changes: 1 addition & 1 deletion common/src/ows/find-and-parse-bbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { findTagText } from "../utils";
import parseBoundingBox from "./parse-bbox";

export default function findAndParseBoundingBox(
xml: string
xml: string,
): Readonly<[number, number, number, number]> | undefined {
const bbox = findTagText(xml, "ows:BoundingBox");
return bbox ? parseBoundingBox(bbox) : undefined;
Expand Down
2 changes: 1 addition & 1 deletion common/src/ows/find-and-parse-operation-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { titlecase } from "../utils";
export default function findAndParseOperationUrl(
xml: string,
op: string,
method: "GET" | "POST" | "Get" | "Post" = "Get"
method: "GET" | "POST" | "Get" | "Post" = "Get",
): string | undefined {
const xmlOp = findOperation(xml, op);
if (!xmlOp) {
Expand Down
2 changes: 1 addition & 1 deletion common/src/ows/find-and-parse-wgs84-bbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { findTagText } from "../utils";
import parseBoundingBox from "./parse-bbox";

export default function parseWGS84BoundingBox(
xml: string
xml: string,
): Readonly<[number, number, number, number]> | undefined {
const bbox = findTagText(xml, "ows:WGS84BoundingBox");
if (bbox) {
Expand Down
2 changes: 1 addition & 1 deletion common/src/ows/find-operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import findOperations from "./find-operations";

export default function findOperation(
xml: string,
name: string
name: string,
): string | undefined {
return findOperations(xml)?.find((op) => getAttribute(op, "name") === name);
}
2 changes: 1 addition & 1 deletion common/src/ows/find-operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { findTagsByPath } from "xml-utils";

export default function findOperations(xml: string): string[] {
return findTagsByPath(xml, ["ows:OperationsMetadata", "ows:Operation"]).map(
(tag) => tag.outer
(tag) => tag.outer,
);
}
2 changes: 1 addition & 1 deletion common/src/ows/parse-bbox.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { findTagText } from "../utils";

export default function parseBoundingBox(
xml: string
xml: string,
): Readonly<[number, number, number, number]> | undefined {
const lowerCorner = findTagText(xml, "ows:LowerCorner");
const upperCorner = findTagText(xml, "ows:UpperCorner");
Expand Down
Loading
Loading