mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-22 11:15:23 -04:00
fix: Move content into to frontend directory
Doing this BEFORE the merge prevents a lot of merge conflicts. Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
4e18ce38f3
commit
762a0a850e
1051 changed files with 0 additions and 35 deletions
44
frontend/src/utils/test-modes.js
Normal file
44
frontend/src/utils/test-modes.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
/**
|
||||
* This file is intentionally a js and not a ts file because it is used in `next.config.js`
|
||||
*/
|
||||
|
||||
/**
|
||||
* Checks if the given string is a positive answer (yes, true or 1).
|
||||
*
|
||||
* @param {string} value The value to check
|
||||
* @return {boolean} {@code true} if the value describes a positive answer string
|
||||
*/
|
||||
const isPositiveAnswer = (value) => {
|
||||
const lowerValue = value.toLowerCase()
|
||||
return lowerValue === 'yes' || lowerValue === '1' || lowerValue === 'true'
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines if the current runtime is built in e2e test mode.
|
||||
* @type boolean
|
||||
*/
|
||||
const isTestMode = !!process.env.NEXT_PUBLIC_TEST_MODE && isPositiveAnswer(process.env.NEXT_PUBLIC_TEST_MODE)
|
||||
|
||||
/**
|
||||
* Defines if the current runtime should use the mocked backend.
|
||||
* @type boolean
|
||||
*/
|
||||
const isMockMode = !!process.env.NEXT_PUBLIC_USE_MOCK_API && isPositiveAnswer(process.env.NEXT_PUBLIC_USE_MOCK_API)
|
||||
|
||||
/**
|
||||
* Defines if the current runtime was built in development mode.
|
||||
* @type boolean
|
||||
*/
|
||||
const isDevMode = process.env.NODE_ENV === 'development'
|
||||
|
||||
module.exports = {
|
||||
isTestMode,
|
||||
isMockMode,
|
||||
isDevMode
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue