From 9020109736d09fdb1ac7a0d2d35f631ea8f5df1b Mon Sep 17 00:00:00 2001 From: Sven Sauleau Date: Mon, 16 Jan 2023 16:49:33 +0000 Subject: [PATCH] format mjs files --- README.md | 25 +------------------------ frontend/mock-db/run.mjs | 16 ++++++++-------- scripts/generate-vapid-keys.mjs | 6 +++--- 3 files changed, 12 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 84d70ca..3f624cb 100644 --- a/README.md +++ b/README.md @@ -34,32 +34,9 @@ To activate **_Images_**, please login into your account, select **_Images_** on ![images subscription](https://imagedelivery.net/NkfPDviynOyTAOI79ar_GQ/fd07dede-a883-4372-b0cf-3afb6b2ab400/public) -### API token - -Before we begin, you also need to create an API token in your Cloudflare account. To do that, [login](https://dash.cloudflare.com/) into your account, and press the **_Create Token_** button under **_My Profile (top right corner) / API Tokens_**. - -![create token](https://imagedelivery.net/NkfPDviynOyTAOI79ar_GQ/589e9e1b-5c50-4269-f039-3414454c4a00/public) - -Now press **_Create Custom Token_** and add the following permissions: - -- D1, account level, edit permission. -- Cloudflare Pages, account level, edit permission. -- Access: Apps and policies, account level, edit permission. -- Access: Organizations, Identity Providers and Groups, account level, read permission. -- Workers KV Storage, account level, edit permission. -- DNS, zone level, edit permission. -- Cloudflare Images, account level, edit permission. -- Workers Scripts, account level, edit permission. - -![token permissions](https://imagedelivery.net/NkfPDviynOyTAOI79ar_GQ/c60327db-b651-4655-6c98-0f4e8c652600/public) - -You can limit the token to the specific zone where you will using Wildebeest if you want. Don't set a TTL. - -Now **_Continue to Summary_**, review your settings, and **_Create Token_**. Take note of your token and store it in your password manager, you're going to need it later. - ### Zone and Account IDs -You also need to take note of your Zone and Account IDs. To find them, [login](https://dash.cloudflare.com/) into your account and select the zone (domain) where you plan to use Wildebeest. Then, on the **_Overview_** page you will the following information: +You need to take note of your Zone and Account IDs. To find them, [login](https://dash.cloudflare.com/) into your account and select the zone (domain) where you plan to use Wildebeest. Then, on the **_Overview_** page you will the following information: ![zone and account IDs](https://imagedelivery.net/NkfPDviynOyTAOI79ar_GQ/f595d8b7-6ce9-4ef7-7416-253efd012800/w=306) diff --git a/frontend/mock-db/run.mjs b/frontend/mock-db/run.mjs index cd805b8..a5138b1 100644 --- a/frontend/mock-db/run.mjs +++ b/frontend/mock-db/run.mjs @@ -1,14 +1,14 @@ -import console from 'console'; -import { dirname, resolve } from 'path'; -import process from 'process'; -import { fileURLToPath } from 'url'; +import console from 'console' +import { dirname, resolve } from 'path' +import process from 'process' +import { fileURLToPath } from 'url' import { unstable_dev } from 'wrangler' -const __dirname = dirname(fileURLToPath(import.meta.url)); +const __dirname = dirname(fileURLToPath(import.meta.url)) /** * A simple utility to run a Cloudflare Worker that will populate a local D1 database with mock data. - * + * * Uses Wrangler's `unstable_dev()` helper to execute the Worker and exit cleanly; * this is much harder to do with the command line Wrangler binary. */ @@ -21,8 +21,8 @@ async function main() { tsconfig: resolve(__dirname, '../../tsconfig.json'), define: ['jest:{}'], } - const workerPath = resolve(__dirname, "./worker.ts"); - const worker = await unstable_dev(workerPath, {...options, experimental: {disableExperimentalWarning: true }}) + const workerPath = resolve(__dirname, './worker.ts') + const worker = await unstable_dev(workerPath, { ...options, experimental: { disableExperimentalWarning: true } }) await worker.fetch() await worker.stop() } diff --git a/scripts/generate-vapid-keys.mjs b/scripts/generate-vapid-keys.mjs index ce543d0..fb65a43 100644 --- a/scripts/generate-vapid-keys.mjs +++ b/scripts/generate-vapid-keys.mjs @@ -1,6 +1,6 @@ import { webcrypto } from 'node:crypto' -const key = await webcrypto.subtle.generateKey({ name: "ECDSA", namedCurve: "P-256" }, true, ["sign", "verify"]); -const serverKey = await webcrypto.subtle.exportKey("jwk", key.privateKey); +const key = await webcrypto.subtle.generateKey({ name: 'ECDSA', namedCurve: 'P-256' }, true, ['sign', 'verify']) +const serverKey = await webcrypto.subtle.exportKey('jwk', key.privateKey) -console.log(JSON.stringify(serverKey)); +console.log(JSON.stringify(serverKey))