diff --git a/gulpfile.js b/gulpfile.js index 879e34ae588..bbc2e6eb08a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,31 +1,30 @@ /* eslint-disable no-console */ 'use strict'; - -var _ = require('lodash'); +console.time('Loading Plugins in Prebid'); var argv = require('yargs').argv; var gulp = require('gulp'); -var gutil = require('gulp-util'); -var connect = require('gulp-connect'); -var webpack = require('webpack'); -var webpackStream = require('webpack-stream'); -var uglify = require('gulp-uglify'); -var gulpClean = require('gulp-clean'); -var KarmaServer = require('karma').Server; -var karmaConfMaker = require('./karma.conf.maker'); -var opens = require('opn'); -var webpackConfig = require('./webpack.conf'); -var helpers = require('./gulpHelpers'); +// var gutil = require('gulp-util'); +// var connect = require('gulp-connect'); +// var webpack = require('webpack'); +// var webpackStream = require('webpack-stream'); +// var uglify = require('gulp-uglify'); +// var gulpClean = require('gulp-clean'); +// var KarmaServer = require('karma').Server; +// var karmaConfMaker = require('./karma.conf.maker'); +// var opens = require('opn'); +// var webpackConfig = require('./webpack.conf'); +// var helpers = require('./gulpHelpers'); var concat = require('gulp-concat'); -var header = require('gulp-header'); -var footer = require('gulp-footer'); +// var header = require('gulp-header'); +// var footer = require('gulp-footer'); var replace = require('gulp-replace'); -var shell = require('gulp-shell'); -var eslint = require('gulp-eslint'); -var gulpif = require('gulp-if'); -var sourcemaps = require('gulp-sourcemaps'); -var through = require('through2'); -var fs = require('fs'); -var jsEscape = require('gulp-js-escape'); +// var shell = require('gulp-shell'); +// var eslint = require('gulp-eslint'); +// var gulpif = require('gulp-if'); +// var sourcemaps = require('gulp-sourcemaps'); +// var through = require('through2'); +// var fs = require('fs'); +// var jsEscape = require('gulp-js-escape'); const path = require('path'); const execa = require('execa'); @@ -33,6 +32,7 @@ var prebid = require('./package.json'); var dateString = 'Updated : ' + (new Date()).toISOString().substring(0, 10); var banner = '/* <%= prebid.name %> v<%= prebid.version %>\n' + dateString + ' */\n'; var port = 9999; +console.timeEnd('Loading Plugins in Prebid'); const FAKE_SERVER_HOST = argv.host ? argv.host : 'localhost'; const FAKE_SERVER_PORT = 4444; const { spawn } = require('child_process'); @@ -49,6 +49,7 @@ function bundleToStdout() { bundleToStdout.displayName = 'bundle-to-stdout'; function clean() { + var gulpClean = require('gulp-clean'); return gulp.src(['build'], { read: false, allowEmpty: true @@ -58,6 +59,8 @@ function clean() { // Dependant task for building postbid. It escapes postbid-config file. function escapePostbidConfig() { + var jsEscape = require('gulp-js-escape'); + gulp.src('./integrationExamples/postbid/oas/postbid-config.js') .pipe(jsEscape()) .pipe(gulp.dest('build/postbid/')); @@ -65,6 +68,9 @@ function escapePostbidConfig() { escapePostbidConfig.displayName = 'escape-postbid-config'; function lint(done) { + var eslint = require('gulp-eslint'); + var gulpif = require('gulp-if'); + if (argv.nolint) { return done(); } @@ -80,6 +86,9 @@ function lint(done) { // View the code coverage report in the browser. function viewCoverage(done) { + var connect = require('gulp-connect'); + var opens = require('opn'); + var coveragePort = 1999; var mylocalhost = (argv.host) ? argv.host : 'localhost'; @@ -96,6 +105,8 @@ viewCoverage.displayName = 'view-coverage'; // Watch Task with Live Reload function watch(done) { + var connect = require('gulp-connect'); + var mainWatcher = gulp.watch([ 'src/**/*.js', 'modules/**/*.js', @@ -121,6 +132,13 @@ function watch(done) { }; function makeDevpackPkg() { + var _ = require('lodash'); + var connect = require('gulp-connect'); + var webpack = require('webpack'); + var webpackStream = require('webpack-stream'); + var webpackConfig = require('./webpack.conf'); + var helpers = require('./gulpHelpers'); + var cloned = _.cloneDeep(webpackConfig); cloned.devtool = 'source-map'; var externalModules = helpers.getArgModules(); @@ -136,6 +154,15 @@ function makeDevpackPkg() { } function makeWebpackPkg() { + var _ = require('lodash'); + var webpack = require('webpack'); + var webpackStream = require('webpack-stream'); + var uglify = require('gulp-uglify'); + var webpackConfig = require('./webpack.conf'); + var helpers = require('./gulpHelpers'); + var header = require('gulp-header'); + var gulpif = require('gulp-if'); + var cloned = _.cloneDeep(webpackConfig); delete cloned.devtool; @@ -157,6 +184,8 @@ function gulpBundle(dev) { } function nodeBundle(modules) { + var through = require('through2'); + return new Promise((resolve, reject) => { bundle(false, modules) .on('error', (err) => { @@ -170,9 +199,17 @@ function nodeBundle(modules) { } function bundle(dev, moduleArr) { + // console.time('Loading Plugins for Prebid'); + var _ = require('lodash'); + var gutil = require('gulp-util'); + var helpers = require('./gulpHelpers'); + var footer = require('gulp-footer'); + var gulpif = require('gulp-if'); + var sourcemaps = require('gulp-sourcemaps'); var modules = moduleArr || helpers.getArgModules(); var allModules = helpers.getModuleNames(modules); - + // console.timeEnd('Loading Plugins for Prebid'); + // console.time('Getting Modules for Prebid'); if (modules.length === 0) { modules = allModules.filter(module => explicitModules.indexOf(module) === -1); } else { @@ -184,7 +221,8 @@ function bundle(dev, moduleArr) { }); } } - + // console.timeEnd('Getting Modules for Prebid'); + // console.time('Concating Starts'); var entries = [helpers.getBuiltPrebidCoreFile(dev)].concat(helpers.getBuiltModules(dev, modules)); var outputFileName = argv.bundleName ? argv.bundleName : 'prebid.js'; @@ -194,10 +232,10 @@ function bundle(dev, moduleArr) { outputFileName = outputFileName.replace(/\.js$/, `.${argv.tag}.js`); } - gutil.log('Concatenating files:\n', entries); - gutil.log('Appending ' + prebid.globalVarName + '.processQueue();'); - gutil.log('Generating bundle:', outputFileName); - + // gutil.log('Concatenating files:\n', entries); + // gutil.log('Appending ' + prebid.globalVarName + '.processQueue();'); + // gutil.log('Generating bundle:', outputFileName); + // console.timeEnd('Concating Starts'); return gulp.src( entries ) @@ -221,6 +259,10 @@ function bundle(dev, moduleArr) { // If --notest is given, it will immediately skip the test task (useful for developing changes with `gulp serve --notest`) function test(done) { + var KarmaServer = require('karma').Server; + var karmaConfMaker = require('./karma.conf.maker'); + var helpers = require('./gulpHelpers'); + if (argv.notest) { done(); } else if (argv.e2e) { @@ -292,10 +334,15 @@ function newKarmaCallback(done) { // If --file "" is given, the task will only run tests in the specified file. function testCoverage(done) { + var KarmaServer = require('karma').Server; + var karmaConfMaker = require('./karma.conf.maker'); + new KarmaServer(karmaConfMaker(true, false, false, argv.file), newKarmaCallback(done)).start(); } function coveralls() { // 2nd arg is a dependency: 'test' must be finished + var shell = require('gulp-shell'); + // first send results of istanbul's test coverage to coveralls.io. return gulp.src('gulpfile.js', { read: false }) // You have to give it a file, but you don't // have to read it. @@ -306,6 +353,8 @@ function coveralls() { // 2nd arg is a dependency: 'test' must be finished // More info can be found here http://prebid.org/overview/what-is-post-bid.html function buildPostbid() { + var fs = require('fs'); + var fileContent = fs.readFileSync('./build/postbid/postbid-config.js', 'utf8'); return gulp.src('./integrationExamples/postbid/oas/postbid.js') @@ -314,6 +363,8 @@ function buildPostbid() { } function setupE2e(done) { + var gutil = require('gulp-util'); + if (!argv.host) { throw new gutil.PluginError({ plugin: 'E2E test', diff --git a/integrationExamples/gpt/gdpr_iframe_hello_world.html b/integrationExamples/gpt/gdpr_iframe_hello_world.html new file mode 100644 index 00000000000..4ead5832bc7 --- /dev/null +++ b/integrationExamples/gpt/gdpr_iframe_hello_world.html @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + +

Prebid.js Test

+
Div-1
+
+ +
+ + \ No newline at end of file diff --git a/integrationExamples/gpt/gdpr_iframe_test.html b/integrationExamples/gpt/gdpr_iframe_test.html new file mode 100644 index 00000000000..bb643da24a6 --- /dev/null +++ b/integrationExamples/gpt/gdpr_iframe_test.html @@ -0,0 +1,10 @@ + + + + + + + +