Skip to content

Commit

Permalink
Replace CRA with Vite; COUNTRY=cambodia (#1210)
Browse files Browse the repository at this point in the history
  • Loading branch information
echaidemenos authored Jul 12, 2024
1 parent 99dec61 commit 3a69a24
Show file tree
Hide file tree
Showing 271 changed files with 15,080 additions and 17,952 deletions.
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

0 comments on commit 3a69a24

Please sign in to comment.