Skip to content

Commit

Permalink
feat: React sdk (#393)
Browse files Browse the repository at this point in the history
* fix: export models outside package

Signed-off-by: Mark Phelps <[email protected]>

* chore: fmt

Signed-off-by: Mark Phelps <[email protected]>

* chore: dont export unneeded types

Signed-off-by: Mark Phelps <[email protected]>

* chore: lint

Signed-off-by: Mark Phelps <[email protected]>

* feat: intro react sdk

Signed-off-by: Mark Phelps <[email protected]>

* chore: add rollup

* chore: fmt

Signed-off-by: Mark Phelps <[email protected]>

* chore: add tests

Signed-off-by: Mark Phelps <[email protected]>

* chore: rm dist

Signed-off-by: Mark Phelps <[email protected]>

* chore: more fmt

Signed-off-by: Mark Phelps <[email protected]>

* chore: setup publish workflow

Signed-off-by: Mark Phelps <[email protected]>

* chore: fmt

Signed-off-by: Mark Phelps <[email protected]>

* chore: set rc

Signed-off-by: Mark Phelps <[email protected]>

* chore: fix node workflow

Signed-off-by: Mark Phelps <[email protected]>

* chore: public

Signed-off-by: Mark Phelps <[email protected]>

* chore: add back rollup external option

Signed-off-by: Mark Phelps <[email protected]>

* chore: export everything

Signed-off-by: Mark Phelps <[email protected]>

* chore: fml

Signed-off-by: Mark Phelps <[email protected]>

* chore: readme add back unit tests

Signed-off-by: Mark Phelps <[email protected]>

* chore: bump version

Signed-off-by: Mark Phelps <[email protected]>

* chore: update example

Signed-off-by: Mark Phelps <[email protected]>

* chore: update main readme

Signed-off-by: Mark Phelps <[email protected]>

* chore: update react to 0.0.1

Signed-off-by: Mark Phelps <[email protected]>

---------

Signed-off-by: Mark Phelps <[email protected]>
  • Loading branch information
markphelps authored Sep 23, 2024
1 parent c3f0806 commit a79e3b2
Show file tree
Hide file tree
Showing 20 changed files with 11,470 additions and 23 deletions.
26 changes: 18 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
updates:
- package-ecosystem: "cargo"
- package-ecosystem: cargo
directory: "/"
schedule:
interval: "weekly"
Expand Down Expand Up @@ -30,6 +30,16 @@ updates:
# kodiak `merge.automerge_label`
- "automerge"

- package-ecosystem: npm
directory: "/flipt-client-react"
schedule:
interval: weekly
open-pull-requests-limit: 5
labels:
- "dependencies"
# kodiak `merge.automerge_label`
- "automerge"

- package-ecosystem: pip
directory: "/flipt-client-python"
schedule:
Expand All @@ -50,7 +60,7 @@ updates:
# kodiak `merge.automerge_label`
- "automerge"

- package-ecosystem: "gradle"
- package-ecosystem: gradle
directory: "/flipt-client-java"
schedule:
interval: weekly
Expand All @@ -60,7 +70,7 @@ updates:
# kodiak `merge.automerge_label`
- "automerge"

- package-ecosystem: "bundler"
- package-ecosystem: bundler
directory: "/flipt-client-ruby"
schedule:
interval: weekly
Expand All @@ -70,7 +80,7 @@ updates:
# kodiak `merge.automerge_label`
- "automerge"

- package-ecosystem: "pub"
- package-ecosystem: pub
directory: "/flipt-client-dart"
schedule:
interval: weekly
Expand All @@ -80,7 +90,7 @@ updates:
# kodiak `merge.automerge_label`
- "automerge"

- package-ecosystem: "cargo"
- package-ecosystem: cargo
directory: "/flipt-engine-ffi"
schedule:
interval: "weekly"
Expand All @@ -90,7 +100,7 @@ updates:
# kodiak `merge.automerge_label`
- "automerge"

- package-ecosystem: "cargo"
- package-ecosystem: cargo
directory: "/flipt-evaluation"
schedule:
interval: "weekly"
Expand All @@ -100,7 +110,7 @@ updates:
# kodiak `merge.automerge_label`
- "automerge"

- package-ecosystem: "cargo"
- package-ecosystem: cargo
directory: "/flipt-engine-wasm"
schedule:
interval: "weekly"
Expand All @@ -110,7 +120,7 @@ updates:
# kodiak `merge.automerge_label`
- "automerge"

- package-ecosystem: "github-actions"
- package-ecosystem: github-actions
# Workflow files stored in the
# default location of `.github/workflows`
directory: "/"
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/package-react-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Package React SDK
on:
push:
tags: ["flipt-client-react-**"]

permissions:
contents: write

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'

- run: |
npm ci
npm run build
npm publish --access public
working-directory: flipt-client-react
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_API_KEY }}
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Flipt Client SDKs

![Status: Stable](https://img.shields.io/badge/status-stable-green)
[![GitHub license](https://img.shields.io/github/license/flipt-io/flipt-client-sdks)](https://github.com/flipt-io/flipt-client-sdks/blob/main/LICENSE)

This repository centralizes the client-side SDKs for [Flipt](https://github.com/flipt-io/flipt).
Expand All @@ -13,7 +12,7 @@ Also, check out our introductory [blog post](https://www.flipt.io/blog/new-clien

## Versions

There are two versions of the client SDKs:
There are two architectures for the client SDKs:

### FFI

Expand All @@ -22,7 +21,7 @@ The [Foreign Function Interface (FFI)](https://en.wikipedia.org/wiki/Foreign_fun
> [!IMPORTANT]
> Our FFI SDKs fully support OSes that use the `glibc` implementation of the C standard library. We have beta support for versions of the SDKs that use the `musl` C library. See [this issue](https://github.com/flipt-io/flipt-client-sdks/issues/141) for which SDKs have versions that support `musl`.
### Supported Architectures
#### Supported Architectures

The FFI-based SDKs are currently supported on the following OSes/architectures:

Expand All @@ -33,7 +32,7 @@ The FFI-based SDKs are currently supported on the following OSes/architectures:

### WASM

The WebAssembly (WASM) version of the client SDKs is currently in beta. This version allows you to evaluate flags in the browser using WebAssembly which is OS and architecture agnostic.
The [WebAssembly (WASM)](https://webassembly.org/) versions of the client SDKs allow you to evaluate flags in the browser and are OS and architecture agnostic.

## Architecture

Expand All @@ -53,13 +52,16 @@ We are constantly growing our list of supported languages.

Currently, we support the following languages/platforms:

1. [Go](./flipt-client-go) (FFI)
1. [Python](./flipt-client-python) (FFI)
1. [Ruby](./flipt-client-ruby) (FFI)
1. [NodeJS](./flipt-client-node) (FFI)
1. [Java](./flipt-client-java) (FFI)
1. [JavaScript/Typescript (Browser)](./flipt-client-browser) (WASM)
1. [Flutter/Dart](./flipt-client-dart) (FFI)
| Language | Implementation |
|----------|----------------|
| [Go](./flipt-client-go) | FFI |
| [Python](./flipt-client-python) | FFI |
| [Ruby](./flipt-client-ruby) | FFI |
| [NodeJS](./flipt-client-node) | WASM |
| [Java](./flipt-client-java) | FFI |
| [JavaScript (Browser)](./flipt-client-browser) | WASM |
| [React Web (Browser)](./flipt-client-react) | WASM |
| [Flutter/Dart](./flipt-client-dart) | FFI |

Documentation for each client can be found in the README of that client's directory.

Expand All @@ -76,6 +78,7 @@ Languages we would like to support but lack expertise in:

1. [Kotlin](https://github.com/flipt-io/flipt-client-sdks/issues/264)
1. [Swift](https://github.com/flipt-io/flipt-client-sdks/issues/263)
1. [React Native](https://github.com/flipt-io/flipt-client-sdks/issues/345)

Want to see a client in a language we don't support? [Open an issue](https://github.com/flipt-io/flipt-client-sdks/issues/new?assignees=&labels=new-language&projects=&template=new_language.yml) and let us know!

Expand Down
11 changes: 10 additions & 1 deletion flipt-client-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,21 @@
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"private": false,
"author": "Flipt Devs <[email protected]>",
"license": "MIT",
"files": [
"dist"
],
"repository": {
"type": "git",
"url": "https://github.com/flipt-io/flipt-client-sdks/tree/main/flipt-client-react"
},
"keywords": [
"flipt",
"feature flags",
"feature toggles",
"wasm"
],
"scripts": {
"fmt": "prettier --config .prettierrc 'src/**/*.ts' --write",
"lint": "prettier --check src/**/*.ts",
Expand Down
14 changes: 12 additions & 2 deletions flipt-client-node/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
{
"name": "@flipt-io/flipt-client",
"version": "0.10.1",
"description": "Flipt Client Evaluation SDK",
"description": "Flipt Client Evaluation SDK for Node.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"private": false,
"author": "Flipt Devs <[email protected]>",
"license": "MIT",
"files": [
"dist"
],
"repository": {
"type": "git",
"url": "https://github.com/flipt-io/flipt-client-sdks/tree/main/flipt-client-node"
},
"keywords": [
"flipt",
"feature flags",
"feature toggles",
"nodejs",
"wasm"
],
"scripts": {
"fmt": "prettier --config .prettierrc 'src/**/*.ts' --write",
"lint": "prettier --check src/**/*.ts",
Expand Down
2 changes: 2 additions & 0 deletions flipt-client-react/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
6 changes: 6 additions & 0 deletions flipt-client-react/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": true,
"trailingComma": "none",
"singleQuote": true,
"printWidth": 80
}
21 changes: 21 additions & 0 deletions flipt-client-react/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Flipt Software Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit a79e3b2

Please sign in to comment.