Skip to content
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

npm run serve-pages #251

Merged
merged 5 commits into from
Apr 11, 2024
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: 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