scm-spain / boros-CMP

GDPR CMP (Consent Managment Provider) implementation
MIT License
5 stars 1 forks source link

Move to babel@7 and export library #58

Closed midudev closed 5 years ago

midudev commented 5 years ago

Background

Right now, CMP library is exporting a whole bundle with all the needed polyfills to work. While that's great in order to use this library standalone, in other apps is causing bloating the bundle as it's loading polyfills that are already imported, like Promises. The idea behind the PR is exporting the library along the bundle, so people could use the library directly and use its polyfills.

Goal

Give the possibility of importing the library without all the polyfills and helpers of babel compiled in a single chunk. This should minify the cost of loading cmp in some apps by ~80% as the majority of the code is polyfills and helpers.

Implementation

Checklist

Visual Description

Before, using the bundled version: image

After, using the library version: image

midudev commented 5 years ago

There's still a pending item about the inject CMP_VERSION global with webpack that's not being injected with babel that needs further investigation. I will be back when it's ready. :)

codecov-io commented 5 years ago

Codecov Report

Merging #58 into master will increase coverage by 0.84%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #58      +/-   ##
==========================================
+ Coverage   92.99%   93.84%   +0.84%     
==========================================
  Files          71       71              
  Lines        2585     2192     -393     
  Branches      198      148      -50     
==========================================
- Hits         2404     2057     -347     
+ Misses        181      135      -46
Impacted Files Coverage Δ
...rastructure/repository/HttpVendorListRepository.js 100% <100%> (ø) :arrow_up:
...p/infrastructure/service/log/loggerDebugHandler.js 23.8% <0%> (-12.2%) :arrow_down:
...ture/container/local/DebugLocalConsentContainer.js 47.16% <0%> (-9.09%) :arrow_down:
src/cmp/domain/vendor_consents/VendorConsents.js 86.36% <0%> (-5.48%) :arrow_down:
...re/container/global/DebugGlobalConsentContainer.js 48.07% <0%> (-5.05%) :arrow_down:
src/cmp/infrastructure/service/log/Log.js 84.21% <0%> (-3.95%) :arrow_down:
...rvices/vendor_consents/buildValidVendorConsents.js 94.87% <0%> (-2.86%) :arrow_down:
.../iframe_communication/IframeCommunicationClient.js 96.07% <0%> (-0.85%) :arrow_down:
...tructure/repository/ChainedVendorListRepository.js 100% <0%> (ø) :arrow_up:
src/globalstorage/application/globalStorage.js 100% <0%> (ø) :arrow_up:
... and 62 more

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 7103cdb...b1cc9ad. Read the comment docs.

alextremp commented 5 years ago

@midudev I've just updated this with a commit for the packaging phase 👍 It's all OK so I'll merge it now :)