@eox/pages-theme-eox 1.8.0 → 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +83 -0
- package/cypress/support/mocks/vitepress.js +8 -1
- package/cypress.config.js +5 -0
- package/package.json +1 -1
- package/src/Layout.vue +58 -1
- package/src/authors.data.js +14 -0
- package/src/components/BlogList.vue +636 -0
- package/src/components/BlogPost.vue +450 -0
- package/src/components/FeatureCard/Index.vue +370 -26
- package/src/components/HeroSection.vue +1 -1
- package/src/components/ImageCarousel.cy.js +22 -0
- package/src/components/ImageCarousel.vue +268 -0
- package/src/components/ImageElement.cy.js +46 -0
- package/src/components/ImageElement.vue +269 -0
- package/src/components/ImageGallery.cy.js +52 -0
- package/src/components/ImageGallery.vue +622 -0
- package/src/components/SectionHeader.cy.js +54 -0
- package/src/components/SectionHeader.vue +115 -0
- package/src/components/SingleTweet.cy.js +27 -0
- package/src/components/SingleTweet.vue +155 -0
- package/src/components/TagList.vue +293 -0
- package/src/components/TeamPage.vue +333 -0
- package/src/components/TestimonialsSection.cy.js +79 -0
- package/src/components/TestimonialsSection.vue +265 -0
- package/src/index.js +21 -0
- package/src/pages/author/[author].md +4 -0
- package/src/pages/author/[author].paths.js +60 -0
- package/src/pages/blog.md +4 -0
- package/src/pages/tag/[tag].md +4 -0
- package/src/pages/tag/[tag].paths.js +49 -0
- package/src/pages/tag.md +4 -0
- package/src/pages/team.md +4 -0
- package/src/posts.data.js +96 -0
- package/src/style.css +160 -0
- package/src/tagUtils.js +148 -0
- package/src/team.data.js +51 -0
- package/src/vitepressConfig.mjs +97 -0
package/src/vitepressConfig.mjs
CHANGED
|
@@ -1,3 +1,90 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
function copyThemePages() {
|
|
5
|
+
try {
|
|
6
|
+
const themeSrcDir = path.dirname(new URL(import.meta.url).pathname);
|
|
7
|
+
const pages = [
|
|
8
|
+
{ src: "blog.md", dest: "blog.md" },
|
|
9
|
+
{ src: "tag.md", dest: "tag.md" },
|
|
10
|
+
{ src: "tag/[tag].md", dest: "tag/[tag].md" },
|
|
11
|
+
{
|
|
12
|
+
...(() => {
|
|
13
|
+
// Let's resolve the actual pages dir inside the theme package
|
|
14
|
+
// This is robust on any npm installation structure
|
|
15
|
+
return {};
|
|
16
|
+
})(),
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
// Better yet, just copy our built-in custom pages directly relative to this module
|
|
21
|
+
const filesToCopy = [
|
|
22
|
+
"blog.md",
|
|
23
|
+
"team.md",
|
|
24
|
+
"tag.md",
|
|
25
|
+
"tag/[tag].md",
|
|
26
|
+
"tag/[tag].paths.js",
|
|
27
|
+
"author/[author].md",
|
|
28
|
+
"author/[author].paths.js",
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const targetDir = process.cwd();
|
|
32
|
+
const pagesSrcDir = path.join(themeSrcDir, "pages");
|
|
33
|
+
|
|
34
|
+
for (const file of filesToCopy) {
|
|
35
|
+
const src = path.join(pagesSrcDir, file);
|
|
36
|
+
const dest = path.join(targetDir, file);
|
|
37
|
+
if (fs.existsSync(src)) {
|
|
38
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
39
|
+
|
|
40
|
+
let shouldCopy = !fs.existsSync(dest);
|
|
41
|
+
if (!shouldCopy) {
|
|
42
|
+
const srcContent = fs.readFileSync(src, "utf8");
|
|
43
|
+
const destContent = fs.readFileSync(dest, "utf8");
|
|
44
|
+
if (srcContent !== destContent) {
|
|
45
|
+
shouldCopy = true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (shouldCopy) {
|
|
49
|
+
fs.writeFileSync(dest, fs.readFileSync(src));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
} catch (err) {
|
|
54
|
+
console.error("Failed to copy theme pages:", err);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function getBlogRewrites() {
|
|
59
|
+
const rewrites = {};
|
|
60
|
+
const postsDir = path.resolve(process.cwd(), "_posts");
|
|
61
|
+
if (!fs.existsSync(postsDir)) return rewrites;
|
|
62
|
+
|
|
63
|
+
const files = fs.readdirSync(postsDir).filter((f) => f.endsWith(".md"));
|
|
64
|
+
for (const file of files) {
|
|
65
|
+
const filePath = path.join(postsDir, file);
|
|
66
|
+
const content = fs.readFileSync(filePath, "utf8");
|
|
67
|
+
const dateMatch = content.match(/date:\s*["']?(\d{4})-(\d{2})-\d{2}["']?/);
|
|
68
|
+
if (dateMatch) {
|
|
69
|
+
const [_, year, month] = dateMatch;
|
|
70
|
+
const baseName = file.replace(/\.md$/, "");
|
|
71
|
+
const slug = baseName
|
|
72
|
+
.toLowerCase()
|
|
73
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
74
|
+
.replace(/^-+|-+$/g, "");
|
|
75
|
+
rewrites[`_posts/${file}`] = `${year}/${month}/${slug}.md`;
|
|
76
|
+
} else {
|
|
77
|
+
const baseName = file.replace(/\.md$/, "");
|
|
78
|
+
const slug = baseName
|
|
79
|
+
.toLowerCase()
|
|
80
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
81
|
+
.replace(/^-+|-+$/g, "");
|
|
82
|
+
rewrites[`_posts/${file}`] = `blog/${slug}.md`;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return rewrites;
|
|
86
|
+
}
|
|
87
|
+
|
|
1
88
|
/**
|
|
2
89
|
* Base configuration for VitePress
|
|
3
90
|
* Documentation: see https://vitepress.dev/reference/site-config
|
|
@@ -5,9 +92,18 @@
|
|
|
5
92
|
* @returns
|
|
6
93
|
*/
|
|
7
94
|
export const generate = (brandConfig) => {
|
|
95
|
+
copyThemePages();
|
|
8
96
|
const config = {
|
|
9
97
|
appearance: false,
|
|
10
98
|
cleanUrls: true,
|
|
99
|
+
markdown: {
|
|
100
|
+
headers: {
|
|
101
|
+
level: [2, 3, 4, 5, 6]
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
rewrites: {
|
|
105
|
+
...getBlogRewrites(),
|
|
106
|
+
},
|
|
11
107
|
description: brandConfig.meta?.description,
|
|
12
108
|
head: [
|
|
13
109
|
["link", { rel: "icon", href: brandConfig.meta?.favicon }],
|
|
@@ -93,6 +189,7 @@ export const generate = (brandConfig) => {
|
|
|
93
189
|
],
|
|
94
190
|
srcExclude: ["README.md"],
|
|
95
191
|
themeConfig: {
|
|
192
|
+
outline: "deep",
|
|
96
193
|
siteTitle: false,
|
|
97
194
|
theme: {
|
|
98
195
|
primaryColor: brandConfig.theme?.primary_color,
|