Skip to content

Structure the tools folder with index modules #126

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

Merged
merged 1 commit into from
Mar 25, 2025
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
run: npm install

- name: Build and validate all steps
run: node tools/prepare-gh-pages.js
run: node tools/builder
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: npm install

- name: Build and validate all steps
run: node tools/prepare-gh-pages.js
run: node tools/deployer

- name: Deploy to GH pages
uses: peaceiris/actions-gh-pages@v4
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"author": "SAP SE",
"private": true,
"scripts": {
"build": "node tools/prepare-gh-pages.js",
"start": "node tools/dev-server.js"
"build": "node tools/builder",
"start": "node tools/dev-server"
},
"devDependencies": {
"@highlightjs/cdn-assets": "^11.11.1",
Expand Down
1 change: 1 addition & 0 deletions tools/builder/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require("./prepare-gh-pages");
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions tools/deployer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require("./deploy-gh-pages");
1 change: 1 addition & 0 deletions tools/dev-server/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require("./server");
8 changes: 5 additions & 3 deletions tools/dev-server.js → tools/dev-server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const express = require('express');
const app = express();
const port = 1337;

const cwd = process.cwd();

async function convertMarkdown(md) {
const converter = new showdown.Converter({
ghCompatibleHeaderId: true,
Expand All @@ -38,22 +40,22 @@ async function getTemplate() {
return templateFn;
}

app.use("/node_modules", express.static(join(__dirname, "..", "node_modules")));
app.use("/node_modules", express.static(join(cwd, "node_modules")));

app.use(async (req, res, next) => {
let file, url;
if (req.url.endsWith("/")) {
for (const index of ["index.md", "README.md"]) {
url = `${req.url}${index}`;
file = join(__dirname, "..", url);
file = join(cwd, url);
if (existsSync(file) && statSync(file).isFile()) {
break;
} else {
file = undefined;
}
}
} else {
file = join(__dirname, "..", req.url);
file = join(cwd, req.url);
if (!(existsSync(file) && statSync(file).isFile())) {
file = undefined;
}
Expand Down
File renamed without changes.