diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 000000000000..78d585db6faa --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,31 @@ +name: Deploy +on: + push: + branches: [main] + pull_request: + branches: main + +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + + permissions: + id-token: write # Needed for auth with Deno Deploy + contents: read # Needed to clone the repository + + steps: + - name: Clone repository + uses: actions/checkout@v3 + + - name: Install Deno + uses: denoland/setup-deno@v1 + + - name: Build step + run: deno task build + + - name: Upload to Deno Deploy + uses: denoland/deployctl@v1 + with: + project: saaskit + entrypoint: ./main.ts \ No newline at end of file diff --git a/.gitignore b/.gitignore index 507624c08704..18d7efa882f3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ cov/ cov.lcov .idea +_fresh/ diff --git a/deno.json b/deno.json index 1fd9a25db4ea..a2037c3d0042 100644 --- a/deno.json +++ b/deno.json @@ -11,7 +11,9 @@ "check:types": "deno check **/*.ts && deno check **/*.tsx", "ok": "deno fmt --check && deno lint && deno task check:license --check && deno task check:types && deno task test", "cov": "deno coverage ./cov/ --lcov --exclude='test.ts' > cov.lcov", - "update": "deno run -A -r https://fresh.deno.dev/update ." + "update": "deno run -A -r https://fresh.deno.dev/update .", + "build": "deno run -A --unstable dev.ts build", + "preview": "deno run -A --unstable main.ts" }, "compilerOptions": { "jsx": "react-jsx", @@ -19,11 +21,11 @@ }, "imports": { "@/": "./", - "$fresh/": "https://raw.githubusercontent.com/denoland/fresh/726740ed39aa0c5a9c484f4eba4f6e329cf730d1/", + "$fresh/": "https://deno.land/x/fresh@1.4.2/", "$gfm": "https://deno.land/x/gfm@0.2.4/mod.ts", "preact": "https://esm.sh/preact@10.15.1", "preact/": "https://esm.sh/preact@10.15.1/", - "preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.2.0", + "preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.2.1", "@preact/signals": "https://esm.sh/*@preact/signals@1.1.3", "@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.2.3", "twind-preset-tailwind/": "https://esm.sh/@twind/preset-tailwind@1.1.4/", @@ -37,7 +39,8 @@ "fresh_charts/": "https://deno.land/x/fresh_charts@0.3.1/" }, "exclude": [ - "cov/" + "cov/", + "_fresh/" ], "lint": { "rules": { diff --git a/dev.ts b/dev.ts index e35895a3355e..c3879c1cb47d 100755 --- a/dev.ts +++ b/dev.ts @@ -2,6 +2,7 @@ // Copyright 2023 the Deno authors. All rights reserved. MIT license. import dev from "$fresh/dev.ts"; +import config from "./fresh.config.ts"; import "std/dotenv/load.ts"; -await dev(import.meta.url, "./main.ts"); +await dev(import.meta.url, "./main.ts", config); diff --git a/fresh.config.ts b/fresh.config.ts new file mode 100644 index 000000000000..89cb393c1294 --- /dev/null +++ b/fresh.config.ts @@ -0,0 +1,8 @@ +// Copyright 2023 the Deno authors. All rights reserved. MIT license. +import { defineConfig } from "$fresh/server.ts"; +import twindPlugin from "$fresh/plugins/twindv1.ts"; +import twindConfig from "./twind.config.ts"; + +export default defineConfig({ + plugins: [twindPlugin(twindConfig)], +}); diff --git a/main.ts b/main.ts index d0bb8bb2d8d2..14af0c7f4a8a 100644 --- a/main.ts +++ b/main.ts @@ -8,9 +8,7 @@ import { start } from "$fresh/server.ts"; import manifest from "./fresh.gen.ts"; - -import twindPlugin from "$fresh/plugins/twindv1.ts"; -import twindConfig from "./twind.config.ts"; +import config from "./fresh.config.ts"; /** * @todo Remove at v1. This is a quick way to reset Deno KV, as database changes are likely to occur and require reset. @@ -29,4 +27,4 @@ if (Deno.env.get("MIGRATE_DENO_KV") === "1") { await migrateKv(); } -await start(manifest, { plugins: [twindPlugin(twindConfig)] }); +await start(manifest, config);