Skip to content

Commit 439b5dd

Browse files
committed
Update README and wrangler configuration for Cloudflare Workers support
1 parent e9ff9ea commit 439b5dd

2 files changed

Lines changed: 40 additions & 29 deletions

File tree

README.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<a aria-label="Version" href="https://github.com/igorkowalczyk/github-views/releases">
99
<img src="https://img.shields.io/github/v/release/igorkowalczyk/github-views?color=blue&logo=github&label=Version">
1010
</a>
11-
<a aria-label="Powered by" href="https://deno.com/deploy">
12-
<img src="https://img.shields.io/static/v1?label=Powered%20by&message=Deno&color=blue&logo=deno">
11+
<a aria-label="Powered by" href="https://workers.cloudflare.com/">
12+
<img src="https://img.shields.io/static/v1?label=Powered%20by&message=Cloudflare+Workers&color=blue&logo=cloudflareworkers">
1313
</a>
1414
<a aria-label="Powered by" href="https://astro.build">
1515
<img src="https://img.shields.io/static/v1?label=Powered%20by&message=Astro&color=blue&logo=astro&logoColor=fff">
@@ -114,30 +114,29 @@ https://views.igorkowalczyk.dev/api/json/YOUR-USERNAME
114114

115115
---
116116

117-
## 🔩 Self Hosting
117+
## 🔩 Local Development
118118

119119
1. Clone [this repository](https://github.com/igorkowalczyk/github-views) `git clone https://github.com/IgorKowalczyk/github-views.git`
120120
2. Run `pnpm i` to install all dependencies,
121-
3. Run `npm run build` to build the project or `npm run dev` to run the project in development mode.
122-
4. Run `pnpm run preview` to preview the project.
121+
3. Edit the `wrangler.jsonc` file with your values
122+
4. Run `pnpm types` to generate types for the project
123+
5. Run `pnpm dev` to start the development server or `pnpm preview` to preview the production build
123124

124-
## 🖥️ Hosting with Deno Deploy
125125

126-
1. Fork this repository on GitHub
127-
1. Go to https://deno.com/deploy and create an account
128-
2. Click "New Project" and select your account and forked repository
129-
3. Click "Add build step" and wait for the project to build
130-
2. Go to [repository settings](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings) -> [Secrets and variables -> Actions -> Variables](https://docs.github.com/en/actions/learn-github-actions/variables) and add `DENO_DEPLOY_PROJECT` variable with your [Deno Deploy](https://deno.com/deploy) project name.
131-
4. Wait for the project to build and go to the project URL
126+
## 🖥️ Hosting with Cloudflare Workers
132127

133-
> [!IMPORTANT]
134-
> This project requires access to [Deno KV](https://deno.com/kv) which is currently in beta.
135-
136-
## 🖥️ Hosting with Vercel
128+
1. Clone [this repository](https://github.com/igorkowalczyk/github-views) `git clone https://github.com/IgorKowalczyk/github-views.git`
129+
2. Run `pnpm i` to install all dependencies,
130+
2. Go to [Cloudflare Workers](https://workers.cloudflare.com/) and create a new project (you can import the project from GitHub)
131+
3. Go to Cloudflare > Storage & Databases -> KV -> Create, and create a new KV namespace
132+
3. Link the KV namespace to the project in the `wrangler.jsonc` file
133+
4. Edit the `wrangler.jsonc` file with your values
134+
4. Run `pnpm types` to generate types for the project
135+
5. Run `pnpm dev` to start the development server or `pnpm preview` to preview the production build
136+
5. If you want to deploy the project, run `pnpm check` to check the project and `pnpm deploy` to deploy the project to Cloudflare Workers
137137

138-
> [!WARNING]
139-
> Versions `>= v3` does not support Vercel hosting. If you want to host this project on Vercel, use versions
140-
`<= v2`. To do this, go to [v2 branch](https://github.com/IgorKowalczyk/github-views/tree/v2.2.1) and follow the instructions corresponding to the version.
138+
> [!NOTE]
139+
> Refer to the [Cloudflare Workers documentation](https://developers.cloudflare.com/workers) and [Wrangler documentation](https://developers.cloudflare.com/workers/tooling/wrangler) for more information.
141140
142141
## ⁉️ Issues
143142

wrangler.jsonc

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,39 @@
11
{
2-
"name": "views",
2+
"$schema": "https://unpkg.com/wrangler@latest/config-schema.json",
33
"compatibility_date": "2025-03-21",
44
"main": "./dist/_worker.js/index.js",
5-
"workers_dev": false,
6-
"preview_urls": true,
7-
"routes": [
8-
{
9-
"pattern": "views.igorkowalczyk.dev",
10-
"custom_domain": true,
11-
},
12-
],
135
"observability": {
146
"enabled": true,
157
},
168
"assets": {
179
"directory": "./dist",
1810
"binding": "ASSETS",
1911
},
20-
"upload_source_maps": true,
12+
"upload_source_maps": false,
13+
14+
// Name of your Cloudflare Worker, you can change it to whatever you want
15+
"name": "views",
16+
17+
// Go to Cloudflare > Storage & Databases -> KV -> Create
18+
// Then copy the ID and paste it here in the "id" field, don't change the "binding" field value
2119
"kv_namespaces": [
2220
{
2321
"binding": "views",
2422
"id": "fd70ac47953b45b09a8f57cf975c6733",
2523
},
2624
],
25+
26+
// Custom domain, you can use your own domain connected to Cloudflare
27+
"routes": [
28+
{
29+
"pattern": "views.igorkowalczyk.dev",
30+
"custom_domain": true,
31+
},
32+
],
33+
34+
// If you want to have a deployment domain like "..workers.dev" you can set the "workers_dev" field to true
35+
"workers_dev": false,
36+
37+
// If you want to have a preview URL like "..workers.dev" you can set the "preview_urls" field to true
38+
"preview_urls": true,
2739
}

0 commit comments

Comments
 (0)