Skip to content

fix: evalation-context import, remove deprecation, add types import to… #286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 22, 2025
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
7 changes: 6 additions & 1 deletion lib/flagsmith/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
{
"name": "flagsmith",
"version": "9.0.1",
"version": "9.0.2",
"description": "Feature flagging to support continuous development",
"main": "./index.js",
"module": "./index.mjs",
"browser": "./index.js",
"types": "./index.d.ts",
"exports": {
"./types": {
"import": "./types.d.ts",
"require": "./types.d.ts",
"browser": "./types.d.ts"
},
Comment on lines +10 to +14
Copy link
Contributor

Choose a reason for hiding this comment

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

by using this we can remove the types export from these files:

Copy link
Member Author

@kyle-ssg kyle-ssg Jan 22, 2025

Choose a reason for hiding this comment

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

I believe they'd serve different purposes to be honest.

The code I added preserves the ability to import from flagsmith/types, without this it was a breaking change.

The code you added (which is preferred but new) allows us to import types directly from flagsmith.

".": {
"import": "./index.mjs",
"require": "./index.js",
Expand Down
2 changes: 1 addition & 1 deletion lib/react-native-flagsmith/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-flagsmith",
"version": "9.0.1",
"version": "9.0.2",
"description": "Feature flagging to support continuous development",
"main": "./index.js",
"repository": {
Expand Down
6 changes: 4 additions & 2 deletions move-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ files.forEach((fileName)=>{
}
})

// copy types.d
// copy types and evaluation-context
fs.copyFileSync(path.join(__dirname,"types.d.ts"),path.join(__dirname,"lib/flagsmith/src/types.d.ts"))
fs.copyFileSync(path.join(__dirname,"types.d.ts"),path.join(__dirname,"lib/react-native-flagsmith/src/types.d.ts"))

fs.copyFileSync(path.join(__dirname,"types.d.ts"),path.join(__dirname,"lib/flagsmith/types.d.ts"))
fs.copyFileSync(path.join(__dirname,"types.d.ts"),path.join(__dirname,"lib/react-native-flagsmith/types.d.ts"))
fs.copyFileSync(path.join(__dirname,"evaluation-context.ts"),path.join(__dirname,"lib/flagsmith/evaluation-context.ts"))
fs.copyFileSync(path.join(__dirname,"evaluation-context.ts"),path.join(__dirname,"lib/react-native-flagsmith/evaluation-context.ts"))


try {
fs.rmdirSync(path.join(__dirname,"lib/flagsmith/lib"), {recursive:true})
Expand Down
13 changes: 2 additions & 11 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,9 @@ export interface IInitConfig<F extends string = string, T extends string = strin
enableDynatrace?: boolean;
enableLogs?: boolean;
angularHttpClient?: any;
/**
* * @deprecated Please consider using evaluationContext.identity: {@link IInitConfig.evaluationContext}.
* */
environmentID?: string;
headers?: object;
/**
* * @deprecated Please consider using evaluationContext.identity: {@link IInitConfig.evaluationContext}.
* */
identity?: IIdentity;
/**
* * @deprecated Please consider using evaluationContext.identity: {@link IInitConfig.evaluationContext}.
* */
traits?: ITraits<T>;
onChange?: OnChange<F>;
onError?: (err: Error) => void;
Expand Down Expand Up @@ -240,8 +231,8 @@ export interface IFlagsmith<F extends string = string, T extends string = string
*/
setTraits: (traits: ITraits) => Promise<void>;
/**
* * @deprecated Please consider using evaluationContext.identity: {@link IFlagsmith.getContext}.
* */
* The stored identity of the user
*/
identity?: IIdentity;
/**
* Whether the flagsmith SDK is initialised
Expand Down
Loading