Skip to content

Commit

Permalink
remove version constant which can't be exported from js-sdk-common (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
eli-darkly authored Jan 26, 2022
1 parent 4e499a3 commit 02895b1
Show file tree
Hide file tree
Showing 10 changed files with 3 additions and 29 deletions.
1 change: 0 additions & 1 deletion .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ plugins:
- babel
- prettier
globals:
VERSION: true
describe: true
it: true
expect: true
Expand Down
3 changes: 0 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,4 @@ module.exports = {
transform: {
'^.+\\.js$': 'babel-jest',
},
globals: {
VERSION: version,
},
};
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
"launchdarkly-js-test-helpers": "1.1.0",
"prettier": "1.11.1",
"readline-sync": "^1.4.9",
"semver": "^5.5.0",
"semver-compare": "^1.0.0",
"typescript": "~4.4.4"
},
"dependencies": {
Expand Down
1 change: 0 additions & 1 deletion src/__tests__/.eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
globals:
VERSION: true
sinon: true
expect: true
requestor: true
Expand Down
8 changes: 0 additions & 8 deletions src/__tests__/LDClient-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as LDClient from '../index';
import * as messages from '../messages';
import * as utils from '../utils';

import semverCompare from 'semver-compare';
import { eventSink, promisifySingle, sleepAsync, withCloseable, AsyncQueue } from 'launchdarkly-js-test-helpers';

import { respond, respondJson } from './mockHttp';
Expand Down Expand Up @@ -106,13 +105,6 @@ describe('LDClient', () => {
});
});

it('should contain package version', () => {
const version = LDClient.version;
// All client bundles above 1.0.7 should contain package version
const result = semverCompare(version, '1.0.6');
expect(result).toEqual(1);
});

async function verifyCustomHeader(sendLDHeaders, shouldGetHeaders) {
await withServers(async (baseConfig, pollServer) => {
await withClient(user, { ...baseConfig, sendLDHeaders }, async client => {
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/utils-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ describe('utils', () => {
});

describe('getLDUserAgentString', () => {
it('uses platform user-agent and package version by default', () => {
it('uses platform user-agent and unknown version by default', () => {
const platform = stubPlatform.defaults();
platform.version = undefined;
const ua = getLDUserAgentString(platform);
expect(ua).toEqual('stubClient/' + VERSION);
expect(ua).toEqual('stubClient/?');
});

it('uses platform user-agent and platform version if provided', () => {
Expand Down
3 changes: 0 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -760,13 +760,10 @@ function initialize(env, user, specifiedOptions, platform, extraOptionDefs) {
};
}

const version = VERSION;

module.exports = {
initialize,
commonBasicLogger,
errors,
messages,
utils,
version,
};
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function chunkUserEventsForUrl(maxLength, events) {
}

function getLDUserAgentString(platform) {
const version = platform.version || VERSION;
const version = platform.version || '?';
return platform.userAgent + '/' + version;
}

Expand Down
2 changes: 0 additions & 2 deletions test-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import * as ld from 'launchdarkly-js-sdk-common';

var ver: string = ld.version;

var userWithKeyOnly: ld.LDUser = { key: 'user' };
var anonUserWithNoKey: ld.LDUser = { anonymous: true };
var anonUserWithKey: ld.LDUser = { key: 'anon-user', anonymous: true };
Expand Down
6 changes: 0 additions & 6 deletions typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
* Basic LaunchDarkly JavaScript client interfaces, shared between the browser SDK and the Electron SDK.
*/
declare module 'launchdarkly-js-sdk-common' {

/**
* The current version string of the SDK.
*/
export const version: string;

/**
* The types of values a feature flag can have.
*
Expand Down

0 comments on commit 02895b1

Please sign in to comment.