From 608974ca9d9d6d1250b5c06ba01dec4581191248 Mon Sep 17 00:00:00 2001 From: sjaanus Date: Fri, 27 Sep 2024 09:51:19 +0300 Subject: [PATCH] feat: now code examples are joined into one --- frontend/src/component/onboarding/dialog/snippets/flutter.md | 5 +---- frontend/src/component/onboarding/dialog/snippets/go.md | 5 +---- frontend/src/component/onboarding/dialog/snippets/java.md | 5 +---- .../src/component/onboarding/dialog/snippets/javascript.md | 5 +---- frontend/src/component/onboarding/dialog/snippets/nodejs.md | 5 +---- frontend/src/component/onboarding/dialog/snippets/php.md | 3 --- frontend/src/component/onboarding/dialog/snippets/python.md | 5 +---- frontend/src/component/onboarding/dialog/snippets/ruby.md | 5 +---- frontend/src/component/onboarding/dialog/snippets/rust.md | 2 +- frontend/src/component/onboarding/dialog/snippets/swift.md | 5 +---- 10 files changed, 9 insertions(+), 36 deletions(-) diff --git a/frontend/src/component/onboarding/dialog/snippets/flutter.md b/frontend/src/component/onboarding/dialog/snippets/flutter.md index 146b9b1f38d5..43bea5e18be4 100644 --- a/frontend/src/component/onboarding/dialog/snippets/flutter.md +++ b/frontend/src/component/onboarding/dialog/snippets/flutter.md @@ -3,7 +3,7 @@ flutter pub add unleash_proxy_client_flutter ``` -2\. Initialize Unleash +2\. Run Unleash ```dart import 'package:unleash_proxy_client_flutter/unleash_proxy_client_flutter.dart'; import 'dart:async'; @@ -14,10 +14,7 @@ final unleash = UnleashClient( appName: 'unleash-onboarding-flutter'); unleash.start(); -``` -3\. Check feature flag status -```dart Timer.periodic(Duration(seconds: 1), (Timer timer) { final flagStatus = unleash.isEnabled(''); print('Flag is ${unleash.isEnabled("") ? "enabled" : "disabled"}'); diff --git a/frontend/src/component/onboarding/dialog/snippets/go.md b/frontend/src/component/onboarding/dialog/snippets/go.md index a77f2e19640b..63170c00cf5f 100644 --- a/frontend/src/component/onboarding/dialog/snippets/go.md +++ b/frontend/src/component/onboarding/dialog/snippets/go.md @@ -3,7 +3,7 @@ go get github.com/Unleash/unleash-client-go/v3 ``` -2\. Initialize Unleash +2\. Run Unleash ```go import ( "github.com/Unleash/unleash-client-go/v3" @@ -20,10 +20,7 @@ func init() { unleash.WithMetricsInterval(5*time.Second), ) } -``` -3\. Check feature flag status -```go func main() { for { unleash.IsEnabled("") diff --git a/frontend/src/component/onboarding/dialog/snippets/java.md b/frontend/src/component/onboarding/dialog/snippets/java.md index 93d714c1c2b4..ed41182a6f67 100644 --- a/frontend/src/component/onboarding/dialog/snippets/java.md +++ b/frontend/src/component/onboarding/dialog/snippets/java.md @@ -7,7 +7,7 @@ ``` -2\. Initialize Unleash +2\. Run Unleash ```java UnleashConfig config = UnleashConfig.builder() .appName("unleash-onboarding-java") @@ -18,10 +18,7 @@ UnleashConfig config = UnleashConfig.builder() .build(); Unleash unleash = new DefaultUnleash(config); -``` -3\. Check feature flag status -```java while (true) { boolean featureEnabled = unleash.isEnabled(""); System.out.println("Feature enabled: " + featureEnabled); diff --git a/frontend/src/component/onboarding/dialog/snippets/javascript.md b/frontend/src/component/onboarding/dialog/snippets/javascript.md index 0b7785a4de8d..d575ebfbef43 100644 --- a/frontend/src/component/onboarding/dialog/snippets/javascript.md +++ b/frontend/src/component/onboarding/dialog/snippets/javascript.md @@ -3,7 +3,7 @@ npm install unleash-proxy-client ``` -2\. Initialize Unleash +2\. Run Unleash ```js const { UnleashClient } = require('unleash-proxy-client'); @@ -15,10 +15,7 @@ const unleash = new UnleashClient({ }); unleash.start(); -``` -3\. Check feature flag status -```js setInterval(() => { console.log('Is enabled', unleash.isEnabled('')); }, 1000); diff --git a/frontend/src/component/onboarding/dialog/snippets/nodejs.md b/frontend/src/component/onboarding/dialog/snippets/nodejs.md index 0763726e5e43..5ea2523b1ed0 100644 --- a/frontend/src/component/onboarding/dialog/snippets/nodejs.md +++ b/frontend/src/component/onboarding/dialog/snippets/nodejs.md @@ -3,7 +3,7 @@ npm install unleash-client ``` -2\. Initialize Unleash +2\. Run Unleash ```js const { initialize } = require('unleash-client'); @@ -13,10 +13,7 @@ const unleash = initialize({ customHeaders: { Authorization: '' }, metricsInterval: 5000, }); -``` -3\. Check feature flag status -```js setInterval(() => { console.log('Is enabled', unleash.isEnabled('')); }, 1000); diff --git a/frontend/src/component/onboarding/dialog/snippets/php.md b/frontend/src/component/onboarding/dialog/snippets/php.md index 1aec6312c78c..636a7fa1b361 100644 --- a/frontend/src/component/onboarding/dialog/snippets/php.md +++ b/frontend/src/component/onboarding/dialog/snippets/php.md @@ -18,10 +18,7 @@ $unleash = UnleashBuilder::create() ->withInstanceId('unleash-onboarding-instance') ->withMetricsInterval(5000) ->build(); -``` -3\. Check feature flag status -```php while (true) { echo 'Feature flag is: ' . $unleash->isEnabled('') . PHP_EOL; sleep(1); diff --git a/frontend/src/component/onboarding/dialog/snippets/python.md b/frontend/src/component/onboarding/dialog/snippets/python.md index 2a013fb9b949..a1f57952c830 100644 --- a/frontend/src/component/onboarding/dialog/snippets/python.md +++ b/frontend/src/component/onboarding/dialog/snippets/python.md @@ -3,7 +3,7 @@ pip install UnleashClient ``` -2\. Initialize Unleash +2\. Run Unleash ```python from UnleashClient import UnleashClient import asyncio @@ -15,10 +15,7 @@ client = UnleashClient( custom_headers={'Authorization': ''}) client.initialize_client() -``` -3\. Check feature flag status -```python while True: print(client.is_enabled("")) asyncio.run(asyncio.sleep(1)) diff --git a/frontend/src/component/onboarding/dialog/snippets/ruby.md b/frontend/src/component/onboarding/dialog/snippets/ruby.md index 1fc136151e65..fac0eadd527c 100644 --- a/frontend/src/component/onboarding/dialog/snippets/ruby.md +++ b/frontend/src/component/onboarding/dialog/snippets/ruby.md @@ -3,7 +3,7 @@ gem install unleash ``` -2\. Initialize Unleash +2\. Run Unleash ```rb require 'unleash' @@ -15,10 +15,7 @@ require 'unleash' refresh_interval: 3, # In production use interval of >15s metrics_interval: 3, # In production use interval of >15s ) -``` -3\. Check feature flag status -```rb while true if @unleash.is_enabled?("") puts "Flag is enabled" diff --git a/frontend/src/component/onboarding/dialog/snippets/rust.md b/frontend/src/component/onboarding/dialog/snippets/rust.md index 6826f5db61fc..de2ab1b34628 100644 --- a/frontend/src/component/onboarding/dialog/snippets/rust.md +++ b/frontend/src/component/onboarding/dialog/snippets/rust.md @@ -7,7 +7,7 @@ cargo add serde tokio --features full cargo add serde anyhow cfg cfg-if enum-map@~2.0.0 surf ``` -2\. Initialize Unleash +2\. Run Unleash ```rust use enum_map::Enum; use serde::{Deserialize, Serialize}; diff --git a/frontend/src/component/onboarding/dialog/snippets/swift.md b/frontend/src/component/onboarding/dialog/snippets/swift.md index d7dadce5831b..5448b985a43c 100644 --- a/frontend/src/component/onboarding/dialog/snippets/swift.md +++ b/frontend/src/component/onboarding/dialog/snippets/swift.md @@ -4,7 +4,7 @@ https://github.com/Unleash/unleash-proxy-client-swift.git ``` -2\. Initialize Unleash +2\. Run Unleash ```swift import Foundation import UnleashProxyClientSwift @@ -17,10 +17,7 @@ var unleash = UnleashProxyClientSwift.UnleashClient( context: [:]) unleash.start() -``` -3\. Check feature flag status -```swift Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { _ in print("Is enabled", unleash.isEnabled(name: "")) }