Skip to content

Commit

Permalink
[FEATURE] serve: Add '--simple-index' parameter (#265)
Browse files Browse the repository at this point in the history
The directory listing of the UI5 Server has been overhauled by
integrating parts of the serve-index[1] project (see [2]).

The '--simple-index' flag allows to toggle between a detailed- and a
simplified rendering of the directory index.

Thanks to @jkoenig134 for this contribution!

[1] https://github.com/expressjs/serve-index
[2] SAP/ui5-server#253
  • Loading branch information
jkoenig134 authored and RandomByte committed Nov 7, 2019
1 parent abf954b commit dbe195e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/cli/commands/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ serve.builder = function(cli) {
default: false,
type: "boolean"
})
.option("simple-index", {
describe: "Use a simplified view for the server directory listing",
default: false,
type: "boolean"
})
.option("accept-remote-connections", {
describe: "Accept remote connections. By default the server only accepts connections from localhost",
default: false,
Expand Down Expand Up @@ -87,6 +92,7 @@ serve.handler = async function(argv) {
port,
changePortIfInUse,
h2: argv.h2,
simpleIndex: !!argv.simpleIndex,
acceptRemoteConnections: !!argv.acceptRemoteConnections,
cert: argv.h2 ? argv.cert : undefined,
key: argv.h2 ? argv.key : undefined,
Expand Down
7 changes: 6 additions & 1 deletion test/lib/cli/commands/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const defaultInitialHandlerArgs = Object.freeze({
key: path.join(os.homedir(), ".ui5", "server", "server.key"),
loglevel: "info",
t8r: "npm",
translator: "npm"
translator: "npm",
simpleIndex: false
});

const projectTree = {
Expand Down Expand Up @@ -56,6 +57,7 @@ test.serial("ui5 serve: default", async (t) => {
changePortIfInUse: true,
acceptRemoteConnections: false,
h2: false,
simpleIndex: false,
port: 8080,
cert: undefined,
key: undefined,
Expand Down Expand Up @@ -92,6 +94,7 @@ test.serial("ui5 serve --h2", async (t) => {
changePortIfInUse: true,
acceptRemoteConnections: false,
h2: true,
simpleIndex: false,
port: 8443,
key: "randombyte-likes-ponies-key",
cert: "randombyte-likes-ponies-cert",
Expand Down Expand Up @@ -163,6 +166,7 @@ test.serial("ui5 serve --key --cert", async (t) => {
changePortIfInUse: true,
acceptRemoteConnections: false,
h2: true,
simpleIndex: false,
port: 8443,
key: "ponies-loaded-from-custompath-key",
cert: "ponies-loaded-from-custompath-crt",
Expand Down Expand Up @@ -207,6 +211,7 @@ test.serial("ui5 serve --sap-csp-policies", async (t) => {
changePortIfInUse: true,
acceptRemoteConnections: false,
h2: false,
simpleIndex: false,
port: 8080,
cert: undefined,
key: undefined,
Expand Down

0 comments on commit dbe195e

Please sign in to comment.