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

Upgrade to astro 4 (next try) #2200

Open
wants to merge 16 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
89 changes: 45 additions & 44 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import admonitionsPlugin from './bin/remark-admonitions.js';
import { mermaid } from './bin/remark-mermaid.ts';
import pipelines_json from '/public/pipelines.json';
import githubDarkDimmed from '/public/themes/github-dark-dimmed.json';
import mdx from '@astrojs/mdx';
import netlify from '@astrojs/netlify/functions';
import netlify from '@astrojs/netlify';
import partytown from '@astrojs/partytown';
import prefetch from '@astrojs/prefetch';
import sitemap from '@astrojs/sitemap';
import svelte from '@astrojs/svelte';
import yaml from '@rollup/plugin-yaml';
Expand All @@ -23,9 +21,10 @@ import remarkDirective from 'remark-directive';
import emoji from 'remark-emoji';
import remarkGfm from 'remark-gfm';
import remarkMath from 'remark-math';
import mermaid from '@dendronhq/remark-mermaid';
import remarkDescription from 'astro-remark-description';
import markdownIntegration from '@astropub/md';
import icon from "astro-icon";
import icon from 'astro-icon';

const latestToolsRelease = await fetch('https://api.github.com/repos/nf-core/tools/releases/latest')
.then((res) => res.json())
Expand All @@ -39,7 +38,8 @@ pipelines_json.remote_workflows.map(
export default defineConfig({
site: 'https://nf-co.re/',
output: 'hybrid',
adapter: netlify(),
adapter: netlify({ cacheOnDemandPages: true }),
prefetch: false,
redirects: {
...latestPipelineReleases,
},
Expand All @@ -66,7 +66,6 @@ export default defineConfig({
},
}),
sitemap(),
prefetch(),
partytown({
// Adds dataLayer.push as a forwarding-event.
config: {
Expand All @@ -91,18 +90,13 @@ export default defineConfig({
}),
],
ssr: {
noExternal: ['@popperjs/core', 'bin/cache.js'],
noExternal: ['@popperjs/core', 'bin/cache.js', 'sharp'],
optimizeDeps: { exclude: ['sharp'] },
},
resolve: {
preserveSymlinks: true,
},
},
image: {
domains: ['raw.githubusercontent.com', 'unsplash.com'],
service: {
entrypoint: 'astro/assets/services/sharp',
},
},
markdown: {
syntaxHighlight: false,
shikiConfig: {
Expand All @@ -115,40 +109,47 @@ export default defineConfig({
remarkGfm,
remarkDirective,
admonitionsPlugin,
mermaid,
[mermaid, { simple: true }],
remarkMath,
[
remarkDescription,
{
name: 'excerpt',
node: (node, i, parent) => {
// check if parent has a child that is an html comment with the text 'end of excerpt'
if (
parent?.children?.some(
(child) =>
(child.type === 'html' && child.value === '<!-- end of excerpt -->') ||
(child.type === 'mdxFlowExpression' && child?.value === '/* end of excerpt */'),
)
) {
const sibling = parent?.children[i + 1];
// [
// remarkDescription,
// {
// name: 'excerpt',
// node: (node, i, parent) => {
// // check if parent has a child that is an html comment with the text 'end of excerpt'
// if (
// parent?.children?.some(
// (child) =>
// (child.type === 'html' && child.value === '<!-- end of excerpt -->') ||
// (child.type === 'mdxFlowExpression' && child?.value === '/* end of excerpt */'),
// )
// ) {
// const sibling = parent?.children[i + 1];

return (
(sibling?.type === 'html' && sibling?.value === '<!-- end of excerpt -->') ||
(sibling?.type === 'mdxFlowExpression' && sibling?.value === '/* end of excerpt */')
);
} else {
// return the first paragraph otherwise
// return (
// (sibling?.type === 'html' && sibling?.value === '<!-- end of excerpt -->') ||
// (sibling?.type === 'mdxFlowExpression' && sibling?.value === '/* end of excerpt */')
// );
// } else {
// // return the first paragraph otherwise

// get the index of the first paragraph
const firstParagraphIndex = parent?.children.findIndex(
(child) => child.type === 'paragraph',
);
// if the node is the first paragraph, return true
return i === firstParagraphIndex;
}
},
},
],
// // get the index of the first paragraph
// const firstParagraphIndex = parent?.children.findIndex(
// (child) => child.type === 'paragraph',
// );
// // if the node is the first paragraph, return true
// return i === firstParagraphIndex;
// }
// },
// filter: (options, { path }) => {
// console.log(path);
// if (path.startsWith('/src/content/blog')) {
// return false; // Return falsey value to skip
// }
// return options;
// },
// },
// ],
],
// NOTE: Also update the plugins in `src/components/Markdown.svelte`!
rehypePlugins: [
Expand Down
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
external_node_modules = ["vscode-oniguruma","shiki"]
node_bundler = "esbuild"
[build]
environment = { NODE_VERSION = "20.4.0" }
environment = { NODE_VERSION = "20.11.0" }
Loading