Migrate to wrangler v2
This commit is contained in:
parent
6b347052a4
commit
760f9f3f07
5 changed files with 7 additions and 31 deletions
4
.github/workflows/deploy-master-to-prod.yml
vendored
4
.github/workflows/deploy-master-to-prod.yml
vendored
|
@ -10,9 +10,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: wrangler publish
|
- name: wrangler publish
|
||||||
uses: cloudflare/wrangler-action@1.3.0
|
uses: cloudflare/wrangler-action@2.0.0
|
||||||
with:
|
with:
|
||||||
apiToken: ${{ secrets.CF_API_TOKEN }}
|
apiToken: ${{ secrets.CF_API_TOKEN }}
|
||||||
environment: omaps
|
environment: omaps
|
||||||
|
|
||||||
# TODO: Add organicmaps deploy.
|
|
|
@ -30,11 +30,7 @@ npm i
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
Use `npx wrangler dev` for localhost development.
|
Use `npx wrangler dev` for development using Cloudflare, or `npx wrangler dev --local` for localhost development.
|
||||||
|
|
||||||
## Preview on workers.dev
|
|
||||||
|
|
||||||
Use `npx wrangler preview` to open and test deployed worker in browser.
|
|
||||||
|
|
||||||
## Deployment
|
## Deployment
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ const OMAPS_REWRITE_RULES: Record<string, string> = {
|
||||||
addEventListener('fetch', (event) => {
|
addEventListener('fetch', (event) => {
|
||||||
try {
|
try {
|
||||||
event.respondWith(handleFetchEvent(event));
|
event.respondWith(handleFetchEvent(event));
|
||||||
} catch (e) {
|
} catch (e: any) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
event.respondWith(new Response(e.message || e.toString(), { status: 500 }));
|
event.respondWith(new Response(e.message || e.toString(), { status: 500 }));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -6,12 +6,12 @@
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"target": "ESNext",
|
"target": "ESNext",
|
||||||
"lib": [
|
"lib": [
|
||||||
"ESNext",
|
"ESNext"
|
||||||
"webworker"
|
|
||||||
],
|
],
|
||||||
"alwaysStrict": true,
|
"alwaysStrict": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"preserveConstEnums": true,
|
"preserveConstEnums": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"types": [
|
"types": [
|
||||||
|
|
|
@ -1,44 +1,26 @@
|
||||||
# Default worker is for dev only.
|
# Default worker is for dev only.
|
||||||
# See omaps and organicmaps environments below for production.
|
# See omaps and organicmaps environments below for production.
|
||||||
name = 'url-processor'
|
name = 'url-processor'
|
||||||
type = 'javascript'
|
|
||||||
# Organic Maps CF Account ID.
|
# Organic Maps CF Account ID.
|
||||||
account_id = '462f578f0939f041e2c24ec99adce458'
|
account_id = '462f578f0939f041e2c24ec99adce458'
|
||||||
workers_dev = true
|
workers_dev = true
|
||||||
compatibility_date = "2022-10-06"
|
compatibility_date = '2022-11-21'
|
||||||
|
main = './workers-site/index.js'
|
||||||
|
|
||||||
[site]
|
[site]
|
||||||
bucket = './public'
|
bucket = './public'
|
||||||
entry-point = './workers-site'
|
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
upload.format = 'service-worker'
|
|
||||||
command = 'npm i --prefer-offline --no-audit && npm run build'
|
command = 'npm i --prefer-offline --no-audit && npm run build'
|
||||||
|
|
||||||
[vars]
|
[vars]
|
||||||
DEBUG = true
|
DEBUG = true
|
||||||
|
|
||||||
|
|
||||||
[env.omaps]
|
[env.omaps]
|
||||||
name = 'url-processor-omaps'
|
name = 'url-processor-omaps'
|
||||||
workers_dev = false
|
workers_dev = false
|
||||||
# omaps.app CF zone ID.
|
|
||||||
zone_id = '3fce06554abc3899504e11d928be0ee7'
|
|
||||||
# See the full list of handled files in the code.
|
# See the full list of handled files in the code.
|
||||||
route = 'omaps.app/*'
|
route = 'omaps.app/*'
|
||||||
|
|
||||||
[env.omaps.vars]
|
[env.omaps.vars]
|
||||||
DEBUG = false
|
DEBUG = false
|
||||||
|
|
||||||
|
|
||||||
#[env.organicmaps]
|
|
||||||
#DEBUG = false
|
|
||||||
#name = 'url-processor-organicmaps'
|
|
||||||
#workers_dev = false
|
|
||||||
# organicmaps.app CF zone ID.
|
|
||||||
#zone_id = 'a520ad91909e819d66c62f53f9454589'
|
|
||||||
# See the full list of handled files in the code.
|
|
||||||
#route = 'organicmaps.app/*'
|
|
||||||
|
|
||||||
[env.organicmaps.vars]
|
|
||||||
DEBUG = false
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue