Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cb 4495 enable minification for function and class names for ee repository #2519

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0fc4540
CB-4495 adds terser-webpack-plugin to package.json
sergeyteleshev Mar 28, 2024
908481e
CB-4495 updates ts references
sergeyteleshev Mar 28, 2024
ad7c69a
CB-4495 adds source-map to enable minimizer TerserPlugin
sergeyteleshev Mar 28, 2024
0e6be38
Merge branch 'devel' into CB-4495-enable-minification-for-function-an…
sergeyteleshev Apr 1, 2024
86f75ff
Revert "CB-4495 adds source-map to enable minimizer TerserPlugin"
sergeyteleshev Apr 1, 2024
15d5dea
Merge branch 'devel' into CB-4495-enable-minification-for-function-an…
sergeyteleshev Apr 2, 2024
721773d
CB-4495 adds minimizing only for CE files
sergeyteleshev Apr 3, 2024
f05e9f3
Merge branch 'devel' into CB-4495-enable-minification-for-function-an…
sergeyteleshev Apr 3, 2024
b2e98da
СB-4495 fixes packages unneeded regexp script for filtering
sergeyteleshev Apr 3, 2024
fde72f8
CB-4495 adds mangle for properties
sergeyteleshev Apr 3, 2024
e25c7a6
CB-4495 gets back keep_classnames, keep_fnames in product config
sergeyteleshev Apr 3, 2024
2dee3a1
CB-4495 remove unneeded css regexp
sergeyteleshev Apr 3, 2024
4e2fd8e
CB-4495 compress worker js file
sergeyteleshev Apr 3, 2024
6073a21
CB-4495 removes unneeded mangle options
sergeyteleshev Apr 4, 2024
3ea417e
CB-4495 cleanup
sergeyteleshev Apr 4, 2024
43eafaa
Merge branch 'devel' into CB-4495-enable-minification-for-function-an…
sergeyteleshev Apr 8, 2024
44fb911
CB-4495 webpack splits packages to directories depending on product (…
sergeyteleshev Apr 8, 2024
93a490b
Merge branch 'devel' into CB-4495-enable-minification-for-function-an…
sergeyteleshev May 27, 2024
fedb7b0
Merge branch 'devel' into CB-4495-enable-minification-for-function-an…
sergeyteleshev May 28, 2024
644c824
CB-4495 splits public and private chunks
sergeyteleshev May 28, 2024
bccedba
CB-4495 excludes ee files
sergeyteleshev May 28, 2024
e61d3bd
CB-4495 fix: compresses commons-async chunk correctly depending on pr…
sergeyteleshev May 29, 2024
2292170
СB-4495 clean up
sergeyteleshev May 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"reakit": "~1.3.11",
"reflect-metadata": "^0.2.1",
"rimraf": "~5.0.5",
"terser-webpack-plugin": "^5.3.10",
"typescript": "^5.3.3",
"typescript-plugin-css-modules": "^5.1.0"
},
Expand Down
15 changes: 11 additions & 4 deletions webapp/packages/core-cli/configs/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,14 @@ module.exports = (env, argv) => {
chunks: 'all',
test: /[\\/]locales[\\/].*?\.js/,
name(module) {
return module.rawRequest.substr(2);
const path = module.context ?? module.resource;
const match = /.*[\\/](.*?)[\\/]webapp[\\/]packages[\\/]((plugin|core)-.*?)([\\/]|$)/.exec(path);

if (!path || !match) {
return module.rawRequest.substr(2);
}

return `${match[1]}/${module.rawRequest.substr(2)}`;
},
priority: 20,
reuseExistingChunk: true,
Expand All @@ -205,11 +212,11 @@ module.exports = (env, argv) => {
test: /[\\/]packages[\\/]((plugin|core)-.*?)[\\/](src|dist)[\\/]/,
name(module) {
const path = module.context ?? module.resource;
const match = /[\\/]packages[\\/]((plugin|core)-.*?)([\\/]|$)/.exec(path);
const match = /.*[\\/](.*?)[\\/]webapp[\\/]packages[\\/]((plugin|core)-.*?)([\\/]|$)/.exec(path);
if (!path || !match) {
return 'package';
}
return match[1];
return `${match[1]}/${match[2]}`;
},
priority: 10,
reuseExistingChunk: true,
Expand Down Expand Up @@ -245,7 +252,7 @@ module.exports = (env, argv) => {
asyncCommons: {
chunks: 'async',
name: 'commons-async',
filename: 'js/[name]-[contenthash].js',
filename: '[name].[contenthash].js',
priority: -15,
reuseExistingChunk: true,
},
Expand Down
11 changes: 9 additions & 2 deletions webapp/packages/core-cli/configs/webpack.plugin.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
const { resolve } = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const PeerDepsExternalsPlugin = require('peer-deps-externals-webpack-plugin');
Expand All @@ -16,8 +23,8 @@ module.exports = (env, argv) => merge(commonConfig(env, argv), {
index,
},
output: {
filename: '[name].js',
chunkFilename: '[name].[contenthash].bundle.js',
filename: '[name].public-ce.js',
chunkFilename: '[name].[contenthash].bundle.public-ce.js',
library: package.name,
libraryTarget: 'commonjs',
path: outputDir,
Expand Down
17 changes: 17 additions & 0 deletions webapp/packages/core-cli/configs/webpack.product.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,26 @@ module.exports = (env, argv) => {
mode: 'production',
devtool: false,
output: {
filename: 'index.[contenthash].public-ce.js',
chunkFilename: '[name].[contenthash].bundle.public-ce.js',
library: package.name,
libraryTarget: 'umd',
path: outputDir,
},
optimization: {
splitChunks: {
cacheGroups: {
asyncCommons: {
filename: '[name].[contenthash].public-ce.js',
},
packages: {
filename: '[name].[contenthash].public-ce.js',
},
locale: {
filename: '[name].[contenthash].locale.public-ce.js',
},
},
},
minimize: true,

minimizer: [
Expand All @@ -48,6 +63,8 @@ module.exports = (env, argv) => {
keep_classnames: true,
keep_fnames: true,
},
include: [/.*.public-ce..*$/, /^cloudbeaver\/.*/, /^service-worker.js$/],
exclude: [/^cloudbeaver-ee\/.*/, /.*.private-ee..*$/],
}),
new CssMinimizerPlugin(),
],
Expand Down
1 change: 0 additions & 1 deletion webapp/packages/core-settings-user/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"@cloudbeaver/core-root": "~0.1.0",
"@cloudbeaver/core-settings": "~0.1.0",
"@cloudbeaver/core-storage": "~0.1.0",
"@cloudbeaver/core-utils": "~0.1.0",
"mobx": "^6.12.0"
},
"peerDependencies": {},
Expand Down
3 changes: 0 additions & 3 deletions webapp/packages/core-settings-user/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
},
{
"path": "../core-storage/tsconfig.json"
},
{
"path": "../core-utils/tsconfig.json"
}
],
"include": [
Expand Down
Loading