Skip to content

Commit f2e3d8a

Browse files
prepare 2.15.0 release (#183)
1 parent fd05808 commit f2e3d8a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+10389
-31554
lines changed

.circleci/config.yml

+8-11
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,22 @@ jobs:
66
steps:
77
- checkout
88

9-
- run: npm install # this automatically runs "npm prepare" too
10-
# Note that for CI to work properly, our lerna command for "npm prepare" in package.json needs to
11-
# have "--concurrency=2", otherwise we may run out of memory. This is a known issue with Lerna.
9+
- run: npm install
1210
- run: npm run lint
13-
- run: npm run build
11+
- run: npm run build:min
1412

15-
# We could do "npm run test" here to run tests for all the packages, but then we would not be
16-
# able to produce separate output files.
1713
- run: mkdir -p reports/junit
1814
- run:
19-
command: cd ~/project/packages/launchdarkly-js-sdk-common && npm run test:junit
15+
command: npm run test:junit
2016
environment:
2117
JEST_JUNIT_OUTPUT: "./reports/junit/js-common-test-results.xml"
18+
19+
- run: npm run check-typescript
20+
2221
- run:
23-
command: cd ~/project/packages/launchdarkly-js-client-sdk && npm run test:junit
24-
environment:
25-
JEST_JUNIT_OUTPUT: "./reports/junit/js-test-results.xml"
22+
name: dependency audit
23+
command: ./scripts/better-audit.sh
2624

27-
- run: cd ~/project && npm run check-typescript
2825
- store_test_results:
2926
path: reports/junit/
3027
- store_artifacts:

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules/
22
coverage/
33
dist/
44
eventsource.js
5+
example/example.js

.releaser/config.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
repo:
2+
public: js-client-sdk
3+
private: js-client-sdk-private
4+
5+
publications:
6+
- url: https://www.npmjs.com/package/launchdarkly-js-client-sdk
7+
description: npm
8+
9+
template:
10+
name: npm
11+
12+
documentation:
13+
githubPages: true
14+
title: LaunchDarkly JavaScript SDK

CONTRIBUTING.md

+12-19
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,34 @@ LaunchDarkly has published an [SDK contributor's guide](https://docs.launchdarkl
66

77
The LaunchDarkly SDK team monitors the [issue tracker](https://github.com/launchdarkly/js-client-sdk/issues) in the SDK repository. Bug reports and feature requests specific to this SDK should be filed in this issue tracker. The SDK team will respond to all newly filed issues within two business days.
88

9-
Submitting pull requests
10-
------------------
9+
## Submitting pull requests
1110

1211
We encourage pull requests and other contributions from the community. Before submitting pull requests, ensure that all temporary or unintended code is removed. Don't worry about adding reviewers to the pull request; the LaunchDarkly SDK team will add themselves. The SDK team will acknowledge all pull requests within two business days.
1312

14-
Build instructions
15-
------------------
13+
## Build instructions
1614

17-
Before building the code, it would be helpful to know a bit about the structure of the code in this repository. This repository is a monorepo containing two projects, each of which is published to npm as a package with the same name:
18-
19-
- `launchdarkly-js-client-sdk`: This is the main SDK package that applications will import. Any logic that specifically relies on being in a browser environment should go here (see `browserPlatform.js`). This automatically imports `launchdarkly-js-sdk-common`.
20-
- `launchdarkly-js-sdk-common`: Internal implementation code that is not browser-specific.
15+
### Prerequisites
2116

22-
The reason `launchdarkly-js-sdk-common` exists is that the [Electron SDK](https://github.com/launchdarkly/electron-client) has very similar functionality to the browser SDK. Therefore, all of the code that is used by both has been factored out into the common package.
17+
Note that much of the basic SDK logic, which is common to all of the LaunchDarkly client-side JavaScript-based SDKs, is in the `launchdarkly-js-sdk-common` package in the [js-sdk-common](https://github.com/launchdarkly/js-sdk-common) repository. This is pulled in automatically by `npm` when you build the SDK, but if you are planning to make changes that affect the common code, you will need to check out that repository as well.
2318

24-
### Prerequisites
19+
### Setup
2520

26-
Before building the SDK, you need to install [Lerna](https://www.npmjs.com/package/lerna).
21+
To install project dependencies, from the project root directory:
2722

2823
```
29-
npm install lerna
24+
npm install
3025
```
3126

32-
### Building
27+
### Testing
3328

34-
You can build all three packages by running the following command from the root directory:
29+
To run all unit tests:
3530

3631
```
37-
npm run build
32+
npm test
3833
```
3934

40-
### Testing
41-
42-
You can run all tests by running the following command from the root directory:
35+
To verify that the TypeScript declarations compile correctly (this involves compiling the file `test-types.ts`, so if you have changed any types or interfaces, you will want to update that code):
4336

4437
```
45-
npm test
38+
npm run check-typescript
4639
```

example/README.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# SDK Browser Demo Page
2+
3+
This is a simple front-end-only JavaScript application that exercises much of the functionality of the LaunchDarkly SDK for browser JavaScript. It is not meant to be an example of how to write a LaunchDarkly application, since most of its logic is devoted to implementing a testing UI that a real application would not have. Instead, it is meant to show the SDK in action and to verify that feature flags work as expected in a given environment.
4+
5+
For a more realistic example of a LaunchDarkly-enabled application with both a front end and a back end, see [`hello-bootstrap`](https://github.com/launchdarkly/hello-bootstrap).
6+
7+
## Running the demo
8+
9+
Most of the demo can be used without a real HTTP server; just start your browser and tell it to open the `index.html` file in this directory. The only thing that will not work in that mode is the "Set URL" feature under Navigation/Events.
10+
11+
To access the demo via a basic HTTP server, there are several ways but the simplest-- if you have Python-- is to run `python -m SimpleHTTPServer 8000` from a command line at the SDK root directory, and then browse to this location.
12+
13+
Note that by default, the demo uses the latest release of the JS SDK script that is hosted on `app.launchdarkly.com`. However, if it detects that you have built the SDK locally, it will use the local SDK code instead. Therefore, it can be used for testing changes to the SDK. To build from the SDK root directory, run `npm run build`.
14+
15+
## Selecting an environment
16+
17+
By default, the demo uses a simple environment that LaunchDarkly has created for this purpose, containing a few feature flags as follows-- two that do not change, and two that change in response to a user property:
18+
19+
* `client-side-flag-1-always-true`: Always returns the boolean value `true`.
20+
* `client-side-flag-2-always-green`: Always returns the string value `"green"`.
21+
* `client-side-flag-3-does-name-start-with-b`: Returns `true` if the user's `name` property starts with the letter B, otherwise `false`.
22+
* `client-side-flag-4-has-valid-email`: Returns `true` if the user's `email` property matches a simple regex for validating emails, otherwise `false`.
23+
24+
You can instead use your own environment, by copying the environment ID from [your dashboard](https://app.launchdarkly.com/settings/projects) into the Environment ID field and clicking "Update Configuration, Reconnect". You should now see all feature flags from your environment that have the "Make this flag available to client-side SDKs" option checked. If you also clicked the "Live updates (streaming)" box, you should also see any changes you make to your flags reflected on the page in real time.

example/example.css

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
#logPanel {
3+
border: 1px solid #888;
4+
font-family: monospace;
5+
font-size: 9pt;
6+
height: 140px;
7+
overflow: scroll;
8+
white-space: pre;
9+
}
10+
11+
code {
12+
font-size: 9pt;
13+
}
14+
15+
.error {
16+
color: red;
17+
}
18+
19+
#usingWhichScript, #usingWhichScript .local, #usingWhichScript .hosted {
20+
display: none;
21+
}
22+
23+
#usingWhichScript.local, #usingWhichScript.hosted, #usingWhichScript.local .local, #usingWhichScript.hosted .hosted {
24+
display: inline;
25+
}

0 commit comments

Comments
 (0)