Skip to content

Bump to version 1.0.0 #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ node_js:
branches:
only:
- master
- devel
install: "npm install"
script:
- "npm test"
9 changes: 9 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
-------------------------------------------------------------------------------
1.0.0
-------------------------------------------------------------------------------
* Introduce support for Full Stack projects in Optimizely X with no breaking changes from previous version.
* Introduce more graceful exception handling in instantiation and core methods.
* Update whitelisting to take precedence over audience condition evaluation.
* Fix bug activating/tracking with attributes not in the datafile.
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
0.1.4
-------------------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#Contributing to the Optimizely JavaScript SDK

We welcome contributions and feedback! Please read the [README](README.md) to set up your development environment, then read the guidelines below for information on submitting your code.
We welcome contributions and feedback! All contributors must sign our [Contributor License Agreement (CLA)](https://docs.google.com/a/optimizely.com/forms/d/e/1FAIpQLSf9cbouWptIpMgukAKZZOIAhafvjFCV8hS00XJLWQnWDFtwtA/viewform) to be eligible to contribute. Please read the [README](README.md) to set up your development environment, then read the guidelines below for information on submitting your code.

## Development process

1. Create a branch off of `master`: `git checkout -b YOUR_NAME/branch_name`.
1. Create a branch off of `devel`: `git checkout -b YOUR_NAME/branch_name`.
2. Commit your changes. Make sure to add tests!
3. Run `npm run lint` to ensure there are no lint errors.
4. Run `webpack` to generate the built and minified file for those not installing via `npm`
5. `git push` your changes to GitHub.
6. Make sure that all unit tests are passing and that there are no merge conflicts between your branch and `master`.
7. Open a pull request from `YOUR_NAME/branch_name` to `master`.
6. Make sure that all unit tests are passing and that there are no merge conflicts between your branch and `devel`.
7. Open a pull request from `YOUR_NAME/branch_name` to `devel`.
8. A repository maintainer will review your pull request and, if all goes well, merge it!

##Pull request acceptance criteria
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Optimizely JavaScript SDK

This repository houses the JavaScript SDK for Optimizely's server-side testing product, which is currently in private beta.
This repository houses the JavaScript SDK for Optimizely X Full Stack.

##Getting Started

Expand All @@ -13,7 +13,7 @@ npm install optimizely-client-sdk --save
```

###Using the SDK
See the Optimizely server-side testing [developer documentation](http://developers.optimizely.com/server/reference/index.html) to learn how to set up your first custom project and use the SDK. **Please note that you must be a member of the private server-side testing beta to create custom projects and use this SDK.**
See the Optimizely X Full Stack testing [developer documentation](http://developers.optimizely.com/server/reference/index.html) to learn how to set up your first JavaScript project and use the SDK.

##Development

Expand Down
10 changes: 4 additions & 6 deletions dist/optimizely.min.js

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ var logger = require('optimizely-server-sdk/lib/plugins/logger');

var Optimizely = require('optimizely-server-sdk/lib/optimizely');

var JAVASCRIPT_CLIENT_VERSION = '1.0.0';
var MODULE_NAME = 'INDEX';

/**
* Entry point into the Optimizely Node testing SDK
*/
Expand All @@ -26,12 +29,21 @@ module.exports = {
if (config) {
try {
configValidator.validate(config);
config.isValidInstance = true;
} catch (ex) {
defaultLogger.log(enums.LOG_LEVEL.ERROR, ex.message);
var errorMessage = MODULE_NAME + ':' + ex.message;
if (config.logger) {
config.logger.log(enums.LOG_LEVEL.ERROR, errorMessage);
} else {
defaultLogger.log(enums.LOG_LEVEL.ERROR, errorMessage);
}
config.isValidInstance = false;
}
}

config = _.assignIn({
clientEngine: enums.JAVASCRIPT_CLIENT_ENGINE,
clientVersion: JAVASCRIPT_CLIENT_VERSION,
errorHandler: defaultErrorHandler,
eventDispatcher: defaultEventDispatcher,
logger: logger.createLogger({ logLevel: enums.LOG_LEVEL.INFO }),
Expand Down
8 changes: 4 additions & 4 deletions lib/plugins/event_dispatcher/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var _ = require('lodash/core');
var bluebird = require('bluebird');
var es6Promise = require('es6-promise').Promise;

var POST_METHOD = 'POST';
var GET_METHOD = 'GET';
Expand All @@ -16,7 +16,7 @@ module.exports = {
var params = eventObj.params;

if (eventObj.httpVerb === POST_METHOD) {
return new bluebird(function(resolve, reject) {
return new es6Promise(function(resolve, reject) {

var req = new XMLHttpRequest();
req.open(POST_METHOD, url, true);
Expand All @@ -26,9 +26,9 @@ module.exports = {
resolve(responseObj);
});
req.send(JSON.stringify(params));
})
});
} else {
return new bluebird(function (resolve, reject) {
return new es6Promise(function (resolve, reject) {
// add param for cors headers to be sent by the log endpoint
url += '?wxhr=true';
if (params) {
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "optimizely-client-sdk",
"version": "0.1.4",
"description": "Javascript SDK for client testing",
"version": "1.0.0",
"description": "JavaScript SDK for client testing",
"main": "index.js",
"scripts": {
"test": "./node_modules/.bin/mocha ./tests.js",
Expand All @@ -19,9 +19,9 @@
},
"homepage": "https://github.com/optimizely/javascript-sdk#readme",
"dependencies": {
"bluebird": "^3.4.0",
"es6-promise": "^3.3.1",
"lodash": "^4.13.1",
"optimizely-server-sdk": "^0.1.4"
"optimizely-server-sdk": "^1.0.0"
},
"devDependencies": {
"chai": "^3.5.0",
Expand Down
13 changes: 13 additions & 0 deletions tests.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var configValidator = require('optimizely-server-sdk/lib/utils/config_validator');
var Optimizely = require('optimizely-server-sdk/lib/optimizely');
var optimizelyFactory = require('./');
var packageJSON = require('./package.json');

var chai = require('chai');
var assert = chai.assert;
Expand Down Expand Up @@ -42,6 +43,18 @@ describe('javascript-sdk', function() {

assert.instanceOf(optlyInstance, Optimizely);
});

it('should set the Javascript client engine and version', function() {
var optlyInstance = optimizelyFactory.createInstance({
datafile: {},
errorHandler: fakeErrorHandler,
eventDispatcher: fakeEventDispatcher,
logger: fakeLogger,
});

assert.equal('javascript-sdk', optlyInstance.clientEngine);
assert.equal(packageJSON.version, optlyInstance.clientVersion);
});
});
});
});