Skip to content

Commit

Permalink
prepare 2.23.0 release (#257)
Browse files Browse the repository at this point in the history
* add new JS SDK test/demo page

* misc doc edits

* fixing merge error

* fixing merge error

* fix broken links on npmjs.com (#193)

* update lockfiles for new packages

* fix changelog formatting error that messes up the release script

* Specify unpkg default target file in package.json for
launchdarkly-js-client-sdk and launchdarkly-js-sdk-common.

* Correct requestor call to fetch flags on a received ping event.

* Implement Hooks API (#196)

* Initial commit reusing withLDProvider

* Added sitenav. Cleaned up filenames.

* Updated readme with hooks api docs. Fixed linting errors.

* Fixed linting errors.

* Update README.md

* bumping our lerna version to resolve transitive dependency vulnerabilities with fstream and tar (#198)

* fix goals query logic for Electron, also fix handling of invalid content type

* add ability to alter URL in events

* Update browserPlatform definition to detect when an EventSource
polyfill is available and has published that it supports setting the
method used for the stream. When this is the case, the platform
publishes that it supports using REPORT with EventSource and will
provide the polyfill implementation if the SDK attempts a EventSource
connection with the method set to REPORT.

* Fix initial linter warnings.

* Fix another linter warning.

* fix a broken readme link (#202)

* removing a stray character in the readme

* fix stream reconnect logic and add stream connection logging

* linter

* assume logger always exists, as we do in other components

* fix and simplify how the logger object is passed around

* make it so eventUrlTransformer actually does something

* linter

* copy flags object to prevent subtle update problem in Electron

* additional fix + test

* make bootstrapped flags available immediately

* Refactor some of the EventSource constructor selection logic.

* Change browserPlatform.js to check config options when determining
EventSource implementation to use. Added tests for EventSource factory
in browserPlatform.js

* Deal with linter.

* change how supported options are detected in EventSource polyfill

* fix broken homepage attributes (#209)

* improve bad initialization messages (#210)

* improve bad initialization messages

* remove the spaces

* fixing a broken link in a logged message (#212)

* add jsdelivr attribute to js packages (#213)

* adding an option to disable the camel-casing of flag keys (#214)

* adding an option disabling the camel-casing of flag keys

* update comment

* update comment

* fix linter errors

* address pr feedback

* updated readme

* [ch45487] useCamelCaseFlagKeys option (#215)

* Initial commit

* Update initLDClient.ts

* PR fixes. Added prettier.

* Update withLDProvider.test.tsx

* Fixed lint errors. Added test for useCamelCase false on server changes.

* Removed prettier.

* Re-added prettier

* Update yarn.lock

* Update prettier and lock files.

* Fixed more linting issues.

* fix a typo

* use persistent anonymous user logic by default in react sdk (#216)

* use persistent anonymous user logic by default in react sdk

* added a comment

* minor test change

* missed a line

* remove React package from monorepo

* make link text match link

* improve log format and add configurable prefix

* fix test

* linter

* deprecate samplingInterval

* linter

* improve log message for stream connection failures (#221)

* improve log message for stream connection failures

* update the reconnection warning so that it only displays for the first set of each reconnection attempts

* also test that the original put is getting called

* updating tests

* updating tests

* Revert "updating tests"

This reverts commit 84163cdf8b5af6a6e969d777b946a8a2973919ed.

* better abstraction

* minor change

* updating the js-common readme to mention client-side node (#222)

* remove common package, no more monorepo

* add Releaser metadata

* npm audit fix

* unify Rollup config

* migrate new demo code to new package structure

* moved example folder

* syntax fix in demo

* fix directory name

* fix linting

* use spread operator instead of Object.assign

* don't close client on beforeunload, but do flush events

* typo

* clarify test postconditions

* misc test app improvements for testing beforeunload handler

* rm unused yarn.lock

* rm typedoc dependency, don't commit installation of it during release

* fix paths

* fix file copying logic

* pr template

* revert

* fix programmatically reported version string

* upgrade Typescript to avoid Typedoc incompatibility

* Revert "upgrade Typescript to avoid Typedoc incompatibility"

This reverts commit 34d9a0f.

* update Babel, Jest, Rollup

* remove old releaser (#229)

* remove unused Rollup plugins, update dependencies

* use new config validation mechanism in js-sdk-common 3.x

* add image-loading event delivery logic factored out of js-sdk-common

* enable diagnostic events in JS SDK

* lint

* fix tests

* use common 3.0.0-beta2

* use 3.1.0-beta3, fix property name

* lint

* use js-sdk-common 3.1.0

* use js-sdk-common 3.1.1 for event payload ID fix

* use js-sdk-common 3.1.2 and loosen our other dependency

* fix license

* use js-sdk-common 3.2.0-beta1

* SDK name should be js-client-sdk

* misc fixes

* use js-sdk-common 3.2.0

* use js-sdk-common 3.2.0

* standardize linting

* use js-sdk-common 3.2.1

* use js-sdk-common 3.2.2

* update package-lock

* update js-sdk-common dependency for initialization error bugfix

* update js-sdk-common for content type bugfix; update some dev dependencies

* remove unsafe usage of hasOwnProperty

* use js-sdk-common 3.2.5

* resolve security vulnerability in acorn dependency (#240)

* update js-sdk-common to get console logging IE bugfix

* update js-sdk-common for duplicate diagnostic event fix

* update js-sdk-common for TS decl fix, improve TS compilation test (#243)

* bump to 3.2.9 to get startsWith fix (#244)

* add option to disable sync event flush (#245)

* update js-sdk-common + some dev dependencies

* No longer remove non-section hash in substring and regex matching

* linting

* the linting target to run in CI is "lint:all", not "lint"

* new js-common-sdk version (#249)

* resolve node-notifier vulnerability by updating jest dep (#250)

* adding contextKind to goal events, bumping js-common to get alias function (#251)

* pin typedoc to unblock our releases (#252)

* Removed the guides link

* add inlineUsersToEvents to TypeScript defs by updating js-sdk-common

* Update common JS SDK library to use fixes for debug event generation issues.

* Update package lock.

* use Releaser v2 config + newer CI image (#256)

* Updated readme headers (#258)

* don't log a warning about custom goal being unknown

* lint + comment

* Release js-client-sdk with the header transformation change

* Updates docs link

* bump js-sdk-common version for better localstorage error handling

* Update launchdarkly-js-sdk-common for JSON error handling fix (sc-142333)

* update lockfile

* add basicLogger export

* Update common for application tags support. (#265)

* Re-remove package-lock.json and add it to the .gitignore. (#266)

* Use a combination of dependencies that is compatible. (#269) (#270)

* Update js-sdk-common to 3.7.0 (#271)

Co-authored-by: Eli Bishop <eli@launchdarkly.com>
Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com>
Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com>
Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com>
Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com>
Co-authored-by: Yusinto Ngadiman <yusinto@gmail.com>
Co-authored-by: Zach Davis <zach@launchdarkly.com>
Co-authored-by: Elliot <35050275+Apache-HB@users.noreply.github.com>
Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com>
Co-authored-by: Louis Chan <lchan@launchdarkly.com>
Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com>
Co-authored-by: Ember Stevens <ember.stevens@launchdarkly.com>
Co-authored-by: ember-stevens <79482775+ember-stevens@users.noreply.github.com>
Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
  • Loading branch information
15 people authored Oct 5, 2022
1 parent 8fc0e31 commit d558052
Show file tree
Hide file tree
Showing 14 changed files with 65 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
build:
docker:
- image: cimg/node:12.22
- image: cimg/node:14.20
steps:
- checkout

Expand Down
2 changes: 1 addition & 1 deletion .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
parser: babel-eslint
parser: "@babel/eslint-parser"
root: true
extends:
- prettier
Expand Down
7 changes: 5 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ module.exports = {
setupFiles: ['jest-localstorage-mock', './jest.setup.js'],
testMatch: ['**/__tests__/**/*-test.js'],
transform: {
'^.+\\.js$': 'babel-jest',
'^.+\\.js$': ['babel-jest', { rootMode: 'upward' }],
},
globals: {
window: true,
VERSION: version,
},
testURL: 'https://mydomain.com/some/path',
testEnvironmentOptions: {
url: 'https://mydomain.com/some/path',
},
testEnvironment: 'jsdom',
};
65 changes: 31 additions & 34 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,46 +41,43 @@
"prepublishOnly": "npm run build:min"
},
"devDependencies": {
"@babel/cli": "^7.11.6",
"@babel/core": "^7.11.6",
"@babel/plugin-transform-regenerator": "7.10.4",
"@babel/plugin-transform-runtime": "7.11.5",
"@babel/preset-env": "^7.11.5",
"@babel/runtime": "^7.11.2",
"@rollup/plugin-node-resolve": "^6.0.0",
"@rollup/plugin-replace": "^2.2.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^26.3.0",
"chai": "^4.1.2",
"cross-env": "^5.1.4",
"eslint": "^6.8.0",
"eslint-config-prettier": "^2.9.0",
"eslint-config-xo": "^0.20.1",
"eslint-formatter-pretty": "^1.3.0",
"eslint-plugin-babel": "^5.0.0",
"eslint-plugin-prettier": "^2.6.0",
"jest": "^26.6.3",
"jest-junit": "^11.1.0",
"jest-localstorage-mock": "^2.4.3",
"jsdom": "^11.12.0",
"prettier": "1.11.1",
"readline-sync": "1.4.9",
"@babel/cli": "^7.19.3",
"@babel/core": "^7.19.3",
"@babel/eslint-parser": "7.19.1",
"@babel/plugin-transform-regenerator": "7.18.6",
"@babel/plugin-transform-runtime": "7.19.1",
"@babel/preset-env": "^7.19.3",
"@babel/runtime": "^7.19.0",
"@rollup/plugin-node-resolve": "^14.1.0",
"@rollup/plugin-replace": "^4.0.0",
"babel-jest": "^29.1.0",
"cross-env": "^7.0.3",
"eslint": "^8.24.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-xo": "^0.42.0",
"eslint-formatter-pretty": "^4.1.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^29.1.1",
"jest-environment-jsdom": "^29.1.1",
"jest-junit": "^14.0.1",
"jest-localstorage-mock": "^2.4.22",
"jsdom": "^20.0.0",
"prettier": "2.7.1",
"rimraf": "^3.0.2",
"rollup": "^1.26.0",
"rollup-plugin-babel": "^4.3.3",
"rollup": "^2.79.1",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-filesize": "^6.2.1",
"rollup-plugin-filesize": "^9.1.2",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-uglify": "^6.0.4",
"semver": "^7.1.3",
"semver-compare": "^1.0.0",
"sinon": "7.2.7",
"typescript": "^3.7.5"
"sinon": "^14.0.0",
"typescript": "^4.8.4",
"@types/estree": "^1.0.0"
},
"dependencies": {
"escape-string-regexp": "^1.0.5",
"launchdarkly-js-sdk-common": "3.6.0"
"escape-string-regexp": "^4.0.0",
"launchdarkly-js-sdk-common": "3.7.0"
},
"repository": {
"type": "git",
Expand Down
13 changes: 3 additions & 10 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
const pkg = require('./package.json');
const resolve = require('@rollup/plugin-node-resolve');
const { nodeResolve } = require('@rollup/plugin-node-resolve');
const commonjs = require('rollup-plugin-commonjs');
const babel = require('rollup-plugin-babel');
const replace = require('@rollup/plugin-replace');
const { terser } = require('rollup-plugin-terser');
const { uglify } = require('rollup-plugin-uglify');
const filesize = require('rollup-plugin-filesize');

const env = process.env.NODE_ENV || 'development';
Expand All @@ -17,7 +16,7 @@ const basePlugins = [
'process.env.NODE_ENV': JSON.stringify(env),
VERSION: JSON.stringify(version),
}),
resolve({
nodeResolve({
mainFields: ['browser', 'module', 'main'],
preferBuiltins: true,
}),
Expand All @@ -29,12 +28,6 @@ const basePlugins = [
];

const plugins = env === 'production' ?
basePlugins.concat(
uglify()
) :
basePlugins;

const esPlugins = env === 'production' ?
basePlugins.concat(
terser()
) : basePlugins;
Expand Down Expand Up @@ -66,7 +59,7 @@ const configs = [
format: 'es',
sourcemap: true,
},
plugins: esPlugins,
plugins: plugins,
},
];

Expand Down
4 changes: 2 additions & 2 deletions src/GoalManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ export default function GoalManager(clientVars, readyCallback) {

clientVars.requestor
.fetchJSON(getGoalsPath())
.then(g => {
.then((g) => {
if (g && g.length > 0) {
goals = g;
goalTracker = GoalTracker(goals, sendGoalEvent);
watchLocation(locationWatcherInterval, refreshGoalTracker);
}
readyCallback();
})
.catch(err => {
.catch((err) => {
clientVars.emitter.maybeReportError(
new common.errors.LDUnexpectedResponseError('Error fetching goals: ' + (err && err.message) ? err.message : err)
);
Expand Down
4 changes: 2 additions & 2 deletions src/GoalTracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default function GoalTracker(goals, onEvent) {
}

if (clickGoals.length > 0) {
listenerFn = function(event) {
listenerFn = function (event) {
const goals = findGoalsForClick(event, clickGoals);
for (let i = 0; i < goals.length; i++) {
onEvent('click', goals[i]);
Expand All @@ -85,7 +85,7 @@ export default function GoalTracker(goals, onEvent) {
document.addEventListener('click', listenerFn);
}

tracker.dispose = function() {
tracker.dispose = function () {
document.removeEventListener('click', listenerFn);
};

Expand Down
10 changes: 5 additions & 5 deletions src/__tests__/LDClient-events-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ describe('LDClient', () => {
describe('event generation', () => {
function stubEventProcessor() {
const ep = { events: [] };
ep.start = function() {};
ep.flush = function() {};
ep.stop = function() {};
ep.enqueue = function(e) {
ep.start = function () {};
ep.flush = function () {};
ep.stop = function () {};
ep.enqueue = function (e) {
ep.events.push(e);
};
return ep;
Expand Down Expand Up @@ -65,7 +65,7 @@ describe('LDClient', () => {
const client = LDClient.initialize(envName, user, {
eventProcessor: ep,
bootstrap: {},
eventUrlTransformer: url => url + suffix,
eventUrlTransformer: (url) => url + suffix,
});
await client.waitForInitialization();
client.track('eventkey');
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/LDClient-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('LDClient', () => {
expect(server.requests[0].url).toMatch(/sdk\/eval/);
});

it('should resolve waitUntilGoalsReady when goals are loaded', done => {
it('should resolve waitUntilGoalsReady when goals are loaded', (done) => {
const handleGoalsReady = jest.fn();
const client = LDClient.initialize(envName, user, { bootstrap: {}, sendEvents: false });

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/browserPlatform-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe('browserPlatform', () => {
});

it('calls URL transformer if specified', () => {
const p = browserPlatform({ eventUrlTransformer: url => url + '/x' });
const p = browserPlatform({ eventUrlTransformer: (url) => url + '/x' });
expect(p.getCurrentUrl()).toEqual(expectedUrl + '/x');
});
});
Expand Down
8 changes: 4 additions & 4 deletions src/__tests__/internal-test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { doesUrlMatch } from '../GoalTracker';

describe('url matching', () => {
const getHash = url => {
const getHash = (url) => {
const idx = url.indexOf('#');
return idx === -1 ? '' : url.substring(idx, url.length);
};

const getSearch = url => {
const getSearch = (url) => {
const idx = url.indexOf('?');
return idx === -1 ? '' : url.substring(idx, url.length);
};
Expand Down Expand Up @@ -208,9 +208,9 @@ describe('url matching', () => {
},
];

tests.forEach(method => {
tests.forEach((method) => {
describe(method.type + ' matching', () => {
method.tests.forEach(each => {
method.tests.forEach((each) => {
it(`expects \`${each.goal}\` to ${each.match ? 'match' : 'not match'} \`${each.path}\``, async () => {
method.matcher(each.path, each.goal).toEqual(each.match);
});
Expand Down
14 changes: 7 additions & 7 deletions src/browserPlatform.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function makeBrowserPlatform(options) {
};

// Image-based mechanism for sending events if POST isn't available
ret.httpFallbackPing = url => {
ret.httpFallbackPing = (url) => {
const img = new window.Image();
img.src = url;
};
Expand All @@ -48,17 +48,17 @@ export default function makeBrowserPlatform(options) {
try {
if (window.localStorage) {
ret.localStorage = {
get: key =>
new Promise(resolve => {
get: (key) =>
new Promise((resolve) => {
resolve(window.localStorage.getItem(key));
}),
set: (key, value) =>
new Promise(resolve => {
new Promise((resolve) => {
window.localStorage.setItem(key, value);
resolve();
}),
clear: key =>
new Promise(resolve => {
clear: (key) =>
new Promise((resolve) => {
window.localStorage.removeItem(key);
resolve();
}),
Expand Down Expand Up @@ -116,7 +116,7 @@ export default function makeBrowserPlatform(options) {
return new eventSourceConstructor(url, esOptions);
};

ret.eventSourceIsActive = es =>
ret.eventSourceIsActive = (es) =>
es.readyState === window.EventSource.OPEN || es.readyState === window.EventSource.CONNECTING;
}

Expand Down
2 changes: 1 addition & 1 deletion src/httpRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function newHttpRequest(method, url, headers, body, pageIsClosing
}
resolve({
status: xhr.status,
header: key => xhr.getResponseHeader(key),
header: (key) => xhr.getResponseHeader(key),
body: xhr.responseText,
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function initialize(env, user, options = {}) {
const validatedOptions = clientVars.options;
const emitter = clientVars.emitter;

const goalsPromise = new Promise(resolve => {
const goalsPromise = new Promise((resolve) => {
const onGoals = emitter.on(goalsEvent, () => {
emitter.off(goalsEvent, onGoals);
resolve();
Expand Down

0 comments on commit d558052

Please sign in to comment.