Skip to content

Commit

Permalink
prepare 2.16.1 release (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
LaunchDarklyCI authored Dec 17, 2019
1 parent 9c8d0d9 commit 3f558ba
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 24 deletions.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:
- run:
name: dependency audit
command: ./scripts/better-audit.sh
- run:
name: packaging test
command: ./scripts/packaging-test.sh
- store_test_results:
path: reports/junit/
- store_artifacts:
Expand Down
14 changes: 1 addition & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,7 @@
All notable changes to the LaunchDarkly Client-side SDK for React will be documented in this file. For the source code for versions 2.13.0 and earlier, see the corresponding tags in the [js-client-sdk](https://github.com/launchdarkly/js-client-sdk) repository; this code was previously in a monorepo package there. See also the [JavaScript SDK changelog](https://github.com/launchdarkly/js-client-sdk/blob/master/CHANGELOG.md), since the React SDK inherits all of the underlying functionality of the JavaScript SDK; this file covers only changes that are specific to the React interface. This project adheres to [Semantic Versioning](http://semver.org).

## [2.16.0] - 2019-12-16
### Added:
- Configuration property `eventCapacity`: the maximum number of analytics events (not counting evaluation counters) that can be held at once, to prevent the SDK from consuming unexpected amounts of memory in case an application generates events unusually rapidly. In JavaScript code this would not normally be an issue, since the SDK flushes events every two seconds by default, but you may wish to increase this value if you will intentionally be generating a high volume of custom or identify events. The default value is 100.
- Configuration properties `wrapperName` and `wrapperVersion`: used by the React SDK to identify a JS SDK instance that is being used with a wrapper API.

### Changed:
- The SDK now logs a warning if any configuration property has an inappropriate type, such as `baseUri:3` or `sendEvents:"no"` (normally not possible in TypeScript, but could happen if an arbitrary object is cast to `LDOptions`). For boolean properties, the SDK will still interpret the value in terms of truthiness, which was the previous behavior. For all other types, since there's no such commonly accepted way to coerce the type, it will fall back to the default setting for that property; previously, the behavior was undefined but most such mistakes would have caused the SDK to throw an exception at some later point.

### Fixed:
- When calling `identify`, the current user (as reported by `getUser()`) was being updated before the SDK had received the new flag values for that user, causing the client to be temporarily in an inconsistent state where flag evaluations would be associated with the wrong user in analytics events. Now, the current-user state will stay in sync with the flags and change only when they have finished changing. (Thanks, [edvinerikson](https://github.com/launchdarkly/js-sdk-common/pull/3)!)

### Deprecated:
- The `samplingInterval` configuration property was deprecated in the code in the previous minor version release, and in the changelog, but the deprecation notice was accidentally omitted from the documentation comments. It is hereby deprecated again.

***This release was broken and has been removed.***

## [2.15.1] - 2019-11-14
### Fixed:
Expand Down
12 changes: 12 additions & 0 deletions scripts/packaging-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -e

npm pack
TARBALL=$(ls *.tgz)
trap "rm ${TARBALL}" EXIT

tar tfz ${TARBALL} | grep '^package/lib/.*\.js$' || (echo "tarball contained no .js files"; exit 1)
tar tfz ${TARBALL} | grep '^package/lib/.*\.d\.ts$' || (echo "tarball contained no .d.ts files"; exit 1)

echo "tarball contained .js and .d.ts files in package/lib/ - OK"
9 changes: 2 additions & 7 deletions src/initLDClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ jest.mock('launchdarkly-js-client-sdk', () => {
import { initialize, LDClient, LDOptions, LDUser } from 'launchdarkly-js-client-sdk';
import { defaultReactOptions, LDReactOptions } from './types';
import initLDClient from './initLDClient';
import * as packageJson from '../package.json';

const ldClientInitialize = initialize as jest.Mock;

const clientSideID = 'deadbeef';
const defaultUser: LDUser = { key: 'abcdef' };
const options: LDOptions = { bootstrap: 'localStorage', wrapperName: 'React', wrapperVersion: packageJson.version };
const options: LDOptions = { bootstrap: 'localStorage', wrapperName: 'React' };
const flags = { 'test-flag': false, 'another-test-flag': true };

describe('initLDClient', () => {
Expand All @@ -42,11 +41,7 @@ describe('initLDClient', () => {
const anonUser: LDUser = { anonymous: true };
await initLDClient(clientSideID);

expect(ldClientInitialize.mock.calls[0]).toEqual([
clientSideID,
anonUser,
{ wrapperName: 'React', wrapperVersion: packageJson.version },
]);
expect(ldClientInitialize.mock.calls[0]).toEqual([clientSideID, anonUser, { wrapperName: 'React' }]);
expect(mockLDClient.variation).toHaveBeenCalledTimes(0);
});

Expand Down
3 changes: 1 addition & 2 deletions src/initLDClient.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { initialize as ldClientInitialize, LDClient, LDFlagSet, LDOptions, LDUser } from 'launchdarkly-js-client-sdk';
import { AllFlagsLDClient, defaultReactOptions, LDReactOptions } from './types';
import { camelCaseKeys } from './utils';
import * as packageJson from '../package.json';

/**
* Internal function to initialize the `LDClient`.
Expand All @@ -21,7 +20,7 @@ const initLDClient = async (
options?: LDOptions,
targetFlags?: LDFlagSet,
): Promise<AllFlagsLDClient> => {
const allOptions = { wrapperName: 'React', wrapperVersion: packageJson.version, ...options };
const allOptions = { wrapperName: 'React', ...options };
const ldClient = ldClientInitialize(clientSideID, user, allOptions);

return new Promise<AllFlagsLDClient>(resolve => {
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
"noImplicitAny": true,
"strictNullChecks": true,
"jsx": "react",
"esModuleInterop": true,
"resolveJsonModule": true,
"esModuleInterop": true
},
"files": [
"./node_modules/@testing-library/jest-dom/extend-expect.d.ts"
Expand Down

0 comments on commit 3f558ba

Please sign in to comment.