Switch the base framework from Create React App to Next.JS

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Renovate Bot 2021-12-25 15:44:24 +00:00 committed by Tilman Vatteroth
parent a979b6ffdd
commit 77a60c6c48
361 changed files with 5130 additions and 9605 deletions

View file

@ -41,7 +41,10 @@ export const cypressId = (
* @param value The attribute content
* @return An object if in test mode, undefined otherwise.
*/
export const cypressAttribute = (attribute: string, value: string): Record<string, string> | undefined => {
export const cypressAttribute = (
attribute: string,
value: string | undefined
): Record<string, string | undefined> | undefined => {
if (!isTestMode()) {
return
}

View file

@ -0,0 +1,9 @@
/*
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
export const isClientSideRendering = (): boolean => {
return typeof window !== 'undefined' && typeof window.navigator !== 'undefined'
}

View file

@ -4,18 +4,22 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
/**
* Checks if the current runtime is built in e2e test mode.
*/
export const isTestMode = (): boolean => {
return !!process.env.REACT_APP_TEST_MODE
return process.env.NEXT_PUBLIC_TEST_MODE === 'true'
}
/**
* Checks if the current runtime should use the mocked backend.
*/
export const isMockMode = (): boolean => {
return process.env.REACT_APP_BACKEND_BASE_URL === undefined
return process.env.NEXT_PUBLIC_USE_MOCK_API === 'true'
}
/**
* Checks if the current runtime was built in development mode.
*
* @return {@code true} if the runtime was built in development mode.
*/
export const isDevMode = (): boolean => {
return process.env.NODE_ENV === 'development'