Skip to content

Commit

Permalink
Merge branch 'update_dependencies' into update_typescript_config
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilianoSanchez committed Mar 27, 2024
2 parents 60e0839 + ae51bd0 commit b057204
Show file tree
Hide file tree
Showing 56 changed files with 13,542 additions and 1,868 deletions.
60 changes: 60 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
module.exports = {
'env': {
'browser': true,
'es6': true,
'node': true
},
'extends': [
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended'
],
'parser': '@typescript-eslint/parser',
'parserOptions': {
'ecmaVersion': 2015,
'sourceType': 'module'
},
'plugins': [
'react',
'@typescript-eslint',
'import'
],
'rules': {
'indent': ['error', 2, { 'SwitchCase': 1 }],
'quotes': ['warn', 'single', 'avoid-escape'],
'linebreak-style': ['error', 'unix'],
'camelcase': ['error', { 'properties': 'never' }],
'eol-last': ['error', 'always'],
'keyword-spacing': 'error',
'no-trailing-spaces': 'error',
'space-before-function-paren': ['error', {'named': 'never'}],
'react/display-name': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-inferrable-types': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unused-vars': ['warn', { 'argsIgnorePattern': '^_' }],
'prefer-const': ['error', {
'destructuring': 'all'
}]
},
'overrides': [{
'files': ['src/**/*.ts'],
'excludedFiles': ['src/**/__tests__/**'],
'extends': [
'plugin:compat/recommended'
],
'settings': {
'polyfills': [
'Promise' // required as a polyfill by the user
]
},
'rules': {
'no-restricted-syntax': ['error', 'ForOfStatement', 'ForInStatement'],
'compat/compat': ['error', 'defaults, not ie < 11'],
'no-throw-literal': 'error',
'import/no-self-import': 'error',
'import/no-default-export': 'error',
}
}],
};
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @splitio/sdk
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

## How do we test the changes introduced in this PR?

## Extra Notes
## Extra Notes
48 changes: 42 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: ci
on:
push:
branches:
- '*'
pull_request:
branches:
- master
pull_request_target:
branches:
- development
push:
branches:
- '*'

Expand All @@ -13,10 +16,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up nodejs
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: 'npm'
Expand All @@ -28,7 +33,38 @@ jobs:
run: npm run check

- name: npm Test
run: npm run test
run: npm run test -- --coverage

- name: npm Build
run: npm run build

- name: Set VERSION env
run: echo "VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV

- name: SonarQube Scan (Push)
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/development')
uses: SonarSource/sonarcloud-github-action@v1.9
env:
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
projectBaseDir: .
args: >
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
-Dsonar.projectVersion=${{ env.VERSION }}
-Dsonar.branch.name=${{ github.ref_name }}
- name: SonarQube Scan (Pull Request)
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
uses: SonarSource/sonarcloud-github-action@v1.9
env:
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
projectBaseDir: .
args: >
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
-Dsonar.projectVersion=${{ env.VERSION }}
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}
6 changes: 3 additions & 3 deletions .github/workflows/update-license-year.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -24,7 +24,7 @@ jobs:
run: "echo PREVIOUS=$(($CURRENT-1)) >> $GITHUB_ENV"

- name: Update LICENSE
uses: jacobtomlinson/gha-find-replace@v2
uses: jacobtomlinson/gha-find-replace@v3
with:
find: ${{ env.PREVIOUS }}
replace: ${{ env.CURRENT }}
Expand All @@ -38,7 +38,7 @@ jobs:
git commit -m "Updated License Year" -a
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: Update License Year
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ es
types
coverage
examples
.vscode
.vscode
.scannerwork
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v14
lts/*
66 changes: 62 additions & 4 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,61 @@
1.11.0 (March 27, 2023)
- Added `sideEffects: false` property in the package.json file to allow tree shaking.
- Updated Redux-Thunk peer dependency range to include redux-thunk@3.x.x.
- Updated the build process and added the `tslib` package as an explicit dependency to import TypeScript helpers, thereby avoiding duplicated helper code in the output files.
- Updated @splitsoftware/splitio package to version 10.25.2, which includes vulnerability fixes and other improvements.

1.10.0 (December 18, 2023)
- Added support for Flag Sets on the SDK, which enables grouping feature flags and interacting with the group rather than individually (more details in our documentation):
- Added a new optional `flagSets` property to the param object of the `getTreatments` action creator, to support evaluating flags in given flag set/s. Either `splitNames` or `flagSets` must be provided to the function. If both are provided, `splitNames` will be used.
- Added a new optional Split Filter configuration option. This allows the SDK and Split services to only synchronize the flags in the specified flag sets, avoiding unused or unwanted flags from being synced on the SDK instance, bringing all the benefits from a reduced payload.
- Added `sets` property to the `SplitView` object returned by the `getSplit` and `getSplits` helper functions to expose flag sets on flag views.
- Added `defaultTreatment` property to the `SplitView` object returned by the `getSplit` and `getSplits` helper functions (Related to issue https://github.com/splitio/javascript-commons/issues/225).
- Updated `getTreatments` action creator to validate the provided params object, in order to log a descriptive error when an invalid object is provided rather than throwing a cryptic error.
- Updated @splitsoftware/splitio package to version 10.24.1 that includes flag sets support, vulnerability fixes and other improvements.

1.9.0 (July 18, 2023)
- Updated some transitive dependencies for vulnerability fixes.
- Updated @splitsoftware/splitio package to version 10.23.0 that includes:
- Updated streaming architecture implementation to apply feature flag updates from the notification received which is now enhanced, improving efficiency and reliability of the whole update system.

1.8.0 (June 27, 2023)
- Added `ISplitState` TypeScript interface to the library exports, which is the type for the Split reducer's slice of state.

1.7.3 (May 16, 2023)
- Updated @splitsoftware/splitio package to version 10.22.5 that includes:
- Updated terminology on the SDKs codebase to be more aligned with current standard without causing a breaking change. The core change is the term split for feature flag on things like logs and IntelliSense comments.
- Updated some transitive dependencies for vulnerability fixes.

1.7.2 (April 3, 2023)
- Updated linter dependencies and rules. The deprecated TSLint package was replaced by ESLint.
- Updated some transitive dependencies for vulnerability fixes.
- Updated @splitsoftware/splitio package to version 10.22.4 that includes minor improvements.
- Bugfixing - Fixed error when using the SDK in localhost mode for testing with NodeJS test runners such as Jest (See https://help.split.io/hc/en-us/articles/360038851551-Redux-SDK#localhost-mode).

1.7.1 (November 15, 2022)
- Updated React Redux peer dependency range to include React-redux@8.x.x and React@18.x.x.
- Updated @splitsoftware/splitio dependency to version 10.22.2, which includes vulnerability and bug fixes.

1.7.0 (October 5, 2022)
- Updated @splitsoftware/splitio dependency to version 10.22.0, which includes:
- Added a new impressions mode for the SDK called NONE, to be used in factory when there is no desire to capture impressions on an SDK factory to feed Split's analytics engine. Running NONE mode, the SDK will only capture unique keys evaluated for a particular feature flag instead of full blown impressions.
- Added `autoRequire` configuration option to the Google Analytics to Split integration, which takes care of requiring the splitTracker plugin on trackers dynamically created by Google tag managers (See https://help.split.io/hc/en-us/articles/360040838752#set-up-with-gtm-and-gtag.js).
- Updated default value of `scheduler.featuresRefreshRate` config parameter from 30 seconds to 60 seconds.
- Updated storage implementations to improve the performance of split evaluations (i.e., `getTreatment(s)` method calls) when using the default storage in memory.
- Updated browser listener to push remaining impressions and events on 'visibilitychange' and 'pagehide' DOM events, instead of 'unload', which is not reliable in modern mobile and desktop Web browsers.
- Updated the synchronization flow to be more reliable in the event of an edge case generating delay in cache purge propagation, keeping the SDK cache properly synced.
- Updated some dependencies for vulnerability fixes.

1.6.0 (Jul 7, 2022)
- Updated @splitsoftware/splitio dependency to version 10.20.0, which includes:
- Added a new config option to control the tasks that listen or poll for updates on feature flags and segments, via the new config sync.enabled . Running online Split will always pull the most recent updates upon initialization, this only affects updates fetching on a running instance. Useful when a consistent session experience is a must or to save resources when updates are not being used.
- Updated telemetry logic to track the anonymous config for user consent flag set to declined or unknown.
- Updated submitters logic, to avoid duplicating the post of impressions to Split cloud when the SDK is destroyed while its periodic post of impressions is running.
- Added `scheduler.telemetryRefreshRate` property to SDK configuration, and deprecated `scheduler.metricsRefreshRate` property.
- Updated SDK telemetry storage, metrics and updater to be more effective and send less often.
- Updated eventsource dependency range to ^1.1.2 to avoid a vulnerability and dependency resolution to a vulnerable version of url-parse transitive dependency.
- Bugfixing - Updated submitters logic, to avoid dropping impressions and events that are being tracked while POST request is pending.

1.5.0 (April 20, 2022)
- Updated @splitsoftware/splitio dependency to version 10.18.1, which includes:
- Added user consent feature to allow delaying or disabling the data tracking from SDK until user consent is explicitly granted or declined. Read more in our docs.
Expand Down Expand Up @@ -25,12 +83,12 @@
- Updated Split's SDK dependency to fix vulnerabilities.

1.3.0 (December 9, 2020)
- Added a new parameter to `getTreatments` actions creator: `evalOnReadyFromCache` to evaluate splits when the SDK_READY_FROM_CACHE event is emitted. Learn more in our Redux SDK documentation.
- Updated how splits evaluations are handled on SDK_READY, SDK_READY_FROM_CACHE and SDK_UPDATE events, to dispatch a single action with evaluations that results in all treatments updates in the state at once, instead of having multiple actions that might lead to multiple store notifications.
- Added a new parameter to `getTreatments` action creator: `evalOnReadyFromCache` to evaluate feature flags when the SDK_READY_FROM_CACHE event is emitted. Learn more in our Redux SDK documentation.
- Updated how feature flag evaluations are handled on SDK_READY, SDK_READY_FROM_CACHE and SDK_UPDATE events, to dispatch a single action with evaluations that results in all treatments updates in the state at once, instead of having multiple actions that might lead to multiple store notifications.
- Updated some NPM dependencies for vulnerability fixes.

1.2.1 (Oct 7, 2020)
- Updated @splitsoftware/splitio dependency to version 10.15.0, which uses the optimized impressions sending and supports filtering the splits to be synced. Learn more in our javascript-client changelog or documentation.
- Updated @splitsoftware/splitio dependency to version 10.15.0, which uses the optimized impressions sending and supports filtering the feature flags to be synced. Learn more in our javascript-client changelog or documentation.

1.2.0 (Jul 7, 2020)
- Updated @splitsoftware/splitio dependency to version 10.13.0, which uses streaming synchronization by default, amongst other updates. Learn more in our javascript-client changelog or documentation.
Expand All @@ -39,7 +97,7 @@
- Added an optional callback parameter to `destroySplitSdk` action creator: `onDestroy`, to listen when the SDK has gracefully shut down.

1.1.0 (May 11, 2020)
- Bugfixing - incorrect evaluation of splits on browser when using `getTreatments` with a different user key than the default, caused by not waiting the fetch of segments.
- Bugfixing - incorrect evaluation of feature flags on browser when using `getTreatments` with a different user key than the default, caused by not waiting the fetch of segments.
- Added `destroySplitSdk` action creator to gracefully shutdown the SDK.
- Added two new status properties to split's piece of state: `hasTimedout` and `isDestroyed` to better reflect the current state of the associated factory.

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTORS-GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ If you want to debug your changes consuming it from a test application, you can

# Contact

If you have any other questions or need to contact us directly in a private manner send us a note at sdks@split.io
If you have any other questions or need to contact us directly in a private manner send us a note at sdks@split.io
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright © 2022 Split Software, Inc.
Copyright © 2024 Split Software, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![npm version](https://badge.fury.io/js/%40splitsoftware%2Fsplitio-redux.svg)](https://badge.fury.io/js/%40splitsoftware%2Fsplitio-redux) [![Build Status](https://github.com/splitio/redux-client/actions/workflows/ci.yml/badge.svg)](https://github.com/splitio/redux-client/actions/workflows/ci.yml)

## Overview
This SDK is designed to work with Split, the platform for controlled rollouts, which serves features to your users via a Split feature flag to manage your complete customer experience.
This SDK is designed to work with Split, the platform for controlled rollouts, which serves features to your users via feature flags to manage your complete customer experience.

[![Twitter Follow](https://img.shields.io/twitter/follow/splitsoftware.svg?style=social&label=Follow&maxAge=1529000)](https://twitter.com/intent/follow?screen_name=splitsoftware)

Expand Down Expand Up @@ -35,15 +35,15 @@ const store = createStore(
// Define your config object and dispatch `initSplitSdk` action to init the SDK
const CONFIG = {
core: {
authorizationKey: 'YOUR_BROWSER_API_KEY',
authorizationKey: 'YOUR_SDK_KEY',
key: 'CUSTOMER_ID'
}
};
store.dispatch(initSplitSdk({ config: CONFIG }))

// Dispach a `getTreatments` action to evaluate one or more splits.
// Dispach a `getTreatments` action to evaluate one or more feature flags.
// The evaluation is done asynchronously when the SDK is ready.
store.dispatch(getTreatments({ splitNames: 'SPLIT_NAME' }))
store.dispatch(getTreatments({ splitNames: 'FEATURE_FLAG_NAME' }))

// Connect your component to splitio's piece of state
const MyComponent = connectSplit()(({ splitio }) => {
Expand All @@ -52,7 +52,7 @@ const MyComponent = connectSplit()(({ splitio }) => {
return <div>Loading SDK ...</div>;

// Select a treatment value
const treatment = selectTreatmentValue(splitio, 'SPLIT_NAME')
const treatment = selectTreatmentValue(splitio, 'FEATURE_FLAG_NAME')
if (treatment === 'on') {
// return JSX for 'on' treatment
} else if (treatment === 'off') {
Expand Down Expand Up @@ -92,13 +92,16 @@ Split has built and maintains SDKs for:

* .NET [Github](https://github.com/splitio/dotnet-client) [Docs](https://help.split.io/hc/en-us/articles/360020240172--NET-SDK)
* Android [Github](https://github.com/splitio/android-client) [Docs](https://help.split.io/hc/en-us/articles/360020343291-Android-SDK)
* Angular [Github](https://github.com/splitio/angular-sdk-plugin) [Docs](https://help.split.io/hc/en-us/articles/6495326064397-Angular-utilities)
* Flutter [Github](https://github.com/splitio/flutter-sdk-plugin) [Docs](https://help.split.io/hc/en-us/articles/8096158017165-Flutter-plugin)
* GO [Github](https://github.com/splitio/go-client) [Docs](https://help.split.io/hc/en-us/articles/360020093652-Go-SDK)
* iOS [Github](https://github.com/splitio/ios-client) [Docs](https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK)
* Java [Github](https://github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK)
* Javascript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK)
* Javascript for Browser [Github](https://github.com/splitio/javascript-browser-client) [Docs](https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK)
* JavaScript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK)
* JavaScript for Browser [Github](https://github.com/splitio/javascript-browser-client) [Docs](https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK)
* Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
* PHP [Github](https://github.com/splitio/php-client) [Docs](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK)
* PHP thin-client [Github](https://github.com/splitio/php-thin-client) [Docs](https://help.split.io/hc/en-us/articles/18305128673933-PHP-Thin-Client-SDK)
* Python [Github](https://github.com/splitio/python-client) [Docs](https://help.split.io/hc/en-us/articles/360020359652-Python-SDK)
* React [Github](https://github.com/splitio/react-client) [Docs](https://help.split.io/hc/en-us/articles/360038825091-React-SDK)
* React Native [Github](https://github.com/splitio/react-native-client) [Docs](https://help.split.io/hc/en-us/articles/4406066357901-React-Native-SDK)
Expand Down
10 changes: 4 additions & 6 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ module.exports = {
}
},

setupFilesAfterEnv: ['./setupTests.js'],

// Test files are .js, .jsx, .ts and .tsx files inside of __tests__ folders and with a suffix of .test or .spec
testMatch: [ "**/__tests__/**/?(*.)+(spec|test).[jt]s?(x)" ],
testMatch: [ '**/__tests__/**/?(*.)+(spec|test).[jt]s?(x)' ],

// Included files for test coverage (npm run test:coverage)
collectCoverageFrom: [
"src/**/*.{js,jsx,ts,tsx}",
"!src/__tests__/**",
'src/**/*.{js,jsx,ts,tsx}',
'!src/__tests__/**',
]
};
};
Loading

0 comments on commit b057204

Please sign in to comment.