Skip to content
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

Update astro #207

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 34 additions & 24 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,44 +1,54 @@
import { defineConfig } from 'astro/config'
import { CUSTOM_DOMAIN, BASE_PATH } from './src/server-constants'
import FeaturedImageDownloader from './src/integrations/featured-image-downloader'
import PublicNotionCopier from './src/integrations/public-notion-copier'
import { defineConfig } from 'astro/config';
import { CUSTOM_DOMAIN, BASE_PATH } from './src/server-constants';
import CoverImageDownloader from './src/integrations/cover-image-downloader';
import CustomIconDownloader from './src/integrations/custom-icon-downloader';
import FeaturedImageDownloader from './src/integrations/featured-image-downloader';
import PublicNotionCopier from './src/integrations/public-notion-copier';
import tailwind from '@astrojs/tailwind'
import partytown from '@astrojs/partytown'
import image from '@astrojs/image'
import mdx from '@astrojs/mdx'

const getSite = function () {
if (!process.env.CF_PAGES) {
return new URL(BASE_PATH, 'http://localhost:3000').toString()
if (CUSTOM_DOMAIN) {
return new URL(BASE_PATH, `https://${CUSTOM_DOMAIN}`).toString();
}
if (process.env.CF_PAGES_BRANCH !== 'main') {
return new URL(BASE_PATH, process.env.CF_PAGES_URL).toString()

if (process.env.VERCEL && process.env.VERCEL_URL) {
return new URL(BASE_PATH, `https://${process.env.VERCEL_URL}`).toString();
}
if (CUSTOM_DOMAIN) {
return new URL(BASE_PATH, `https://${CUSTOM_DOMAIN}`).toString()

if (process.env.CF_PAGES) {
if (process.env.CF_PAGES_BRANCH !== 'main') {
return new URL(BASE_PATH, process.env.CF_PAGES_URL).toString();
}

return new URL(
BASE_PATH,
`https://${new URL(process.env.CF_PAGES_URL).host
.split('.')
.slice(1)
.join('.')}`
).toString();
}
return new URL(
BASE_PATH,
`https://${new URL(process.env.CF_PAGES_URL).host
.split('.')
.slice(1)
.join('.')}`,
).toString()
}

return new URL(BASE_PATH, 'http://localhost:4321').toString();
};

// https://astro.build/config
export default defineConfig({
site: getSite(),
base: BASE_PATH,
integrations: [
CoverImageDownloader(),
CustomIconDownloader(),
FeaturedImageDownloader(),
PublicNotionCopier(),
tailwind(),
partytown({
config: {
forward: ['dataLayer.push'],
},
}),
image(),
FeaturedImageDownloader(),
PublicNotionCopier(),
mdx(),
],
site: 'https://cloudnativedays.jp',
})
});
Loading