1
0
mirror of https://gitlab.com/psono/psono-admin-client synced 2025-04-19 03:22:17 +03:00

Upgraded dependencies

Signed-off-by: Sascha Pfeiffer <sascha.pfeiffer@esaqa.com>
This commit is contained in:
Sascha Pfeiffer 2025-04-05 11:14:41 +02:00
parent 23b3f728b8
commit eebceacc79
11 changed files with 16166 additions and 21931 deletions

10
.babelrc Normal file
View File

@ -0,0 +1,10 @@
{
"presets": [
["@babel/preset-env", { "targets": { "node": "current" } }],
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-runtime"
]
}

4
.husky/pre-commit Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx lint-staged

View File

@ -0,0 +1,10 @@
'use strict';
module.exports = {
process() {
return 'module.exports = {};';
},
getCacheKey() {
return 'cssTransform';
},
};

View File

@ -0,0 +1,42 @@
'use strict';
const path = require('path');
module.exports = {
process(src, filename) {
const assetFilename = JSON.stringify(path.basename(filename));
if (filename.match(/\.svg$/)) {
// Create a simple component that just renders the file basename
const pascalCaseName = path.basename(filename, '.svg')
.split(/[-_\s]+/)
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
.join('');
const componentName = `Svg${pascalCaseName}`;
return `const React = require('react');
module.exports = {
__esModule: true,
default: ${assetFilename},
ReactComponent: React.forwardRef(function ${componentName}(props, ref) {
return {
$$typeof: Symbol.for('react.element'),
type: 'svg',
ref: ref,
key: null,
props: Object.assign({}, props, {
children: ${assetFilename}
})
};
}),
};
`;
}
return `module.exports = ${assetFilename};`;
},
getCacheKey() {
return 'fileTransform';
},
};

39
jest.config.js Normal file
View File

@ -0,0 +1,39 @@
module.exports = {
roots: ['<rootDir>/src'],
collectCoverageFrom: ['src/**/*.{js,jsx}', '!src/**/*.d.ts'],
setupFiles: ['react-app-polyfill/jsdom'],
setupFilesAfterEnv: ['<rootDir>/src/setupTests.js'],
testMatch: ['<rootDir>/src/**/__tests__/**/*.{js,jsx}', '<rootDir>/src/**/*.{spec,test}.{js,jsx}'],
testEnvironment: 'jsdom',
transform: {
'^.+\\.(js|jsx)$': '<rootDir>/node_modules/babel-jest',
'^.+\\.css$': '<rootDir>/config/jest/cssTransform.js',
'^(?!.*\\.(js|jsx|css|json)$)': '<rootDir>/config/jest/fileTransform.js',
},
transformIgnorePatterns: [
'[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$',
'^.+\\.module\\.(css|sass|scss)$',
],
modulePaths: [],
moduleNameMapper: {
'^react-native$': 'react-native-web',
'^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy',
'\\.(css|less)$': 'identity-obj-proxy',
},
moduleFileExtensions: [
'js',
'jsx',
'json',
'node',
],
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
],
coverageReporters: [
'html',
'text',
'cobertura',
'text-summary',
],
};

37698
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -21,16 +21,15 @@
"clientjs": "^0.1.11",
"ecma-nacl": "^2.4.2",
"font-awesome": "^4.7.0",
"husky": "^0.14.3",
"husky": "^9.1.7",
"i18next": "^21.4.0",
"i18next-browser-languagedetector": "^6.1.2",
"i18next-http-backend": "^1.3.2",
"js-sha256": "^0.9.0",
"js-sha512": "^0.8.0",
"lint-staged": "^7.3.0",
"lint-staged": "^15.5.0",
"moment": "^2.29.4",
"moment-timezone": "^0.5.34",
"npm-run-all": "^4.1.1",
"perfect-scrollbar": "^1.3.0",
"react": "^17.0.2",
"react-chartist": "^0.14.4",
@ -40,9 +39,7 @@
"react-moment": "^1.1.2",
"react-redux": "^7.2.6",
"react-router-dom": "^5.3.4",
"react-scripts": "^5.0.1",
"react-spinners": "^0.13.3",
"react-swipeable-views": "^0.14.0",
"react-timeout": "^1.0.1",
"redux": "^4.1.2",
"redux-logger": "^3.0.6",
@ -51,27 +48,17 @@
"uuid-js": "^0.7.5"
},
"lint-staged": {
"linters": {
"src/**/*.{js,jsx,json,css}": [
"prettier --single-quote --write --tab-width 4",
"git add"
]
}
},
"jest": {
"coverageReporters": [
"html",
"text",
"cobertura",
"text-summary"
"src/**/*.{js,jsx,json,css}": [
"prettier --single-quote --write --tab-width 4"
]
},
"scripts": {
"precommit": "lint-staged",
"start": "DISABLE_ESLINT_PLUGIN=true react-scripts start",
"build": "DISABLE_ESLINT_PLUGIN=true react-scripts build",
"test": "DISABLE_ESLINT_PLUGIN=true react-scripts test --env=jsdom",
"eject": "DISABLE_ESLINT_PLUGIN=true react-scripts eject"
"start": "webpack serve --config webpack.dev.js",
"build": "webpack --config webpack.prod.js",
"test": "jest --detectOpenHandles --forceExit",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"prepare": "husky"
},
"browserslist": [
">0.2%",
@ -80,8 +67,38 @@
"not op_mini all"
],
"devDependencies": {
"@babel/core": "^7.22.5",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-transform-runtime": "^7.22.5",
"@babel/preset-env": "^7.22.5",
"@babel/preset-react": "^7.22.5",
"@babel/runtime": "^7.22.5",
"babel-jest": "^29.5.0",
"babel-loader": "^9.1.2",
"buffer": "^6.0.3",
"camelcase": "^7.0.1",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.8.1",
"css-minimizer-webpack-plugin": "^5.0.1",
"html-webpack-plugin": "^5.5.3",
"identity-obj-proxy": "^3.0.0",
"interpolate-html-plugin": "^4.0.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"jest-watch-typeahead": "^2.2.2",
"mini-css-extract-plugin": "^2.7.6",
"path-browserify": "^1.0.1",
"prettier": "^2.6.2",
"react-test-renderer": "^17.0.2"
"process": "^0.11.10",
"react-app-polyfill": "^3.0.0",
"react-test-renderer": "^17.0.2",
"style-loader": "^3.3.3",
"terser-webpack-plugin": "^5.3.9",
"webpack": "^5.88.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.2",
"webpack-merge": "^5.9.0"
},
"browser": {
"crypto": false

View File

@ -8,19 +8,14 @@
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="icon" type="image/png" href="%PUBLIC_URL%/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="%PUBLIC_URL%/favicon-16x16.png" sizes="16x16">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link rel="apple-touch-icon" sizes="180x180" href="%PUBLIC_URL%/apple-touch-icon.png">
<link rel="manifest" href="/portal/manifest.json">
<link rel="icon" type="image/png" href="/portal/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/portal/favicon-16x16.png" sizes="16x16">
<link rel="shortcut icon" href="/portal/favicon.ico">
<link rel="apple-touch-icon" sizes="180x180" href="/portal/apple-touch-icon.png">
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Notice the use of hardcoded paths in the tags above.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Psono Admin Panel</title>
</head>
@ -40,4 +35,4 @@
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
</html>

84
webpack.common.js Normal file
View File

@ -0,0 +1,84 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const webpack = require('webpack');
const paths = {
publicUrlOrPath: '/portal/',
};
module.exports = {
entry: './src/index.js',
output: {
filename: 'static/js/[name].[contenthash:8].js',
chunkFilename: 'static/js/[name].[contenthash:8].chunk.js',
path: path.resolve(__dirname, 'build'),
publicPath: '/portal/',
},
plugins: [
new CleanWebpackPlugin(),
new CopyWebpackPlugin({
patterns: [
{
from: 'public',
to: '',
globOptions: {
ignore: ['**/index.html'],
},
},
],
}),
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer'],
}),
],
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-react',
],
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-transform-runtime',
],
},
},
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.(png|svg|jpg|jpeg|gif|ico)$/i,
type: 'asset/resource',
generator: {
filename: 'static/media/[name].[hash:8][ext]',
},
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/i,
type: 'asset/resource',
generator: {
filename: 'static/media/[name].[hash:8][ext]',
},
},
],
},
resolve: {
extensions: ['.js', '.jsx'],
fallback: {
"crypto": false,
"buffer": require.resolve("buffer/"),
"path": require.resolve("path-browserify"),
"process": require.resolve("process/browser"),
},
},
};

41
webpack.dev.js Normal file
View File

@ -0,0 +1,41 @@
const { merge } = require('webpack-merge');
const common = require('./webpack.common.js');
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = merge(common, {
mode: 'development',
devtool: 'inline-source-map',
devServer: {
static: {
directory: path.join(__dirname, 'public'),
},
hot: true,
historyApiFallback: {
disableDotRule: true,
index: '/portal/',
},
port: 3000,
client: {
overlay: {
errors: true,
warnings: false,
},
},
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
'process.env.PUBLIC_URL': JSON.stringify('/portal'),
}),
// Replace HtmlWebpackPlugin to use template processing
new HtmlWebpackPlugin({
inject: true,
template: path.resolve(__dirname, 'public/index.html'),
templateParameters: {
PUBLIC_URL: '/portal',
},
}),
],
});

85
webpack.prod.js Normal file
View File

@ -0,0 +1,85 @@
const { merge } = require('webpack-merge');
const common = require('./webpack.common.js');
const TerserPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
module.exports = merge(common, {
mode: 'production',
devtool: 'source-map',
output: {
filename: 'static/js/[name].[contenthash:8].js',
chunkFilename: 'static/js/[name].[contenthash:8].chunk.js',
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
compress: {
comparisons: false,
},
mangle: {
safari10: true,
},
output: {
comments: false,
ascii_only: true,
},
},
}),
new CssMinimizerPlugin(),
],
splitChunks: {
chunks: 'all',
name: false,
},
runtimeChunk: {
name: (entrypoint) => `runtime-${entrypoint.name}`,
},
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production'),
'process.env.PUBLIC_URL': JSON.stringify('/portal'),
}),
new MiniCssExtractPlugin({
filename: 'static/css/[name].[contenthash:8].css',
chunkFilename: 'static/css/[name].[contenthash:8].chunk.css',
}),
// Replace HtmlWebpackPlugin to use template processing
new HtmlWebpackPlugin({
inject: true,
template: path.resolve(__dirname, 'public/index.html'),
templateParameters: {
PUBLIC_URL: '/portal',
},
minify: {
removeComments: true,
collapseWhitespace: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true,
},
}),
],
module: {
rules: [
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
],
},
],
},
});