@sap-ux/cap-config-writer 0.4.1 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  export { updateAppPackageJson, updateRootPackageJson } from './package-json';
2
2
  export { updateTsConfig, updateStaticLocationsInApplicationYaml } from './tsconfig-and-yaml';
3
3
  export { updatePomXml } from './pom-xml';
4
+ export { getAppLaunchText } from './utils';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updatePomXml = exports.updateStaticLocationsInApplicationYaml = exports.updateTsConfig = exports.updateRootPackageJson = exports.updateAppPackageJson = void 0;
3
+ exports.getAppLaunchText = exports.updatePomXml = exports.updateStaticLocationsInApplicationYaml = exports.updateTsConfig = exports.updateRootPackageJson = exports.updateAppPackageJson = void 0;
4
4
  var package_json_1 = require("./package-json");
5
5
  Object.defineProperty(exports, "updateAppPackageJson", { enumerable: true, get: function () { return package_json_1.updateAppPackageJson; } });
6
6
  Object.defineProperty(exports, "updateRootPackageJson", { enumerable: true, get: function () { return package_json_1.updateRootPackageJson; } });
@@ -9,4 +9,6 @@ Object.defineProperty(exports, "updateTsConfig", { enumerable: true, get: functi
9
9
  Object.defineProperty(exports, "updateStaticLocationsInApplicationYaml", { enumerable: true, get: function () { return tsconfig_and_yaml_1.updateStaticLocationsInApplicationYaml; } });
10
10
  var pom_xml_1 = require("./pom-xml");
11
11
  Object.defineProperty(exports, "updatePomXml", { enumerable: true, get: function () { return pom_xml_1.updatePomXml; } });
12
+ var utils_1 = require("./utils");
13
+ Object.defineProperty(exports, "getAppLaunchText", { enumerable: true, get: function () { return utils_1.getAppLaunchText; } });
12
14
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,11 @@
1
+ import type { CapRuntime } from '@sap-ux/odata-service-inquirer';
2
+ /**
3
+ * Generates a launch text for the launching of applications.
4
+ *
5
+ * @param capType The type of CAP runtime used in the application will be provided for CAP applications.
6
+ * @param projectName The project's name, which is the module name.
7
+ * @param appId If appId is provided, it will be used to open the application instead of the project name. This option is available for use with npm workspaces.
8
+ * @returns The launch text for the application.
9
+ */
10
+ export declare function getAppLaunchText(capType: CapRuntime, projectName: string, appId?: string): string;
11
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAppLaunchText = void 0;
4
+ const i18n_1 = require("../i18n");
5
+ /**
6
+ * Returns the url to the specified cap app as served by `cds serve` or `cds watch`.
7
+ *
8
+ * @param capType The type of CAP runtime used in the application (e.g., 'Java' or 'Node.js').
9
+ * @param projectName The project's name, which is the module name.
10
+ * @param appId If appId is provided, it will be used to open the application instead of the project name. This option is available for use with npm workspaces.
11
+ * @returns The URL for launching the project.
12
+ */
13
+ function getCapUrl(capType, projectName, appId) {
14
+ const projectPath = appId !== null && appId !== void 0 ? appId : projectName + '/webapp';
15
+ if (capType === 'Java') {
16
+ // For Java projects
17
+ return `http://localhost:8080/${projectName}/webapp/index.html`;
18
+ }
19
+ else {
20
+ // For Node.js projects or when capType is undefined
21
+ return `http://localhost:4004/${projectPath}/index.html`;
22
+ }
23
+ }
24
+ /**
25
+ * Generates a launch text for the launching of applications.
26
+ *
27
+ * @param capType The type of CAP runtime used in the application will be provided for CAP applications.
28
+ * @param projectName The project's name, which is the module name.
29
+ * @param appId If appId is provided, it will be used to open the application instead of the project name. This option is available for use with npm workspaces.
30
+ * @returns The launch text for the application.
31
+ */
32
+ function getAppLaunchText(capType, projectName, appId) {
33
+ // Determine the Maven command if the project is a Java project
34
+ const mvnCommand = capType === 'Java' ? ' (```mvn spring-boot:run```)' : '';
35
+ const capUrl = getCapUrl(capType, projectName, appId);
36
+ // Return launch text
37
+ return `${(0, i18n_1.t)('launchCapText', { mvnCommand, capUrl })}`;
38
+ }
39
+ exports.getAppLaunchText = getAppLaunchText;
40
+ //# sourceMappingURL=utils.js.map
@@ -8,5 +8,6 @@
8
8
  },
9
9
  "error": {
10
10
  "updateApplicationYaml": "Error occured while updating application yaml {{ error }}"
11
- }
11
+ },
12
+ "launchCapText": "In order to launch the generated app, simply start your CAP project{{mvnCommand}} and navigate to the following location in your browser:\n\n{{- capUrl}}"
12
13
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/cap-config-writer",
3
3
  "description": "Add or update configuration for SAP CAP projects",
4
- "version": "0.4.1",
4
+ "version": "0.5.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -26,7 +26,7 @@
26
26
  "xml-js": "1.6.11",
27
27
  "@sap-ux/logger": "0.5.1",
28
28
  "@sap-ux/project-access": "1.22.2",
29
- "@sap-ux/odata-service-inquirer": "0.3.4",
29
+ "@sap-ux/odata-service-inquirer": "0.3.5",
30
30
  "@sap-ux/yaml": "0.15.1"
31
31
  },
32
32
  "devDependencies": {