*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit 5687ecab authored by Moser, Maximilian's avatar Moser, Maximilian
Browse files

Update frontend build project

parent 95c3c6fe
1 merge request!116InvenioRDM v12
/* /*
* This file is part of Invenio. * This file is part of Invenio.
* Copyright (C) 2017-2018 CERN. * Copyright (C) 2017-2018 CERN.
* Copyright (C) 2022 Graz University of Technology. * Copyright (C) 2022-2023 Graz University of Technology.
* Copyright (C) 2021-2023 TU Wien. * Copyright (C) 2021-2024 TU Wien.
* *
* Invenio is free software; you can redistribute it and/or modify it * Invenio is free software; you can redistribute it and/or modify it
* under the terms of the MIT License; see LICENSE file for more details. * under the terms of the MIT License; see LICENSE file for more details.
*/ */
const fs = require("fs");
const path = require("path");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const config = require("./config");
const BundleTracker = require("webpack-bundle-tracker"); const BundleTracker = require("webpack-bundle-tracker");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const ESLintPlugin = require("eslint-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const safePostCssParser = require("postcss-safe-parser");
const TerserPlugin = require("terser-webpack-plugin"); const TerserPlugin = require("terser-webpack-plugin");
const config = require("./config");
const path = require("path");
const webpack = require("webpack"); const webpack = require("webpack");
const ESLintPlugin = require("eslint-webpack-plugin");
// Load aliases from config and resolve their full path // Load aliases from config and resolve their full path
let aliases = {}; let aliases = {};
...@@ -27,7 +26,7 @@ if (config.aliases) { ...@@ -27,7 +26,7 @@ if (config.aliases) {
Object.entries(config.aliases).map(([alias, alias_path]) => [ Object.entries(config.aliases).map(([alias, alias_path]) => [
alias, alias,
path.resolve(config.build.context, alias_path), path.resolve(config.build.context, alias_path),
]) ]),
); );
} }
...@@ -35,10 +34,26 @@ var webpackConfig = { ...@@ -35,10 +34,26 @@ var webpackConfig = {
mode: process.env.NODE_ENV, mode: process.env.NODE_ENV,
entry: config.entry, entry: config.entry,
context: config.build.context, context: config.build.context,
stats: {
warnings: true,
errors: true,
errorsCount: true,
errorStack: true,
errorDetails: true,
children: true,
},
resolve: { resolve: {
extensions: ["*", ".js", ".jsx"], extensions: ["*", ".js", ".jsx"],
symlinks: false, symlinks: false,
alias: aliases, alias: aliases,
fallback: {
zlib: require.resolve("browserify-zlib"),
stream: require.resolve("stream-browserify"),
https: require.resolve("https-browserify"),
http: require.resolve("stream-http"),
url: false,
assert: false,
},
}, },
output: { output: {
path: config.build.assetsPath, path: config.build.assetsPath,
...@@ -52,7 +67,7 @@ var webpackConfig = { ...@@ -52,7 +67,7 @@ var webpackConfig = {
terserOptions: { terserOptions: {
parse: { parse: {
// we want terser to parse ecma 8 code. However, we don't want it // we want terser to parse ecma 8 code. However, we don't want it
// to apply any minfication steps that turns valid ecma 5 code // to apply any minification steps that turns valid ecma 5 code
// into invalid ecma 5 code. This is why the 'compress' and 'output' // into invalid ecma 5 code. This is why the 'compress' and 'output'
// sections only apply transformations that are ecma 5 safe // sections only apply transformations that are ecma 5 safe
// https://github.com/facebook/create-react-app/pull/4234 // https://github.com/facebook/create-react-app/pull/4234
...@@ -83,17 +98,8 @@ var webpackConfig = { ...@@ -83,17 +98,8 @@ var webpackConfig = {
ascii_only: true, ascii_only: true,
}, },
}, },
// Use multi-process parallel running to improve the build speed
// Default number of concurrent runs: os.cpus().length - 1
parallel: true,
cache: true,
}),
new OptimizeCSSAssetsPlugin({
cssProcessorOptions: {
parser: safePostCssParser,
map: false,
},
}), }),
new CssMinimizerPlugin(),
], ],
splitChunks: { splitChunks: {
chunks: "all", chunks: "all",
...@@ -150,29 +156,42 @@ var webpackConfig = { ...@@ -150,29 +156,42 @@ var webpackConfig = {
}, },
// Inline images smaller than 10k // Inline images smaller than 10k
{ {
test: /\.(avif|webp|png|cur|jpe?g|gif|svg)(\?.*)?$/, test: /\.(avif|webp|png|jpe?g|gif|svg)(\?.*)?$/,
use: [ type: "asset/inline",
{ parser: {
loader: require.resolve("url-loader"), dataUrlCondition: {
options: { maxSize: 10 * 1024, // 10kb
limit: 10000,
name: "img/[name].[hash:7].[ext]",
},
}, },
], },
},
// no mimetype for ".cur" in mimetype database, specify it with `generator`
{
test: /\.(cur)(\?.*)?$/,
type: "asset/inline",
generator: {
dataUrl: {
encoding: "base64",
mimetype: "image/x-icon",
},
},
parser: {
dataUrlCondition: {
maxSize: 10 * 1024, // 10kb
},
},
}, },
// Inline webfonts smaller than 10k // Inline webfonts smaller than 10k
{ {
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
use: [ type: "asset/resource",
{ generator: {
loader: require.resolve("file-loader"), filename: "fonts/[name].[contenthash:7].[ext]",
options: { },
limit: 10000, parser: {
name: "fonts/[name].[hash:7].[ext]", dataUrlCondition: {
}, maxSize: 10 * 1024, // 10kb
}, },
], },
}, },
], ],
}, },
...@@ -202,6 +221,32 @@ var webpackConfig = { ...@@ -202,6 +221,32 @@ var webpackConfig = {
dangerouslyAllowCleanPatternsOutsideProject: true, dangerouslyAllowCleanPatternsOutsideProject: true,
cleanStaleWebpackAssets: process.env.NODE_ENV === "production", // keep stale assets in dev because of OS issues cleanStaleWebpackAssets: process.env.NODE_ENV === "production", // keep stale assets in dev because of OS issues
}), }),
// Copying relevant CSS files as TinyMCE tries to import CSS files from the dist/js folder of static files
new CopyWebpackPlugin({
patterns: [
{
from: path.resolve(
__dirname,
"../node_modules/tinymce/skins/content/default/content.css",
),
to: path.resolve(config.build.assetsPath, "js/skins/content/default"),
},
{
from: path.resolve(
__dirname,
"../node_modules/tinymce/skins/ui/oxide/skin.min.css",
),
to: path.resolve(config.build.assetsPath, "js/skins/ui/oxide"),
},
{
from: path.resolve(
__dirname,
"../node_modules/tinymce/skins/ui/oxide/content.min.css",
),
to: path.resolve(config.build.assetsPath, "js/skins/ui/oxide"),
},
],
}),
// Automatically inject jquery // Automatically inject jquery
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({
jQuery: "jquery", jQuery: "jquery",
...@@ -217,6 +262,12 @@ var webpackConfig = { ...@@ -217,6 +262,12 @@ var webpackConfig = {
}), }),
], ],
performance: { hints: false }, performance: { hints: false },
snapshot: {
managedPaths: [],
},
watchOptions: {
followSymlinks: true,
},
}; };
if (process.env.npm_config_report) { if (process.env.npm_config_report) {
......
...@@ -5,61 +5,68 @@ ...@@ -5,61 +5,68 @@
"author": "Center for Research Data Management <centerrdm.team@tuwien.ac.at>", "author": "Center for Research Data Management <centerrdm.team@tuwien.ac.at>",
"private": true, "private": true,
"scripts": { "scripts": {
"start": "NODE_OPTIONS='--openssl-legacy-provider' NODE_PRESERVE_SYMLINKS=1 NODE_ENV=development webpack --watch --progress --config ./build/webpack.config.js", "start": "NODE_PRESERVE_SYMLINKS=1 NODE_ENV=development webpack --watch --progress --config ./build/webpack.config.js",
"build": "NODE_OPTIONS='--openssl-legacy-provider' NODE_PRESERVE_SYMLINKS=1 NODE_ENV=production webpack --config ./build/webpack.config.js", "build": "NODE_PRESERVE_SYMLINKS=1 NODE_ENV=production webpack --config ./build/webpack.config.js",
"postinstalls": "patch-package" "postinstall": "patch-package"
},
"dependencies": {
"tinymce": "^6.7.2"
}, },
"dependencies": {},
"devDependencies": { "devDependencies": {
"browserify-zlib": "^0.2.0",
"https-browserify": "^1.0.0",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"patch-package": "^6.5.0",
"@babel/core": "^7.18.0", "@babel/core": "^7.18.0",
"ajv": "^8.12.0",
"@babel/eslint-parser": "^7.18.0", "@babel/eslint-parser": "^7.18.0",
"@babel/plugin-proposal-class-properties": "^7.18.0", "@babel/plugin-proposal-class-properties": "^7.18.0",
"@babel/plugin-proposal-private-property-in-object": "^7.21.0",
"@babel/plugin-transform-runtime": "^7.18.0", "@babel/plugin-transform-runtime": "^7.18.0",
"@babel/preset-env": "^7.18.0", "@babel/preset-env": "^7.18.0",
"@babel/preset-react": "^7.18.0", "@babel/preset-react": "^7.18.0",
"@babel/register": "^7.18.0",
"@babel/runtime": "^7.18.0", "@babel/runtime": "^7.18.0",
"@inveniosoftware/eslint-config-invenio": "^2.0.0", "@inveniosoftware/eslint-config-invenio": "^2.0.0",
"autoprefixer": "^10.4.0", "autoprefixer": "^10.4.0",
"babel-loader": "^8.2.0", "babel-loader": "^9.0.0",
"babel-register": "^6.26.0", "chalk": "^5.0.0",
"chalk": "^4.1.0", "clean-webpack-plugin": "^4.0.0",
"clean-webpack-plugin": "^3.0.0", "css-loader": "^6.0.0",
"css-loader": "^4.2.0", "css-minimizer-webpack-plugin": "^4.2.0",
"eslint-config-react-app": "^7.0.1", "eslint-config-react-app": "^7.0.1",
"eslint-friendly-formatter": "^4.0.1", "eslint-friendly-formatter": "^4.0.1",
"eslint-webpack-plugin": "^2.5.0", "eslint-webpack-plugin": "^2.5.0",
"eventsource-polyfill": "^0.9.0", "eventsource-polyfill": "^0.9.0",
"expose-loader": "^1.0.0", "expose-loader": "^4.0.0",
"file-loader": "^6.0.0", "file-loader": "^6.0.0",
"function-bind": "^1.1.0", "function-bind": "^1.1.0",
"less": "^3.12.0", "less": "^4.0.0",
"less-loader": "^6.2.0", "less-loader": "^11.0.0",
"mini-css-extract-plugin": "^0.10.0", "mini-css-extract-plugin": "^2.0.0",
"ora": "^5.0.0", "ora": "^6.0.0",
"patch-package": "^6.2.0", "postcss-flexbugs-fixes": "^5.0.0",
"postcss-flexbugs-fixes": "^4.1.0", "postcss-loader": "^7.0.0",
"postcss-loader": "^3.0.0", "postcss-preset-env": "^8.0.0",
"postcss-preset-env": "^6.4.0", "postcss-safe-parser": "^6.0.0",
"postcss-safe-parser": "^4.0.0",
"prettier": "^2.7.0", "prettier": "^2.7.0",
"rimraf": "^3.0.0", "rimraf": "^4.0.0",
"sass": "^1.50.0", "sass": "^1.50.0",
"sass-loader": "^10.0.0", "sass-loader": "^13.0.0",
"semver": "^7.3.0", "style-loader": "^3.0.0",
"style-loader": "^1.2.0", "terser-webpack-plugin": "^5.0.0",
"terser-webpack-plugin": "^4.1.0",
"url-loader": "^4.1.0", "url-loader": "^4.1.0",
"webpack": "^4.27.0", "webpack": "^5.0.0",
"webpack-bundle-analyzer": "^3.0.0", "webpack-bundle-analyzer": "^4.0.0",
"webpack-bundle-tracker": "^1.0.0", "webpack-bundle-tracker": "^1.0.0",
"webpack-cli": "^3.1.0", "webpack-cli": "^5.0.0",
"webpack-dev-middleware": "^3.4.0", "webpack-dev-middleware": "^6.0.0",
"webpack-hot-middleware": "^2.24.0", "webpack-hot-middleware": "^2.24.0",
"webpack-livereload-plugin": "^2.2.0", "webpack-livereload-plugin": "^3.0.0",
"webpack-merge": "^5.1.0", "webpack-merge": "^5.1.0",
"webpack-yam-plugin": "^1.0.0", "webpack-yam-plugin": "^1.0.0",
"optimize-css-assets-webpack-plugin": "^5.0.0", "copy-webpack-plugin": "^11.0.0"
"friendly-errors-webpack-plugin": "^1.7.0"
}, },
"engines": { "engines": {
"node": ">= 18", "node": ">= 18",
......
diff --git a/node_modules/semantic-ui-less/themes/default/collections/message.variables b/node_modules/semantic-ui-less/themes/default/collections/message.variables
index 10d7f98..a596ffa 100644
--- a/node_modules/semantic-ui-less/themes/default/collections/message.variables
+++ b/node_modules/semantic-ui-less/themes/default/collections/message.variables
@@ -36,7 +36,7 @@
@headerFontWeight: @bold;
@headerDisplay: block;
@headerDistance: 0rem;
-@headerMargin: -@headerLineHeightOffset 0em @headerDistance 0em;
+@headerMargin: (-@headerLineHeightOffset) 0em @headerDistance 0em;
@headerParagraphDistance: 0.25em;
/* Paragraph */
diff --git a/node_modules/semantic-ui-less/themes/default/elements/header.variables b/node_modules/semantic-ui-less/themes/default/elements/header.variables
index 885715b..58699eb 100644
--- a/node_modules/semantic-ui-less/themes/default/elements/header.variables
+++ b/node_modules/semantic-ui-less/themes/default/elements/header.variables
@@ -16,7 +16,7 @@
@bottomMargin: @headerBottomMargin;
@margin: @topMargin 0em @bottomMargin;
-@firstMargin: -@lineHeightOffset;
+@firstMargin: (-@lineHeightOffset);
@lastMargin: 0em;
@horizontalPadding: 0em;
@verticalPadding: 0em;
diff --git a/node_modules/semantic-ui-less/themes/default/globals/site.variables b/node_modules/semantic-ui-less/themes/default/globals/site.variables
index f297aef..39f2555 100755
--- a/node_modules/semantic-ui-less/themes/default/globals/site.variables
+++ b/node_modules/semantic-ui-less/themes/default/globals/site.variables
@@ -390,34 +390,34 @@
This rounds @size values to the closest pixel then expresses that value in (r)em.
This ensures all size values round to exact pixels
*/
-@mini : unit( round(@miniSize * @emSize) / @emSize, rem);
-@tiny : unit( round(@tinySize * @emSize) / @emSize, rem);
-@small : unit( round(@smallSize * @emSize) / @emSize, rem);
-@medium : unit( round(@mediumSize * @emSize) / @emSize, rem);
-@large : unit( round(@largeSize * @emSize) / @emSize, rem);
-@big : unit( round(@bigSize * @emSize) / @emSize, rem);
-@huge : unit( round(@hugeSize * @emSize) / @emSize, rem);
-@massive : unit( round(@massiveSize * @emSize) / @emSize, rem);
+@mini : unit( (round(@miniSize * @emSize) / @emSize), rem);
+@tiny : unit( (round(@tinySize * @emSize) / @emSize), rem);
+@small : unit( (round(@smallSize * @emSize) / @emSize), rem);
+@medium : unit( (round(@mediumSize * @emSize) / @emSize), rem);
+@large : unit( (round(@largeSize * @emSize) / @emSize), rem);
+@big : unit( (round(@bigSize * @emSize) / @emSize), rem);
+@huge : unit( (round(@hugeSize * @emSize) / @emSize), rem);
+@massive : unit( (round(@massiveSize * @emSize) / @emSize), rem);
/* em */
-@relativeMini : unit( round(@miniSize * @emSize) / @emSize, em);
-@relativeTiny : unit( round(@tinySize * @emSize) / @emSize, em);
-@relativeSmall : unit( round(@smallSize * @emSize) / @emSize, em);
-@relativeMedium : unit( round(@mediumSize * @emSize) / @emSize, em);
-@relativeLarge : unit( round(@largeSize * @emSize) / @emSize, em);
-@relativeBig : unit( round(@bigSize * @emSize) / @emSize, em);
-@relativeHuge : unit( round(@hugeSize * @emSize) / @emSize, em);
-@relativeMassive : unit( round(@massiveSize * @emSize) / @emSize, em);
+@relativeMini : unit( (round(@miniSize * @emSize) / @emSize), em);
+@relativeTiny : unit( (round(@tinySize * @emSize) / @emSize), em);
+@relativeSmall : unit( (round(@smallSize * @emSize) / @emSize), em);
+@relativeMedium : unit( (round(@mediumSize * @emSize) / @emSize), em);
+@relativeLarge : unit( (round(@largeSize * @emSize) / @emSize), em);
+@relativeBig : unit( (round(@bigSize * @emSize) / @emSize), em);
+@relativeHuge : unit( (round(@hugeSize * @emSize) / @emSize), em);
+@relativeMassive : unit( (round(@massiveSize * @emSize) / @emSize), em);
/* rem */
-@absoluteMini : unit( round(@miniSize * @emSize) / @emSize, rem);
-@absoluteTiny : unit( round(@tinySize * @emSize) / @emSize, rem);
-@absoluteSmall : unit( round(@smallSize * @emSize) / @emSize, rem);
-@absoluteMedium : unit( round(@mediumSize * @emSize) / @emSize, rem);
-@absoluteLarge : unit( round(@largeSize * @emSize) / @emSize, rem);
-@absoluteBig : unit( round(@bigSize * @emSize) / @emSize, rem);
-@absoluteHuge : unit( round(@hugeSize * @emSize) / @emSize, rem);
-@absoluteMassive : unit( round(@massiveSize * @emSize) / @emSize, rem);
+@absoluteMini : unit( (round(@miniSize * @emSize) / @emSize), rem);
+@absoluteTiny : unit( (round(@tinySize * @emSize) / @emSize), rem);
+@absoluteSmall : unit( (round(@smallSize * @emSize) / @emSize), rem);
+@absoluteMedium : unit( (round(@mediumSize * @emSize) / @emSize), rem);
+@absoluteLarge : unit( (round(@largeSize * @emSize) / @emSize), rem);
+@absoluteBig : unit( (round(@bigSize * @emSize) / @emSize), rem);
+@absoluteHuge : unit( (round(@hugeSize * @emSize) / @emSize), rem);
+@absoluteMassive : unit( (round(@massiveSize * @emSize) / @emSize), rem);
/*-------------------
Icons
diff --git a/node_modules/semantic-ui-less/themes/default/modules/search.variables b/node_modules/semantic-ui-less/themes/default/modules/search.variables
index 362bc13..e6668d5 100644
--- a/node_modules/semantic-ui-less/themes/default/modules/search.variables
+++ b/node_modules/semantic-ui-less/themes/default/modules/search.variables
@@ -51,7 +51,7 @@
/* Result Content */
@resultTitleFont: @headerFont;
-@resultTitleMargin: -@headerLineHeightOffset 0em 0em;
+@resultTitleMargin: (-@headerLineHeightOffset) 0em 0em;
@resultTitleFontWeight: @bold;
@resultTitleFontSize: @relativeMedium;
@resultTitleColor: @darkTextColor;
diff --git a/node_modules/watchpack/lib/DirectoryWatcher.js b/node_modules/watchpack/lib/DirectoryWatcher.js
index 78888f6..30dcfc8 100644
--- a/node_modules/watchpack/lib/DirectoryWatcher.js
+++ b/node_modules/watchpack/lib/DirectoryWatcher.js
@@ -53,8 +53,8 @@ function DirectoryWatcher(directoryPath, options) {
this.watcher = chokidar.watch(directoryPath, {
ignoreInitial: true,
persistent: true,
- followSymlinks: false,
- depth: 0,
+ followSymlinks: true,
+ depth: 1,
atomic: false,
alwaysStat: true,
ignorePermissionErrors: true,
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment