Skip to content

Commit 5d16a10

Browse files
authored
Structure the tools folder with index modules (#126)
1 parent 10a47f2 commit 5d16a10

File tree

10 files changed

+12
-7
lines changed

10 files changed

+12
-7
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ jobs:
2828
run: npm install
2929

3030
- name: Build and validate all steps
31-
run: node tools/prepare-gh-pages.js
31+
run: node tools/builder

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
run: npm install
2727

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

3131
- name: Deploy to GH pages
3232
uses: peaceiris/actions-gh-pages@v4

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"author": "SAP SE",
44
"private": true,
55
"scripts": {
6-
"build": "node tools/prepare-gh-pages.js",
7-
"start": "node tools/dev-server.js"
6+
"build": "node tools/builder",
7+
"start": "node tools/dev-server"
88
},
99
"devDependencies": {
1010
"@highlightjs/cdn-assets": "^11.11.1",

tools/builder/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require("./prepare-gh-pages");
File renamed without changes.
File renamed without changes.

tools/deployer/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require("./deploy-gh-pages");

tools/dev-server/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require("./server");

tools/dev-server.js renamed to tools/dev-server/server.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ const express = require('express');
1313
const app = express();
1414
const port = 1337;
1515

16+
const cwd = process.cwd();
17+
1618
async function convertMarkdown(md) {
1719
const converter = new showdown.Converter({
1820
ghCompatibleHeaderId: true,
@@ -38,22 +40,22 @@ async function getTemplate() {
3840
return templateFn;
3941
}
4042

41-
app.use("/node_modules", express.static(join(__dirname, "..", "node_modules")));
43+
app.use("/node_modules", express.static(join(cwd, "node_modules")));
4244

4345
app.use(async (req, res, next) => {
4446
let file, url;
4547
if (req.url.endsWith("/")) {
4648
for (const index of ["index.md", "README.md"]) {
4749
url = `${req.url}${index}`;
48-
file = join(__dirname, "..", url);
50+
file = join(cwd, url);
4951
if (existsSync(file) && statSync(file).isFile()) {
5052
break;
5153
} else {
5254
file = undefined;
5355
}
5456
}
5557
} else {
56-
file = join(__dirname, "..", req.url);
58+
file = join(cwd, req.url);
5759
if (!(existsSync(file) && statSync(file).isFile())) {
5860
file = undefined;
5961
}
File renamed without changes.

0 commit comments

Comments
 (0)