diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 09ef5c445f2..b225be162a8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -16,7 +16,8 @@ For any user facing change, submit a link to a PR on the docs repo at https://gi - [ ] Bugfix - [ ] Feature -- [ ] New bidder adapter +- [ ] New bidder adapter +- [ ] Updated bidder adapter - [ ] Code style update (formatting, local variables) - [ ] Refactoring (no functional changes, no api changes) - [ ] Build related changes diff --git a/README.md b/README.md index e6d25a5cb5a..f890f055104 100644 --- a/README.md +++ b/README.md @@ -229,6 +229,16 @@ Or, if you are consuming Prebid through npm, with the `disableFeatures` option i **Note**: this is still a work in progress - at the moment, `NATIVE` is the only feature that can be disabled this way, resulting in a minimal decrease in size (but you can expect that to improve over time). +## Unminified code + +You can get a version of the code that's unminified for debugging with `build-bundle-dev`: + +```bash +gulp build-bundle-dev --modules=bidderA,module1,... +``` + +The results will be in build/dev/prebid.js. + ## Test locally To lint the code: @@ -237,6 +247,12 @@ To lint the code: gulp lint ``` +To lint and only show errors + +```bash +gulp lint --no-lint-warnings +``` + To run the unit tests: ```bash @@ -245,7 +261,7 @@ gulp test To run the unit tests for a particular file (example for pubmaticBidAdapter_spec.js): ```bash -gulp test --file "test/spec/modules/pubmaticBidAdapter_spec.js" +gulp test --file "test/spec/modules/pubmaticBidAdapter_spec.js" --nolint ``` To generate and view the code coverage reports: diff --git a/allowedModules.js b/allowedModules.js index 75ad4141a6c..bc9ada39571 100644 --- a/allowedModules.js +++ b/allowedModules.js @@ -7,7 +7,7 @@ module.exports = { ], 'src': [ 'fun-hooks/no-eval', - 'just-clone', + 'klona', 'dlv', 'dset' ], diff --git a/creative/constants.js b/creative/constants.js index 6bb92cfe3c2..d02c4c9d5e4 100644 --- a/creative/constants.js +++ b/creative/constants.js @@ -1,9 +1,9 @@ // eslint-disable-next-line prebid/validate-imports -import CONSTANTS from '../src/constants.json'; +import { AD_RENDER_FAILED_REASON, EVENTS, MESSAGES } from '../src/constants.js'; -export const MESSAGE_REQUEST = CONSTANTS.MESSAGES.REQUEST; -export const MESSAGE_RESPONSE = CONSTANTS.MESSAGES.RESPONSE; -export const MESSAGE_EVENT = CONSTANTS.MESSAGES.EVENT; -export const EVENT_AD_RENDER_FAILED = CONSTANTS.EVENTS.AD_RENDER_FAILED; -export const EVENT_AD_RENDER_SUCCEEDED = CONSTANTS.EVENTS.AD_RENDER_SUCCEEDED; -export const ERROR_EXCEPTION = CONSTANTS.AD_RENDER_FAILED_REASON.EXCEPTION; +export const MESSAGE_REQUEST = MESSAGES.REQUEST; +export const MESSAGE_RESPONSE = MESSAGES.RESPONSE; +export const MESSAGE_EVENT = MESSAGES.EVENT; +export const EVENT_AD_RENDER_FAILED = EVENTS.AD_RENDER_FAILED; +export const EVENT_AD_RENDER_SUCCEEDED = EVENTS.AD_RENDER_SUCCEEDED; +export const ERROR_EXCEPTION = AD_RENDER_FAILED_REASON.EXCEPTION; diff --git a/creative/renderers/display/constants.js b/creative/renderers/display/constants.js index d291c79bb34..2493fb2d163 100644 --- a/creative/renderers/display/constants.js +++ b/creative/renderers/display/constants.js @@ -1,4 +1,4 @@ // eslint-disable-next-line prebid/validate-imports -import CONSTANTS from '../../../src/constants.json'; +import { AD_RENDER_FAILED_REASON } from '../../../src/constants.js'; -export const ERROR_NO_AD = CONSTANTS.AD_RENDER_FAILED_REASON.NO_AD; +export const ERROR_NO_AD = AD_RENDER_FAILED_REASON.NO_AD; diff --git a/creative/renderers/native/constants.js b/creative/renderers/native/constants.js index ac20275fca8..b82e2d1d54e 100644 --- a/creative/renderers/native/constants.js +++ b/creative/renderers/native/constants.js @@ -1,7 +1,7 @@ // eslint-disable-next-line prebid/validate-imports -import CONSTANTS from '../../../src/constants.json'; +import { MESSAGES } from '../../../src/constants.js'; -export const MESSAGE_NATIVE = CONSTANTS.MESSAGES.NATIVE; +export const MESSAGE_NATIVE = MESSAGES.NATIVE; export const ACTION_RESIZE = 'resizeNativeHeight'; export const ACTION_CLICK = 'click'; export const ACTION_IMP = 'fireNativeImpressionTrackers'; diff --git a/gulpfile.js b/gulpfile.js index 17c421f4dc1..86c1b7fe509 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -11,6 +11,7 @@ var webpackStream = require('webpack-stream'); var gulpClean = require('gulp-clean'); var opens = require('opn'); var webpackConfig = require('./webpack.conf.js'); +const standaloneDebuggingConfig = require('./webpack.debugging.js'); var helpers = require('./gulpHelpers.js'); var concat = require('gulp-concat'); var replace = require('gulp-replace'); @@ -127,35 +128,56 @@ function viewReview(done) { viewReview.displayName = 'view-review'; -function makeDevpackPkg() { - var cloned = _.cloneDeep(webpackConfig); - Object.assign(cloned, { - devtool: 'source-map', - mode: 'development' - }) +function makeVerbose(config = webpackConfig) { + return _.merge({}, config, { + optimization: { + minimizer: [ + new TerserPlugin({ + parallel: true, + terserOptions: { + mangle: false, + format: { + comments: 'all' + } + }, + extractComments: false, + }), + ], + } + }); +} - const babelConfig = require('./babelConfig.js')({disableFeatures: helpers.getDisabledFeatures(), prebidDistUrlBase: argv.distUrlBase || '/build/dev/'}); +function makeDevpackPkg(config = webpackConfig) { + return function() { + var cloned = _.cloneDeep(config); + Object.assign(cloned, { + devtool: 'source-map', + mode: 'development' + }) + + const babelConfig = require('./babelConfig.js')({disableFeatures: helpers.getDisabledFeatures(), prebidDistUrlBase: argv.distUrlBase || '/build/dev/'}); - // update babel config to set local dist url - cloned.module.rules - .flatMap((rule) => rule.use) - .filter((use) => use.loader === 'babel-loader') - .forEach((use) => use.options = Object.assign({}, use.options, babelConfig)); + // update babel config to set local dist url + cloned.module.rules + .flatMap((rule) => rule.use) + .filter((use) => use.loader === 'babel-loader') + .forEach((use) => use.options = Object.assign({}, use.options, babelConfig)); - var externalModules = helpers.getArgModules(); + var externalModules = helpers.getArgModules(); - const analyticsSources = helpers.getAnalyticsSources(); - const moduleSources = helpers.getModulePaths(externalModules); + const analyticsSources = helpers.getAnalyticsSources(); + const moduleSources = helpers.getModulePaths(externalModules); - return gulp.src([].concat(moduleSources, analyticsSources, 'src/prebid.js')) - .pipe(helpers.nameModules(externalModules)) - .pipe(webpackStream(cloned, webpack)) - .pipe(gulp.dest('build/dev')) - .pipe(connect.reload()); + return gulp.src([].concat(moduleSources, analyticsSources, 'src/prebid.js')) + .pipe(helpers.nameModules(externalModules)) + .pipe(webpackStream(cloned, webpack)) + .pipe(gulp.dest('build/dev')) + .pipe(connect.reload()); + } } -function makeWebpackPkg(extraConfig = {}) { - var cloned = _.merge(_.cloneDeep(webpackConfig), extraConfig); +function makeWebpackPkg(config = webpackConfig) { + var cloned = _.cloneDeep(config) if (!argv.sourceMaps) { delete cloned.devtool; } @@ -446,7 +468,15 @@ function startLocalServer(options = {}) { port: port, host: INTEG_SERVER_HOST, root: './', - livereload: options.livereload + livereload: options.livereload, + middleware: function () { + return [ + function (req, res, next) { + res.setHeader('Ad-Auction-Allowed', 'True'); + next(); + } + ]; + } }); } @@ -487,26 +517,11 @@ gulp.task(escapePostbidConfig); gulp.task('build-creative-dev', gulp.series(buildCreative(argv.creativeDev ? 'development' : 'production'), updateCreativeRenderers)); gulp.task('build-creative-prod', gulp.series(buildCreative(), updateCreativeRenderers)); -gulp.task('build-bundle-dev', gulp.series('build-creative-dev', makeDevpackPkg, gulpBundle.bind(null, true))); -gulp.task('build-bundle-prod', gulp.series('build-creative-prod', makeWebpackPkg(), gulpBundle.bind(null, false))); +gulp.task('build-bundle-dev', gulp.series('build-creative-dev', makeDevpackPkg(standaloneDebuggingConfig), makeDevpackPkg(), gulpBundle.bind(null, true))); +gulp.task('build-bundle-prod', gulp.series('build-creative-prod', makeWebpackPkg(standaloneDebuggingConfig), makeWebpackPkg(), gulpBundle.bind(null, false))); // build-bundle-verbose - prod bundle except names and comments are preserved. Use this to see the effects // of dead code elimination. -gulp.task('build-bundle-verbose', gulp.series(makeWebpackPkg({ - optimization: { - minimizer: [ - new TerserPlugin({ - parallel: true, - terserOptions: { - mangle: false, - format: { - comments: 'all' - } - }, - extractComments: false, - }), - ], - } -}), gulpBundle.bind(null, false))); +gulp.task('build-bundle-verbose', gulp.series('build-creative-dev', makeWebpackPkg(makeVerbose(standaloneDebuggingConfig)), makeWebpackPkg(makeVerbose()), gulpBundle.bind(null, true))); // public tasks (dependencies are needed for each task since they can be ran on their own) gulp.task('test-only', test); diff --git a/integrationExamples/gpt/51DegreesRtdProvider_example.html b/integrationExamples/gpt/51DegreesRtdProvider_example.html new file mode 100644 index 00000000000..5f66dd9c8e2 --- /dev/null +++ b/integrationExamples/gpt/51DegreesRtdProvider_example.html @@ -0,0 +1,196 @@ + + +
+ + + + + + + + +debug: true
under pbjs.setConfig
in this example code (be sure to remove it for production!)
+ <YOUR RESOURCE KEY>
in this example code with the one you have obtained
+ from the 51Degrees Configurator Tool[51Degrees RTD Submodule]: reqBidsConfigObj:
message (under reqBidsConfigObj.global.device
)Start local server with:
+gulp serve-fast --https
+Chrome flags:
+--enable-features=CookieDeprecationFacilitatedTesting:label/treatment_1.2/force_eligible/true
+ --privacy-sandbox-enrollment-overrides=https://localhost:9999
+Join interest group at https://privacysandbox.openx.net/fledge/advertiser +
+