Skip to content
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

Vulnerability fixes and general polishing #17

Merged
merged 14 commits into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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@v2
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@v2
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@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: Update License Year
branch: update-license
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright © 2021 Split Software, Inc.
Copyright © 2022 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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Split JavaScript SDK for React Native

[![npm version](https://badge.fury.io/js/%40splitsoftware%2Fsplitio-react-native.svg)](https://badge.fury.io/js/%40splitsoftware%2Fsplitio) [![Build Status](https://travis-ci.com/splitio/react-native-client.svg?branch=main)](https://travis-ci.com/splitio/react-native-client)
[![npm version](https://badge.fury.io/js/%40splitsoftware%2Fsplitio-react-native.svg)](https://badge.fury.io/js/%40splitsoftware%2Fsplitio) [![Build Status](https://github.com/splitio/react-native-client/actions/workflows/ci.yml/badge.svg)](https://github.com/splitio/react-native-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.
Expand Down Expand Up @@ -62,8 +62,8 @@ Split has built and maintains SDKs for:
* 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)
* Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-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)
* 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)
Expand Down
130 changes: 95 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@splitsoftware/splitio-react-native",
"version": "0.1.0",
"version": "0.1.1-rc.0",
"description": "Split SDK for React Native",
"main": "lib/commonjs/index.js",
"module": "lib/module/index.js",
Expand Down Expand Up @@ -54,14 +54,13 @@
},
"homepage": "https://github.com/splitio/react-native-client#readme",
"dependencies": {
"@splitsoftware/splitio-commons": "1.0.0"
"@splitsoftware/splitio-commons": "1.2.1-rc.10"
},
"devDependencies": {
"@react-native-community/eslint-config": "^2.0.0",
"@types/jest": "^27.0.2",
"@types/object-assign": "^4.0.30",
"@types/react": "^16.9.19",
"@types/react-native": "0.62.13",
"@types/react-native": "0.65.1",
"eslint": "^7.2.0",
"eslint-config-prettier": "^7.0.0",
"eslint-plugin-import": "^2.23.4",
Expand All @@ -73,7 +72,7 @@
"react-native": "^0.65.1",
"react-native-builder-bob": "^0.18.1",
"replace": "^1.2.1",
"typescript": "^4.1.3"
"typescript": "4.4.4"
},
"peerDependencies": {
"react": "*",
Expand Down
11 changes: 6 additions & 5 deletions src/full/splitFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ import { settingsValidator } from '../settings/full';
import { getModules } from '../platform/getModules';
import { sdkFactory } from '@splitsoftware/splitio-commons/src/sdkFactory/index';
import type { ISdkFactoryParams } from '@splitsoftware/splitio-commons/src/sdkFactory/types';
import { merge } from '@splitsoftware/splitio-commons/src/utils/lang';

/**
* SplitFactory for React Native.
* Includes localhost mode.
*
* @param config Configuration object used to instantiates the SDK
* @param customModules Optional object of SDK modules to overwrite default ones. Use with caution since, unlike `config`, this param is not validated.
* @param config Configuration object used to instantiate the SDK
* @param __updateModules Optional function that lets redefine internal SDK modules. Use with
* caution since, unlike `config`, this param is not validated neither considered part of the public API.
* @throws Will throw an error if the provided config is invalid.
*/
export function SplitFactory(config: any, customModules?: Partial<ISdkFactoryParams>) {
export function SplitFactory(config: any, __updateModules: (modules: ISdkFactoryParams) => void) {
const settings = settingsValidator(config);
const modules = getModules(settings);
return sdkFactory(customModules ? (merge(modules, customModules) as ISdkFactoryParams) : modules);
if (__updateModules) __updateModules(modules);
return sdkFactory(modules);
}
16 changes: 16 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
Copyright 2022 Split Software

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
**/

export { SplitFactory } from './splitFactory';
export { ErrorLogger } from '@splitsoftware/splitio-commons/src/logger/browser/ErrorLogger';
export { WarnLogger } from '@splitsoftware/splitio-commons/src/logger/browser/WarnLogger';
Expand Down