Skip to content

Commit e060eb0

Browse files
committed
fix: Update sdk-client rollup configuration to match common
1 parent 70cf3c3 commit e060eb0

File tree

6 files changed

+33
-15
lines changed

6 files changed

+33
-15
lines changed

packages/sdk/react-native/example/App.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,20 @@ import {
44
AutoEnvAttributes,
55
LDProvider,
66
ReactNativeLDClient,
7+
LDOptions,
78
} from '@launchdarkly/react-native-client-sdk';
89

910
import Welcome from './src/welcome';
1011

11-
const featureClient = new ReactNativeLDClient(MOBILE_KEY, AutoEnvAttributes.Enabled, {
12+
const options: LDOptions = {
1213
debug: true,
1314
applicationInfo: {
1415
id: 'ld-rn-test-app',
1516
version: '0.0.1',
1617
},
17-
});
18+
};
19+
20+
const featureClient = new ReactNativeLDClient(MOBILE_KEY, AutoEnvAttributes.Enabled, options);
1821

1922
const App = () => {
2023
return (

packages/sdk/react-native/example/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"devDependencies": {
3333
"@babel/core": "^7.20.0",
3434
"@config-plugins/detox": "^8.0.0",
35+
"@tsconfig/react-native": "^3.0.5",
3536
"@types/detox": "^18.1.0",
3637
"@types/jest": "^29.5.11",
3738
"@types/node": "^20.10.5",

packages/sdk/react-native/example/src/welcome.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useState } from 'react';
22
import { ScrollView, StyleSheet, Text, TextInput, TouchableOpacity, View } from 'react-native';
33

44
import { ConnectionMode } from '@launchdarkly/js-client-sdk-common';
5-
import { useBoolVariation, useLDClient } from '@launchdarkly/react-native-client-sdk';
5+
import { useBoolVariation, useLDClient, LDContext, LDClientImpl } from '@launchdarkly/react-native-client-sdk';
66

77
export default function Welcome() {
88
const [flagKey, setFlagKey] = useState('sample-feature');
@@ -12,7 +12,7 @@ export default function Welcome() {
1212

1313
const onIdentify = () => {
1414
ldc
15-
.identify({ kind: 'user', key: userKey }, { timeout: 5 })
15+
.identify({ kind: 'user', key: userKey } as LDContext, { timeout: 5 })
1616
.catch((e: any) => console.error(`error identifying ${userKey}: ${e}`));
1717
};
1818

packages/shared/common/package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,14 @@
1919
"client"
2020
],
2121
"exports": {
22-
"require": { "types": "./dist/cjs/index.d.ts", "default": "./dist/cjs/index.cjs"},
23-
"import": { "types": "./dist/esm/index.d.ts", "default": "./dist/esm/index.mjs"}
22+
"require": {
23+
"types": "./dist/cjs/index.d.ts",
24+
"default": "./dist/cjs/index.cjs"
25+
},
26+
"import": {
27+
"types": "./dist/esm/index.d.ts",
28+
"default": "./dist/esm/index.mjs"
29+
}
2430
},
2531
"scripts": {
2632
"test": "npx jest --ci",

packages/shared/sdk-client/package.json

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"name": "@launchdarkly/js-client-sdk-common",
33
"version": "1.9.0",
44
"type": "module",
5-
"main": "./dist/index.mjs",
6-
"types": "./dist/index.d.ts",
5+
"main": "./dist/esm/index.mjs",
6+
"types": "./dist/esm/index.d.ts",
77
"homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/shared/sdk-client",
88
"repository": {
99
"type": "git",
@@ -19,14 +19,22 @@
1919
"client"
2020
],
2121
"exports": {
22-
"types": "./dist/index.d.ts",
23-
"require": "./dist/index.cjs",
24-
"import": "./dist/index.mjs"
22+
"require": {
23+
"types": "./dist/cjs/index.d.ts",
24+
"default": "./dist/cjs/index.cjs"
25+
},
26+
"import": {
27+
"types": "./dist/esm/index.d.ts",
28+
"default": "./dist/esm/index.mjs"
29+
}
2530
},
2631
"scripts": {
2732
"doc": "../../../scripts/build-doc.sh .",
2833
"test": "npx jest --ci",
29-
"build": "tsc --noEmit && rollup -c rollup.config.js",
34+
"make-cjs-package-json": "echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
35+
"make-esm-package-json": "echo '{\"type\":\"module\"}' > dist/esm/package.json",
36+
"make-package-jsons": "npm run make-cjs-package-json && npm run make-esm-package-json",
37+
"build": "npx tsc --noEmit && rollup -c rollup.config.js && npm run make-package-jsons",
3038
"clean": "rimraf dist",
3139
"lint": "npx eslint . --ext .ts",
3240
"lint:fix": "yarn run lint -- --fix",

packages/shared/sdk-client/rollup.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const getSharedConfig = (format, file) => ({
2121

2222
export default [
2323
{
24-
...getSharedConfig('es', 'dist/index.mjs'),
24+
...getSharedConfig('es', 'dist/esm/index.mjs'),
2525
plugins: [
2626
typescript({
2727
module: 'esnext',
@@ -37,7 +37,7 @@ export default [
3737
],
3838
},
3939
{
40-
...getSharedConfig('cjs', 'dist/index.cjs'),
41-
plugins: [typescript({ tsconfig: './tsconfig.json' }), common(), resolve(), json()],
40+
...getSharedConfig('cjs', 'dist/cjs/index.cjs'),
41+
plugins: [typescript({ tsconfig: './tsconfig.json', outputToFilesystem: true, }), common(), resolve(), json()],
4242
},
4343
];

0 commit comments

Comments
 (0)