Skip to content

Commit 33f2691

Browse files
committed
docs: update README files for flipper packages
Revise documentation for @flippercloud/flipper, flipper-cache, and flipper-redis to clarify installation steps, usage examples, and core concepts. Refactor code samples to use modern import syntax and JavaScript/TypeScript conventions. Improve explanations around cache wrappers, adapters, and feature flag examples for better onboarding. Streamline doc sections to focus on quick usage and relocate advanced development setup to separate docs. Enhance links to comprehensive guides for configuration and best practices.
1 parent 3bb262d commit 33f2691

3 files changed

Lines changed: 40 additions & 28 deletions

File tree

packages/flipper-cache/README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,33 @@
11
# @flippercloud/flipper-cache
22

3-
Generic cache wrapper for Flipper TypeScript adapters, providing read-through and optional write-through caching.
3+
Generic cache wrapper for Flipper adapters, providing read-through and optional write-through caching for improved performance.
44

5-
## Install
5+
## Installation
66

77
```bash
88
bun add @flippercloud/flipper-cache
99
```
1010

1111
## Quick usage
1212

13-
```ts
13+
```typescript
14+
import Flipper from '@flippercloud/flipper'
1415
import Cache, { MemoryCache } from '@flippercloud/flipper-cache'
15-
const cached = new Cache(storeAdapter, new MemoryCache(), { ttlSeconds: 300, prefix: 'flipper:' })
16+
17+
const storeAdapter = new YourAdapter() // e.g., RedisAdapter, SequelizeAdapter
18+
const cacheAdapter = new Cache(storeAdapter, new MemoryCache(), {
19+
ttlSeconds: 300,
20+
prefix: 'flipper:',
21+
})
22+
const flipper = new Flipper(cacheAdapter)
23+
24+
await flipper.enable('cached-feature')
25+
const isEnabled = await flipper.isEnabled('cached-feature')
1626
```
1727

1828
## Docs
1929

20-
Looking for setup, options, custom backends, and best practices? See the full guide: [Cache adapter guide](../../docs/adapters/cache.md).
30+
Looking for cache backends, TTL configuration, and best practices? See the full guide: [Cache adapter guide](../../docs/adapters/cache.md).
2131

2232
## License
2333

packages/flipper-redis/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ console.log(isEnabled) // true
3434

3535
## Docs
3636

37-
Looking for setup options, clustering, read-only mode, data structures, and best practices? See the full guide: [Redis adapter guide](../../docs/adapters/redis.md).
37+
Looking for setup options, clustering, read-only mode, and best practices? See the full guide: [Redis adapter guide](../../docs/adapters/redis.md).
3838

3939
## License
4040

packages/flipper/README.md

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,40 @@
1-
# Flipper TypeScript
1+
# @flippercloud/flipper
22

3-
A TypeScript implementation of [Flipper](https://github.com/flippercloud/flipper) - a feature flagging library.
3+
A TypeScript/JavaScript implementation of [Flipper](https://github.com/flippercloud/flipper) - a feature flagging library for controlling features and behavior.
44

55
## Installation
66

77
```bash
8-
bun add flipper-typescript
8+
bun add @flippercloud/flipper
99
```
1010

11-
## Development
11+
## Quick usage
1212

13-
### Prerequisites
13+
```typescript
14+
import Flipper from '@flippercloud/flipper'
15+
import { MemoryAdapter } from '@flippercloud/flipper'
1416

15-
- Node.js >= 18.0.0
16-
- Bun >= 1.3.2
17+
const adapter = new MemoryAdapter()
18+
const flipper = new Flipper(adapter)
1719

18-
### Setup
20+
// Enable a feature
21+
await flipper.enable('new-ui')
1922

20-
```bash
21-
bun install
23+
// Check if a feature is enabled
24+
const isEnabled = await flipper.isEnabled('new-ui')
25+
console.log(isEnabled) // true
26+
27+
// Enable for specific actors
28+
await flipper.enableActor('premium-feature', 'user-123')
29+
30+
// Check if enabled for a specific actor
31+
const isPremiumEnabled = await flipper.isEnabledFor('premium-feature', 'user-123')
32+
console.log(isPremiumEnabled) // true
2233
```
2334

24-
### Scripts
25-
26-
- `bun run build` - Build the TypeScript source
27-
- `bun test` - Run tests
28-
- `bun run test:watch` - Run tests in watch mode
29-
- `bun run test:coverage` - Run tests with coverage
30-
- `bun run lint` - Lint code with ESLint
31-
- `bun run lint:fix` - Lint and auto-fix issues
32-
- `bun run type-check` - Check TypeScript types
33-
- `bun run format` - Format code with Prettier
34-
- `bun run format:check` - Check code formatting
35-
- `bun run clean` - Remove build artifacts
35+
## Docs
36+
37+
Looking for configuration, adapters, advanced usage, and best practices? See the full guide: [Flipper documentation](../../docs/README.md).
3638

3739
## License
3840

0 commit comments

Comments
 (0)