Skip to content

Commit

Permalink
npm run serve-pages (#251)
Browse files Browse the repository at this point in the history
Co-authored-by: Ralf Handl <[email protected]>
  • Loading branch information
HeikoTheissen and ralfhandl authored Apr 11, 2024
1 parent d431c2f commit 1887311
Show file tree
Hide file tree
Showing 5 changed files with 790 additions and 0 deletions.
2 changes: 2 additions & 0 deletions _site/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
12 changes: 12 additions & 0 deletions lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,15 @@ anywhere in this repository.
If you use [Visual Studio Code](https://code.visualstudio.com/), you can [run this script directly from the explorer](https://code.visualstudio.com/docs/getstarted/tips-and-tricks#_run-npm-scripts-as-tasks-from-the-explorer).

You should also install the recommended extension for [XML Language Support by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-xml). It will validate the XML files against the official [OData CDSL XML schemas](https://github.com/oasis-tcs/odata-csdl-schemas/tree/main/schemas).

`npm run pages` builds pages that can be deployed to github.io. To test these pages locally,
run `npm run serve-pages`.

Node.js packages with a dependency on `odata-vocabularies` can inherit the page building functionality
by including the following in their `package.json`:
```
"scripts": {
"pages": "node -e \"require('odata-vocabularies/pages')\" \"<package name>\"",
"serve-pages": "node -e \"require('odata-vocabularies/serve-pages')\""
}
```
11 changes: 11 additions & 0 deletions lib/serve-pages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const express = require("express");

var app = express()
.get("/", function (req, res) {
res.redirect("/odata-vocabularies/");
})
.use("/odata-vocabularies", express.static("_site"));

app.listen(8080, function () {
console.log("Server running on http://localhost:8080");
});
Loading

0 comments on commit 1887311

Please sign in to comment.