Skip to content

Commit fbbf9f8

Browse files
docs(README): List supported environments, add badges, and more (#136)
## Summary - Add the same Full Stack description to the top of the READMEs here that @jonslaught advised to for python-sdk in optimizely/python-sdk#124 - Clarify Lerna usage: no multiple packages, for now - Fix stale package name in root readme, and fix the NPM badge that also was based on it - Add badges to `@optimizely/optimizely-sdk`'s README - Precisely document supported JavaScript environments - Add note about default `EventDispatcher`s. (I have mixed feelings on this; happy to hear opinions) - Make `Contributing` section more concise - Drop references to `dist/` artifacts, since #135 made them no longer a thing [Rendered](https://github.com/optimizely/javascript-sdk/blob/sw/readme/packages/optimizely-sdk/README.md)
1 parent 4273292 commit fbbf9f8

File tree

2 files changed

+47
-44
lines changed

2 files changed

+47
-44
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,22 @@
33
</h3>
44

55
<p align="center">
6-
This repository houses the official JavaScript SDK for use with Optimizely X Full Stack
6+
This repository houses the official JavaScript SDK for use with Optimizely X Full Stack.
77
</p>
88

9+
Optimizely X Full Stack is A/B testing and feature management for product development teams. Experiment in any application. Make every feature on your roadmap an opportunity to learn. Learn more at https://www.optimizely.com/products/full-stack/, or see the [documentation](https://developers.optimizely.com/x/solutions/sdks/reference/index.html?language=node).
10+
911
## Packages
1012

11-
This repository is a monorepo that we manage using [Lerna](https://github.com/lerna/lerna). That means that we actually publish [several packages](/packages) to npm from the same codebase, including:
13+
This repository is a monorepo that we manage using [Lerna](https://github.com/lerna/lerna). Only one package lives here currently, but that may change in the future.
1214

1315
| Package | Version | Docs | Description |
1416
| ------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
15-
| [`optimizely-sdk`](/packages/optimizely-sdk) | [![npm](https://img.shields.io/npm/v/optimizely-sdk.svg?style=flat-square)](https://npmjs.com/package/@optimizely/optimizely-sdk) | [![](https://img.shields.io/badge/API%20Docs-site-green.svg?style=flat-square)](https://developers.optimizely.com/x/solutions/sdks/reference/?language=javascript) | The Optimizely SDK |
17+
| [`@optimizely/optimizely-sdk`](/packages/optimizely-sdk) | [![npm](https://img.shields.io/npm/v/%40optimizely%2Foptimizely-sdk.svg)](https://www.npmjs.com/package/@optimizely/optimizely-sdk) | [![](https://img.shields.io/badge/API%20Docs-site-green.svg?style=flat-square)](https://developers.optimizely.com/x/solutions/sdks/reference/?language=javascript) | The Optimizely SDK |
1618

1719
## About
1820

19-
`optimizely-sdk` is developed and maintained by [Optimizely](https://optimizely.com) and many [contributors](https://github.com/optimizely/javascript-sdk/graphs/contributors). If you're interested in learning more about what Optimizely X FullStack can do for your company, please [get in touch](mailto:[email protected])!
21+
`@optimizely/optimizely-sdk` is developed and maintained by [Optimizely](https://optimizely.com) and many [contributors](https://github.com/optimizely/javascript-sdk/graphs/contributors). If you're interested in learning more about what Optimizely X Full Stack can do for your company, please [get in touch](mailto:[email protected])!
2022

2123

2224
### Contributing

packages/optimizely-sdk/README.md

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,69 @@
1-
# Optimizely JavaScript SDK
1+
# JavaScript SDK for Optimizely X Full Stack
2+
[![npm](https://img.shields.io/npm/v/%40optimizely%2Foptimizely-sdk.svg)](https://www.npmjs.com/package/@optimizely/optimizely-sdk)
3+
[![npm](https://img.shields.io/npm/dm/%40optimizely%2Foptimizely-sdk.svg)](https://www.npmjs.com/package/@optimizely/optimizely-sdk)
4+
[![Travis CI](https://img.shields.io/travis/optimizely/javascript-sdk.svg)](https://travis-ci.org/optimizely/javascript-sdk)
5+
[![Coveralls](https://img.shields.io/coveralls/optimizely/javascript-sdk.svg)](https://coveralls.io/github/optimizely/javascript-sdk)
6+
[![license](https://img.shields.io/github/license/optimizely/javascript-sdk.svg)](https://choosealicense.com/licenses/apache-2.0/)
27

3-
This repository houses the JavaScript SDK for Optimizely X Full Stack.
8+
9+
Optimizely X Full Stack is A/B testing and feature management for product development teams. Experiment in any application. Make every feature on your roadmap an opportunity to learn. Learn more at the [landing page](https://www.optimizely.com/products/full-stack/), or see the [documentation](https://developers.optimizely.com/x/solutions/sdks/reference/index.html?language=node).
10+
11+
This directory contains the source code for the JavaScript SDK, which is usable in Node.js, browsers, and beyond.
412

513
## Getting Started
614

7-
### Installing the SDK
15+
### Prerequisites
16+
17+
Ensure the SDK supports all of the platforms you're targeting. In particular, the SDK targets any ES5-compliant JavaScript environment. We officially support:
18+
- Node.js >= 4.0.0. By extension, environments like AWS Lambda, Google Cloud Functions, and Auth0 Webtasks are supported as well. Older Node.js releases likely work too (try `npm test` to validate for yourself), but are not formally supported.
19+
- [Web browsers](https://caniuse.com/#feat=es5)
20+
21+
Other environments likely are compatible, too, but note that we don't officially support them:
22+
- Progressive Web Apps, WebViews, and hybrid mobile apps like those built with React Native and Apache Cordova.
23+
- [Cloudflare Workers](https://developers.cloudflare.com/workers/) and [Fly](https://fly.io/), both of which are powered by recent releases of V8.
24+
- Anywhere else you can think of that might embed a JavaScript engine. The sky is the limit; experiment everywhere! 🚀
825

9-
The SDK is available through [npm](https://npmjs.com/package/optimizely-sdk). To install:
26+
Once you've validated that the SDK supports the platforms you're targeting, fetch the package from [NPM](https://www.npmjs.com/package/@optimizely/optimizely-sdk). Using `npm`:
1027

1128
```
12-
npm install @optimizely/optimizely-sdk --save
29+
npm install --save @optimizely/optimizely-sdk
1330
```
1431

15-
Or to use in a non CommonJS fashion in the Browser:
32+
### Usage
33+
See the Optimizely X Full Stack [developer documentation](http://developers.optimizely.com/server/reference/index.html) to learn how to set up your first JavaScript project and use the SDK.
1634

17-
1. Run `npm run build`
18-
2. Pull in `dist/optimizely.browser.umd.min.js` as a `<script>`
19-
3. Use as global variable `window.optimizelyClient`
35+
Regarding `EventDispatcher`s: In Node.js and browser environments, the default `EventDispatcher` is powered by the [`http/s`](https://nodejs.org/api/http.html) modules and by [`XMLHttpRequest`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Browser_compatibility), respectively. In all other environments, you must supply your own `EventDispatcher`.
2036

2137
### Migrating from 1.x.x
2238

2339
This version represents a major version change and, as such, introduces some breaking changes:
2440

25-
- The Node SDK is now combined with the JavaScript SDK so that we have one `optimizely-sdk` package that works across both server + browser environments.
41+
- The Node.js SDK is now combined with the JavaScript SDK. We now have just one package, `@optimizely/optimizely-sdk`, that works in many JavaScript environments.
2642

27-
- We no longer support legacy Node versions (under 4.0).
43+
- We no longer support Node.js < 4.0.0, which collectively [reached end-of-life](https://github.com/nodejs/Release#end-of-life-releases) on 2016-12-31.
2844

2945
- You will no longer be able to pass in `revenue` value as a stand-alone argument to the `track` call. Instead you will need to pass it as an entry in the [`eventTags`](https://developers.optimizely.com/x/solutions/sdks/reference/index.html?language=javascript#event-tags).
3046

31-
### Feature Management Access
32-
33-
To access the Feature Management configuration in the Optimizely dashboard, please contact your Optimizely account executive.
34-
35-
### Using the SDK
36-
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.
37-
38-
## Development
47+
### Feature Management access
3948

40-
### Installing dependencies
49+
To access Feature Management in the Optimizely web application, please contact your Optimizely account executive.
4150

42-
```npm install```
51+
## Contributing
52+
This information is relevant only if you plan on contributing to the SDK itself.
4353

44-
### Unit tests
54+
```sh
55+
# Prerequisite: Install dependencies.
56+
npm install
4557

46-
You can run all unit tests with:
47-
```
58+
# Run unit tests with mocha.
4859
npm test
49-
```
5060

51-
### Build distribution packages
52-
53-
```
54-
npm run build
61+
# Run unit tests in many browsers, currently via BrowserStack.
62+
# For this to work, the following environment variables must be set:
63+
# - BROWSER_STACK_USERNAME
64+
# - BROWSER_STACK_PASSWORD
65+
npm run test-xbrowser
5566
```
5667

57-
This command will build several distribution bundles under the `dist` directory:
58-
1. optimizely.browser.cjs.js - This is the main entry point for browser/client-side bundles
59-
2. optimizely.browser.umd.js - This is used when not packaging the optimizely-sdk with your own JS bundles. Instead you would load this script as a `<script>` tag and reference it via the global var `optimizelyClient`
60-
3. optimizely.node.js - This is the main entry point for Node apps
61-
62-
The browser bundles also come with a minified / production-ready version.
63-
64-
### Environment Variables
65-
66-
The .yml of this project contains environment vairables for ```BROWSER_STACK_USERNAME``` and ```BROWSER_STACK_ACCESS_KEY```.
68+
[.travis.yml](/.travis.yml) contains the definitions for `BROWSER_STACK_USERNAME` and `BROWSER_STACK_ACCESS_KEY` used in CI. These values are Optimizely's BrowserStack credentials, encrypted with our Travis CI public key. These creds can be rotated by following [these docs](https://docs.travis-ci.com/user/environment-variables/#Defining-encrypted-variables-in-.travis.yml).
6769

68-
These variables, created in BrowserStack, are encrypted by the Travis CI public key. This is done directly with the Travis CI command line tools; for additional information see travis encrypt-file.

0 commit comments

Comments
 (0)