-
Notifications
You must be signed in to change notification settings - Fork 197
Migrate to Cloudflare #2432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to Cloudflare #2432
Changes from all commits
a6ff1e2
e2f7d7a
fdec2d3
6dcfcab
dd77cab
850ca09
080e4e6
df8cac3
43c3721
d91ca95
8d71e9e
4d2e761
1865960
02eccd8
604a55e
514ade4
31dae02
d969527
2e54f5f
178477d
947d158
937517d
f3402eb
251286d
e26bd79
f8a8558
23d26b1
7f11920
35c8d3d
f0edf23
4aafcb8
0529168
1089ce1
8ee6041
cbcea5f
53fd01d
59536a1
be90647
d13a2bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| name: Worker Build Logs | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["**"] | ||
|
|
||
| jobs: | ||
| build-logs: | ||
| if: github.repository == 'withastro/astro.build' | ||
| name: Cloudflare Worker Build | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Stream Workers Builds Logs | ||
| uses: withastro/workers-builds-log-action@v1 | ||
| with: | ||
| api-token: ${{ secrets.CF_BUILDS_API_TOKEN }} | ||
| account-id: ${{ secrets.CF_ACCOUNT_ID }} | ||
| worker-tag: ${{ secrets.CF_WORKER_TAG }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,30 @@ | ||
| // @ts-check | ||
|
|
||
| import mdx from '@astrojs/mdx'; | ||
| import netlify from '@astrojs/netlify'; | ||
| import cloudflare from '@astrojs/cloudflare'; | ||
| import sitemap from '@astrojs/sitemap'; | ||
| import tailwind from '@astrojs/tailwind'; | ||
| import { defineConfig } from 'astro/config'; | ||
| import { defineConfig, sessionDrivers } from 'astro/config'; | ||
| import astroExpressiveCode from 'astro-expressive-code'; | ||
| import icon from 'astro-icon'; | ||
| import houston from './houston.theme.json'; | ||
|
|
||
| /* https://docs.netlify.com/configure-builds/environment-variables/#read-only-variables */ | ||
| const NETLIFY_PREVIEW_SITE = process.env.CONTEXT !== 'production' && process.env.DEPLOY_PRIME_URL; | ||
| /* On Cloudflare Workers Builds, WORKERS_CI_BRANCH is set to the branch name for non-production deploys */ | ||
| const PREVIEW_SITE = process.env.WORKERS_CI_BRANCH | ||
| ? `https://${process.env.WORKERS_CI_BRANCH}.previews.astro.build` | ||
| : undefined; | ||
|
|
||
| // https://astro.build/config | ||
| export default defineConfig({ | ||
| site: NETLIFY_PREVIEW_SITE || 'https://astro.build', | ||
| site: PREVIEW_SITE || 'https://astro.build', | ||
| prefetch: true, | ||
| integrations: [ | ||
| tailwind({ | ||
| applyBaseStyles: false, | ||
| }), | ||
| astroExpressiveCode({ | ||
| themes: [houston], | ||
| shiki: { engine: 'javascript' }, | ||
| styleOverrides: { | ||
| borderRadius: '0.375rem', | ||
| borderColor: 'rgb(84 88 100)', | ||
|
|
@@ -56,8 +59,29 @@ export default defineConfig({ | |
| ssr: { | ||
| noExternal: ['smartypants'], | ||
| }, | ||
| optimizeDeps: { | ||
| include: [ | ||
| 'astro-icon > @iconify/utils > debug', | ||
| // TODO: once Expressive Code is refactored/fixed, remove this workaround for | ||
| // Expressive Code relying on CJS dependencies like postcss not compatible | ||
| // with non-Node.js compatible environments like Cloudflare. | ||
| 'astro-expressive-code/components', | ||
| 'astro-expressive-code>hast-util-select', | ||
| 'astro-expressive-code>rehype', | ||
| 'astro-expressive-code>unist-util-visit', | ||
| 'astro-expressive-code>rehype-format', | ||
| 'astro-expressive-code>hastscript', | ||
| 'astro-expressive-code>hast-util-from-html', | ||
| 'astro-expressive-code>hast-util-to-string', | ||
| 'astro-expressive-code>@expressive-code/core>postcss', | ||
|
delucis marked this conversation as resolved.
|
||
| 'astro-expressive-code>@expressive-code/core>postcss-nested', | ||
| ], | ||
| }, | ||
| }, | ||
| adapter: netlify({ imageCDN: false }), | ||
| adapter: cloudflare({ | ||
| imageService: 'cloudflare-binding', | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noting that images feel noticeably slower in the preview deploy. I think this is because Netlify had a kind of hybrid set-up:
But with Not a blocker necessarily, but worth looking into improving. I know @OliverSpeir had one suggestion in withastro/astro#15662 and there’s also withastro/astro#16194 which is related. |
||
| }), | ||
| session: { driver: sessionDrivers.lruCache() }, | ||
| experimental: { | ||
| contentIntellisense: true, | ||
| rustCompiler: true, | ||
|
|
||
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reminder for us to double check this once the PR merges.