Skip to content

Commit

Permalink
feat: port README script to TS
Browse files Browse the repository at this point in the history
  • Loading branch information
cmgriffing committed Sep 2, 2023
1 parent b463b0b commit 71dbd4a
Show file tree
Hide file tree
Showing 27 changed files with 991 additions and 171 deletions.
58 changes: 43 additions & 15 deletions clients/client-cocoa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,36 @@ client.fetchFlags(fileName: "features.json", fetchCompletionHandler: { flags, er
```


### Generate Types (Optional)

We have created a tool to generate types for usage in your code. It will crawl your JSON structures and create consts or enums to help prevent typos and other "magic string" related issues. You just need to pass the URL of the JSON file where it is hosted.

#### NPM

To use the tool, you can run it directly from NPM.

```
npx vexilla types cocoa REMOTE_JSON_URL
```

#### Automatic Install Script

You can also use a precompiled binary for your platform. This install script will automatically choose the right binary for you:

```
curl -o- -s https://raw.githubusercontent.com/vexilla/vexilla/main/install.sh | bash
```

The install script also accepts a target install path:

```
curl -o- -s https://raw.githubusercontent.com/vexilla/vexilla/main/install.sh | bash
```

#### Manual Installation

If you prefer to download the binary manually you can get it from the releases section in Github, [https://github.com/vexilla/vexilla/releases](https://github.com/vexilla/vexilla/releases)

### Usage

Use the created client to check if a feature `Should` be on.
Expand Down Expand Up @@ -67,7 +97,7 @@ client.fetchFlags(fileName: "features.json", fetchCompletionHandler: { flags, er

## What are Feature Flags?

Feature flags are useful for enabling or disabling parts of your application without having to redeploy. In some cases such as mobile applications, the redeploy could take up to a week.
Feature flags are useful for enabling or disabling parts of your application without having to redeploy. In some cases, such as mobile applications, the redeploy could take up to a week.

See more about them here:

Expand All @@ -78,34 +108,32 @@ Feature Flags are also a fundamental building block for things such as A/B testi

## How does it work?

1. You configure the Config UI with your hosting credentials. These are stored in LocalStorage. Your credentials should have a limited scope of permissions.

2. You add environments to the Config UI.
The process is simple but has several steps to get up and running. Please see our in-depth guides in our [documentation](https://vexilla.dev/documentation).

3. Then you add features. These can be a toggle or a gradual rollout.

4. Then you upload the json to your static hosting provider. You can also download ot copy the JSON to your clipboard for other uses.

5. Your applications include a client library as a dependency and the client consumes the JSON config.
## Contributing

6. Finally your application uses the client you created to determine if a feature `Should` be on.
Would you like to contribute to this client SDK? There are many ways you can help. Reporting issues or creating PRs are the most obvious. Helping triage the issues and PRs of others would also be a huge help. Being a vibrant member of the community on [Discord](https://discord.gg/GbJu3d93TC) is another way to help out.

## Contributing
If you would like to contribute to the app, docs, or other parts of the project, please go see our [Contribution Guide](https://vexilla.dev/documentation/contributing).

## Support

If you are having issues, please open a Github Issue on the relevant repo. (client, app, docs, etc.).
Have you run into a bug? Is there a feature you feel is missing? Feel free to create a [GitHub Issue](https://github.com/vexilla/vexilla/issues).

Another way to get support or help is to reach out in our [Discord community](https://discord.gg/GbJu3d93TC).

## Sponsors

No sponsors yet. This could be a link and icon for **your** company here.

## LICENSE - MIT
## LICENSE

MIT

Copyright 2021 Vexilla
Copyright 2023 Vexilla

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.
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.
6 changes: 3 additions & 3 deletions clients/client-cocoa/README.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Add VexillaClient as a dependency via Swift Packages
'''
CustomInstanceHash = "customInstanceHash"
FetchFlags = "fetchFlags"
SyncFlags = "fetchFlags"
SetupSnippet = '''
```swift
var client = VexillaClient(environment: "dev", baseUrl: "https://BUCKET_NAME.s3-website-AWS_REGION.amazonaws.com", customInstanceHash: userId)
Expand All @@ -19,7 +19,7 @@ client.fetchFlags(fileName: "features.json", fetchCompletionHandler: { flags, er
}
client.setFlags(flags: flags!)
)}
```
'''
Expand All @@ -41,7 +41,7 @@ client.fetchFlags(fileName: "features.json", fetchCompletionHandler: { flags, er
}
client.setFlags(flags: flags!)
if client.should(FEATURE_NAME) {
// Do the thing
}
Expand Down
72 changes: 50 additions & 22 deletions clients/client-csharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,52 @@ nuget install Vexilla.Client -OutputDirectory packages

You will need to create a Client within your app. This optionally takes in the `customInstanceHash` for use with gradual rollout.

After creation, call `FetchFlags`. This can be chained from the constructor since it returns the client instance.
After creation, call `SyncFlags`. This can be chained from the constructor since it returns the client instance.

```csharp
var httpClient = new HttpClient()
VexillaHasher client = new VexillaClient(
'https://BUCKET_NAME.s3-website-AWS_REGION.amazonaws.com',
process.env.ENVIRONMENT,
userId
);
)

var flags = await client.FetchFlags("features.json", httpClient);
let flags = await client.SyncFlags("features.json", httpClient);
```

### Generate Types (Optional)

We have created a tool to generate types for usage in your code. It will crawl your JSON structures and create consts or enums to help prevent typos and other "magic string" related issues. You just need to pass the URL of the JSON file where it is hosted.

#### NPM

To use the tool, you can run it directly from NPM.

```
npx vexilla types csharp REMOTE_JSON_URL
```

#### Automatic Install Script

You can also use a precompiled binary for your platform. This install script will automatically choose the right binary for you:

```
curl -o- -s https://raw.githubusercontent.com/vexilla/vexilla/main/install.sh | bash
```

The install script also accepts a target install path:

```
curl -o- -s https://raw.githubusercontent.com/vexilla/vexilla/main/install.sh | bash
```

#### Manual Installation

If you prefer to download the binary manually you can get it from the releases section in Github, [https://github.com/vexilla/vexilla/releases](https://github.com/vexilla/vexilla/releases)

### Usage

Use the created client to check if a feature `should` be on.
Use the created client to check if a feature `Should` be on.

```csharp
client.Should(FEATURE_NAME);
Expand All @@ -57,21 +87,21 @@ client.Should(FEATURE_NAME);
### Full Example

```csharp
var httpClient = new HttpClient();
var httpClient = new HttpClient()
var client = new VexillaClient(
'https://BUCKET_NAME.s3-website-AWS_REGION.amazonaws.com',
process.env.ENVIRONMENT,
userId
);
var flags = FetchFlags("features.json", httpClient);
client.SetFlags(flags);
)
var flags = SyncFlags("features.json", httpClient);
client.SetFlags(flags)

var useIsAllowed = client.Should(FEATURE_NAME);
```

## What are Feature Flags?

Feature flags are useful for enabling or disabling parts of your application without having to redeploy. In some cases such as mobile applications, the redeploy could take up to a week.
Feature flags are useful for enabling or disabling parts of your application without having to redeploy. In some cases, such as mobile applications, the redeploy could take up to a week.

See more about them here:

Expand All @@ -82,31 +112,29 @@ Feature Flags are also a fundamental building block for things such as A/B testi

## How does it work?

1. You configure the Config UI with your hosting credentials. These are stored in LocalStorage. Your credentials should have a limited scope of permissions.

2. You add environments to the Config UI.
The process is simple but has several steps to get up and running. Please see our in-depth guides in our [documentation](https://vexilla.dev/documentation).

3. Then you add features. These can be a toggle or a gradual rollout.

4. Then you upload the json to your static hosting provider. You can also download ot copy the JSON to your clipboard for other uses.

5. Your applications include a client library as a dependency and the client consumes the JSON config.
## Contributing

6. Finally your application uses the client you created to determine if a feature `should` be on.
Would you like to contribute to this client SDK? There are many ways you can help. Reporting issues or creating PRs are the most obvious. Helping triage the issues and PRs of others would also be a huge help. Being a vibrant member of the community on [Discord](https://discord.gg/GbJu3d93TC) is another way to help out.

## Contributing
If you would like to contribute to the app, docs, or other parts of the project, please go see our [Contribution Guide](https://vexilla.dev/documentation/contributing).

## Support

If you are having issues, please open a Github Issue on the relevant repo. (client, app, docs, etc.).
Have you run into a bug? Is there a feature you feel is missing? Feel free to create a [GitHub Issue](https://github.com/vexilla/vexilla/issues).

Another way to get support or help is to reach out in our [Discord community](https://discord.gg/GbJu3d93TC).

## Sponsors

No sponsors yet. This could be a link and icon for **your** company here.

## LICENSE - MIT
## LICENSE

MIT

Copyright 2021 Vexilla
Copyright 2023 Vexilla

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:

Expand Down
6 changes: 3 additions & 3 deletions clients/client-csharp/README.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ nuget install Vexilla.Client -OutputDirectory packages
'''
CustomInstanceHash = "customInstanceHash"
FetchFlags = "FetchFlags"
SyncFlags = "SyncFlags"
SetupSnippet = '''
```csharp
var httpClient = new HttpClient()
Expand All @@ -33,7 +33,7 @@ VexillaHasher client = new VexillaClient(
userId
)
let flags = await client.FetchFlags("features.json", httpClient);
let flags = await client.SyncFlags("features.json", httpClient);
```
'''
Should = "Should"
Expand All @@ -50,7 +50,7 @@ var client = new VexillaClient(
process.env.ENVIRONMENT,
userId
)
var flags = FetchFlags("features.json", httpClient);
var flags = SyncFlags("features.json", httpClient);
client.SetFlags(flags)
var useIsAllowed = client.Should(FEATURE_NAME);
Expand Down
62 changes: 43 additions & 19 deletions clients/client-dart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ To get started is easy.

### Installation


Add the client pubspec.yaml.

```yaml
Expand All @@ -30,7 +29,6 @@ You will need to create a Client within your app. This optionally takes in the `

After creation, call `fetchFlags`. This can be chained from the constructor since it returns the client instance.


```dart
var client = VexillaClient(
'dev',
Expand All @@ -43,19 +41,47 @@ client.setFlags(flags);
```


### Generate Types (Optional)

We have created a tool to generate types for usage in your code. It will crawl your JSON structures and create consts or enums to help prevent typos and other "magic string" related issues. You just need to pass the URL of the JSON file where it is hosted.

#### NPM

To use the tool, you can run it directly from NPM.

```
npx vexilla types dart REMOTE_JSON_URL
```

#### Automatic Install Script

You can also use a precompiled binary for your platform. This install script will automatically choose the right binary for you:

```
curl -o- -s https://raw.githubusercontent.com/vexilla/vexilla/main/install.sh | bash
```

The install script also accepts a target install path:

```
curl -o- -s https://raw.githubusercontent.com/vexilla/vexilla/main/install.sh | bash
```

#### Manual Installation

If you prefer to download the binary manually you can get it from the releases section in Github, [https://github.com/vexilla/vexilla/releases](https://github.com/vexilla/vexilla/releases)

### Usage

Use the created client to check if a feature `should` be on.


```dart
var shouldGradual = client.should(FEATURE_NAME)
```


### Full Example


```dart
var client = VexillaClient(
'dev',
Expand All @@ -74,7 +100,7 @@ if (client.should('FEATURE_NAME')) {

## What are Feature Flags?

Feature flags are useful for enabling or disabling parts of your application without having to redeploy. In some cases such as mobile applications, the redeploy could take up to a week.
Feature flags are useful for enabling or disabling parts of your application without having to redeploy. In some cases, such as mobile applications, the redeploy could take up to a week.

See more about them here:

Expand All @@ -85,34 +111,32 @@ Feature Flags are also a fundamental building block for things such as A/B testi

## How does it work?

1. You configure the Config UI with your hosting credentials. These are stored in LocalStorage. Your credentials should have a limited scope of permissions.
The process is simple but has several steps to get up and running. Please see our in-depth guides in our [documentation](https://vexilla.dev/documentation).

2. You add environments to the Config UI.

3. Then you add features. These can be a toggle or a gradual rollout.

4. Then you upload the json to your static hosting provider. You can also download ot copy the JSON to your clipboard for other uses.
## Contributing

5. Your applications include a client library as a dependency and the client consumes the JSON config.
Would you like to contribute to this client SDK? There are many ways you can help. Reporting issues or creating PRs are the most obvious. Helping triage the issues and PRs of others would also be a huge help. Being a vibrant member of the community on [Discord](https://discord.gg/GbJu3d93TC) is another way to help out.

6. Finally your application uses the client you created to determine if a feature `should` be on.

## Contributing
If you would like to contribute to the app, docs, or other parts of the project, please go see our [Contribution Guide](https://vexilla.dev/documentation/contributing).

## Support

If you are having issues, please open a Github Issue on the relevant repo. (client, app, docs, etc.).
Have you run into a bug? Is there a feature you feel is missing? Feel free to create a [GitHub Issue](https://github.com/vexilla/vexilla/issues).

Another way to get support or help is to reach out in our [Discord community](https://discord.gg/GbJu3d93TC).

## Sponsors

No sponsors yet. This could be a link and icon for **your** company here.

## LICENSE - MIT
## LICENSE

MIT

Copyright 2021 Vexilla
Copyright 2023 Vexilla

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.
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.

0 comments on commit 71dbd4a

Please sign in to comment.