Skip to content

Commit 7e1398c

Browse files
authored
Bump to version 1.0.0 (#12)
* Replace bluebird dependency with smaller es6-promise library. * Update contribution doc to use CLA (#9) Update contribution doc to use CLA * Bump version to 1.0.0 (#10) Bump version to 1.0.0
1 parent 9c73842 commit 7e1398c

File tree

9 files changed

+54
-21
lines changed

9 files changed

+54
-21
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ node_js:
66
branches:
77
only:
88
- master
9+
- devel
910
install: "npm install"
1011
script:
1112
- "npm test"

CHANGELOG

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
-------------------------------------------------------------------------------
2+
1.0.0
3+
-------------------------------------------------------------------------------
4+
* Introduce support for Full Stack projects in Optimizely X with no breaking changes from previous version.
5+
* Introduce more graceful exception handling in instantiation and core methods.
6+
* Update whitelisting to take precedence over audience condition evaluation.
7+
* Fix bug activating/tracking with attributes not in the datafile.
8+
-------------------------------------------------------------------------------
9+
110
-------------------------------------------------------------------------------
211
0.1.4
312
-------------------------------------------------------------------------------

CONTRIBUTING.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#Contributing to the Optimizely JavaScript SDK
22

3-
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.
3+
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.
44

55
## Development process
66

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

1616
##Pull request acceptance criteria

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Optimizely JavaScript SDK
22

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

55
##Getting Started
66

@@ -13,7 +13,7 @@ npm install optimizely-client-sdk --save
1313
```
1414

1515
###Using the SDK
16-
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.**
16+
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.
1717

1818
##Development
1919

dist/optimizely.min.js

+4-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ var logger = require('optimizely-server-sdk/lib/plugins/logger');
77

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

10+
var JAVASCRIPT_CLIENT_VERSION = '1.0.0';
11+
var MODULE_NAME = 'INDEX';
12+
1013
/**
1114
* Entry point into the Optimizely Node testing SDK
1215
*/
@@ -26,12 +29,21 @@ module.exports = {
2629
if (config) {
2730
try {
2831
configValidator.validate(config);
32+
config.isValidInstance = true;
2933
} catch (ex) {
30-
defaultLogger.log(enums.LOG_LEVEL.ERROR, ex.message);
34+
var errorMessage = MODULE_NAME + ':' + ex.message;
35+
if (config.logger) {
36+
config.logger.log(enums.LOG_LEVEL.ERROR, errorMessage);
37+
} else {
38+
defaultLogger.log(enums.LOG_LEVEL.ERROR, errorMessage);
39+
}
40+
config.isValidInstance = false;
3141
}
3242
}
3343

3444
config = _.assignIn({
45+
clientEngine: enums.JAVASCRIPT_CLIENT_ENGINE,
46+
clientVersion: JAVASCRIPT_CLIENT_VERSION,
3547
errorHandler: defaultErrorHandler,
3648
eventDispatcher: defaultEventDispatcher,
3749
logger: logger.createLogger({ logLevel: enums.LOG_LEVEL.INFO }),

lib/plugins/event_dispatcher/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var _ = require('lodash/core');
2-
var bluebird = require('bluebird');
2+
var es6Promise = require('es6-promise').Promise;
33

44
var POST_METHOD = 'POST';
55
var GET_METHOD = 'GET';
@@ -16,7 +16,7 @@ module.exports = {
1616
var params = eventObj.params;
1717

1818
if (eventObj.httpVerb === POST_METHOD) {
19-
return new bluebird(function(resolve, reject) {
19+
return new es6Promise(function(resolve, reject) {
2020

2121
var req = new XMLHttpRequest();
2222
req.open(POST_METHOD, url, true);
@@ -26,9 +26,9 @@ module.exports = {
2626
resolve(responseObj);
2727
});
2828
req.send(JSON.stringify(params));
29-
})
29+
});
3030
} else {
31-
return new bluebird(function (resolve, reject) {
31+
return new es6Promise(function (resolve, reject) {
3232
// add param for cors headers to be sent by the log endpoint
3333
url += '?wxhr=true';
3434
if (params) {

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "optimizely-client-sdk",
3-
"version": "0.1.4",
4-
"description": "Javascript SDK for client testing",
3+
"version": "1.0.0",
4+
"description": "JavaScript SDK for client testing",
55
"main": "index.js",
66
"scripts": {
77
"test": "./node_modules/.bin/mocha ./tests.js",
@@ -19,9 +19,9 @@
1919
},
2020
"homepage": "https://github.com/optimizely/javascript-sdk#readme",
2121
"dependencies": {
22-
"bluebird": "^3.4.0",
22+
"es6-promise": "^3.3.1",
2323
"lodash": "^4.13.1",
24-
"optimizely-server-sdk": "^0.1.4"
24+
"optimizely-server-sdk": "^1.0.0"
2525
},
2626
"devDependencies": {
2727
"chai": "^3.5.0",

tests.js

+13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var configValidator = require('optimizely-server-sdk/lib/utils/config_validator');
22
var Optimizely = require('optimizely-server-sdk/lib/optimizely');
33
var optimizelyFactory = require('./');
4+
var packageJSON = require('./package.json');
45

56
var chai = require('chai');
67
var assert = chai.assert;
@@ -42,6 +43,18 @@ describe('javascript-sdk', function() {
4243

4344
assert.instanceOf(optlyInstance, Optimizely);
4445
});
46+
47+
it('should set the Javascript client engine and version', function() {
48+
var optlyInstance = optimizelyFactory.createInstance({
49+
datafile: {},
50+
errorHandler: fakeErrorHandler,
51+
eventDispatcher: fakeEventDispatcher,
52+
logger: fakeLogger,
53+
});
54+
55+
assert.equal('javascript-sdk', optlyInstance.clientEngine);
56+
assert.equal(packageJSON.version, optlyInstance.clientVersion);
57+
});
4558
});
4659
});
4760
});

0 commit comments

Comments
 (0)