Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 39 additions & 6 deletions .github/workflows/pr-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
- name: Setup mise
uses: jdx/mise-action@v2

- name: Cache npm packages
uses: actions/cache@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-

- name: Restore cache
- name: Restore Next.js cache
uses: actions/cache@v4
with:
path: .next/cache
Expand All @@ -45,4 +49,33 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build with Next.js
run: npm run build
run: npm run build

check-generated:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup mise
uses: jdx/mise-action@v2

- name: Cache npm packages
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-

- name: Install dependencies
run: npm ci

- name: Regenerate hooks
run: npm run generate-flags

- name: Check for uncommitted changes
run: |
if ! git diff --exit-code src/generated; then
echo "Generated files are out of date. Run 'npm run generate-flags' and commit the result."
exit 1
fi
47 changes: 47 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Contributing to ToggleShop

ToggleShop is an OpenFeature demo app. Contributions are welcome, whether that's fixing a bug, improving a scenario, or testing new OpenFeature functionality.

## Developer setup

We use [mise](https://mise.jdx.dev) to manage tool versions. It pins both Node.js and the OpenFeature CLI per-project, so every contributor gets the same environment.

1. [Install mise](https://mise.jdx.dev/getting-started.html)
2. Install project tools:
```sh
mise install
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The mise setup instructions are missing the activation step. Without activating mise in the shell (e.g., via eval "$(mise activate bash)" or the shell hook), subsequent commands like npm install and npm run dev will use the system's default Node.js version instead of the one pinned in mise.toml. Consider adding a note about activation or recommending the use of mise exec for these commands.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gemini is referring to https://mise.jdx.dev/getting-started.html#activate-mise, which we should add to the instructions as well.

```
3. Install dependencies:
```sh
npm install
```
4. Start the app:
```sh
npm run dev
```

If you prefer nvm, the `.nvmrc` file is still present. You'll need to [install the OpenFeature CLI](https://github.com/open-feature/cli#installation) separately.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The documentation states that .nvmrc is still present. Since the project is upgrading to Node 20 (as seen in the Dockerfile and mise.toml changes), please ensure that .nvmrc is also updated to 20 to maintain consistency for contributors using nvm. It appears that .nvmrc was not updated in this pull request, which could lead to version mismatches.


## Generated files

The React hooks and Node.js client in `src/generated/` are generated by the OpenFeature CLI from `flags.json` and `.openfeature.yaml`. If you change flag definitions, regenerate them before committing:

```sh
npm run generate-flags
```

CI will fail if `src/generated/` is out of date with the flag definitions.

## DCO sign-off

All commits to OpenFeature repositories require a [Developer Certificate of Origin (DCO)](https://developercertificate.org/) sign-off:

```sh
git commit -s -m "your commit message"
```

## Running tests

```sh
npm test
```
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker.io/docker/dockerfile:1

FROM node:18-alpine AS base
FROM node:20-alpine AS base

# 1. Install dependencies only when needed
FROM base AS deps
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,7 @@ Deploy the ToggleShop and supporting infrastructure:
```sh
kubectl -n default apply -f kubernetes/toggle-shop.yaml && kubectl wait --timeout=60s deployment --for condition=Available=True -l 'app=toggle-shop' -n 'default'
```

## Contributing

See [CONTRIBUTING.md](./CONTRIBUTING.md) for dev setup, how to regenerate flag hooks, and DCO sign-off requirements.
4 changes: 4 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[tools]
node = "20"
"github:open-feature/cli" = "0.4.1"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The OpenFeature CLI version 0.4.1 is quite old. Given that the project uses recent versions of the OpenFeature SDKs (e.g., @openfeature/server-sdk ^1.18.0), it is recommended to update to a more recent version (e.g., 0.7.1) to ensure compatibility and access to the latest features and bug fixes.

Suggested change
"github:open-feature/cli" = "0.4.1"
"github:open-feature/cli" = "0.7.1"


6 changes: 6 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>open-feature/community-tooling"
]
}
Loading