Skip to content

Commit 699fe35

Browse files
committed
WIP
1 parent 9736e18 commit 699fe35

File tree

6 files changed

+43
-16
lines changed

6 files changed

+43
-16
lines changed

packages/sdk/browser/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
"allowSyntheticDefaultImports": true,
44
"declaration": true,
55
"declarationMap": true,
6-
"jsx": "react-jsx",
76
"lib": ["ES2017", "dom"],
8-
"module": "ES6",
7+
"module": "ESNext",
98
"moduleResolution": "node",
109
"noImplicitOverride": true,
1110
"resolveJsonModule": true,

packages/shared/common/package.json

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "@launchdarkly/js-sdk-common",
33
"version": "2.9.0",
4-
"type": "commonjs",
5-
"main": "./dist/index.js",
6-
"types": "./dist/index.d.ts",
4+
"type": "module",
5+
"main": "./dist/index.es.js",
6+
"types": "./dist/src/index.d.ts",
77
"homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/shared/common",
88
"repository": {
99
"type": "git",
@@ -18,18 +18,27 @@
1818
"analytics",
1919
"client"
2020
],
21+
"exports": {
22+
"types": "./dist/index.d.ts",
23+
"require": "./dist/index.cjs.js",
24+
"import": "./dist/index.es.js"
25+
},
2126
"scripts": {
2227
"test": "npx jest --ci",
23-
"build-types": "npx tsc --declaration true --emitDeclarationOnly true --declarationDir dist",
24-
"build": "npx tsc",
25-
"clean": "npx tsc --build --clean",
28+
"build": "npx tsc && rollup -c rollup.config.js",
29+
"clean": "rimraf dist",
2630
"lint": "npx eslint . --ext .ts",
2731
"lint:fix": "yarn run lint --fix",
2832
"prettier": "prettier --write 'src/*.@(js|ts|tsx|json)'",
2933
"check": "yarn && yarn prettier && yarn lint && tsc && yarn test"
3034
},
3135
"license": "Apache-2.0",
3236
"devDependencies": {
37+
"@rollup/plugin-commonjs": "^25.0.0",
38+
"@rollup/plugin-json": "^6.1.0",
39+
"@rollup/plugin-node-resolve": "^15.0.2",
40+
"@rollup/plugin-terser": "^0.4.3",
41+
"@rollup/plugin-typescript": "^11.1.1",
3342
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
3443
"@types/jest": "^29.4.0",
3544
"@typescript-eslint/eslint-plugin": "^6.20.0",
@@ -44,8 +53,13 @@
4453
"jest": "^29.5.0",
4554
"launchdarkly-js-test-helpers": "^2.2.0",
4655
"prettier": "^3.0.0",
56+
"rimraf": "6.0.1",
57+
"rollup": "^3.23.0",
4758
"ts-jest": "^29.0.5",
4859
"typedoc": "0.25.0",
4960
"typescript": "5.1.6"
61+
},
62+
"dependencies": {
63+
"tslib": "^2.7.0"
5064
}
5165
}

packages/shared/common/rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ export default [
3838
},
3939
{
4040
...getSharedConfig('cjs', 'dist/index.cjs.js'),
41-
plugins: [typescript(), common(), resolve(), terser(), json()],
41+
plugins: [typescript({tsconfig: './tsconfig.json'}), common(), resolve(), terser(), json()],
4242
},
4343
];

packages/shared/common/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"declaration": true,
1414
"declarationMap": true, // enables importers to jump to source
1515
"stripInternal": true,
16-
"composite": true
16+
"composite": true,
17+
"emitDeclarationOnly": true
1718
},
1819
"exclude": ["**/*.test.ts", "dist", "node_modules", "__tests__"]
1920
}

packages/shared/sdk-client/package.json

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "@launchdarkly/js-client-sdk-common",
33
"version": "1.8.0",
4-
"type": "commonjs",
5-
"main": "./dist/index.js",
6-
"types": "./dist/index.d.ts",
4+
"type": "module",
5+
"main": "./dist/index.es.js",
6+
"types": "./dist/src/index.d.ts",
77
"homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/shared/sdk-client",
88
"repository": {
99
"type": "git",
@@ -18,11 +18,16 @@
1818
"analytics",
1919
"client"
2020
],
21+
"exports": {
22+
"types": "./dist/src/index.d.ts",
23+
"require": "./dist/index.cjs.js",
24+
"import": "./dist/index.es.js"
25+
},
2126
"scripts": {
2227
"doc": "../../../scripts/build-doc.sh .",
2328
"test": "npx jest --ci",
24-
"build": "npx tsc",
25-
"clean": "npx tsc --build --clean",
29+
"build": "tsc --noEmit && rollup -c rollup.config.js",
30+
"clean": "rimraf dist",
2631
"lint": "npx eslint . --ext .ts",
2732
"lint:fix": "yarn run lint -- --fix",
2833
"prettier": "prettier --write 'src/*.@(js|ts|tsx|json)'",
@@ -33,6 +38,11 @@
3338
"@launchdarkly/js-sdk-common": "2.9.0"
3439
},
3540
"devDependencies": {
41+
"@rollup/plugin-commonjs": "^25.0.0",
42+
"@rollup/plugin-json": "^6.1.0",
43+
"@rollup/plugin-node-resolve": "^15.0.2",
44+
"@rollup/plugin-terser": "^0.4.3",
45+
"@rollup/plugin-typescript": "^11.1.1",
3646
"@testing-library/dom": "^9.3.1",
3747
"@testing-library/jest-dom": "^5.16.5",
3848
"@types/jest": "^29.5.3",
@@ -51,6 +61,8 @@
5161
"jest-environment-jsdom": "^29.6.1",
5262
"launchdarkly-js-test-helpers": "^2.2.0",
5363
"prettier": "^3.0.0",
64+
"rimraf": "6.0.1",
65+
"rollup": "^3.23.0",
5466
"ts-jest": "^29.1.1",
5567
"typedoc": "0.25.0",
5668
"typescript": "5.1.6"

packages/shared/sdk-client/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"outDir": "dist",
55
"target": "ES2017",
66
"lib": ["es6", "DOM"],
7-
"module": "commonjs",
7+
"module": "ESNext",
8+
"moduleResolution": "node",
89
"strict": true,
910
"noImplicitOverride": true,
1011
// Needed for CommonJS modules: markdown-it, fs-extra

0 commit comments

Comments
 (0)