Skip to content

Commit

Permalink
Merge pull request prebid#4 from prebid/master
Browse files Browse the repository at this point in the history
merge from prebid master to fork
  • Loading branch information
pm-manasi-moghe committed Jan 16, 2019
2 parents 6e856c0 + 42cd7ae commit 881c7db
Show file tree
Hide file tree
Showing 274 changed files with 7,207 additions and 3,591 deletions.
19 changes: 0 additions & 19 deletions .babelrc

This file was deleted.

34 changes: 34 additions & 0 deletions .babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

let path = require('path');

function useLocal(module) {
return require.resolve(module, {
paths: [
__dirname
]
})
}

module.exports = {
"presets": [
[
useLocal('@babel/preset-env'),
{
"targets": {
"browsers": [
"chrome >= 61",
"safari >=8",
"edge >= 14",
"ff >= 57",
"ie >= 10",
"ios >= 8"
]
}
}
]
],
"plugins": [
path.resolve(__dirname, './plugins/pbjsGlobals.js'),
useLocal('babel-plugin-transform-object-assign')
]
};
83 changes: 83 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,94 @@ Working examples can be found in [the developer docs](http://prebid.org/dev-docs

**Table of Contents**

- [Usage](#Usage)
- [Install](#Install)
- [Build](#Build)
- [Run](#Run)
- [Contribute](#Contribute)

<a name="Usage"></a>

## Usage (as a npm dependency)

*Note:* Requires Prebid.js v1.38.0+

Prebid.js depends on Babel and some Babel Plugins in order to run correctly in the browser. Here are some examples for
configuring webpack to work with Prebid.js.

With Babel 7:
```javascript
// webpack.conf.js
let path = require('path');
module.exports = {
mode: 'production',
module: {
rules: [

// this rule can be excluded if you don't require babel-loader for your other application files
{
test: /\.m?js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
}
},

// this separate rule is required to make sure that the Prebid.js files are babel-ified. this rule will
// override the regular exclusion from above (for being inside node_modules).
{
test: /.js$/,
include: new RegExp(`\\${path.sep}prebid\.js`),
use: {
loader: 'babel-loader',
// presets and plugins for Prebid.js must be manually specified separate from your other babel rule.
// this can be accomplished by requiring prebid's .babelrc.js file (requires Babel 7 and Node v8.9.0+)
options: require('prebid.js/.babelrc.js')
}
}
]
}
}
```

Or for Babel 6 and/or Node v8.6.0 and less:
```javascript
// you must manually install and specify the presets and plugins yourself
options: {
plugins: [
"transform-object-assign", // required (for IE support) and "babel-plugin-transform-object-assign"
// must be installed as part of your package.
require('prebid.js/plugins/pbjsGlobals.js') // required!
],
presets: [
["env", { // you can use other presets if you wish.
"targets": { // this example is using "babel-presets-env", which must be installed if you
"browsers": [ // follow this example.
... // your browser targets. they should probably match the targets you're using for the rest
// of your application
]
}
}]
]
}
```

Then you can use Prebid.js as any other npm depedendency

```javascript
import prebid from 'prebid.js';
import 'prebid.js/modules/rubiconBidAdapter'; // imported modules will register themselves automatically with prebid
import 'prebid.js/modules/appnexusBidAdapter';
prebid.processQueue(); // required to process existing pbjs.queue blocks and setup any further pbjs.queue execution

prebid.requestBids({
...
})

```



<a name="Install"></a>

## Install
Expand Down
2 changes: 1 addition & 1 deletion gulpHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module.exports = {
try {
var absoluteModulePath = path.join(__dirname, MODULE_PATH);
internalModules = fs.readdirSync(absoluteModulePath)
.filter(file => !(/(^|\/)\.[^\/\.]/g).test(file))
.filter(file => (/^[^\.]+(\.js)?$/).test(file))
.reduce((memo, file) => {
var moduleName = file.split(new RegExp('[.\\' + path.sep + ']'))[0];
var modulePath = path.join(absoluteModulePath, file);
Expand Down
2 changes: 0 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ function makeDevpackPkg() {
return gulp.src([].concat(moduleSources, analyticsSources, 'src/prebid.js'))
.pipe(helpers.nameModules(externalModules))
.pipe(webpackStream(cloned, webpack))
.pipe(replace('$prebid.version$', prebid.version))
.pipe(gulp.dest('build/dev'))
.pipe(connect.reload());
}
Expand All @@ -159,7 +158,6 @@ function makeWebpackPkg() {
return gulp.src([].concat(moduleSources, analyticsSources, 'src/prebid.js'))
.pipe(helpers.nameModules(externalModules))
.pipe(webpackStream(cloned, webpack))
.pipe(replace('$prebid.version$', prebid.version))
.pipe(uglify())
.pipe(gulpif(file => file.basename === 'prebid-core.js', header(banner, { prebid: prebid })))
.pipe(optimizejs())
Expand Down
2 changes: 1 addition & 1 deletion modules/33acrossBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as utils from 'src/utils';
import * as utils from '../src/utils';

const { registerBidder } = require('../src/adapters/bidderFactory');
const { config } = require('../src/config');
Expand Down
4 changes: 2 additions & 2 deletions modules/a4gBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {registerBidder} from 'src/adapters/bidderFactory';
import * as utils from 'src/utils';
import {registerBidder} from '../src/adapters/bidderFactory';
import * as utils from '../src/utils';

const A4G_BIDDER_CODE = 'a4g';
const A4G_CURRENCY = 'USD';
Expand Down
4 changes: 2 additions & 2 deletions modules/aardvarkBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as utils from 'src/utils';
import {registerBidder} from 'src/adapters/bidderFactory';
import * as utils from '../src/utils';
import {registerBidder} from '../src/adapters/bidderFactory';

const BIDDER_CODE = 'aardvark';
const DEFAULT_ENDPOINT = 'bidder.rtk.io';
Expand Down
6 changes: 3 additions & 3 deletions modules/adagioAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* Analytics Adapter for Adagio
*/

import adapter from 'src/AnalyticsAdapter';
import adaptermanager from 'src/adaptermanager';
import adapter from '../src/AnalyticsAdapter';
import adapterManager from '../src/adapterManager';

// This config makes Prebid.js call this function on each event:
// `window['AdagioPrebidAnalytics']('on', eventType, args)`
Expand All @@ -15,7 +15,7 @@ var adagioAdapter = adapter({
analyticsType: 'bundle'
});

adaptermanager.registerAnalyticsAdapter({
adapterManager.registerAnalyticsAdapter({
adapter: adagioAdapter,
code: 'adagio'
});
Expand Down
4 changes: 2 additions & 2 deletions modules/adagioBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import find from 'core-js/library/fn/array/find';
import * as utils from 'src/utils';
import { registerBidder } from 'src/adapters/bidderFactory';
import * as utils from '../src/utils';
import { registerBidder } from '../src/adapters/bidderFactory';

const BIDDER_CODE = 'adagio';
const VERSION = '1.0.0';
Expand Down
6 changes: 3 additions & 3 deletions modules/adbutlerBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

import * as utils from 'src/utils';
import {config} from 'src/config';
import {registerBidder} from 'src/adapters/bidderFactory';
import * as utils from '../src/utils';
import {config} from '../src/config';
import {registerBidder} from '../src/adapters/bidderFactory';

const BIDDER_CODE = 'adbutler';

Expand Down
4 changes: 2 additions & 2 deletions modules/adformBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

import {registerBidder} from 'src/adapters/bidderFactory';
import { BANNER, VIDEO } from 'src/mediaTypes';
import {registerBidder} from '../src/adapters/bidderFactory';
import { BANNER, VIDEO } from '../src/mediaTypes';

const BIDDER_CODE = 'adform';
export const spec = {
Expand Down
6 changes: 3 additions & 3 deletions modules/adformOpenRTBBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

import {
registerBidder
} from 'src/adapters/bidderFactory';
} from '../src/adapters/bidderFactory';
import {
NATIVE
} from 'src/mediaTypes';
import * as utils from 'src/utils';
} from '../src/mediaTypes';
import * as utils from '../src/utils';

const BIDDER_CODE = 'adformOpenRTB';
const NATIVE_ASSET_IDS = { 0: 'title', 2: 'icon', 3: 'image', 5: 'sponsoredBy', 4: 'body', 1: 'cta' };
Expand Down
8 changes: 4 additions & 4 deletions modules/adgenerationBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as utils from 'src/utils';
import {registerBidder} from 'src/adapters/bidderFactory';
import {BANNER, NATIVE} from 'src/mediaTypes';
import { config } from 'src/config';
import * as utils from '../src/utils';
import {registerBidder} from '../src/adapters/bidderFactory';
import {BANNER, NATIVE} from '../src/mediaTypes';
import { config } from '../src/config';
const ADG_BIDDER_CODE = 'adgeneration';

export const spec = {
Expand Down
Loading

0 comments on commit 881c7db

Please sign in to comment.