Skip to content

Commit

Permalink
Merge pull request #1 from prebid/master
Browse files Browse the repository at this point in the history
t
  • Loading branch information
mhlm authored Oct 8, 2019
2 parents 38081ff + 2121f18 commit 15bc5fd
Show file tree
Hide file tree
Showing 382 changed files with 30,778 additions and 6,928 deletions.
7 changes: 6 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:7.10
- image: circleci/node:8.9.0

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
Expand All @@ -34,6 +34,7 @@ jobs:
key: v1-dependencies-{{ checksum "package.json" }}

- run: sudo npm install -g gulp-cli

# Download and run BrowserStack local
- run:
name : Download BrowserStack Local binary and start it.
Expand All @@ -48,3 +49,7 @@ jobs:
- run:
name: BrowserStack testing
command: gulp test --browserstack --nolintfix
# run e2e tests
- run:
name: Functional testing
command: echo "127.0.0.1 test.localhost" | sudo tee -a /etc/hosts && gulp e2e-test --host=test.localhost --file=./test/spec/e2e/banner/basic_banner_ad.spec.js
14 changes: 13 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

const allowedModules = require("./allowedModules");

module.exports = {
"env": {
"browser": true,
Expand All @@ -11,6 +14,9 @@ module.exports = {
}
},
"extends": "standard",
"plugins": [
"prebid"
],
"globals": {
"$$PREBID_GLOBAL$$": false
},
Expand All @@ -31,5 +37,11 @@ module.exports = {
"no-throw-literal": "off",
"no-undef": "off",
"no-useless-escape": "off",
}
},
"overrides": Object.keys(allowedModules).map((key) => ({
"files": key + "/**/*.js",
"rules": {
"prebid/validate-imports": ["error", allowedModules[key]]
}
}))
};
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ build/coverage/
.idea/
# if you remove the above rule, at least ignore the following:

# VS Code
.vscode/

# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.0
8.9
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ commit your changes, and [open a pull request](https://help.github.com/articles/
master branch.

Pull requests must have 80% code coverage before beign considered for merge.
Additional details about the process can be found [here](./pr_review.md).
Additional details about the process can be found [here](./PR_REVIEW.md).

## Issues
[prebid.org](http://prebid.org/) contains documentation that may help answer questions you have about using Prebid.js.
Expand Down
5 changes: 5 additions & 0 deletions PR_REVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ For modules and core platform updates, the initial reviewer should request an ad
- Review for obvious errors or bad coding practice / use best judgement here.
- If the change is a new feature / change to core prebid.js - review the change with a Tech Lead on the project and make sure they agree with the nature of change.
- If the change results in needing updates to docs (such as public API change, module interface etc), add a label for "needs docs" and inform the submitter they must submit a docs PR to update the appropriate area of Prebid.org **before the PR can merge**. Help them with finding where the docs are located on prebid.org if needed.
- Below are some examples of bidder specific updates that should require docs update (in their dev-docs/bidders/bidder.md file):
- Add support for GDPR consentManagement module > add `gdpr_supported: true`
- Add support for userId module > add `userId: pubCommon, digitrust, newProviderHere`
- Add support for video and/or native mediaTypes > add `media_types: video, native`
- Add support for COPPA > add `coppa_supported: true`
- If all above is good, add a `LGTM` comment and request 1 additional core member to review.
- Once there is 2 `LGTM` on the PR, merge to master
- Ask the submitter to add a PR for documentation if applicable.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module.exports = {
}
```

Or for Babel 6 and/or Node v8.6.0 and less:
Or for Babel 6:
```javascript
// you must manually install and specify the presets and plugins yourself
options: {
Expand Down Expand Up @@ -112,9 +112,9 @@ prebid.requestBids({
$ cd Prebid.js
$ npm install

*Note:* You need to have `NodeJS` 6.x or greater installed.
*Note:* You need to have `NodeJS` 8.9.x or greater installed.

*Note:* In the 1.24.0 release of Prebid.js we have transitioned to using gulp 4.0 from using gulp 3.9.1. To compily with gulp's recommended setup for 4.0, you'll need to have `gulp-cli` installed globally prior to running the general `npm install`. This shouldn't impact any other projects you may work on that use an earlier version of gulp in it's setup.
*Note:* In the 1.24.0 release of Prebid.js we have transitioned to using gulp 4.0 from using gulp 3.9.1. To comply with gulp's recommended setup for 4.0, you'll need to have `gulp-cli` installed globally prior to running the general `npm install`. This shouldn't impact any other projects you may work on that use an earlier version of gulp in its setup.

If you have a previous version of `gulp` installed globally, you'll need to remove it before installing `gulp-cli`. You can check if this is installed by running `gulp -v` and seeing the version that's listed in the `CLI` field of the output. If you have the `gulp` package installed globally, it's likely the same version that you'll see in the `Local` field. If you already have `gulp-cli` installed, it should be a lower major version (it's at version `2.0.1` at the time of the transition).

Expand Down
24 changes: 24 additions & 0 deletions allowedModules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

const sharedWhiteList = [
"core-js/library/fn/array/find", // no ie11
"core-js/library/fn/array/includes", // no ie11
"core-js/library/fn/set", // ie11 supports Set but not Set#values
"core-js/library/fn/string/includes", // no ie11
"core-js/library/fn/number/is-integer", // no ie11,
"core-js/library/fn/array/from" // no ie11
];

module.exports = {
'modules': [
...sharedWhiteList,
'jsencrypt',
'crypto-js'
],
'src': [
...sharedWhiteList,
'fun-hooks/no-eval',
'just-clone',
'dlv',
'dset'
]
};
26 changes: 13 additions & 13 deletions browsers.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"bs_edge_16_windows_10": {
"bs_edge_17_windows_10": {
"base": "BrowserStack",
"os_version": "10",
"browser": "edge",
"browser_version": "16.0",
"browser_version": "17.0",
"device": null,
"os": "Windows"
},
"bs_edge_17_windows_10": {
"bs_edge_16_windows_10": {
"base": "BrowserStack",
"os_version": "10",
"browser": "edge",
"browser_version": "17.0",
"browser_version": "16.0",
"device": null,
"os": "Windows"
},
Expand All @@ -23,35 +23,35 @@
"device": null,
"os": "Windows"
},
"bs_chrome_72_windows_10": {
"bs_chrome_74_windows_10": {
"base": "BrowserStack",
"os_version": "10",
"browser": "chrome",
"browser_version": "72.0",
"browser_version": "74.0",
"device": null,
"os": "Windows"
},
"bs_chrome_71_windows_10": {
"bs_chrome_75_windows_10": {
"base": "BrowserStack",
"os_version": "10",
"browser": "chrome",
"browser_version": "71.0",
"browser_version": "75.0",
"device": null,
"os": "Windows"
},
"bs_firefox_65_windows_10": {
"bs_firefox_66_windows_10": {
"base": "BrowserStack",
"os_version": "10",
"browser": "firefox",
"browser_version": "65.0",
"browser_version": "66.0",
"device": null,
"os": "Windows"
},
"bs_firefox_64_windows_10": {
"bs_firefox_67_windows_10": {
"base": "BrowserStack",
"os_version": "10",
"browser": "firefox",
"browser_version": "64.0",
"browser_version": "67.0",
"device": null,
"os": "Windows"
},
Expand All @@ -71,4 +71,4 @@
"device": null,
"os": "OS X"
}
}
}
19 changes: 17 additions & 2 deletions gulpHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const MANIFEST = 'package.json';
const through = require('through2');
const _ = require('lodash');
const gutil = require('gulp-util');
const submodules = require('./modules/.submodules.json');

const MODULE_PATH = './modules';
const BUILD_PATH = './build/dist';
Expand Down Expand Up @@ -39,7 +40,9 @@ module.exports = {
.replace(/\/>/g, '\\/>');
},
getArgModules() {
var modules = (argv.modules || '').split(',').filter(module => !!module);
var modules = (argv.modules || '')
.split(',')
.filter(module => !!module);

try {
if (modules.length === 1 && path.extname(modules[0]).toLowerCase() === '.json') {
Expand All @@ -56,6 +59,15 @@ module.exports = {
});
}

Object.keys(submodules).forEach(parentModule => {
if (
!modules.includes(parentModule) &&
modules.some(module => submodules[parentModule].includes(module))
) {
modules.unshift(parentModule);
}
});

return modules;
},
getModules: _.memoize(function(externalModules) {
Expand All @@ -79,7 +91,10 @@ module.exports = {
}
return Object.assign(externalModules.reduce((memo, module) => {
try {
var modulePath = require.resolve(module);
// prefer internal project modules before looking at project dependencies
var modulePath = require.resolve(module, {paths: ['./modules']});
if (modulePath === '') modulePath = require.resolve(module);

memo[modulePath] = module;
} catch (err) {
// do something
Expand Down
57 changes: 40 additions & 17 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,6 @@ function bundle(dev, moduleArr) {
.pipe(gulpif(dev, sourcemaps.write('.')));
}

// Workaround for incompatibility between Karma & gulp callbacks.
// See https://github.com/karma-runner/gulp-karma/issues/18 for some related discussion.
function newKarmaCallback(done) {
return function (exitCode) {
if (exitCode) {
done(new Error('Karma tests failed with exit code ' + exitCode));
} else {
done();
}
}
}

// Run the unit tests.
//
// By default, this runs in headless chrome.
Expand All @@ -226,16 +214,35 @@ function newKarmaCallback(done) {
// If --browserstack is given, it will run the full suite of currently supported browsers.
// If --browsers is given, browsers can be chosen explicitly. e.g. --browsers=chrome,firefox,ie9
// If --notest is given, it will immediately skip the test task (useful for developing changes with `gulp serve --notest`)

function test(done) {
if (argv.notest) {
done();
} else if (argv.e2e) {
let wdioCmd = path.join(__dirname, 'node_modules/.bin/wdio');
let wdioConf = path.join(__dirname, 'wdio.conf.js');
let wdioOpts = [
wdioConf
];
return execa(wdioCmd, wdioOpts, { stdio: 'inherit' });
let wdioOpts;

if (argv.file) {
wdioOpts = [
wdioConf,
`--spec`,
`${argv.file}`
]
} else {
wdioOpts = [
wdioConf
];
}
execa(wdioCmd, wdioOpts, { stdio: 'inherit' })
.then(stdout => {
done();
process.exit(0);
})
.catch(err => {
done(new Error(`Tests failed with error: ${err}`));
process.exit(1);
});
} else {
var karmaConf = karmaConfMaker(false, argv.browserstack, argv.watch, argv.file);

Expand All @@ -248,6 +255,22 @@ function test(done) {
}
}

function newKarmaCallback(done) {
return function(exitCode) {
if (exitCode) {
done(new Error('Karma tests failed with exit code ' + exitCode));
if (argv.browserstack) {
process.exit(exitCode);
}
} else {
done();
if (argv.browserstack) {
process.exit(exitCode);
}
}
}
}

// If --file "<path-to-test-file>" is given, the task will only run tests in the specified file.
function testCoverage(done) {
new KarmaServer(karmaConfMaker(true, false, false, argv.file), newKarmaCallback(done)).start();
Expand Down Expand Up @@ -311,7 +334,7 @@ gulp.task('build-postbid', gulp.series(escapePostbidConfig, buildPostbid));
gulp.task('serve', gulp.series(clean, lint, gulp.parallel('build-bundle-dev', watch, test)));
gulp.task('default', gulp.series(clean, makeWebpackPkg));

gulp.task('e2e-test', gulp.series(clean, setupE2e, gulp.parallel('build-bundle-dev', watch), test))
gulp.task('e2e-test', gulp.series(clean, setupE2e, gulp.parallel('build-bundle-prod', watch), test))
// other tasks
gulp.task(bundleToStdout);
gulp.task('bundle', gulpBundle.bind(null, false)); // used for just concatenating pre-built files with no build step
Expand Down
Loading

0 comments on commit 15bc5fd

Please sign in to comment.