Skip to content

Commit ff2e84a

Browse files
jkoenig134RandomByte
authored andcommitted
[FEATURE] serve: Add '--simple-index' parameter
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
1 parent abf954b commit ff2e84a

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/cli/commands/serve.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ serve.builder = function(cli) {
2525
default: false,
2626
type: "boolean"
2727
})
28+
.option("simple-index", {
29+
describe: "Use a simplified view for the server directory listing",
30+
default: false,
31+
type: "boolean"
32+
})
2833
.option("accept-remote-connections", {
2934
describe: "Accept remote connections. By default the server only accepts connections from localhost",
3035
default: false,
@@ -87,6 +92,7 @@ serve.handler = async function(argv) {
8792
port,
8893
changePortIfInUse,
8994
h2: argv.h2,
95+
simpleIndex: !!argv.simpleIndex,
9096
acceptRemoteConnections: !!argv.acceptRemoteConnections,
9197
cert: argv.h2 ? argv.cert : undefined,
9298
key: argv.h2 ? argv.key : undefined,

test/lib/cli/commands/serve.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ const defaultInitialHandlerArgs = Object.freeze({
1414
key: path.join(os.homedir(), ".ui5", "server", "server.key"),
1515
loglevel: "info",
1616
t8r: "npm",
17-
translator: "npm"
17+
translator: "npm",
18+
simpleIndex: false
1819
});
1920

2021
const projectTree = {
@@ -56,6 +57,7 @@ test.serial("ui5 serve: default", async (t) => {
5657
changePortIfInUse: true,
5758
acceptRemoteConnections: false,
5859
h2: false,
60+
simpleIndex: false,
5961
port: 8080,
6062
cert: undefined,
6163
key: undefined,
@@ -92,6 +94,7 @@ test.serial("ui5 serve --h2", async (t) => {
9294
changePortIfInUse: true,
9395
acceptRemoteConnections: false,
9496
h2: true,
97+
simpleIndex: false,
9598
port: 8443,
9699
key: "randombyte-likes-ponies-key",
97100
cert: "randombyte-likes-ponies-cert",
@@ -163,6 +166,7 @@ test.serial("ui5 serve --key --cert", async (t) => {
163166
changePortIfInUse: true,
164167
acceptRemoteConnections: false,
165168
h2: true,
169+
simpleIndex: false,
166170
port: 8443,
167171
key: "ponies-loaded-from-custompath-key",
168172
cert: "ponies-loaded-from-custompath-crt",
@@ -207,6 +211,7 @@ test.serial("ui5 serve --sap-csp-policies", async (t) => {
207211
changePortIfInUse: true,
208212
acceptRemoteConnections: false,
209213
h2: false,
214+
simpleIndex: false,
210215
port: 8080,
211216
cert: undefined,
212217
key: undefined,

0 commit comments

Comments
 (0)