Skip to content

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

Merged
potench merged 12 commits into
masterfrom
migration
Jul 3, 2018
Merged

PLTX-2337 (refactor) upgrade to latest CMP from appnexus#4
potench merged 12 commits into
masterfrom
migration

Conversation

@potench
Copy link
Copy Markdown

@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

Comment thread src/lib/cmp.js
callback
});
}
// else if (
Copy link
Copy Markdown

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
Copy Markdown
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

Comment thread .node_version
@@ -0,0 +1 @@
8.11.3
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎉

Comment thread config/common.webpack.config.babel.js Outdated
// import CopyWebpackPlugin from 'copy-webpack-plugin';
import autoprefixer from 'autoprefixer';
import path from 'path';
// import UglifyJS from 'uglify-es';
Copy link
Copy Markdown

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

Comment thread 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
Copy Markdown

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
Copy Markdown

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

Comment thread src/s1/cmp.js
@@ -0,0 +1,135 @@
// __cmp('setConsentUiCallback', callback) QUANTCAST
import 'core-js/fn/array/find-index';
Copy link
Copy Markdown

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
Copy Markdown

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown

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
Copy Markdown
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

Comment thread src/lib/init.js

// Expose `processCommand` as the CMP implementation
window[CMP_GLOBAL_NAME] = cmp.processCommand;
// window[CMP_GLOBAL_NAME] = cmp.processCommand;
Copy link
Copy Markdown
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