Skip to content

Commit

Permalink
Version Packages (#30)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and github-actions[bot] committed Sep 12, 2022
1 parent d9ebb3b commit ef5020f
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 64 deletions.
62 changes: 0 additions & 62 deletions .changeset/slimy-items-dress.md

This file was deleted.

8 changes: 8 additions & 0 deletions example/CHANGELOG.md
@@ -0,0 +1,8 @@
# example

## 0.1.1

### Patch Changes

- Updated dependencies [1822587]
- @happykit/flags@3.0.0
2 changes: 1 addition & 1 deletion example/package.json
@@ -1,6 +1,6 @@
{
"name": "example",
"version": "0.1.0",
"version": "0.1.1",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
64 changes: 64 additions & 0 deletions package/CHANGELOG.md
@@ -0,0 +1,64 @@
# @happykit/flags

## 3.0.0

### Major Changes

- 1822587: BREAKING CHANGE: Configuration overhaul

### What

This release changes HappyKit's configuration approach.

Previously you had to create a `flags.config.js` file and import it into your `pages/_app.js` and into every middleware that wanted to use feature flags. If you were using your own `AppFlags` type, you also had to pass this type every time you invoked `getFlags()`, `useFlags()` or `getEdgeFlags()`. And the configuration options for client-, server- and edge were mixed together into a single `flags.config.js` file.

### Why

This release replaces the existing configuration approach with a new one. This new approach configuration prepares happykit for upcoming features.

### How

#### 1. Add `flags` folder

Follow the updated [Setup](https://github.com/happykit/flags/tree/master/package#setup) instructions to create the `flags` folder in your own application, and fill it with.

After this step, you should have

- `./flags/config.ts` which exports a configuration
- `./flags/client.ts` which exports a `useFlags` function
- `./flags/server.ts` which exports a `getFlags` function
- `./flags/edge.ts` which exports a `getEdgeFlags` function

#### 2. Set up absolute imports

Enable Absolute Imports as described [here](https://github.com/happykit/flags/tree/master/package#absolute-imports).

#### 3. Adapt your imports

Then change the application code in your `pages/` folder to use these functions from your `flags/` folder instead of from `@happykit/flags`:

```diff
- import { useFlags } from "@happykit/flags/client"
+ import { useFlags } from "flags/client"
```

```diff
- import { getFlags } from "@happykit/flags/server"
+ import { getFlags } from "flags/server"
```

```diff
- import { getEdgeFlags } from "@happykit/flags/edge"
+ import { getEdgeFlags } from "flags/edge"
```

_Note that because of the absolute imports we configured in step 2, all imports from `"flags/_"` will use the local flags folder you created in step 1.\*

#### 4. Delete your old setup

We can now delete the old setup since we no longer need it

- delete `flags.config.js`
- remove the `flags.config` import from your `pages/_app` file
- you might be able to delete the `pages/_app` file if it's not doing anything else anymore
- remove the import of `flags.config` from your middleware
2 changes: 1 addition & 1 deletion package/package.json
@@ -1,6 +1,6 @@
{
"name": "@happykit/flags",
"version": "2.0.7",
"version": "3.0.0",
"description": "Feature Flags for Next.js",
"author": "Dominik Ferber <dominik.ferber+npm@gmail.com> (http://dferber.de/)",
"license": "MIT",
Expand Down

1 comment on commit ef5020f

@vercel
Copy link

@vercel vercel bot commented on ef5020f Sep 12, 2022

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

flags – ./

flags.happykit.dev
flags-git-master-happykit.vercel.app
flags-happykit.vercel.app

Please sign in to comment.