Skip to content

Commit 7cc1e09

Browse files
authored
fix: removed duped core types (#800)
A while back I added: ```json "paths": { "@openfeature/core": [ "./packages/shared/src" ] }, ``` To the tsconfigs, which helped with local dev by always resolving `src/*` files from sibling packages instead of anything in their `dist/`. It also had the nasty side-effect of causing our type bundling to include types from this package in it's output, causing duplicated artifacts and possible compiler issues. I've overridden this with a custom `tsconfig.rollup.json`. Before this fix, the web/server SDK dists contained dupes of the stuff in shared: ```ts import EventEmitter from 'events'; type FlagValueType = 'boolean' | 'string' | 'number' | 'object'; type PrimitiveValue = null | boolean | string | number; type JsonObject = { [key: string]: JsonValue; }; type JsonArray = JsonValue[]; /** * Represents a JSON node value. */ ``` After this fix, they import them: ```ts import { BaseHook, HookHints, EvaluationDetails, JsonValue, EvaluationLifeCycle, ManageLogger, Eventing, ClientMetadata, ProviderStatus, ClientProviderEvents, GenericEventEmitter, CommonEventDetails, FlagValue, CommonProvider, EvaluationContext, Logger, ResolutionDetails, EventHandler, OpenFeatureCommonAPI, ManageContext } from '@openfeature/core'; export * from '@openfeature/core'; ``` --------- Signed-off-by: Todd Baert <[email protected]>
1 parent 4114e63 commit 7cc1e09

10 files changed

+41
-39
lines changed

Diff for: package-lock.json

+2-35
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
"devDependencies": {
3939
"@openfeature/flagd-provider": "^0.10.2",
4040
"@openfeature/flagd-web-provider": "^0.4.0",
41-
"@rollup/plugin-alias": "^5.0.0",
4241
"@rollup/plugin-typescript": "^11.0.0",
4342
"@types/events": "^3.0.0",
4443
"@types/jest": "^29.0.0",

Diff for: packages/client/tsconfig.rollup.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"paths": {}
5+
}
6+
}

Diff for: packages/nest/tsconfig.rollup.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"paths": {}
5+
}
6+
}

Diff for: packages/react/tsconfig.rollup.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"paths": {}
5+
}
6+
}

Diff for: packages/server/tsconfig.rollup.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"paths": {}
5+
}
6+
}

Diff for: packages/shared/tsconfig.rollup.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"paths": {}
5+
}
6+
}

Diff for: rollup.config.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// this config rolls up all the types in the project to a single declaration (d.ts) file.
22
// we do NOT use rollup to build (we use esbuild for that)
33

4-
import alias from '@rollup/plugin-alias';
54
import dts from 'rollup-plugin-dts';
65

76
export default {
@@ -18,6 +17,7 @@ export default {
1817
}
1918
],
2019
plugins: [
21-
dts({tsconfig: './tsconfig.json'}),
20+
// use the rollup override tsconfig (applies equivalent in each sub-packages as well)
21+
dts({tsconfig: './tsconfig.rollup.json'}),
2222
],
2323
};

Diff for: tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
3131
"paths": {
3232
"@openfeature/core": [ "./packages/shared/src" ]
33-
}, /* Specify a set of entries that re-map imports to additional lookup locations. */
33+
}, /* Specify a set of entries that re-map imports to additional lookup locations. */
3434
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
3535
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
3636
// "types": [], /* Specify type package names to be included without being referenced in a source file. */

Diff for: tsconfig.rollup.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"paths": {}
5+
}
6+
}

0 commit comments

Comments
 (0)