diff --git a/README.md b/README.md index d114cc4..f5f09bb 100644 --- a/README.md +++ b/README.md @@ -26,11 +26,14 @@ The top of each sample's screen says which of the two answered. ```bash npm install -cds watch # needs @sap/cds-dk (npm i -g @sap/cds-dk) - or: npm run mocked +npm start # cds-serve --with-mocks - or cds watch, with @sap/cds-dk installed ``` -`cds watch` prints the address of every sample. Log in as `alice` with an -empty password (CAP's mocked development user), then open +`--with-mocks` is what `cds watch` passes: every remote system without +credentials is mocked. In the production profile CAP ignores the flag, so the +same script serves a deployment. The log prints the address of every sample. +Log in as `alice` with an empty password (CAP's mocked development user), then +open or . diff --git a/package.json b/package.json index 356abc2..42b22b6 100644 --- a/package.json +++ b/package.json @@ -41,9 +41,8 @@ "fast-xml-parser": "^5.11.1" }, "scripts": { - "start": "cds-serve", + "start": "cds-serve --with-mocks", "watch": "cds watch", - "mocked": "cds-serve --with-mocks", "test": "node --test test/*.test.mjs", "lint": "eslint ." }, diff --git a/srv/apps/z2ui5_cl_caps_app_001.js b/srv/apps/z2ui5_cl_caps_app_001.js index 3c6b7ca..b3a5f08 100644 --- a/srv/apps/z2ui5_cl_caps_app_001.js +++ b/srv/apps/z2ui5_cl_caps_app_001.js @@ -280,6 +280,7 @@ function source_of(srv) { if (srv.mocked) return `the mock of ${srv.name} - cds watch serves it while no credentials are configured`; const { url, destination } = srv.options.credentials ?? {}; if (destination) return `destination ${destination}`; - const u = new URL(url); + let u; + try { u = new URL(url); } catch { return srv.name; } // no url, or not one: the query's error says so return u.origin + u.pathname; } diff --git a/srv/apps/z2ui5_cl_caps_app_002.js b/srv/apps/z2ui5_cl_caps_app_002.js index 877c8c6..fefd182 100644 --- a/srv/apps/z2ui5_cl_caps_app_002.js +++ b/srv/apps/z2ui5_cl_caps_app_002.js @@ -356,7 +356,8 @@ function dats(value) { // host and client, and never user or password. function source_of(srv) { if (srv.mocked) return `the mock of ${srv.name} - cds watch serves it while no credentials are configured`; - const { destination, ashost, mshost, client } = srv.options.credentials ?? {}; + const { destination, ashost, mshost, wshost, client } = srv.options.credentials ?? {}; if (destination) return `destination ${destination}`; - return `${ashost ?? mshost}, client ${client}`; + const host = ashost ?? mshost ?? wshost; + return host ? `${host}, client ${client}` : srv.name; // incomplete credentials: the call's error says so }