Skip to content

Commit cd6b719

Browse files
prepare 4.0.1 release (#58)
1 parent 05a82f9 commit cd6b719

28 files changed

+263
-253
lines changed

.circleci/config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ jobs:
88

99
- run: npm install
1010
- run: npm run lint:all
11-
- run: npm run build:min
1211
- run:
1312
command: npm test
1413
environment:

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,9 @@ To verify that the TypeScript declarations compile correctly (this involves comp
3737
```
3838
npm run check-typescript
3939
```
40+
41+
### Coding guidelines
42+
43+
This code is shared between several SDK projects: `js-client-sdk` which runs in browsers, `node-client-sdk` which runs in Node.js, and `electron-client-sdk` which uses it both in a Node environment and in a browser environment.
44+
45+
Therefore, it should not have any JavaScript usages that work _only_ in a browser or _only_ in Node.js. All such things, if they depend on the runtime environment, must be accessed indirectly via the "platform" abstraction, where each SDK provides its own platform-specific callbacks for the `js-sdk-common` code to use. Or, if it's just a question of JavaScript syntax usages, use whatever will work in both browsers and Node (for instance, use only `require` and `module.exports`, not ES6 imports).

docs/typedoc.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,8 @@
44
"description": "LaunchDarkly SDK for JavaScript - common code",
55
"author": "LaunchDarkly <team@launchdarkly.com>",
66
"license": "Apache-2.0",
7-
"files": [
8-
"ldclient-common.cjs.js",
9-
"ldclient-common.cjs.js.map",
10-
"ldclient-common.es.js",
11-
"ldclient-common.es.js.map",
12-
"ldclient-common.min.js",
13-
"ldclient-common.min.js.map",
14-
"typings.d.ts"
15-
],
167
"types": "./typings.d.ts",
17-
"main": "dist/ldclient-common.cjs.js",
18-
"module": "dist/ldclient-common.es.js",
19-
"unpkg": "dist/ldclient-common.min.js",
20-
"jsdelivr": "dist/ldclient-common.min.js",
8+
"main": "src/index.js",
219
"scripts": {
2210
"lint": "eslint --format 'node_modules/eslint-formatter-pretty' --ignore-path .eslintignore",
2311
"lint:all": "eslint --format 'node_modules/eslint-formatter-pretty' --ignore-path .eslintignore src",
@@ -27,14 +15,8 @@
2715
"format:test": "npm run format:test:md && npm run format:test:js",
2816
"format:test:md": "prettier --parser markdown --ignore-path .prettierignore --list-different '*.md'",
2917
"format:test:js": "prettier --ignore-path .prettierignore --list-different 'src/**/*.js'",
30-
"build": "cross-env NODE_ENV=development rollup -c rollup.config.js",
31-
"build:min": "cross-env NODE_ENV=production rollup -c rollup.config.js",
3218
"test": "cross-env NODE_ENV=test jest",
33-
"test:junit": "cross-env NODE_ENV=test jest --testResultsProcessor jest-junit",
34-
"check-typescript": "node_modules/typescript/bin/tsc",
35-
"clean": "rimraf dist/**",
36-
"prepublishOnly": "npm run build:min",
37-
"prepare": "npm run build"
19+
"check-typescript": "node_modules/typescript/bin/tsc"
3820
},
3921
"devDependencies": {
4022
"@babel/cli": "^7.8.4",
@@ -43,7 +25,6 @@
4325
"@babel/plugin-transform-runtime": "^7.6.2",
4426
"@babel/preset-env": "^7.6.3",
4527
"@babel/runtime": "7.6.3",
46-
"@rollup/plugin-node-resolve": "^6.0.0",
4728
"@rollup/plugin-replace": "^2.2.0",
4829
"babel-eslint": "^10.1.0",
4930
"babel-jest": "^25.1.0",
@@ -59,13 +40,6 @@
5940
"launchdarkly-js-test-helpers": "1.1.0",
6041
"prettier": "1.11.1",
6142
"readline-sync": "^1.4.9",
62-
"rimraf": "^2.6.2",
63-
"rollup": "^1.26.0",
64-
"rollup-plugin-babel": "^4.3.3",
65-
"rollup-plugin-commonjs": "^10.1.0",
66-
"rollup-plugin-filesize": "^6.2.1",
67-
"rollup-plugin-terser": "5.2.0",
68-
"rollup-plugin-uglify": "6.0.4",
6943
"semver": "^5.5.0",
7044
"semver-compare": "^1.0.0",
7145
"typescript": "~4.4.4"

rollup.config.js

Lines changed: 0 additions & 73 deletions
This file was deleted.

src/EventEmitter.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default function EventEmitter(logger) {
1+
function EventEmitter(logger) {
22
const emitter = {};
33
const events = {};
44

@@ -56,3 +56,5 @@ export default function EventEmitter(logger) {
5656
};
5757
return emitter;
5858
}
59+
60+
module.exports = EventEmitter;

src/EventProcessor.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import EventSender from './EventSender';
2-
import EventSummarizer from './EventSummarizer';
3-
import UserFilter from './UserFilter';
4-
import * as errors from './errors';
5-
import * as messages from './messages';
6-
import * as utils from './utils';
1+
const EventSender = require('./EventSender');
2+
const EventSummarizer = require('./EventSummarizer');
3+
const UserFilter = require('./UserFilter');
4+
const errors = require('./errors');
5+
const messages = require('./messages');
6+
const utils = require('./utils');
77

8-
export default function EventProcessor(
8+
function EventProcessor(
99
platform,
1010
options,
1111
environmentId,
@@ -171,3 +171,5 @@ export default function EventProcessor(
171171

172172
return processor;
173173
}
174+
175+
module.exports = EventProcessor;

src/EventSender.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import * as errors from './errors';
2-
import * as utils from './utils';
1+
const errors = require('./errors');
2+
const utils = require('./utils');
33
const { v1: uuidv1 } = require('uuid');
44

55
const MAX_URL_LENGTH = 2000;
66

7-
export default function EventSender(platform, environmentId, options) {
7+
function EventSender(platform, environmentId, options) {
88
const imageUrlPath = '/a/' + environmentId + '.gif';
99
const baseHeaders = utils.extend({ 'Content-Type': 'application/json' }, utils.getLDHeaders(platform, options));
1010
const httpFallbackPing = platform.httpFallbackPing; // this will be set for us if we're in the browser SDK
@@ -83,3 +83,5 @@ export default function EventSender(platform, environmentId, options) {
8383

8484
return sender;
8585
}
86+
87+
module.exports = EventSender;

src/EventSummarizer.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default function EventSummarizer() {
1+
function EventSummarizer() {
22
const es = {};
33

44
let startDate = 0,
@@ -80,3 +80,5 @@ export default function EventSummarizer() {
8080

8181
return es;
8282
}
83+
84+
module.exports = EventSummarizer;

src/Identity.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import * as utils from './utils';
1+
const utils = require('./utils');
22

3-
export default function Identity(initialUser, onChange) {
3+
function Identity(initialUser, onChange) {
44
const ident = {};
55
let user;
66

@@ -22,3 +22,5 @@ export default function Identity(initialUser, onChange) {
2222

2323
return ident;
2424
}
25+
26+
module.exports = Identity;

0 commit comments

Comments
 (0)