From 6bb3e471bded412ca6e2298e2c8ca1b48a53f985 Mon Sep 17 00:00:00 2001 From: Max Thomson Date: Mon, 16 Jan 2023 11:39:55 -0800 Subject: [PATCH] [Pages] Move functions into src folder (#15) * [Pages] Move functions into src folder * tsconfig updates --- package.json | 10 +++++----- {functions => src/functions}/tsconfig.json | 2 +- .../functions}/v2/[[name]]/blobs/[reference]/index.ts | 2 +- .../v2/[[name]]/manifests/[reference]/index.ts | 2 +- {functions => src/functions}/v2/seed.ts | 0 src/tsconfig.json | 3 ++- tsconfig.json => tsconfig.base.json | 0 7 files changed, 10 insertions(+), 9 deletions(-) rename {functions => src/functions}/tsconfig.json (71%) rename {functions => src/functions}/v2/[[name]]/blobs/[reference]/index.ts (97%) rename {functions => src/functions}/v2/[[name]]/manifests/[reference]/index.ts (99%) rename {functions => src/functions}/v2/seed.ts (100%) rename tsconfig.json => tsconfig.base.json (100%) diff --git a/package.json b/package.json index 9367a69..50921f6 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,11 @@ "version": "0.0.1", "private": true, "scripts": { - "dev:a": "PUBLIC_GIT_SHA=$(git rev-parse --short HEAD) astro dev", - "dev:cf": "( sleep 10 && curl http://localhost:8788/v2/seed ) & PUBLIC_GIT_SHA=$(git rev-parse --short HEAD) wrangler pages dev --compatibility-date=2023-01-12 --kv containerFlareKV --r2 containerFlareR2 --binding $(cat .env) -- astro dev #--proxy 3000", - "preview": "npm run build && rm functions/[[path]].js && wrangler pages dev dist/ --compatibility-date=2023-01-12 --kv containerFlareKV --r2 containerFlareR2 --binding $(cat .env)", - "build": "PUBLIC_GIT_SHA=$(git rev-parse --short HEAD) astro build", - "publish": "npm run build && rm functions/[[path]].js && npx wrangler pages publish --branch main dist/", + "dev:a": "astro dev", + "dev:cf": "( sleep 10 && curl http://localhost:8788/v2/seed ) & cd ./src && wrangler pages dev --compatibility-date=2023-01-12 --kv containerFlareKV --r2 containerFlareR2 --binding $(cat ../.env) -- npm run --prefix ../ dev:a", + "preview": "npm run build && cd ./src && wrangler pages dev ../dist --compatibility-date=2023-01-12 --kv containerFlareKV --r2 containerFlareR2 --binding $(cat ../.env) ", + "build": "astro build && rm -rf ./functions", + "publish": "npm run build && cd ./src && wrangler pages publish ../dist #--branch main", "astro": "astro", "--Oberservability": "---------------------------------------------------------", "logs:preview": "wrangler pages deployment tail --project-name containerflare --environment preview", diff --git a/functions/tsconfig.json b/src/functions/tsconfig.json similarity index 71% rename from functions/tsconfig.json rename to src/functions/tsconfig.json index dd366d5..6f39b2b 100644 --- a/functions/tsconfig.json +++ b/src/functions/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "target": "ESNext", "module": "ESNext", diff --git a/functions/v2/[[name]]/blobs/[reference]/index.ts b/src/functions/v2/[[name]]/blobs/[reference]/index.ts similarity index 97% rename from functions/v2/[[name]]/blobs/[reference]/index.ts rename to src/functions/v2/[[name]]/blobs/[reference]/index.ts index 8972f25..ec0aca4 100644 --- a/functions/v2/[[name]]/blobs/[reference]/index.ts +++ b/src/functions/v2/[[name]]/blobs/[reference]/index.ts @@ -1,4 +1,4 @@ -import type { +import { EventContext, PagesFunction, Response, diff --git a/functions/v2/[[name]]/manifests/[reference]/index.ts b/src/functions/v2/[[name]]/manifests/[reference]/index.ts similarity index 99% rename from functions/v2/[[name]]/manifests/[reference]/index.ts rename to src/functions/v2/[[name]]/manifests/[reference]/index.ts index 11a455b..b2cf49b 100644 --- a/functions/v2/[[name]]/manifests/[reference]/index.ts +++ b/src/functions/v2/[[name]]/manifests/[reference]/index.ts @@ -1,4 +1,4 @@ -import type { +import { EventContext, PagesFunction, Response, diff --git a/functions/v2/seed.ts b/src/functions/v2/seed.ts similarity index 100% rename from functions/v2/seed.ts rename to src/functions/v2/seed.ts diff --git a/src/tsconfig.json b/src/tsconfig.json index 57f8ef5..9b60755 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -1,5 +1,6 @@ { - "extends": "../tsconfig.json", + "extends": "../tsconfig.base.json", + "exclude": ["./functions"], "compilerOptions": { "target": "ESNext", "module": "ESNext", diff --git a/tsconfig.json b/tsconfig.base.json similarity index 100% rename from tsconfig.json rename to tsconfig.base.json