Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion packages/sdk/server-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@
"type": "commonjs",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"exports": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to make everything happy. I tried require and import in JS with node, and I tried import in TS with node. Everything worked and showed types. I needed the "typesVersions" before vscode intellisense worked correctly for integrations.

I have not done this much, so I am not a domain expert here.

import { TestData } from '@launchdarkly/node-server-sdk/integrations';

I am still exporting integrations from the main package. Probably safe for now.

".": {
"default": "./dist/src/index.js",
"types": "./dist/src/index.d.ts"
},
"./integrations": {
"default": "./dist/src/integrations.js",
"types": "./dist/src/integrations.d.ts"
}
},
"typesVersions": {
"*": {
"integrations": ["./dist/src/integrations.d.ts"]
}
},
"files": [
"dist"
],
Expand All @@ -25,7 +40,7 @@
"test": "npx jest --ci --runInBand",
"build": "npx tsc",
"lint": "npx eslint . --ext .ts",
"lint:fix": "yarn run lint -- --fix"
"lint:fix": "yarn run lint --fix"
},
"license": "Apache-2.0",
"dependencies": {
Expand Down
5 changes: 5 additions & 0 deletions packages/sdk/server-node/src/integrations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { integrations } from '@launchdarkly/js-server-sdk-common';

const { FileDataSourceFactory, TestData, TestDataFlagBuilder, TestDataRuleBuilder } = integrations;

export { FileDataSourceFactory, TestData, TestDataFlagBuilder, TestDataRuleBuilder };