Skip to content

Commit

Permalink
Merge branch 'master' into get_status
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilianoSanchez committed May 23, 2024
2 parents 80a0e32 + 5189e9e commit a985fab
Show file tree
Hide file tree
Showing 48 changed files with 17,064 additions and 5,236 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
70 changes: 70 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: ci
on:
pull_request:
branches:
- master
pull_request_target:
branches:
- development
push:
branches:
- '*'

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up nodejs
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: 'npm'

- name: npm CI
run: npm ci

- name: npm Check
run: npm run check

- name: npm 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 }}
45 changes: 45 additions & 0 deletions .github/workflows/update-license-year.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Update License Year

on:
schedule:
- cron: "0 3 1 1 *" # 03:00 AM on January 1

permissions:
contents: write
pull-requests: write

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set Current year
run: "echo CURRENT=$(date +%Y) >> $GITHUB_ENV"

- name: Set Previous Year
run: "echo PREVIOUS=$(($CURRENT-1)) >> $GITHUB_ENV"

- name: Update LICENSE
uses: jacobtomlinson/gha-find-replace@v3
with:
find: ${{ env.PREVIOUS }}
replace: ${{ env.CURRENT }}
include: "LICENSE"
regex: false

- name: Commit files
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git commit -m "Updated License Year" -a
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: Update License Year
branch: update-license
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
node_modules
lib
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 @@
v10.16
lts/*
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

101 changes: 100 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,110 @@
1.12.0 (May 10, 2024)
- Updated @splitsoftware/splitio package to version 10.26.0 that includes minor updates:
- Added support for targeting rules based on semantic versions (https://semver.org/).
- Added special impression label "targeting rule type unsupported by sdk" when the matcher type is not supported by the SDK, which returns 'control' treatment.
- Updated Split API client to include the flags spec version query parameter for the `splitChanges` and `auth` endpoints.
- Bugfixing - Fixed error when calling `selectTreatmentValue` and `selectTreatmentWithConfig` selectors with an object as a key, caused by the key being stringified rather than using the `matchingKey` property of the object.

1.11.0 (April 3, 2024)
- 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.
- Added `scheduler.impressionsQueueSize` property to SDK configuration to limit the amount of impressions tracked in memory. Read more in our docs.
- Added support to SDK clients on browser to optionally bind attributes to the client, keeping these loaded within the SDK along with the user ID, for easier usage when requesting flag.
- Updated format for MySegments keys in LocalStorage, keeping backwards compatibility (issue https://github.com/splitio/javascript-client/issues/638).
- Updated dependencies for vulnerability fixes, general polishing, and bug fixes.

1.4.0 (September 29, 2021)
- Updated @splitsoftware/splitio dependency to version 10.16.0, which includes:
- Updated localhost mode to emit SDK_READY_FROM_CACHE event in Browser when using localStorage (issue https://github.com/splitio/react-client/issues/34).
- Updated streaming logic to use the newest version of our streaming service, including:
- Integration with Auth service V2, connecting to the new channels and applying the received connection delay.
- Implemented handling of the new MySegmentsV2 notification types (SegmentRemoval, KeyList, Bounded and Unbounded)
- New control notification for environment scoped streaming reset.
- Updated Enzyme and Jest development dependencies to fix vulnerabilities.

1.3.2 (June 25, 2021)
- Updated @splitsoftware/splitio dependency to version 10.15.8, which fixes some issues with localhost mode and includes other improvements.
- Updated other NPM dependencies to fix vulnerabilities.
- Updated ES modules build to target ES5.

1.3.1 (April 29, 2021)
- Updated dependencies to fix vulnerabilities.
- Updated Split's SDK dependency to fix vulnerabilities.

1.3.0 (December 9, 2020)
- 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 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.
- Added a new status property to split's piece of state: `isReadyFromCache`, to indicate that the SDK is ready to evaluate when using LocalStorage cached data in browser.
- Added an optional callback parameter to `initSplitSdk` action creator: `onReadyFromCache`, to listen when the SDK is ready to evaluate using LocalStorage cached data.
- 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
12 changes: 6 additions & 6 deletions CONTRIBUTORS-GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
Split Redux SDK is an open source project and we welcome feedback and contribution. The information below describes how to build the project with your changes, run the tests, and send the Pull Request(PR).

## Development

### Development process

1. Fork the repository and create a topic branch from `development` branch. Please use a descriptive name for your branch.
2. While developing, use descriptive messages in your commits. Avoid short or meaningless sentences like: "fix bug".
3. Make sure to add tests for both positive and negative cases.
Expand All @@ -20,7 +20,7 @@ Split Redux SDK is an open source project and we welcome feedback and contributi

### Building the SDK

For the moment, we provide two different builds of the library:
At the moment, we provide two different builds of the library:
* A **ES2015** modules compatible build.
* A **CommonJS** modules compatible build.

Expand All @@ -34,10 +34,10 @@ For additional testing scripts, refer to our [package.json](package.json) file.

### Linting and other useful checks

Consider running the linter script (`npm run lint`) and fixing any issues before pushing your changes.
Consider running the linter script (`npm run check`) and fixing any issues before pushing your changes.

If you want to debug your changes consuming it from a test application, you can use our examples: a [Single-Page App](./examples/react-redux-spa/README.md) and a [Server-Side Rendering App](./examples/react-redux-ssr/README.md). You could use symlinks via [npm link command](https://docs.npmjs.com/cli/link.html) and then import the package.

# 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.txt → LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright © 2020 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
Loading

0 comments on commit a985fab

Please sign in to comment.