mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-02 07:59:56 -04:00
Switch the base framework from Create React App to Next.JS
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
a979b6ffdd
commit
77a60c6c48
361 changed files with 5130 additions and 9605 deletions
|
@ -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
|
||||
}
|
||||
|
|
9
src/utils/is-client-side-rendering.ts
Normal file
9
src/utils/is-client-side-rendering.ts
Normal 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'
|
||||
}
|
|
@ -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'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue