diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index 04037b71..77180fcd 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -16,7 +16,7 @@ permissions: contents: read jobs: - deploy-cloudflare-worker: + deploy-cfw: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index be55979b..8e5dccb7 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -18,45 +18,76 @@ permissions: contents: read jobs: - test-deno: + profile-deno: runs-on: ubuntu-latest steps: - - name: Setup repo + - name: setup repo uses: actions/checkout@v3 - - name: Setup Deno + - name: setup Deno + uses: denoland/setup-deno@v1 + with: + deno-version: v1.x + + - name: Run profile + run: deno task profile + + unit-test-deno: + runs-on: ubuntu-latest + + steps: + - name: setup repo + uses: actions/checkout@v3 + + - name: setup Deno uses: denoland/setup-deno@v1 with: deno-version: v1.x - # Uncomment this step to verify the use of 'deno fmt' on each commit. # - name: Verify formatting # run: deno fmt --check - - name: Run linter + - name: run linter run: deno lint - - name: Run tests + - name: run tests run: deno task test - # - name: Run profile - # run: deno task profile - - test-bun: + test-run-bun: runs-on: ubuntu-latest steps: - - name: Setup repo + - name: setup repo uses: actions/checkout@v3 - - name: Setup Bun.sh + - name: setup Bun.sh uses: oven-sh/setup-bun@v1 with: bun-version: latest - - name: Bun intall + - name: bun intall run: bun install - - name: Bun run - run: bun run scripts/bun.ts + - name: bun run + run: npm run test:bun + after_script: + - pkill bun + + test-run-wrangler: + runs-on: ubuntu-latest + + steps: + - name: setup repo + uses: actions/checkout@v3 + + - name: npm intall + run: npm install + + - name: setup Wrangler + run: npm install -g wrangler + + - name: wrangler dev + run: npm run test:cfw + after_script: + - pkill node diff --git a/examples/auth/app.ts b/example/auth/app.ts similarity index 97% rename from examples/auth/app.ts rename to example/auth/app.ts index bd244d26..903b931d 100644 --- a/examples/auth/app.ts +++ b/example/auth/app.ts @@ -1,4 +1,4 @@ -import * as Peko from "../../index"; // "https://deno.land/x/peko/mod.ts" +import * as Peko from "../../index.ts"; // "https://deno.land/x/peko/mod.ts" const html = String; const router = new Peko.Router(); @@ -148,4 +148,4 @@ router.get( ) ); -Deno.serve((req) => router.handle(req)); +export default router; diff --git a/examples/preact/src/assets/favicon.png b/example/preactSSR/assets/favicon.png similarity index 100% rename from examples/preact/src/assets/favicon.png rename to example/preactSSR/assets/favicon.png diff --git a/examples/preact/src/assets/lighthouse-score.png b/example/preactSSR/assets/lighthouse-score.png similarity index 100% rename from examples/preact/src/assets/lighthouse-score.png rename to example/preactSSR/assets/lighthouse-score.png diff --git a/examples/preact/src/assets/logo_dark_alpha.png b/example/preactSSR/assets/logo_dark_alpha.png similarity index 100% rename from examples/preact/src/assets/logo_dark_alpha.png rename to example/preactSSR/assets/logo_dark_alpha.png diff --git a/examples/preact/src/assets/logo_dark_alpha.webp b/example/preactSSR/assets/logo_dark_alpha.webp similarity index 100% rename from examples/preact/src/assets/logo_dark_alpha.webp rename to example/preactSSR/assets/logo_dark_alpha.webp diff --git a/examples/preact/src/assets/logo_dark_bg.png b/example/preactSSR/assets/logo_dark_bg.png similarity index 100% rename from examples/preact/src/assets/logo_dark_bg.png rename to example/preactSSR/assets/logo_dark_bg.png diff --git a/examples/preact/src/assets/logo_dark_bg.webp b/example/preactSSR/assets/logo_dark_bg.webp similarity index 100% rename from examples/preact/src/assets/logo_dark_bg.webp rename to example/preactSSR/assets/logo_dark_bg.webp diff --git a/examples/preact/src/assets/logo_light_alpha.png b/example/preactSSR/assets/logo_light_alpha.png similarity index 100% rename from examples/preact/src/assets/logo_light_alpha.png rename to example/preactSSR/assets/logo_light_alpha.png diff --git a/examples/preact/src/assets/logo_light_bg.png b/example/preactSSR/assets/logo_light_bg.png similarity index 100% rename from examples/preact/src/assets/logo_light_bg.png rename to example/preactSSR/assets/logo_light_bg.png diff --git a/examples/preact/src/assets/twemoji_chick.svg b/example/preactSSR/assets/twemoji_chick.svg similarity index 100% rename from examples/preact/src/assets/twemoji_chick.svg rename to example/preactSSR/assets/twemoji_chick.svg diff --git a/examples/preact/document.ts b/example/preactSSR/document.ts similarity index 55% rename from examples/preact/document.ts rename to example/preactSSR/document.ts index 19336f6c..3ef50783 100644 --- a/examples/preact/document.ts +++ b/example/preactSSR/document.ts @@ -1,4 +1,9 @@ -export default (tags: Record) => ` +export default (input: { + title: string; + entrypoint: string; + ssrHTML: string; + serverState?: Record; +}) => ` @@ -6,10 +11,13 @@ export default (tags: Record) => ` - ${tags && tags.title} - + ${input.title} + + - ${tags && tags.modulepreload} +