mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-12-22 21:42:19 +00:00
enhancement: add profiling flag to analyze run
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
1e964839b4
commit
58c2cfe727
3 changed files with 15 additions and 4 deletions
|
@ -3,11 +3,11 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
const { isMockMode, isTestMode, isProductionMode} = require('./src/utils/test-modes')
|
||||
const { isMockMode, isTestMode, isProductionMode, isProfilingMode } = require('./src/utils/test-modes')
|
||||
const path = require('path')
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
const withBundleAnalyzer = require('@next/bundle-analyzer')({
|
||||
enabled: process.env.ANALYZE === 'true'
|
||||
enabled: isProfilingMode
|
||||
})
|
||||
|
||||
console.log('Node environment is', process.env.NODE_ENV)
|
||||
|
@ -31,6 +31,10 @@ if (isMockMode) {
|
|||
`)
|
||||
}
|
||||
|
||||
if (isProfilingMode) {
|
||||
console.info('This build contains the bundle analyzer and profiling metrics.')
|
||||
}
|
||||
|
||||
/** @type {import('@svgr/webpack').LoaderOptions} */
|
||||
const svgrConfig = {
|
||||
svgoConfig: {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"build": "cross-env NODE_ENV=production next build",
|
||||
"build:mock": "cross-env NEXT_PUBLIC_USE_MOCK_API=true next build",
|
||||
"build:test": "cross-env NODE_ENV=test NEXT_PUBLIC_TEST_MODE=true next build",
|
||||
"analyze": "cross-env ANALYZE=true yarn build",
|
||||
"analyze": "cross-env ANALYZE=true yarn build --profile",
|
||||
"format": "prettier -c \"src/**/*.{ts,tsx,js}\" \"cypress/**/*.{ts,tsx}\"",
|
||||
"format:fix": "prettier -w \"src/**/*.{ts,tsx,js}\" \"cypress/**/*.{ts,tsx}\"",
|
||||
"lint": "eslint --max-warnings=0 --ext .ts,.tsx src",
|
||||
|
|
|
@ -43,9 +43,16 @@ const isDevMode = process.env.NODE_ENV === 'development'
|
|||
*/
|
||||
const isProductionMode = process.env.NODE_ENV === 'production'
|
||||
|
||||
/**
|
||||
* Defines if the current runtime contains the bundle analyzer and profiling metrics.
|
||||
* @type boolean
|
||||
*/
|
||||
const isProfilingMode = !!process.env.ANALYZE && isPositiveAnswer(process.env.ANALYZE)
|
||||
|
||||
module.exports = {
|
||||
isTestMode,
|
||||
isMockMode,
|
||||
isDevMode,
|
||||
isProductionMode
|
||||
isProductionMode,
|
||||
isProfilingMode
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue