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

PLTX-2337 (refactor) upgrade to latest CMP from appnexus #4

Merged
merged 12 commits into from
Jul 3, 2018

Conversation

potench
Copy link

@potench potench commented Jun 29, 2018

Background

This is work in progress

Test Plan

cd system1-cmp
yarn
yarn start
# http://localhost:5000/reference.html should load S1 CMP
# http://localhost:5000/ should load Original CMP

yarn build:s1 
# should build to dist/ folder based on package.json version

yarn test
# all tests should pass

callback
});
}
// else if (
Copy link

Choose a reason for hiding this comment

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

Is there a reason we commented this out instead of erasing it? Usually commenting out chunks is a bit of a code smell

Copy link
Author

Choose a reason for hiding this comment

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

I left it commented out because the upstream CMP has a "todo" to remove this, since i've already removed it i want the comment here so it matches up with the upstream file and context is given

@@ -0,0 +1 @@
8.11.3
Copy link

Choose a reason for hiding this comment

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

🎉

// import CopyWebpackPlugin from 'copy-webpack-plugin';
import autoprefixer from 'autoprefixer';
import path from 'path';
// import UglifyJS from 'uglify-es';
Copy link

Choose a reason for hiding this comment

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

Let's erase the commented out imports

package.json Outdated
"clean": "rm -rf build",
"dev": "cross-env NODE_ENV=development webpack-dev-server --inline --hot --progress",
"start": "serve build -s -c 1",
"clean": "rm -rf dist",
Copy link

Choose a reason for hiding this comment

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

yarn add -D rimraf and replace this with:

"clean": "rimraf dist",

This allows the command to work cross platform (mac/linux/bsd/windows)

Copy link

Choose a reason for hiding this comment

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

Actually we already have rimraf so you don't even need to add it

@@ -0,0 +1,135 @@
// __cmp('setConsentUiCallback', callback) QUANTCAST
import 'core-js/fn/array/find-index';
Copy link

Choose a reason for hiding this comment

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

Using this library in one of our sites will double up the bundle size for anything we're using babel-polyfill for. I think what we want to do is something like this:
https://stackoverflow.com/questions/33380063/what-is-the-best-way-to-include-babel-polyfill-using-multiple-entry-points

In development mode in webpack we'd include the polyfill but in production mode we wouldn't include it

Copy link

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Im not using babel-polyfill because it added another 130k to the package. But, would be nice to use it, ill make a ticket (see test plan)

@@ -0,0 +1,73 @@
/* eslint-disable max-nested-callbacks */
Copy link

Choose a reason for hiding this comment

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

^ Whenever I see this I know a party's coming soon

'process.env.NODE_ENV': JSON.stringify(ENV)
}),
new webpack.ProvidePlugin({
Promise: 'promise-polyfill'
Copy link

Choose a reason for hiding this comment

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

The babel-polyfill tweak should allow you to remove this

Copy link
Author

Choose a reason for hiding this comment

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

(see test plan) i removed babel-polyfill because it bloats the library (by 130k), will make a ticket to figure out how separate out the polyfills or optimize this

@@ -48,11 +48,20 @@ export function init(configUpdates) {
const cmp = new Cmp(store);

// Expose `processCommand` as the CMP implementation
window[CMP_GLOBAL_NAME] = cmp.processCommand;
// window[CMP_GLOBAL_NAME] = cmp.processCommand;
Copy link
Author

Choose a reason for hiding this comment

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

same, leaving this comment in because i want to call this out when doing another upstream merge.

@potench potench merged commit 04052cd into master Jul 3, 2018
@potench potench deleted the migration branch July 3, 2018 22:28
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