1
0
mirror of https://github.com/barthuijgen/factorio-sites.git synced 2025-01-21 11:41:56 +02:00

Merge branch 'master' into develop

This commit is contained in:
Bart Huijgen 2022-11-14 11:48:43 +01:00
commit 5f12a98601
9 changed files with 21 additions and 19 deletions

View File

@ -29,7 +29,7 @@ jobs:
env:
CF_WEB_ANALYTICS: 6c563c1e5db141129a5fc95d5c459722
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@master
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}

View File

@ -29,15 +29,15 @@ jobs:
env:
PUBLIC_URL: https://factorio-blueprints-assets.storage.googleapis.com/public
CF_WEB_ANALYTICS: 4a7b06ea5bdb4d328a1baea602aea295
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@master
- name: Authenticate gcloud
uses: google-github-actions/auth@v1
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
credentials_json: "${{ secrets.GCP_SA_KEY }}"
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
- run: gcloud auth configure-docker --quiet
- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
context: .
file: blueprints.github.Dockerfile

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
/* eslint-disable import/first */
/* eslint-disable @typescript-eslint/no-explicit-any, import/first */
jest.mock("next/config", () => () => ({
publicRuntimeConfig: {},
}));
@ -6,16 +6,15 @@ jest.mock("next/config", () => () => ({
import { render } from "@testing-library/react";
import Index from "../src/pages/index";
import * as nextRouter from "next/router";
import { NextRouter } from "next/router";
const useRouter = jest.spyOn(nextRouter, "useRouter");
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(global as any).fetch = jest.fn(() => Promise.resolve());
console.error = jest.fn();
describe("Index", () => {
it("should render successfully", () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
useRouter.mockImplementationOnce(() => ({ query: {} } as any));
useRouter.mockImplementation(() => ({ query: {} } as NextRouter));
const { baseElement } = render(
<Index totalItems={0} currentPage={0} totalPages={0} blueprints={[]} />

View File

@ -90,6 +90,7 @@ export const ImageEditor: React.FC<ImageEditorProps> = ({ string, onError }) =>
// const picture = await editor.getPicture();
// setImage(URL.createObjectURL(picture));
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (reason: any) {
setRenderError(true);
if (onError) onError();

View File

@ -66,7 +66,9 @@ export const useFbeData = (): FactorioData | null => {
useEffect(() => {
(async () => {
if (!fbeDataState.value) {
const result = await fetch("/api/fbe-proxy/data.json")
const result = await fetch(
"https://storage.googleapis.com/factorio-blueprints-fbe-assets/data.json"
)
.then((res) => res.json())
.catch(() => {
console.error("Failed to fetch data.json");

View File

@ -14,7 +14,7 @@ export const useFetch = <T>(
const data = dataState.nested(url).value;
const [loading, setLoading] = useState(() => !data && !skip);
const [error, setError] = useState(null);
const [error, setError] = useState<Error | null>(null);
useEffect(() => {
if (!url || data || skip) return;
@ -25,8 +25,8 @@ export const useFetch = <T>(
const response = await fetch(url);
const data = await response.json();
dataState.nested(url).set(data);
} catch (error: any) {
setError(error);
} catch (error: unknown) {
setError(error as Error);
}
setLoading(false);
};

View File

@ -47,8 +47,8 @@ export const fetchSteamProfile = async (steam_id: string, api_key: string) => {
} else {
throw Error("No players found for the given SteamID.");
}
} catch (error: any) {
throw Error("Steam server error: " + error.message);
} catch (error: unknown) {
throw Error("Steam server error: " + (error as Error).message);
}
};