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

Modernizr update #12402

Merged
merged 7 commits into from May 29, 2023
Merged

Modernizr update #12402

merged 7 commits into from May 29, 2023

Conversation

escopecz
Copy link
Sponsor Member

@escopecz escopecz commented May 29, 2023

Q A
Bug fix? (use the a.b branch) [Library update]
New feature/enhancement? (use the a.x branch) [ ]
Deprecations? [ ]
BC breaks? (use the c.x branch) [y]
Automated tests included? [ ]
Related user documentation PR URL mautic/mautic-documentation#...
Related developer documentation PR URL mautic/developer-documentation#...
Issue(s) addressed Fixes #...

Description:

We were using a Modernizr JS library v2.8.3 that was not published on NPM. Meaning we wouldn't be getting security vulnerability warnings if there would be some.

I'm updating the library to latest v 3.12.0 and loading it from NPM in this PR.

I was also going through all the modules we had in our custom Modernizr build and found only 2 that we actually use.

All the Modernizr checks we were loading:

fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-flexboxlegacy-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-shiv-mq-cssclasses-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes

All the Modernizr checks we are using:

touch-csstransforms3d

Modernizr was a dependency of the Adminre UI that we are using as Mautic administration UI.

The touch/no-touch classes were used but the check was renamed to touchevents/no-touchevents in v 3. See https://modernizr.com/news/modernizr-3-new-release-site. So I updated usages for those too.

Modernizr must be custom-build so I added a post-install command to package.json that will build our custom Modernizr build according to the modernizr-config.json config file. There is no extra step that needs to be taken. The build is done automatically during the npm install command and that is being called automatically during the composer install command.

Steps to test this PR:

  1. Open this PR on Gitpod or pull down for testing locally (see docs on testing PRs here)
  2. Run composer install
  3. Run bin/console mautic:assets:generate
  4. View the source code of any Mautic administration page. Notice that the <html> tag has these classes:
<html class="csstransforms3d touchevents">

It can have more classes but these are the ones that we need.

@codecov
Copy link

codecov bot commented May 29, 2023

Codecov Report

Merging #12402 (891e428) into 5.x (2ed4daa) will increase coverage by 0.04%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##                5.x   #12402      +/-   ##
============================================
+ Coverage     56.27%   56.31%   +0.04%     
- Complexity    35131    35174      +43     
============================================
  Files          2209     2209              
  Lines        105431   105527      +96     
============================================
+ Hits          59328    59425      +97     
+ Misses        46103    46102       -1     
Impacted Files Coverage Δ
...undles/CoreBundle/Helper/AssetGenerationHelper.php 56.95% <ø> (ø)

... and 10 files with indirect coverage changes

@escopecz escopecz added enhancement Any improvement to an existing feature or functionality refactoring The change does not change behavior but improves the code labels May 29, 2023
@escopecz escopecz added this to the 5.0-alpha milestone May 29, 2023
@escopecz escopecz added the ready-to-test PR's that are ready to test label May 29, 2023
Copy link
Member

@mabumusa1 mabumusa1 left a comment

Choose a reason for hiding this comment

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

Changes looks good, I tested the PR classes are added

@escopecz escopecz merged commit fcfb5d4 into mautic:5.x May 29, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Any improvement to an existing feature or functionality ready-to-test PR's that are ready to test refactoring The change does not change behavior but improves the code
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants