diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 269b17b..18f4369 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,10 +1,7 @@ -# Javascript Slim Synchronizer +# Javascript Sync Tools ## What did you accomplish? ## How do we test the changes introduced in this PR? -## Related JIRA tickets and PRs -[](url) - ## Extra Notes diff --git a/CONTRIBUTORS-GUIDE.md b/CONTRIBUTORS-GUIDE.md index 029607e..3bebf1c 100644 --- a/CONTRIBUTORS-GUIDE.md +++ b/CONTRIBUTORS-GUIDE.md @@ -1,6 +1,6 @@ -# Contributing to the Split Javascript Synchronizer +# Contributing to the Split Javascript Sync Tools -Split Javascript Synchronizer 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). +Split Javascript Sync Tools 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 @@ -18,9 +18,9 @@ Split Javascript Synchronizer is an open source project and we welcome feedback 10. Check for conflicts once the pull request is created to make sure your PR can be merged cleanly into `development`. 11. Keep an eye out for any feedback or comments from Split's SDK team. -### Building the Synchronizer +### Building the tools -For widespread use of the Synchronizer with different environments and module formats, we have two different builds: +For widespread use of the tools with different environments and module formats, we have two different builds: * A **ES2015** modules compatible build. * A **CommonJS** modules compatible build. @@ -28,15 +28,17 @@ The different builds can be generated all at once with the command `npm run buil _Note:_ In order to run build/tests commands, Node 10 or higher is required. -### Building the Synchronizer's CLI +### Building the tools CLI [TO BE DEFINED] -To create the CLI that will be set as `bin` in the package, run the command `npm run make:cli`. Refer to [package.json](package.json) for more insight on the build scripts. +To create the CLI that will be set as `bin` in the package, run the command `npm run build:cli`. Refer to [package.json](package.json) for more insight on the build scripts. _Note:_ the CLI capabilities rely on [yargs](https://www.npmjs.com/package/yargs), which requires Node 12 or higher. ### Running tests +The project includes unit as well as integration tests for browser environments. + - To execute unit tests, run `npm run test:unit` -- To execute e2e tests, you need a Redis service up and running with the default configurations, and run `npm run test:e2e:ci`. +- To execute e2e tests, you need a Redis service up and running with the default configurations, and run `npm run test:e2e`. All tests can be run at once with the command `npm run test`. diff --git a/README.md b/README.md index f63f525..e45455b 100644 --- a/README.md +++ b/README.md @@ -1,68 +1,64 @@ -# Split Javascript Synchronizer -[![Build Status](https://api.travis-ci.com/splitio/javascript-slim-synchronizer.svg?branch=main)](https://api.travis-ci.com/splitio/javascript-slim-synchronizer) +# Split Javascript Sync Tools +[![Build Status](https://api.travis-ci.com/splitio/javascript-sync-tools.svg?branch=main)](https://api.travis-ci.com/splitio/javascript-sync-tools) ## Overview -Thin version of Split Synchronizer supporting the core of the synchronization mechanisms used by Split SDK producer libraries. +This package includes a Javascript synchronizer tool that can be used to synchronize storages used by SDKs in consumer mode. [![Twitter Follow](https://img.shields.io/twitter/follow/splitsoftware.svg?style=social&label=Follow&maxAge=1529000)](https://twitter.com/intent/follow?screen_name=splitsoftware) ## Compatibility -Split Synchronizer supports: +Split sync tools supports: - Node version 12 or higher to execute the CLI. -- Node version 8 or higher to import the package as dependency. +- Node version 8 or higher to import the package and use programmatically. ## Getting started -Below is a simple example that describes the execution or instantiation of Split Javascript Synchronizer: +Below is a simple example that describes the execution of the Javascript Synchronizer: ### Install package as global dependency and run CLI -1. Install npm package via `npm install -g @splitsoftware/splitio-node-slim-synchronizer` -2. Then, execute the CLI `split-node-synchronizer [...args]` +1. Install npm package via `npm install -g @splitsoftware/splitio-sync-tools` +2. Then, execute the CLI `split-sync-tools [...args]` ### Install package as a project dependency to run programmatically -1. Install npm package via `npm install @splitsoftware/splitio-node-slim-synchronizer` +1. Install npm package via `npm install @splitsoftware/splitio-sync-tools` 2. Inside your app, import the `Synchronizer` ``` -const { Synchronizer } = require('@splitsoftware/splitio-node-slim-synchronizer') -// or if your project supports modules and ESM -import { Synchronizer } from '@splitsoftware/splitio-node-slim-synchronizer'; +const { Synchronizer } = require('@splitsoftware/splitio-sync-tools') +// or if your project supports EcmaScript modules +import { Synchronizer } from '@splitsoftware/splitio-sync-tools'; ``` -3. Set the configurations: +3. Instantiate the Synchronizer: ``` // Example: -const settings = { +const synchronizer = new Synchronizer({ core: { authorizationKey: '', }, - urls: { - sdk: 'https://sdk.split.io/api', // already a default value - events: 'https://events.split.io/api', // already a default value - }, // Mandatory: provide a valid Storage wrapper. storage: { type: 'PLUGGABLE', prefix: 'storagePrefix', wrapper: storageWrapper, }, + // @TODO review config params synchronizerConfigs: { synchronizerMode: 'MODE_RUN_ALL', eventsPerPost: 2000, impressionsPerPost: 4000, maxRetries: 3, }, -}; -const _sync = new Synchronizer(settings); +}); ``` 4. Run the Synchronizer ``` -_sync.execute().then(() => console.log('ready')); +synchronizer.execute().then(() => console.log('ready')); ``` -Please refer to [our official docs (@TODO)](https://help.split.io/hc/en-us/articles/360020037072-Split-Evaluator) to learn about all the functionality provided by Split Javascript Synchronizer and the configuration options available. +Please refer to [Javascript Sync Tools](https://help.split.io/hc/en-us/articles/@TODO) to learn about all the functionality provided by the package. ## Submitting issues -The Split team monitors all issues submitted to this [issue tracker](https://github.com/splitio/javascript-slim-synchronizer/issues). We encourage you to use this issue tracker to submit any bug reports, feedback, and feature enhancements. We'll do our best to respond in a timely manner. +The Split team monitors all issues submitted to this [issue tracker](https://github.com/splitio/javascript-sync-tools/issues). We encourage you to use this issue tracker to submit any bug reports, feedback, and feature enhancements. We'll do our best to respond in a timely manner. ## Contributing Please see [Contributors Guide](CONTRIBUTORS-GUIDE.md) to find all you need to submit a Pull Request (PR). @@ -84,12 +80,12 @@ 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) +* 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) -* Javascript for Browser [Github](https://github.com/splitio/javascript-browser-client) [Docs](https://help.split.io/hc/en-us/articles/360058730852) * 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) -* React Native [Github](https://github.com/splitio/react-native-client) [Docs](https://help.split.io/hc/en-us/articles/4406066357901) +* React Native [Github](https://github.com/splitio/react-native-client) [Docs](https://help.split.io/hc/en-us/articles/4406066357901-React-Native-SDK) * Redux [Github](https://github.com/splitio/redux-client) [Docs](https://help.split.io/hc/en-us/articles/360038851551-Redux-SDK) * Ruby [Github](https://github.com/splitio/ruby-client) [Docs](https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK) diff --git a/package-lock.json b/package-lock.json index 85af5e5..7c94c91 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { - "name": "@splitsoftware/splitio-synchronizer", - "version": "0.0.1", + "name": "@splitsoftware/splitio-sync-tools", + "version": "0.0.1-rc.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 463a1d9..4c6e131 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { - "name": "@splitsoftware/splitio-synchronizer", - "version": "0.0.1", - "description": "Split Javascript Synchronizer", + "name": "@splitsoftware/splitio-sync-tools", + "version": "0.0.1-rc.0", + "description": "Split Javascript Sync Tools", "main": "lib/cjs/index.js", "module": "lib/esm/index.js", "bin": { - "splitio-synchronizer": "bin/splitio-synchronizer.js" + "splitio-sync-tools": "bin/splitio-sync-tools.js" }, "files": [ "lib", diff --git a/rollup.config.js b/rollup.config.js index 187d134..554b261 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -7,7 +7,7 @@ const config = [ { input: 'lib/cjs/cli.js', output: { - file: 'bin/splitio-synchronizer.js', + file: 'bin/splitio-sync-tools.js', format: 'cjs', // exports: 'auto', // https://rollupjs.org/guide/en/#outputexports }, diff --git a/scripts/make_cli.sh b/scripts/make_cli.sh index d9d0f59..34ba2f4 100755 --- a/scripts/make_cli.sh +++ b/scripts/make_cli.sh @@ -1,3 +1,3 @@ #!/bin/bash -echo "$(echo '#!/usr/bin/env node' | cat - bin/splitio-synchronizer.js)" > bin/splitio-synchronizer.js -chmod u+x bin/splitio-synchronizer.js +echo "$(echo '#!/usr/bin/env node' | cat - bin/splitio-sync-tools.js)" > bin/splitio-sync-tools.js +chmod u+x bin/splitio-sync-tools.js diff --git a/src/settings/defaults.ts b/src/settings/defaults.ts index 2597a86..90f6033 100644 --- a/src/settings/defaults.ts +++ b/src/settings/defaults.ts @@ -5,7 +5,7 @@ const version = '@VERSION@'; /** - * Default values to create settings for the Synchronizer script. + * Default values to create settings for the Javascrip Synchronizer. */ export const defaults = { startup: { @@ -18,6 +18,6 @@ export const defaults = { // Amount of time we will wait before the first push of events. eventsFirstPushWindow: 10, }, - version: `synchronizer-${version}`, + version: `synctoolsjs-${version}`, streamingEnabled: false, }; diff --git a/types/index.d.ts b/types/index.d.ts index 93c1c55..2d8bb6b 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,12 +1,12 @@ -// Type definitions for Split Javascript Synchronizer +// Type definitions for Split Javascript Sync Tools // Project: http://www.split.io/ // Definitions by: Emiliano Sanchez -export = JsSynchronizer; +export = JsSyncTools; -declare module JsSynchronizer { +declare module JsSyncTools { /** - * Javascript synchronizer. + * Javascript synchronizer tool. * * @see {@link @TODO}. */ @@ -171,14 +171,14 @@ declare module JsSynchronizer { impressionsMode?: ImpressionsMode } /** - * Type for specific Synchronizer's configs. + * Type for specific Synchronizer configs. */ synchronizerConfigs: { - // @TODO document - synchronizerMode?: SynchronizerMode - eventsPerPost?: number - impressionsPerPost?: number - maxRetries?: number + // @TODO review + synchronizerMode?: SynchronizerMode // sync.mode ? + eventsPerPost?: number // sync.eventsPerPost ? + impressionsPerPost?: number // sync.impressionsPerPost ? + maxRetries?: number // sync.maxRetries ? } } }