chore: prepare first release 1.0.1
This commit is contained in:
7
packages/next-utils/CHANGELOG.md
Normal file
7
packages/next-utils/CHANGELOG.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# @mintel/next-utils
|
||||
|
||||
## 1.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Initial release of the Mintel factory packages.
|
||||
@@ -1,28 +1,47 @@
|
||||
# @mintel/next-utils
|
||||
|
||||
Reusable utilities for Mintel Next.js projects.
|
||||
A collection of reusable utilities and helpers for Mintel Next.js projects, focusing on internationalization, environment safety, and security.
|
||||
|
||||
## Features
|
||||
## ✨ Features
|
||||
|
||||
- **i18n**: Standardized middleware and request configuration for `next-intl`.
|
||||
- **Env Validation**: Zod-based environment variable validation.
|
||||
- **Rate Limiting**: Simple in-memory rate limiting for server actions.
|
||||
### 🌍 Internationalization (i18n)
|
||||
Standardized helpers for `next-intl`:
|
||||
- `createMintelMiddleware`: A logging-enabled middleware wrapper.
|
||||
- `createMintelI18nRequestConfig`: Centralized request configuration for server-side translations.
|
||||
|
||||
## Usage
|
||||
### 🔐 Environment Validation
|
||||
Zod-based validation to ensure your app never boots with missing secrets:
|
||||
- `validateMintelEnv`: Validates standard Mintel variables (Mail, Sentry, Umami).
|
||||
|
||||
### i18n Middleware
|
||||
### 🛡 Rate Limiting
|
||||
- `rateLimit`: A simple in-memory rate limiter for protecting server actions and form submissions.
|
||||
|
||||
## 🚀 Usage
|
||||
|
||||
### i18n Middleware (`src/middleware.ts`)
|
||||
```typescript
|
||||
import { createMintelMiddleware } from "@mintel/next-utils";
|
||||
|
||||
export default createMintelMiddleware({
|
||||
locales: ["en", "de"],
|
||||
defaultLocale: "en",
|
||||
logRequests: true,
|
||||
});
|
||||
```
|
||||
|
||||
### Env Validation
|
||||
### Env Validation (`scripts/validate-env.ts`)
|
||||
```typescript
|
||||
import { validateMintelEnv } from "@mintel/next-utils";
|
||||
|
||||
const env = validateMintelEnv();
|
||||
validateMintelEnv();
|
||||
```
|
||||
|
||||
### Rate Limiting
|
||||
```typescript
|
||||
import { rateLimit } from "@mintel/next-utils";
|
||||
|
||||
export async function myAction(data: any) {
|
||||
await rateLimit(data.email);
|
||||
// ... logic
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@mintel/next-utils",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "https://npm.infra.mintel.me"
|
||||
|
||||
Reference in New Issue
Block a user