Skip to content

Add webpack bundler#17361

Merged
MauricioFauth merged 3 commits intophpmyadmin:masterfrom
MauricioFauth:js-bundling-webpack
Feb 13, 2022
Merged

Add webpack bundler#17361
MauricioFauth merged 3 commits intophpmyadmin:masterfrom
MauricioFauth:js-bundling-webpack

Conversation

@MauricioFauth
Copy link
Copy Markdown
Member

@MauricioFauth MauricioFauth commented Feb 9, 2022

Adds webpack to bundle the JavaScript files and other assets.

The main difference from the previous attempt is that IIFE wrappers are not being added to code. So we don't need to declare every global in the source files.

Related to #15580

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 9, 2022

Codecov Report

Merging #17361 (a179a60) into master (fb18d3b) will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #17361   +/-   ##
=========================================
  Coverage     49.38%   49.38%           
  Complexity    16660    16660           
=========================================
  Files           601      601           
  Lines         59686    59686           
=========================================
+ Hits          29475    29477    +2     
+ Misses        30211    30209    -2     
Flag Coverage Δ
dbase-extension 49.12% <ø> (+1.15%) ⬆️
recode-extension 47.95% <ø> (+0.06%) ⬆️
unit-7.2-ubuntu-latest 49.12% <ø> (+1.25%) ⬆️
unit-7.3-ubuntu-latest 50.48% <ø> (-0.02%) ⬇️
unit-7.4-ubuntu-latest 50.42% <ø> (-1.32%) ⬇️
unit-8.0-ubuntu-latest 50.55% <ø> (+0.02%) ⬆️
unit-8.1-ubuntu-latest 51.24% <ø> (+0.50%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
libraries/classes/Header.php 87.31% <0.00%> (-1.09%) ⬇️
libraries/classes/Transformations.php 60.91% <0.00%> (-0.51%) ⬇️
libraries/classes/Charsets.php 82.00% <0.00%> (ø)
libraries/classes/Config/Descriptions.php 99.86% <0.00%> (+0.27%) ⬆️
...ries/classes/Plugins/Auth/AuthenticationConfig.php 76.11% <0.00%> (+5.97%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fb18d3b...a179a60. Read the comment docs.

@MauricioFauth MauricioFauth force-pushed the js-bundling-webpack branch 2 times, most recently from 2fc30a5 to 203366f Compare February 10, 2022 15:05
Comment thread webpack.config.js Outdated
},
plugins: [
new webpack.BannerPlugin({
banner: 'OpenLayers (https://openlayers.org/)\nCopyright 2005-present, OpenLayers Contributors All rights reserved.\nLicensed under BSD 2-Clause License (https://github.com/openlayers/openlayers/blob/main/LICENSE.md)'
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@williamdes I didn't find a way to add the package version like it had in the sync-js script.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
@MauricioFauth MauricioFauth marked this pull request as ready for review February 10, 2022 21:27
@MauricioFauth
Copy link
Copy Markdown
Member Author

The generated code is almost the same as before.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Comment thread webpack.config.js
'setup/styles': './setup/scss/styles.scss',
},
output: {
filename: 'build/css/[name].js',
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

webpack generates these empty .js files. I don't know how to not generate them, so I chose to output them into the build directory.

Comment thread webpack.config.js
const CopyPlugin = require('copy-webpack-plugin');
const WebpackConcatPlugin = require('webpack-concat-files-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const WebpackRTLPlugin = require('webpack-rtl-plugin');
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should revisit this plugin in the future, as it's triggering some deprecation messages. And looks like it's an abandoned plugin.
https://github.com/phpmyadmin/phpmyadmin/runs/5148016820?check_suite_focus=true#step:6:14

Copy link
Copy Markdown
Member

@williamdes williamdes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This really looks nice, maybe the gitattributes file and the release script cleanup will need adjustments

@MauricioFauth MauricioFauth merged commit 7cc3278 into phpmyadmin:master Feb 13, 2022
@MauricioFauth MauricioFauth deleted the js-bundling-webpack branch February 13, 2022 11:38
@MauricioFauth MauricioFauth self-assigned this Feb 13, 2022
@MauricioFauth MauricioFauth added this to the 5.3.0 milestone Feb 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants