feat: Astro update

This commit is contained in:
Emil Gulamov 2025-01-02 19:04:59 +04:00
parent b40644e307
commit a8c09361a9
8 changed files with 1405 additions and 1160 deletions

View file

@ -4,6 +4,8 @@ import sitemap from "@astrojs/sitemap";
import compressor from "astro-compressor"; import compressor from "astro-compressor";
import starlight from "@astrojs/starlight"; import starlight from "@astrojs/starlight";
import mdx from "@astrojs/mdx";
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({
// https://docs.astro.build/en/guides/images/#authorizing-remote-images // https://docs.astro.build/en/guides/images/#authorizing-remote-images
@ -22,9 +24,7 @@ export default defineConfig({
// }, // },
// }, // },
prefetch: true, prefetch: true,
integrations: [ integrations: [tailwind(), sitemap({
tailwind(),
sitemap({
i18n: { i18n: {
defaultLocale: "en", // All urls that don't contain `fr` after `https://screwfast.uk/` will be treated as default locale, i.e. `en` defaultLocale: "en", // All urls that don't contain `fr` after `https://screwfast.uk/` will be treated as default locale, i.e. `en`
locales: { locales: {
@ -32,8 +32,7 @@ export default defineConfig({
fr: "fr", fr: "fr",
}, },
}, },
}), }), starlight({
starlight({
title: "ScrewFast Docs", title: "ScrewFast Docs",
defaultLocale: "root", defaultLocale: "root",
// https://github.com/withastro/starlight/blob/main/packages/starlight/CHANGELOG.md // https://github.com/withastro/starlight/blob/main/packages/starlight/CHANGELOG.md
@ -111,12 +110,10 @@ export default defineConfig({
}, },
}, },
], ],
}), }), compressor({
compressor({
gzip: false, gzip: false,
brotli: true, brotli: true,
}), }), mdx()],
],
experimental: { experimental: {
clientPrerender: true, clientPrerender: true,
}, },

2092
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -11,16 +11,17 @@
}, },
"dependencies": { "dependencies": {
"@astrojs/check": "^0.9.4", "@astrojs/check": "^0.9.4",
"@astrojs/mdx": "^4.0.3",
"@astrojs/sitemap": "^3.2.1", "@astrojs/sitemap": "^3.2.1",
"@astrojs/starlight": "^0.29.3", "@astrojs/starlight": "^0.30.3",
"@astrojs/starlight-tailwind": "^2.0.3", "@astrojs/starlight-tailwind": "^3.0.0",
"@astrojs/tailwind": "^5.1.3", "@astrojs/tailwind": "^5.1.4",
"@preline/accordion": "^2.5.0", "@preline/accordion": "^2.5.0",
"@preline/collapse": "^2.6.0", "@preline/collapse": "^2.6.0",
"@preline/dropdown": "^2.5.0", "@preline/dropdown": "^2.5.0",
"@preline/overlay": "^2.6.0", "@preline/overlay": "^2.6.0",
"@preline/tabs": "^2.6.0", "@preline/tabs": "^2.6.0",
"astro": "^4.16.17", "astro": "^5.1.2",
"astro-compressor": "^1.0.0", "astro-compressor": "^1.0.0",
"clipboard": "^2.0.11", "clipboard": "^2.0.11",
"globby": "^14.0.2", "globby": "^14.0.2",

97
src/content.config.ts Normal file
View file

@ -0,0 +1,97 @@
// https://docs.astro.build/en/guides/content-collections/#defining-collections
import { z, defineCollection } from 'astro:content';
import { docsSchema } from '@astrojs/starlight/schema';
import { glob } from 'astro/loaders';
const productsCollection = defineCollection({
loader: glob({ pattern: '**/[^_]*.{md,mdx}', base: "./src/content/products" }),
schema: ({ image }) => z.object({
title: z.string(),
description: z.string(),
main: z.object({
id: z.number(),
content: z.string(),
imgCard: image(),
imgMain: image(),
imgAlt: z.string(),
}),
tabs: z.array(
z.object({
id: z.string(),
dataTab: z.string(),
title: z.string(),
})
),
longDescription: z.object({
title: z.string(),
subTitle: z.string(),
btnTitle: z.string(),
btnURL: z.string(),
}),
descriptionList: z.array(
z.object({
title: z.string(),
subTitle: z.string(),
})
),
specificationsLeft: z.array(
z.object({
title: z.string(),
subTitle: z.string(),
})
),
specificationsRight: z.array(
z.object({
title: z.string(),
subTitle: z.string(),
})
).optional(),
tableData: z.array(
z.object({
feature: z.array(z.string()),
description: z.array(z.array(z.string())),
})
).optional(),
blueprints: z.object({
first: image().optional(),
second: image().optional(),
}),
}),
});
const blogCollection = defineCollection({
loader: glob({ pattern: '**/[^_]*.{md,mdx}', base: "./src/content/blog" }),
schema: ({ image }) => z.object ({
title: z.string(),
description: z.string(),
contents: z.array(z.string()),
author: z.string(),
role: z.string().optional(),
authorImage: image(),
authorImageAlt: z.string(),
pubDate: z.date(),
cardImage: image(),
cardImageAlt: z.string(),
readTime: z.number(),
tags: z.array(z.string()).optional(),
}),
});
const insightsCollection = defineCollection({
loader: glob({ pattern: '**/[^_]*.{md,mdx}', base: "./src/content/insights" }),
schema: ({ image }) => z.object ({
title: z.string(),
description: z.string(),
// contents: z.array(z.string()),
cardImage: image(),
cardImageAlt: z.string(),
}),
});
export const collections = {
docs: defineCollection({ schema: docsSchema() }),
'products': productsCollection,
'blog': blogCollection,
'insights': insightsCollection,
};

View file

@ -1,96 +1,96 @@
// https://docs.astro.build/en/guides/content-collections/#defining-collections // // https://docs.astro.build/en/guides/content-collections/#defining-collections
import { z, defineCollection } from 'astro:content'; // import { z, defineCollection } from 'astro:content';
import { docsSchema } from '@astrojs/starlight/schema'; // import { docsSchema } from '@astrojs/starlight/schema';
const productsCollection = defineCollection({ // const productsCollection = defineCollection({
type: 'content', // type: 'content',
schema: ({ image }) => z.object({ // schema: ({ image }) => z.object({
title: z.string(), // title: z.string(),
description: z.string(), // description: z.string(),
main: z.object({ // main: z.object({
id: z.number(), // id: z.number(),
content: z.string(), // content: z.string(),
imgCard: image(), // imgCard: image(),
imgMain: image(), // imgMain: image(),
imgAlt: z.string(), // imgAlt: z.string(),
}), // }),
tabs: z.array( // tabs: z.array(
z.object({ // z.object({
id: z.string(), // id: z.string(),
dataTab: z.string(), // dataTab: z.string(),
title: z.string(), // title: z.string(),
}) // })
), // ),
longDescription: z.object({ // longDescription: z.object({
title: z.string(), // title: z.string(),
subTitle: z.string(), // subTitle: z.string(),
btnTitle: z.string(), // btnTitle: z.string(),
btnURL: z.string(), // btnURL: z.string(),
}), // }),
descriptionList: z.array( // descriptionList: z.array(
z.object({ // z.object({
title: z.string(), // title: z.string(),
subTitle: z.string(), // subTitle: z.string(),
}) // })
), // ),
specificationsLeft: z.array( // specificationsLeft: z.array(
z.object({ // z.object({
title: z.string(), // title: z.string(),
subTitle: z.string(), // subTitle: z.string(),
}) // })
), // ),
specificationsRight: z.array( // specificationsRight: z.array(
z.object({ // z.object({
title: z.string(), // title: z.string(),
subTitle: z.string(), // subTitle: z.string(),
}) // })
).optional(), // ).optional(),
tableData: z.array( // tableData: z.array(
z.object({ // z.object({
feature: z.array(z.string()), // feature: z.array(z.string()),
description: z.array(z.array(z.string())), // description: z.array(z.array(z.string())),
}) // })
).optional(), // ).optional(),
blueprints: z.object({ // blueprints: z.object({
first: image().optional(), // first: image().optional(),
second: image().optional(), // second: image().optional(),
}), // }),
}), // }),
}); // });
const blogCollection = defineCollection({ // const blogCollection = defineCollection({
type: "content", // type: "content",
schema: ({ image }) => z.object ({ // schema: ({ image }) => z.object ({
title: z.string(), // title: z.string(),
description: z.string(), // description: z.string(),
contents: z.array(z.string()), // contents: z.array(z.string()),
author: z.string(), // author: z.string(),
role: z.string().optional(), // role: z.string().optional(),
authorImage: image(), // authorImage: image(),
authorImageAlt: z.string(), // authorImageAlt: z.string(),
pubDate: z.date(), // pubDate: z.date(),
cardImage: image(), // cardImage: image(),
cardImageAlt: z.string(), // cardImageAlt: z.string(),
readTime: z.number(), // readTime: z.number(),
tags: z.array(z.string()).optional(), // tags: z.array(z.string()).optional(),
}), // }),
}); // });
const insightsCollection = defineCollection({ // const insightsCollection = defineCollection({
type: "content", // type: "content",
schema: ({ image }) => z.object ({ // schema: ({ image }) => z.object ({
title: z.string(), // title: z.string(),
description: z.string(), // description: z.string(),
// contents: z.array(z.string()), // // contents: z.array(z.string()),
cardImage: image(), // cardImage: image(),
cardImageAlt: z.string(), // cardImageAlt: z.string(),
}), // }),
}); // });
export const collections = { // export const collections = {
docs: defineCollection({ schema: docsSchema() }), // docs: defineCollection({ schema: docsSchema() }),
'products': productsCollection, // 'products': productsCollection,
'blog': blogCollection, // 'blog': blogCollection,
'insights': insightsCollection, // 'insights': insightsCollection,
}; // };

View file

@ -54,7 +54,7 @@ const pageTitle: string = `${post.data.title} | ${SITE.title}`;
> >
</div> </div>
</div> </div>
<p class="text-pretty text-sm font-light text-neutral-500"> <p class="text-pretty text-sm text-neutral-500">
Table of Contents: Table of Contents:
</p> </p>
<div id="toc" class=""> <div id="toc" class="">

View file

@ -56,7 +56,7 @@ const pageTitle: string = `${post.data.title} | ${SITE.title}`;
> >
</div> </div>
</div> </div>
<p class="text-pretty text-sm font-light text-neutral-500"> <p class="text-pretty text-sm text-neutral-500">
Table of Contents: Table of Contents:
</p> </p>
<div id="toc" class=""> <div id="toc" class="">

View file

@ -12,5 +12,7 @@
"@styles/*": ["src/assets/styles/*"], "@styles/*": ["src/assets/styles/*"],
"@utils/*": ["src/utils/*"] "@utils/*": ["src/utils/*"]
}, },
} },
"include": [".astro/types.d.ts", "**/*"],
"exclude": ["dist"]
} }