Commit Graph

7 Commits

Author SHA1 Message Date
Florin-Mihai Anghel 0e7db0209e
feat: update golang output (#63)
<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->

## This PR
<!-- add the description of the PR here -->

- updates the golang output for the flag accessors

---------

Signed-off-by: Florin-Mihai Anghel <fanghel@google.com>
Signed-off-by: Florin-Mihai Anghel <44744433+anghelflorinm@users.noreply.github.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
2024-12-09 18:25:21 +00:00
Florin-Mihai Anghel 515b5340b5
chore: update back to previous mkdir permissions (#61)
<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->

## This PR
updates back to previous mkdir permissions.
context:
https://unix.stackexchange.com/questions/21251/execute-vs-read-bit-how-do-directory-permissions-in-linux-work

---------

Signed-off-by: Florin-Mihai Anghel <fanghel@google.com>
Signed-off-by: Florin-Mihai Anghel <44744433+anghelflorinm@users.noreply.github.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
2024-11-27 12:42:02 +00:00
Florin-Mihai Anghel e3058db6d7
refactor: change name of go module (#46)
<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->

## This PR
Changes the name of the go module

### Related Issues
<!-- add here the GitHub issue that this PR resolves if applicable -->

Fixes #45

---------

Signed-off-by: Florin-Mihai Anghel <fanghel@google.com>
Signed-off-by: Florin-Mihai Anghel <44744433+anghelflorinm@users.noreply.github.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
2024-10-31 19:15:05 +00:00
Florin-Mihai Anghel ce14e1c99c
test: Add tests for golang and react with in memory files (#43)
<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->

## This PR
<!-- add the description of the PR here -->

- adds tests for React and Golang

### Related Issues
https://github.com/open-feature/codegen/issues/42

Fixes #42 

### How to test
`go test ./...` from root folder

---------

Signed-off-by: Florin-Mihai Anghel <fanghel@google.com>
Signed-off-by: Florin-Mihai Anghel <44744433+anghelflorinm@users.noreply.github.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
2024-10-31 15:27:04 +00:00
Michael Beemer c13a4486b9
feat: add version command (#38)
Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
2024-10-22 14:59:59 -04:00
Michael Beemer 757ab66b7f
feat: add basic react support (#31)
## This PR

- proof-of-concept React code gen implementation

### How to test

#### Run:
`go run main.go generate react --flag_manifest_path
./sample/sample_manifest.json --output_path ./output.ts`

#### Output

```ts
'use client';

import {
	useBooleanFlagDetails,
	useNumberFlagDetails,
	useStringFlagDetails,
} from "@openfeature/react-sdk";

/**
* Discount percentage applied to purchases.
* 
* **Details:**
* - flag key: `discountPercentage`
* - default value: `0.15`
* - type: `number`
*/
export const useDiscountPercentage = (options: Parameters<typeof useNumberFlagDetails>[2]) => {
  return useNumberFlagDetails("discountPercentage", 0.15, options);
};

/**
* Controls whether Feature A is enabled.
* 
* **Details:**
* - flag key: `enableFeatureA`
* - default value: `false`
* - type: `boolean`
*/
export const useEnableFeatureA = (options: Parameters<typeof useBooleanFlagDetails>[2]) => {
  return useBooleanFlagDetails("enableFeatureA", false, options);
};

/**
* Maximum allowed length for usernames.
* 
* **Details:**
* - flag key: `usernameMaxLength`
* - default value: `50`
* - type: `number`
*/
export const useUsernameMaxLength = (options: Parameters<typeof useNumberFlagDetails>[2]) => {
  return useNumberFlagDetails("usernameMaxLength", 50, options);
};

/**
* The message to use for greeting users.
* 
* **Details:**
* - flag key: `greetingMessage`
* - default value: `Hello there!`
* - type: `string`
*/
export const useGreetingMessage = (options: Parameters<typeof useStringFlagDetails>[2]) => {
  return useStringFlagDetails("greetingMessage", "Hello there!", options);
};

```

Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
2024-10-15 14:06:43 +00:00
Florin-Mihai Anghel 850c694c84
refactor: change folder, package structure; integrate with cobra (#27)
<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->

## This PR
<!-- add the description of the PR here -->

refactor: changes folder, package structure; integrates CLI with cobra

### Related Issues
<!-- add here the GitHub issue that this PR resolves if applicable -->

Fixes https://github.com/open-feature/codegen/issues/20#issue-2559398075

---------

Signed-off-by: Florin-Mihai Anghel <fanghel@google.com>
Signed-off-by: Florin-Mihai Anghel <44744433+anghelflorinm@users.noreply.github.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
2024-10-10 07:55:36 +00:00