Updated postbuild
This commit is contained in:
@@ -4,6 +4,7 @@ export default {
|
||||
title: 'Pixel Services Docs',
|
||||
description: 'Documentation for all public Pixel Services projects.',
|
||||
siteTitle: 'Documentation for all public Pixel Services projects.',
|
||||
ignoreDeadLinks: true,
|
||||
|
||||
head: [
|
||||
['link', { rel: 'icon', href: 'https://static.pixel-services.com/static/assets/pservices_logo.png' }]
|
||||
|
||||
@@ -29,7 +29,9 @@ You can extend the `RequestHandler` class to create custom handlers that process
|
||||
Because `RequestHandler` is an abstract class, you need to implement both the `handle()` method and the `super` constructor in your custom handler to define the logic that should be executed
|
||||
when a request is received.
|
||||
|
||||
Since `RequestHandler` is an abstract class, you can leverage and chain HDI's to create cleaner and more maintainable route logic (more on that in the [Handler Default Implementations](/flash/advanced/handler-default-implementations) section).
|
||||
Since `RequestHandler` is an abstract class, you can leverage and chain HDI's to create cleaner and more maintainable route logic (more on that in the Handler Default Implementations guide).
|
||||
|
||||
```java[Example]
|
||||
|
||||
### 2. SimpleHandler
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ corresponding file from the server. This is where a dynamic file server comes in
|
||||
|
||||
::: warning
|
||||
The dynamic file server relies heavily on the concept of dynamic handlers, which are handlers that will resolve for
|
||||
any subpath of the endpoint they are registered to (see [Handler Types](/flash/core-concepts/handlers) for more info).
|
||||
any subpath of the endpoint they are registered to (see Handler Types for more info).
|
||||
:::
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -6,11 +6,27 @@ const makeCard = require('twitter-card-image');
|
||||
const projects = ['flash', 'mobot', 'serverlibraries'];
|
||||
const baseDir = path.resolve(__dirname, './');
|
||||
const outputImageDir = path.resolve(__dirname, '../.vitepress/dist/assets/banner-cards/');
|
||||
const excludedFolders = ['assets', 'config', 'vitepress'];
|
||||
|
||||
if (!fs.existsSync(outputImageDir)) {
|
||||
fs.mkdirSync(outputImageDir, { recursive: true });
|
||||
}
|
||||
|
||||
const getMarkdownFiles = (dir) => {
|
||||
let results = [];
|
||||
const list = fs.readdirSync(dir);
|
||||
list.forEach((file) => {
|
||||
const filePath = path.join(dir, file);
|
||||
const stat = fs.statSync(filePath);
|
||||
if (stat && stat.isDirectory() && !excludedFolders.includes(file)) {
|
||||
results = results.concat(getMarkdownFiles(filePath));
|
||||
} else if (file.endsWith('.md')) {
|
||||
results.push(filePath);
|
||||
}
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
const generateBannerCard = async (filePath, outputPath) => {
|
||||
try {
|
||||
const content = fs.readFileSync(filePath, 'utf-8');
|
||||
@@ -73,7 +89,7 @@ const generateIndexImage = async () => {
|
||||
const generateImagesForProjects = async () => {
|
||||
await generateIndexImage();
|
||||
|
||||
//handle all projects
|
||||
// Handle all projects
|
||||
for (const project of projects) {
|
||||
const projectPath = path.join(baseDir, "../" + project);
|
||||
|
||||
@@ -82,10 +98,10 @@ const generateImagesForProjects = async () => {
|
||||
continue;
|
||||
}
|
||||
|
||||
const files = fs.readdirSync(projectPath).filter((file) => file.endsWith('.md'));
|
||||
for (const file of files) {
|
||||
const filePath = path.join(projectPath, file);
|
||||
const fileName = `${project}-${file.replace('.md', '')}.png`;
|
||||
const files = getMarkdownFiles(projectPath);
|
||||
for (const filePath of files) {
|
||||
const relativePath = path.relative(projectPath, filePath);
|
||||
const fileName = `${project}-${relativePath.replace(/[/\\]/g, '-')}.png`;
|
||||
const outputImagePath = path.join(outputImageDir, fileName);
|
||||
console.log(`Generating: ${fileName}`);
|
||||
await generateBannerCard(filePath, outputImagePath);
|
||||
|
||||
Reference in New Issue
Block a user