Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dario-piotrowicz/cf-bindings-cli-idea-poc
https://github.com/dario-piotrowicz/cf-bindings-cli-idea-poc
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/dario-piotrowicz/cf-bindings-cli-idea-poc
- Owner: dario-piotrowicz
- Created: 2023-11-27T18:49:19.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2023-12-01T09:41:11.000Z (12 months ago)
- Last Synced: 2024-04-18T06:19:59.821Z (7 months ago)
- Language: JavaScript
- Size: 2.8 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cf-bindings-cli-idea-poc
## To run the applications
Install dependencies with
```
pnpm i
```then for each app in `/apps`:
```
pnpm dev
```
runs the standard dev serverto build the application using the `poc` library run:
```
pnpm poc_build
```and to then start it using wrangler:
```
pnpm pages:preview
```## Env Types
Note that in every application you can see a `worker-configuration.d.ts` file, such files have been
generated by running
```
pnpm wrangler types
```
in the application's directoryThe command just read the toml file (the same used in dev mode by the `poc` library) and extended accordingly the `Env` interface which is used by the `poc` library to provide a valid type of the `env` object.
This means that users only need to run `wrangler types` and the `poc` library takes care of everything! 🎉 (PS: they do however need to make sure to have `@cloudflare/workers-types` installed, have it added to their `tsconfig.json` and also make sure that the framework picks up the new `d.ts` file 😢)
> [!warning]
> Note that in the toml files I always needed to provide a value for the `main` field although it doesn't make sense in our setup, that's something we might need to address in wrangler### QUESTION
`Env` seems pretty generic and I feel that it might sometimes even overlap with other framework types, I would likely prefer something more specific like `CloudflareEnv`, what do you think? If we wanted to go with something like this I think we'd need to get the `wrangler type` command accept a new flag that allows it to use a different name for the interface, something like this:
```
wrangler types --interface-name CloudflareEnv
```