Skip to content

Commit

Permalink
Production Release 5.0.0 #97 from washingtonpost/v5.0.0_rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
Neal Malkani authored Sep 28, 2021
2 parents d58dbad + 5fed885 commit 9480983
Show file tree
Hide file tree
Showing 19 changed files with 30,533 additions and 14,806 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
extends: 'airbnb-base',
parserOptions: {
sourceType: 'module',
ecmaVersion: '2018',
ecmaFeatures: {
jsx: true
}
Expand Down Expand Up @@ -41,4 +42,4 @@ module.exports = {
"no-use-before-define": 0,
"radix": 0
}
};
};
2 changes: 1 addition & 1 deletion dist/arcads.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions jestPreprocess.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const babelOptions = {
presets: ['env', 'stage-2'],
plugins: ['transform-decorators-legacy', 'babel-plugin-root-import'],
presets: ['@babel/preset-env'],
plugins: ['babel-plugin-root-import'],
};

module.exports = require('babel-jest').createTransformer(babelOptions)
module.exports = require('babel-jest').default.createTransformer(babelOptions);
32,933 changes: 24,001 additions & 8,932 deletions package-lock.json

Large diffs are not rendered by default.

37 changes: 17 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "arcads",
"version": "4.0.1",
"version": "5.0.0",
"description": "ArcAds is a GPT wrapper created by Arc Publishing with publishers in mind.",
"main": "dist/arcads.js",
"scripts": {
"test": "jest --config jest.config.js --no-cache --coverage",
"build": "rm -rf dist && webpack --env.production",
"dev": "rm -rf dist && webpack --env.development --watch",
"build": "rm -rf dist && webpack --env production --mode development",
"dev": "rm -rf dist && webpack --env development --mode development --watch",
"docs": "rm -rf docs && ./node_modules/.bin/esdoc && open docs/index.html",
"debug": "node debugging.js",
"mock": "webpack-dev-server --progress --hot --inline && npm run test"
Expand All @@ -31,30 +31,27 @@
"url": "https://github.com/washingtonpost/arcads/issues"
},
"devDependencies": {
"@babel/core": "^7.0.0-beta.37",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"@babel/core": "^7.15.0",
"@babel/preset-env": "^7.15.0",
"babel-loader": "^8.2.2",
"babel-plugin-root-import": "^5.1.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-env": "^1.6.1",
"babel-preset-stage-2": "^6.24.1",
"eslint": "^4.15.0",
"esdoc": "^1.1.0",
"esdoc-standard-plugin": "^1.0.0",
"eslint": "^7.32.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-config-standard": "^11.0.0-beta.0",
"eslint-config-standard": "^16.0.3",
"eslint-import-resolver-webpack": "^0.8.4",
"eslint-loader": "^1.9.0",
"eslint-plugin-import": "^2.8.0",
"jest": "^22.0.4",
"uglifyjs-webpack-plugin": "^1.1.6",
"webpack": "^3.10.0",
"webpack-cli": "^3.0.8"
"eslint-webpack-plugin": "^3.0.1",
"jest": "^27.1.0",
"terser-webpack-plugin": "^5.1.4",
"webpack": "^5.51.1",
"webpack-cli": "^4.8.0"
},
"dependencies": {
"anylogger": "^1.0.10",
"anylogger": "^1.0.11",
"anylogger-console": "^1.0.0",
"esdoc": "^1.0.4",
"esdoc-standard-plugin": "^1.0.0",
"promise-polyfill": "^8.0.0"
"promise-polyfill": "^8.2.0"
},
"homepage": "https://github.com/washingtonpost/arcads#readme"
}
6 changes: 5 additions & 1 deletion src/__tests__/amazon.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @jest-environment jsdom
*/

import {
fetchAmazonBids,
queueAmazonCommand,
Expand Down Expand Up @@ -39,4 +43,4 @@ describe('amazon service', () => {
queueAmazonCommand(global.amazonTest.cmd);
expect(spy).toHaveBeenCalled();
});
});
});
4 changes: 4 additions & 0 deletions src/__tests__/arcads.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @jest-environment jsdom
*/

import { ArcAds } from '../index';
import * as gptService from '../services/gpt.js';
import * as prebidService from '../services/prebid.js';
Expand Down
6 changes: 5 additions & 1 deletion src/__tests__/displayAd.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @jest-environment jsdom
*/

import { ArcAds } from '../index';
import * as gptService from '../services/gpt.js';
import * as sizemappingService from '../services/sizemapping.js'
Expand Down Expand Up @@ -228,4 +232,4 @@ describe('displayAd ', () => {

});

});
});
4 changes: 4 additions & 0 deletions src/__tests__/gpt.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @jest-environment jsdom
*/

import { ArcAds } from '../index';
import * as gpt from '../services/gpt';
import * as headerbidding from '../services/headerbidding';
Expand Down
6 changes: 5 additions & 1 deletion src/__tests__/headerbidding.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @jest-environment jsdom
*/

import {
initializeBiddingServices
} from '../services/headerbidding';
Expand Down Expand Up @@ -115,4 +119,4 @@ import {
expect(window.arcBiddingReady).toEqual(false);
}, 2000);
});
});
});
3 changes: 3 additions & 0 deletions src/__tests__/mobile.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @jest-environment jsdom
*/

import {MobileDetection} from '../util/mobile.js';

Expand Down
6 changes: 5 additions & 1 deletion src/__tests__/prebid.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @jest-environment jsdom
*/

import {
queuePrebidCommand,
fetchPrebidBids,
Expand Down Expand Up @@ -81,4 +85,4 @@ describe('pbjs', () => {
addUnit('', '', {}, { sizeConfig: { sample: 'test' } }, {});
expect(spy).toHaveBeenCalled();
});
});
});
7 changes: 5 additions & 2 deletions src/__tests__/query.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { expandQueryString } from '../util/query.js';
/**
* @jest-environment jsdom
*/

import { expandQueryString } from '../util/query.js';

describe('expandQueryString', () => {

Expand Down Expand Up @@ -31,4 +34,4 @@ describe('expandQueryString', () => {
const result = expandQueryString('adslot');
expect(result).toEqual('');
});
});
});
7 changes: 5 additions & 2 deletions src/__tests__/registerAds.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
/**
* @jest-environment jsdom
*/

import { ArcAds } from '../index';
import * as gptService from '../services/gpt.js';
import * as prebidService from '../services/prebid.js';
import * as mobileDetection from '../util/mobile.js';


describe('registerAds dimensions branches', () => {

global.pbjs = {
Expand Down Expand Up @@ -348,4 +351,4 @@ describe('registerAds dimensions branches', () => {
expect(errorMock.mock.calls[0][0]).toEqual('ads error');
});

});
});
4 changes: 4 additions & 0 deletions src/__tests__/resources.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @jest-environment jsdom
*/

import {appendResource} from '../util/resources.js';

describe('appendResource', () => {
Expand Down
6 changes: 5 additions & 1 deletion src/__tests__/sizemapping.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @jest-environment jsdom
*/

import {
prepareSizeMaps,
parseSizeMappings,
Expand Down Expand Up @@ -84,4 +88,4 @@ import {
const resultFn = result();
expect(sizemapListeners.abc.correlators[0]).toEqual(true);
});
});
});
4 changes: 4 additions & 0 deletions src/__tests__/util.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @jest-environment jsdom
*/

import anylogger from 'anylogger';
import 'anylogger-console';
import { renamePositionKey } from '../util/customTargeting';
Expand Down
47 changes: 31 additions & 16 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,33 @@
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const ESLintPlugin = require('eslint-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');

const path = require('path');

const generatePlugins = function (env) {
const plugins = [];
const generateOptimizations = (env) => {
let optimizations = {
minimize: false
};
if (env.production) {
optimizations.minimize = true;
optimizations.minimizer = [
new TerserPlugin({
terserOptions: {
format: {
comments: false,
},
},
extractComments: false,
}),
]
}
return optimizations;
};

const generatePlugins = (env) => {
let plugins = [];

if (env.production) {
plugins.push(new UglifyJsPlugin({
sourceMap: true,
}));
plugins.push(new ESLintPlugin())
}
return plugins;
};
Expand All @@ -17,30 +38,24 @@ module.exports = env => ({
path: path.resolve(__dirname, 'dist'),
filename: 'arcads.js',
libraryTarget: 'umd',
globalObject: 'typeof self !== \'undefined\' ? self : this',
},
devtool: env.development ? 'inline-source-map' : false,
resolve: { extensions: ['.js', '.json'] },
module: {
rules: [
{
loader: 'eslint-loader',
enforce: 'pre',
test: /\.js$/,
exclude: /node_modules/,
options: { configFile: '.eslintrc.js' },
},
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['env'],
plugins: ['transform-decorators-legacy', 'transform-object-rest-spread'],
presets: ['@babel/preset-env'],
},
},
},
],
},
optimization: generateOptimizations(env),
plugins: generatePlugins(env),
});
});
Loading

0 comments on commit 9480983

Please sign in to comment.