Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey Kress committed Feb 13, 2020
2 parents d6932f3 + 7b9b5e2 commit 9359953
Show file tree
Hide file tree
Showing 799 changed files with 82,215 additions and 48,759 deletions.
128 changes: 86 additions & 42 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,93 @@
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#

aliases:
- &environment
docker:
# specify the version you desire here
- image: circleci/node:8.9.0

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/mongo:3.4.4
working_directory: ~/Prebid.js

- &restore_dep_cache
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- &save_dep_cache
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}

- &install
name: Install gulp cli
command: sudo npm install -g gulp-cli

- &run_unit_test
name: BrowserStack testing
command: gulp test --browserstack --nolintfix

- &run_endtoend_test
name: BrowserStack End to end testing
command: echo "127.0.0.1 test.localhost" | sudo tee -a /etc/hosts && gulp e2e-test --host=test.localhost

# Download and run BrowserStack local
- &setup_browserstack
name : Download BrowserStack Local binary and start it.
command : |
# Download the browserstack binary file
wget "https://www.browserstack.com/browserstack-local/BrowserStackLocal-linux-x64.zip"
# Unzip it
unzip BrowserStackLocal-linux-x64.zip
# Run the file with user's access key
./BrowserStackLocal ${BROWSERSTACK_ACCESS_KEY} &
- &unit_test_steps
- checkout
- restore_cache: *restore_dep_cache
- run: npm install
- save_cache: *save_dep_cache
- run: *install
- run: *setup_browserstack
- run: *run_unit_test

- &endtoend_test_steps
- checkout
- restore_cache: *restore_dep_cache
- run: npm install
- save_cache: *save_dep_cache
- run: *install
- run: *setup_browserstack
- run: *run_endtoend_test

version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:7.10
<<: *environment
steps: *unit_test_steps

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/mongo:3.4.4

working_directory: ~/Prebid.js

steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: npm install

- save_cache:
paths:
- node_modules
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.
command : |
# Download the browserstack binary file
wget "https://www.browserstack.com/browserstack-local/BrowserStackLocal-linux-x64.zip"
# Unzip it
unzip BrowserStackLocal-linux-x64.zip
# Run the file with user's access key
./BrowserStackLocal ${BROWSERSTACK_ACCESS_KEY} &
# run tests!
- run:
name: BrowserStack testing
command: gulp test --browserstack --nolintfix
e2etest:
<<: *environment
steps: *endtoend_test_steps

workflows:
version: 2
commit:
jobs:
- build
nightly:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
jobs:
- e2etest
16 changes: 14 additions & 2 deletions .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 @@ -29,7 +35,13 @@ module.exports = {
"eqeqeq": "off",
"no-return-assign": "off",
"no-throw-literal": "off",
"no-undef": "off",
"no-undef": 2,
"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
5 changes: 3 additions & 2 deletions 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 Expand Up @@ -48,7 +48,8 @@ When you are adding code to Prebid.js, or modifying code that isn't covered by a
- _Assert_: check that the expected results have occurred
- e.g., use Chai assertions to check that the expected output is equal to the actual output
- Test the public interface, not the internal implementation
- If you need to check `adloader.loadScript` in a test, use a `stub` rather than a `spy`. `spy`s trigger a network call which can result in a `script error` and cause unrelated unit tests to fail. `stub`s will let you gather information about the `adloader.loadScript` call without affecting external resources
- If you need to check `adloader.loadExternalScript` in a test, use a `stub` rather than a `spy`. `spy`s trigger a network call which can result in a `script error` and cause unrelated unit tests to fail. `stub`s will let you gather information about the `adloader.loadExternalScript` call without affecting external resources
- If your test makes ajax requests, use the global xhr stub in `test/mocks/xhr`. Do not use your own `sinon.useFakeXMLHttpRequest()` or `sinon.createFakeServer()`.
- When writing tests you may use ES2015 syntax if desired

### Test Examples
Expand Down
9 changes: 8 additions & 1 deletion PR_REVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ 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 US Privacy consentManagement module > add `usp_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`
- Add support for SChain > add `schain_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 All @@ -24,7 +31,7 @@ For modules and core platform updates, the initial reviewer should request an ad
- Follow steps above for general review process. In addition, please verify the following:
- Verify that bidder has submitted valid bid params and that bids are being received.
- Verify that bidder is not manipulating the prebid.js auction in any way or doing things that go against the principles of the project. If unsure check with the Tech Lead.
- Verify that the bidder is being as efficient as possible, ideally not loading an external library, however if they do load a library it should be cached.
- Verify that the bidder is being as efficient as possible, ideally not loading an external library, however if they do load a library it should be cached.
- Verify that code re-use is being done properly and that changes introduced by a bidder don't impact other bidders.
- If the adapter being submitted is an alias type, check with the bidder contact that is being aliased to make sure it's allowed.
- If the adapter is triggering any user syncs make sure they are using the user sync module in the Prebid.js core.
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
25 changes: 25 additions & 0 deletions allowedModules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

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,
'criteo-direct-rsa-validate',
'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
Loading

0 comments on commit 9359953

Please sign in to comment.