Skip to content

docs(README): List supported environments, add badges, and more #136

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 35 commits into from
Jul 3, 2018
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
83724bb
docs(README): Update
spencerwilson-optimizely Jun 29, 2018
260b780
theoiaw
spencerwilson-optimizely Jun 29, 2018
d4266fd
Add npm workaround
spencerwilson-optimizely Jun 29, 2018
a183ea9
Use complete sentences
spencerwilson-optimizely Jun 29, 2018
a4c16a1
Fix travis yml link, hopefully
spencerwilson-optimizely Jun 29, 2018
e50ba3a
Use 0.10.44
spencerwilson-optimizely Jun 29, 2018
b083826
Add Coveralls badge
spencerwilson-optimizely Jun 29, 2018
818aaa1
Give a better link to Travis encrypted env var docs
spencerwilson-optimizely Jun 29, 2018
c866753
Fix badge link in root readme
spencerwilson-optimizely Jun 29, 2018
2aff7da
Use right package name
spencerwilson-optimizely Jun 29, 2018
d3bb631
Add blurb to root readme
spencerwilson-optimizely Jun 29, 2018
724d1d5
Clarify Lerna usage
spencerwilson-optimizely Jun 29, 2018
09b5afd
Add license badge
spencerwilson-optimizely Jun 29, 2018
67cfbf6
refactor(scripts): Use Karma CLI rather than grunt
spencerwilson-optimizely Jun 30, 2018
22a353b
s/run/start/
spencerwilson-optimizely Jun 30, 2018
17d396f
Merge branch 'sw/drop-grunt' into sw/readme
spencerwilson-optimizely Jun 30, 2018
23dc790
feat(ci): Only run xbrowser-tests with the latest Node.js release
spencerwilson-optimizely Jun 30, 2018
3049c92
Merge branch 'sw/xbrowser-once' into sw/readme
spencerwilson-optimizely Jun 30, 2018
e98687e
Try adding braces
spencerwilson-optimizely Jun 30, 2018
fe7a196
heck the logging
spencerwilson-optimizely Jun 30, 2018
8467cb2
Merge branch 'sw/xbrowser-once' into sw/readme
spencerwilson-optimizely Jun 30, 2018
fae9d22
Update readme
spencerwilson-optimizely Jun 30, 2018
b4d981c
Drop note that says node < 4 is unsupported
spencerwilson-optimizely Jun 30, 2018
268c76e
beyond...
spencerwilson-optimizely Jun 30, 2018
2a6cd9a
Au revoir, 0.10.44
spencerwilson-optimizely Jul 3, 2018
0aa5b7c
s/url/landing page/
spencerwilson-optimizely Jul 3, 2018
a72af3f
Merge branch 'master' into sw/readme
spencerwilson-optimizely Jul 3, 2018
a626342
Options first, like a sane person
spencerwilson-optimizely Jul 3, 2018
115e025
Merge remote-tracking branch 'origin/master' into sw/readme
spencerwilson-optimizely Jul 3, 2018
7758b77
Merge remote-tracking branch 'origin/sw/readme' into sw/readme
spencerwilson-optimizely Jul 3, 2018
40013e3
grammar around EOL date
spencerwilson-optimizely Jul 3, 2018
8d95f8b
Delineate officially-support and other environments
spencerwilson-optimizely Jul 3, 2018
cedffb5
Merge branch 'master' into sw/readme
spencerwilson-optimizely Jul 3, 2018
964a869
Add PWAs, WebViews, and hybrid mobile apps
spencerwilson-optimizely Jul 3, 2018
7956534
Merge remote-tracking branch 'origin/sw/readme' into sw/readme
spencerwilson-optimizely Jul 3, 2018
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
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@
</h3>

<p align="center">
This repository houses the official JavaScript SDK for use with Optimizely X Full Stack
This repository houses the official JavaScript SDK for use with Optimizely X Full Stack.
</p>

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).

## Packages

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:
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.

| Package | Version | Docs | Description |
| ------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| [`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 |
| [`@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 |

## About

`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])!
`@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])!


### Contributing
Expand Down
78 changes: 38 additions & 40 deletions packages/optimizely-sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,66 @@
# Optimizely JavaScript SDK
# JavaScript SDK for Optimizely X Full Stack
[![npm](https://img.shields.io/npm/v/%40optimizely%2Foptimizely-sdk.svg)](https://www.npmjs.com/package/@optimizely/optimizely-sdk)
[![npm](https://img.shields.io/npm/dm/%40optimizely%2Foptimizely-sdk.svg)](https://www.npmjs.com/package/@optimizely/optimizely-sdk)
[![Travis CI](https://img.shields.io/travis/optimizely/javascript-sdk.svg)](https://travis-ci.org/optimizely/javascript-sdk)
[![Coveralls](https://img.shields.io/coveralls/optimizely/javascript-sdk.svg)](https://coveralls.io/github/optimizely/javascript-sdk)
[![license](https://img.shields.io/github/license/optimizely/javascript-sdk.svg)](https://choosealicense.com/licenses/apache-2.0/)

This repository houses the JavaScript SDK for Optimizely X Full Stack.

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).

This directory contains the source code for the JavaScript SDK, which is usable in Node.js, browsers, and beyond.

## Getting Started

### Installing the SDK
### Prerequisites

The SDK is available through [npm](https://npmjs.com/package/optimizely-sdk). To install:
Ensure the SDK supports all of the platforms you're targeting. In particular, we support any ES5-compliant JavaScript environment, including
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can write this a little more precisely so as not to imply supported (as in we'll fix platform-specific issues for that platform) but merely will probably work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'll try to work something out.

- 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

- [Web browsers](https://caniuse.com/#feat=es5)
- [Cloudflare Workers](https://developers.cloudflare.com/workers/) and [Fly](https://fly.io/), both of which are powered by V8.
- Anywhere else you can think of that might embed a JavaScript engine. The sky is the limit; experiment everywhere! 🚀

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`:

```
npm install @optimizely/optimizely-sdk --save
npm install --save @optimizely/optimizely-sdk
```

Or to use in a non CommonJS fashion in the Browser:
### Usage
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.

1. Run `npm run build`
2. Pull in `dist/optimizely.browser.umd.min.js` as a `<script>`
3. Use as global variable `window.optimizelyClient`
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`.

### Migrating from 1.x.x

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

- 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.
- 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.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super nit: by 2016-12-31 would make it true for both 0.10 and 0.12. Reads kind of weird though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hah, yeah. Maybe

which collectively reached end-of-life 2016-12-31.


- 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).

### Feature Management Access

To access the Feature Management configuration in the Optimizely dashboard, please contact your Optimizely account executive.
### Feature Management access

### Using the 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.
To access Feature Management in the Optimizely web application, please contact your Optimizely account executive.

## Development
## Contributing
This information is relevant only if you plan on contributing to the SDK itself.

### Installing dependencies
```sh
# Prerequisite: Install dependencies.
npm install

```npm install```

### Unit tests

You can run all unit tests with:
```
# Run unit tests with mocha.
npm test
```

### Build distribution packages

# Run unit tests in many browsers, currently via BrowserStack.
# For this to work, the following environment variables must be set:
# - BROWSER_STACK_USERNAME
# - BROWSER_STACK_PASSWORD
npm run test-xbrowser
```
npm run build
```

This command will build several distribution bundles under the `dist` directory:
1. optimizely.browser.cjs.js - This is the main entry point for browser/client-side bundles
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`
3. optimizely.node.js - This is the main entry point for Node apps

The browser bundles also come with a minified / production-ready version.

### Environment Variables

The .yml of this project contains environment vairables for ```BROWSER_STACK_USERNAME``` and ```BROWSER_STACK_ACCESS_KEY```.
[.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).

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.