https://github.com/seamapi/wrangler-config
A tool to help you build wrangler.toml with typescript
https://github.com/seamapi/wrangler-config
Last synced: 5 months ago
JSON representation
A tool to help you build wrangler.toml with typescript
- Host: GitHub
- URL: https://github.com/seamapi/wrangler-config
- Owner: seamapi
- Created: 2023-01-21T21:11:52.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-24T23:46:04.000Z (7 months ago)
- Last Synced: 2025-01-26T03:03:28.476Z (5 months ago)
- Language: TypeScript
- Size: 67.4 KB
- Stars: 1
- Watchers: 5
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# wrangler-config
Write your wrangler config with Typescript instead of `toml`.
Automatically generates a `wrangler.toml` file from a `wrangler.config.ts`.
## Usage
```ts
import { checkConfig } from "wrangler-config"
export default checkConfig({
name: "my-config",
main: "src/index.ts",
compatibility_date: "2023-01-20",
node_compat: true,
kv_namespaces: [
{
binding: "BLOG_CACHE",
id: "b9b24cee481e4e5387f02e2331c14349"
}
],
vars: [
MY_ENV_VAR: "b9b24cee481e4e5387f02e2331c14349"
],
triggers: {
crons: ["*/1 * * * *"]
}
})
```Running `wrangler-config` will generate the following `wrangler.toml`:
```toml
name = "my-config"
main = "src/index.ts"
compatibility_date = "2023-01-20"
node_compat = true[[kv_namespaces]]
binding = "BLOG_CACHE"
id = "b9b24cee481e4e5387f02e2331c14349"[vars]
MY_ENV_VAR = "173a62937e944f8001c8c195bf7aa2a5"[triggers]
crons = ["*/1 * * * *"]```
## As Library
You can access [types](./types.ts) by importing `wrangler-config`.
```ts
import type { WranglerConfig } from "wrangler-config"
```