Skip to content

Commit

Permalink
Merge branch 'main' into tools/inject-github-url
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfhandl authored Apr 11, 2024
2 parents 339127e + 2ac78a7 commit 34a894c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Build with pandoc
run: |
npm ci
npm run pages "OASIS OData TC"
npm run pages
- name: Upload artifact
uses: actions/upload-pages-artifact@v3

Expand Down
15 changes: 8 additions & 7 deletions lib/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function file(dir, title, filename) {
console.log(`${dir}/${filename}`);
pandoc(
{
stdin: fs.createReadStream(`${__dirname}/../${dir}/${filename}`),
stdin: fs.createReadStream(`${dir}/${filename}`),
stdout: fs.createWriteStream(
`_site/${dir}/${filename === "README.md" ? "index.html" : filename.replace(/\.md$/, ".html")}`,
),
Expand All @@ -25,11 +25,12 @@ function file(dir, title, filename) {
}

function directory(dir, title) {
if (fs.existsSync(`${__dirname}/../${dir}`)) {
fs.cpSync(`${__dirname}/../${dir}`, `_site/${dir}`, {
recursive: true,
});
fs.readdirSync(`${__dirname}/../${dir}`)
if (fs.existsSync(dir)) {
if (dir !== ".")
fs.cpSync(`${dir}`, `_site/${dir}`, {
recursive: true,
});
fs.readdirSync(dir)
.filter((fn) => fn.endsWith(".md"))
.forEach(function (filename) {
file(dir, title, filename);
Expand All @@ -41,7 +42,7 @@ fs.cpSync(`${__dirname}/../assets/styles`, `_site/styles`, {
recursive: true,
});

file(".", "", "README.md");
directory(".", "");
directory("docs", "Documents");
directory("examples", "Examples");
directory("vocabularies", "Vocabularies");
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"url": "git+https://github.com/oasis-tcs/odata-vocabularies.git"
},
"files": [
"lib/*"
"lib/*",
"assets/*"
],
"bin": {
"odata-vocab2md": "lib/cli.js"
Expand All @@ -32,7 +33,7 @@
},
"scripts": {
"build": "node lib/transform.js",
"pages": "node lib/pages.js",
"pages": "node lib/pages.js \"OASIS OData TC\"",
"test": "c8 -r html -r text mocha",
"watch": "mocha --watch"
},
Expand Down

0 comments on commit 34a894c

Please sign in to comment.