@sap-ux/launch-config 0.2.0

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.
Files changed (51) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +22 -0
  3. package/dist/index.d.ts +10 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +38 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/launch-config-crud/create.d.ts +12 -0
  8. package/dist/launch-config-crud/create.d.ts.map +1 -0
  9. package/dist/launch-config-crud/create.js +43 -0
  10. package/dist/launch-config-crud/create.js.map +1 -0
  11. package/dist/launch-config-crud/delete.d.ts +11 -0
  12. package/dist/launch-config-crud/delete.d.ts.map +1 -0
  13. package/dist/launch-config-crud/delete.js +30 -0
  14. package/dist/launch-config-crud/delete.js.map +1 -0
  15. package/dist/launch-config-crud/modify.d.ts +12 -0
  16. package/dist/launch-config-crud/modify.d.ts.map +1 -0
  17. package/dist/launch-config-crud/modify.js +152 -0
  18. package/dist/launch-config-crud/modify.js.map +1 -0
  19. package/dist/launch-config-crud/read.d.ts +50 -0
  20. package/dist/launch-config-crud/read.d.ts.map +1 -0
  21. package/dist/launch-config-crud/read.js +149 -0
  22. package/dist/launch-config-crud/read.js.map +1 -0
  23. package/dist/launch-config-crud/update.d.ts +14 -0
  24. package/dist/launch-config-crud/update.d.ts.map +1 -0
  25. package/dist/launch-config-crud/update.js +131 -0
  26. package/dist/launch-config-crud/update.js.map +1 -0
  27. package/dist/launch-config-crud/utils.d.ts +44 -0
  28. package/dist/launch-config-crud/utils.d.ts.map +1 -0
  29. package/dist/launch-config-crud/utils.js +235 -0
  30. package/dist/launch-config-crud/utils.js.map +1 -0
  31. package/dist/launch-config-crud/writer.d.ts +14 -0
  32. package/dist/launch-config-crud/writer.d.ts.map +1 -0
  33. package/dist/launch-config-crud/writer.js +35 -0
  34. package/dist/launch-config-crud/writer.js.map +1 -0
  35. package/dist/project-discovery/project.d.ts +14 -0
  36. package/dist/project-discovery/project.d.ts.map +1 -0
  37. package/dist/project-discovery/project.js +82 -0
  38. package/dist/project-discovery/project.js.map +1 -0
  39. package/dist/types/constants.d.ts +4 -0
  40. package/dist/types/constants.d.ts.map +1 -0
  41. package/dist/types/constants.js +7 -0
  42. package/dist/types/constants.js.map +1 -0
  43. package/dist/types/index.d.ts +3 -0
  44. package/dist/types/index.d.ts.map +1 -0
  45. package/dist/types/index.js +19 -0
  46. package/dist/types/index.js.map +1 -0
  47. package/dist/types/types.d.ts +54 -0
  48. package/dist/types/types.d.ts.map +1 -0
  49. package/dist/types/types.js +10 -0
  50. package/dist/types/types.js.map +1 -0
  51. package/package.json +48 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # @sap-ux/launch-config
2
+
3
+ Library that offers functions to read and modify launch configurations for applications.
4
+
5
+
6
+ ## Installation
7
+ Npm
8
+ `npm install --save @sap-ux/launch-config`
9
+
10
+ Yarn
11
+ `yarn add @sap-ux/launch-config`
12
+
13
+ Pnpm
14
+ `pnpm add @sap-ux/launch-config`
15
+
16
+ ## Usage
17
+ See usage in `test/` folder.
18
+
19
+ ## Keywords
20
+ * SAP Fiori tools
21
+ * SAP Fiori elements
22
+ * SAP Fiori freestyle
@@ -0,0 +1,10 @@
1
+ export * from './types';
2
+ export { createLaunchConfig } from './launch-config-crud/create';
3
+ export { deleteLaunchConfig } from './launch-config-crud/delete';
4
+ export { convertOldLaunchConfigToFioriRun } from './launch-config-crud/modify';
5
+ export { getLaunchConfigs, getLaunchConfigByName } from './launch-config-crud/read';
6
+ export { updateLaunchConfig } from './launch-config-crud/update';
7
+ export { getIndexOfArgument, getFioriOptions, generateNewFioriLaunchConfig } from './launch-config-crud/utils';
8
+ export { updateLaunchJSON } from './launch-config-crud/writer';
9
+ export { getDefaultLaunchConfigOptionsForProject } from './project-discovery/project';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,gCAAgC,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAC/G,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,uCAAuC,EAAE,MAAM,6BAA6B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.getDefaultLaunchConfigOptionsForProject = exports.updateLaunchJSON = exports.generateNewFioriLaunchConfig = exports.getFioriOptions = exports.getIndexOfArgument = exports.updateLaunchConfig = exports.getLaunchConfigByName = exports.getLaunchConfigs = exports.convertOldLaunchConfigToFioriRun = exports.deleteLaunchConfig = exports.createLaunchConfig = void 0;
18
+ __exportStar(require("./types"), exports);
19
+ var create_1 = require("./launch-config-crud/create");
20
+ Object.defineProperty(exports, "createLaunchConfig", { enumerable: true, get: function () { return create_1.createLaunchConfig; } });
21
+ var delete_1 = require("./launch-config-crud/delete");
22
+ Object.defineProperty(exports, "deleteLaunchConfig", { enumerable: true, get: function () { return delete_1.deleteLaunchConfig; } });
23
+ var modify_1 = require("./launch-config-crud/modify");
24
+ Object.defineProperty(exports, "convertOldLaunchConfigToFioriRun", { enumerable: true, get: function () { return modify_1.convertOldLaunchConfigToFioriRun; } });
25
+ var read_1 = require("./launch-config-crud/read");
26
+ Object.defineProperty(exports, "getLaunchConfigs", { enumerable: true, get: function () { return read_1.getLaunchConfigs; } });
27
+ Object.defineProperty(exports, "getLaunchConfigByName", { enumerable: true, get: function () { return read_1.getLaunchConfigByName; } });
28
+ var update_1 = require("./launch-config-crud/update");
29
+ Object.defineProperty(exports, "updateLaunchConfig", { enumerable: true, get: function () { return update_1.updateLaunchConfig; } });
30
+ var utils_1 = require("./launch-config-crud/utils");
31
+ Object.defineProperty(exports, "getIndexOfArgument", { enumerable: true, get: function () { return utils_1.getIndexOfArgument; } });
32
+ Object.defineProperty(exports, "getFioriOptions", { enumerable: true, get: function () { return utils_1.getFioriOptions; } });
33
+ Object.defineProperty(exports, "generateNewFioriLaunchConfig", { enumerable: true, get: function () { return utils_1.generateNewFioriLaunchConfig; } });
34
+ var writer_1 = require("./launch-config-crud/writer");
35
+ Object.defineProperty(exports, "updateLaunchJSON", { enumerable: true, get: function () { return writer_1.updateLaunchJSON; } });
36
+ var project_1 = require("./project-discovery/project");
37
+ Object.defineProperty(exports, "getDefaultLaunchConfigOptionsForProject", { enumerable: true, get: function () { return project_1.getDefaultLaunchConfigOptionsForProject; } });
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,sDAAiE;AAAxD,4GAAA,kBAAkB,OAAA;AAC3B,sDAAiE;AAAxD,4GAAA,kBAAkB,OAAA;AAC3B,sDAA+E;AAAtE,0HAAA,gCAAgC,OAAA;AACzC,kDAAoF;AAA3E,wGAAA,gBAAgB,OAAA;AAAE,6GAAA,qBAAqB,OAAA;AAChD,sDAAiE;AAAxD,4GAAA,kBAAkB,OAAA;AAC3B,oDAA+G;AAAtG,2GAAA,kBAAkB,OAAA;AAAE,wGAAA,eAAe,OAAA;AAAE,qHAAA,4BAA4B,OAAA;AAC1E,sDAA+D;AAAtD,0GAAA,gBAAgB,OAAA;AACzB,uDAAsF;AAA7E,kIAAA,uCAAuC,OAAA"}
@@ -0,0 +1,12 @@
1
+ import type { FioriOptions } from '../types';
2
+ import type { Editor } from 'mem-fs-editor';
3
+ /**
4
+ * Enhance or create the launch.json file with new launch config.
5
+ *
6
+ * @param rootFolder - workspace root folder.
7
+ * @param fioriOptions - options for the new launch config.
8
+ * @param fs - optional, the memfs editor instance.
9
+ * @returns memfs editor instance.
10
+ */
11
+ export declare function createLaunchConfig(rootFolder: string, fioriOptions: FioriOptions, fs?: Editor): Promise<Editor>;
12
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/launch-config-crud/create.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,UAAU,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAK5C;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA0BrH"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createLaunchConfig = void 0;
4
+ const mem_fs_1 = require("mem-fs");
5
+ const mem_fs_editor_1 = require("mem-fs-editor");
6
+ const path_1 = require("path");
7
+ const project_access_1 = require("@sap-ux/project-access");
8
+ const types_1 = require("../types");
9
+ const utils_1 = require("./utils");
10
+ const jsonc_parser_1 = require("jsonc-parser");
11
+ const writer_1 = require("./writer");
12
+ /**
13
+ * Enhance or create the launch.json file with new launch config.
14
+ *
15
+ * @param rootFolder - workspace root folder.
16
+ * @param fioriOptions - options for the new launch config.
17
+ * @param fs - optional, the memfs editor instance.
18
+ * @returns memfs editor instance.
19
+ */
20
+ async function createLaunchConfig(rootFolder, fioriOptions, fs) {
21
+ if (!fs) {
22
+ fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
23
+ }
24
+ const launchJSONPath = (0, path_1.join)(rootFolder, project_access_1.DirName.VSCode, types_1.LAUNCH_JSON_FILE);
25
+ if (fs.exists(launchJSONPath)) {
26
+ // launch.json exists, enhance existing file with new config
27
+ const launchConfig = (0, utils_1.generateNewFioriLaunchConfig)(rootFolder, fioriOptions);
28
+ const launchJsonString = fs.read(launchJSONPath);
29
+ const launchJson = (0, jsonc_parser_1.parse)(launchJsonString);
30
+ await (0, writer_1.updateLaunchJSON)(launchConfig, launchJSONPath, ['configurations', launchJson.configurations.length + 1], {
31
+ isArrayInsertion: true
32
+ }, fs);
33
+ }
34
+ else {
35
+ // launch.json is missing, new file with new config
36
+ const configurations = (0, utils_1.generateNewFioriLaunchConfig)(rootFolder, fioriOptions);
37
+ const newLaunchJSONContent = { version: '0.2.0', configurations: [configurations] };
38
+ fs.write(launchJSONPath, JSON.stringify(newLaunchJSONContent, null, 4));
39
+ }
40
+ return fs;
41
+ }
42
+ exports.createLaunchConfig = createLaunchConfig;
43
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/launch-config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C,CAAC;IAC5E,CAAC;IACD,OAAO,EAAE,CAAC;AACd,CAAC;AA1BD,gDA0BC"}
@@ -0,0 +1,11 @@
1
+ import type { Editor } from 'mem-fs-editor';
2
+ /**
3
+ * Deletes existing launch config in launch.json file.
4
+ *
5
+ * @param rootFolder - workspace root folder.
6
+ * @param index - index of the launch config to edit.
7
+ * @param fs - optional, the memfs editor instance.
8
+ * @returns memfs editor instance.
9
+ */
10
+ export declare function deleteLaunchConfig(rootFolder: string, index: number, fs?: Editor): Promise<Editor>;
11
+ //# sourceMappingURL=delete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../src/launch-config-crud/delete.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAG5C;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAUxG"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteLaunchConfig = void 0;
4
+ const mem_fs_1 = require("mem-fs");
5
+ const mem_fs_editor_1 = require("mem-fs-editor");
6
+ const path_1 = require("path");
7
+ const project_access_1 = require("@sap-ux/project-access");
8
+ const types_1 = require("../types");
9
+ const writer_1 = require("./writer");
10
+ /**
11
+ * Deletes existing launch config in launch.json file.
12
+ *
13
+ * @param rootFolder - workspace root folder.
14
+ * @param index - index of the launch config to edit.
15
+ * @param fs - optional, the memfs editor instance.
16
+ * @returns memfs editor instance.
17
+ */
18
+ async function deleteLaunchConfig(rootFolder, index, fs) {
19
+ if (!fs) {
20
+ fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
21
+ }
22
+ const launchJSONPath = (0, path_1.join)(rootFolder, project_access_1.DirName.VSCode, types_1.LAUNCH_JSON_FILE);
23
+ if (fs.exists(launchJSONPath)) {
24
+ // delete existing launch config
25
+ await (0, writer_1.updateLaunchJSON)(undefined, launchJSONPath, ['configurations', index], undefined, fs);
26
+ }
27
+ return fs;
28
+ }
29
+ exports.deleteLaunchConfig = deleteLaunchConfig;
30
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../src/launch-config-crud/delete.ts"],"names":[],"mappings":";;;AAAA,mCAAiD;AACjD,iDAAuC;AACvC,+BAA4B;AAC5B,2DAAiD;AACjD,oCAA4C;AAE5C,qCAA4C;AAE5C;;;;;;;GAOG;AACI,KAAK,UAAU,kBAAkB,CAAC,UAAkB,EAAE,KAAa,EAAE,EAAW;IACnF,IAAI,CAAC,EAAE,EAAE,CAAC;QACN,EAAE,GAAG,IAAA,sBAAM,EAAC,IAAA,eAAa,GAAE,CAAC,CAAC;IACjC,CAAC;IACD,MAAM,cAAc,GAAG,IAAA,WAAI,EAAC,UAAU,EAAE,wBAAO,CAAC,MAAM,EAAE,wBAAgB,CAAC,CAAC;IAC1E,IAAI,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC;QAC5B,gCAAgC;QAChC,MAAM,IAAA,yBAAgB,EAAC,SAAS,EAAE,cAAc,EAAE,CAAC,gBAAgB,EAAE,KAAK,CAAC,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;IAChG,CAAC;IACD,OAAO,EAAE,CAAC;AACd,CAAC;AAVD,gDAUC"}
@@ -0,0 +1,12 @@
1
+ import type { LaunchConfig } from '../types';
2
+ import type { Editor } from 'mem-fs-editor';
3
+ /**
4
+ * Modifies (if possible) existing launch config that uses 'run script' to use fiori run cli.
5
+ *
6
+ * @param launchConfig - existing launch config.
7
+ * @param projectRoot - project root.
8
+ * @param memFs - optional, the memfs editor instance.
9
+ * @returns modified launch config.
10
+ */
11
+ export declare function convertOldLaunchConfigToFioriRun(launchConfig: LaunchConfig, projectRoot?: string, memFs?: Editor): Promise<LaunchConfig>;
12
+ //# sourceMappingURL=modify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modify.d.ts","sourceRoot":"","sources":["../../src/launch-config-crud/modify.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,UAAU,CAAC;AAI9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAuH5C;;;;;;;GAOG;AACH,wBAAsB,gCAAgC,CAClD,YAAY,EAAE,YAAY,EAC1B,WAAW,CAAC,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,YAAY,CAAC,CAwBvB"}
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertOldLaunchConfigToFioriRun = void 0;
4
+ const project_access_1 = require("@sap-ux/project-access");
5
+ const path_1 = require("path");
6
+ const types_1 = require("../types");
7
+ const utils_1 = require("./utils");
8
+ const jsonc_parser_1 = require("jsonc-parser");
9
+ const fs_1 = require("fs");
10
+ const RUN_SCRIPT = 'run-script';
11
+ /**
12
+ * Moves arguments from older launch configurations (like '--ui5 1.1.1' and '--ui5Uri uri.com') to environment variables.
13
+ *
14
+ * @param launchConfig - launch config.
15
+ * @returns parsed arguments.
16
+ */
17
+ function moveOldArgsToEnv(launchConfig) {
18
+ if (launchConfig.args) {
19
+ // old format --ui5Uri https://ui5.sap.com --ui5 1.90.7
20
+ const ui5Index = (0, utils_1.getIndexOfArgument)(launchConfig.args, '--ui5');
21
+ if (ui5Index !== -1) {
22
+ const ui5ArgParts = launchConfig.args[ui5Index].split(' ');
23
+ const ui5 = ui5ArgParts.indexOf('--ui5');
24
+ const ui5Uri = ui5ArgParts.indexOf('--ui5Uri');
25
+ if (ui5 !== -1 && ui5Uri !== -1) {
26
+ launchConfig.env['FIORI_TOOLS_UI5_VERSION'] = ui5ArgParts[ui5 + 1];
27
+ launchConfig.env['FIORI_TOOLS_UI5_URI'] = ui5ArgParts[ui5Uri + 1];
28
+ launchConfig.args.splice(ui5Index, 1);
29
+ }
30
+ }
31
+ // old format [--backendConfig, [{path:'', url:''}] ]
32
+ const backendIndex = (0, utils_1.getIndexOfArgument)(launchConfig.args, '--backendConfig');
33
+ if (backendIndex !== -1) {
34
+ launchConfig.env['FIORI_TOOLS_BACKEND_CONFIG'] = launchConfig.args[backendIndex + 1];
35
+ // delete prefix and value itself
36
+ launchConfig.args.splice(backendIndex, 2);
37
+ }
38
+ // remove unnecessary -- prefix that was used before in arguments definition
39
+ const prefixIndex = (0, utils_1.getIndexOfArgument)(launchConfig.args, '--');
40
+ if (prefixIndex !== -1) {
41
+ launchConfig.args.splice(prefixIndex, 1);
42
+ }
43
+ }
44
+ return launchConfig;
45
+ }
46
+ /**
47
+ * Adds the '--open' and '--config' arguments to the args section of a launch configuration.
48
+ *
49
+ * @param scriptArgs list of cli arguments
50
+ * @returns arguments in args section.
51
+ */
52
+ function addArgs(scriptArgs) {
53
+ const args = [];
54
+ const openIndex = scriptArgs.indexOf(types_1.Arguments.Open) !== -1 ? scriptArgs.indexOf(types_1.Arguments.Open) : scriptArgs.indexOf('-o');
55
+ const configIndex = scriptArgs.indexOf(types_1.Arguments.Config) !== -1 ? scriptArgs.indexOf(types_1.Arguments.Config) : scriptArgs.indexOf('-c');
56
+ if (openIndex !== -1) {
57
+ args.push(types_1.Arguments.Open, scriptArgs[openIndex + 1]);
58
+ }
59
+ if (configIndex !== -1) {
60
+ args.push(types_1.Arguments.Config, scriptArgs[configIndex + 1]);
61
+ }
62
+ return args;
63
+ }
64
+ /**
65
+ * Converts start scripts from older launch configurations to 'fiori run'.
66
+ *
67
+ * @param launchConfig launch config.
68
+ * @param scripts scrips configuration.
69
+ * @param runScriptName name of the start script.
70
+ * @returns updated launch config.
71
+ */
72
+ function convertRunScriptToFioriRun(launchConfig, scripts, runScriptName) {
73
+ launchConfig.runtimeArgs = ['fiori', 'run'];
74
+ // parse package.json and try to find start file for fiori run command
75
+ Object.entries(scripts).forEach(([key, value]) => {
76
+ // read script from package.json scripts
77
+ if (key === runScriptName) {
78
+ const scriptParts = value.split(/\s+/);
79
+ if (scriptParts.includes('fiori') && scriptParts.includes('run')) {
80
+ launchConfig.args = addArgs(scriptParts);
81
+ }
82
+ }
83
+ });
84
+ if (launchConfig.runtimeExecutable === 'npm' && launchConfig.windows?.runtimeExecutable === 'npm.cmd') {
85
+ launchConfig.runtimeExecutable = 'npx';
86
+ launchConfig.windows.runtimeExecutable = 'npx.cmd';
87
+ }
88
+ if (launchConfig.windows?.args) {
89
+ // we do not use windows specific args in fiori run
90
+ delete launchConfig.windows.args;
91
+ }
92
+ return launchConfig;
93
+ }
94
+ /**
95
+ * Returns true if launch config uses run scripts.
96
+ *
97
+ * @param runtimeArgs - launch config runtime arguments.
98
+ * @returns whether launch configuration uses 'run-script'.
99
+ */
100
+ function isRunScriptUsed(runtimeArgs) {
101
+ return runtimeArgs?.includes(RUN_SCRIPT);
102
+ }
103
+ /**
104
+ * Returns the project root from env[run.config], otherwise undefined.
105
+ *
106
+ * @param envConfig env section of the run configuration.
107
+ * @returns project root.
108
+ */
109
+ function getProjectRootFromEnv(envConfig) {
110
+ if (envConfig) {
111
+ if (envConfig['run.config']) {
112
+ return JSON.parse(envConfig['run.config']).runnableId;
113
+ }
114
+ }
115
+ return undefined;
116
+ }
117
+ /**
118
+ * Modifies (if possible) existing launch config that uses 'run script' to use fiori run cli.
119
+ *
120
+ * @param launchConfig - existing launch config.
121
+ * @param projectRoot - project root.
122
+ * @param memFs - optional, the memfs editor instance.
123
+ * @returns modified launch config.
124
+ */
125
+ async function convertOldLaunchConfigToFioriRun(launchConfig, projectRoot, memFs) {
126
+ // we only convert configs that uses run-script
127
+ if (isRunScriptUsed(launchConfig.runtimeArgs)) {
128
+ const runScriptName = launchConfig.runtimeArgs[1];
129
+ // read projec root from parameter or else from actual launch config
130
+ const projectRootPath = projectRoot ?? getProjectRootFromEnv(launchConfig.env);
131
+ // check if there is already args defined for UI5 and backend config
132
+ moveOldArgsToEnv(launchConfig);
133
+ if (projectRootPath) {
134
+ const pckJsonPath = (0, path_1.join)(projectRootPath, project_access_1.FileName.Package);
135
+ let packageJsonString;
136
+ if (memFs) {
137
+ packageJsonString = memFs.read(pckJsonPath);
138
+ }
139
+ else {
140
+ packageJsonString = await fs_1.promises.readFile(pckJsonPath, { encoding: 'utf8' });
141
+ }
142
+ const packageJson = (0, jsonc_parser_1.parse)(packageJsonString);
143
+ const scripts = packageJson.scripts;
144
+ if (scripts) {
145
+ convertRunScriptToFioriRun(launchConfig, scripts, runScriptName);
146
+ }
147
+ }
148
+ }
149
+ return launchConfig;
150
+ }
151
+ exports.convertOldLaunchConfigToFioriRun = convertOldLaunchConfigToFioriRun;
152
+ //# sourceMappingURL=modify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modify.js","sourceRoot":"","sources":["../../src/launch-config-crud/modify.ts"],"names":[],"mappings":";;;AACA,2DAAkD;AAClD,+BAA4B;AAE5B,oCAAqC;AACrC,mCAA6C;AAC7C,+CAAqC;AAErC,2BAAoC;AAEpC,MAAM,UAAU,GAAG,YAAY,CAAC;AAEhC;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,YAA0B;IAChD,IAAI,YAAY,CAAC,IAAI,EAAE,CAAC;QACpB,uDAAuD;QACvD,MAAM,QAAQ,GAAG,IAAA,0BAAkB,EAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAChE,IAAI,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC;YAClB,MAAM,WAAW,GAAG,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC3D,MAAM,GAAG,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACzC,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YAC/C,IAAI,GAAG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AAE,yBAAQ,CAAC,OAAO,CAAC,CAAC;YAC5D,IAAI,iBAAiB,CAAC;YACtB,IAAI,KAAK,EAAE,CAAC;gBACR,iBAAiB,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAChD,CAAC;iBAAM,CAAC;gBACJ,iBAAiB,GAAG,MAAM,aAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;YAC7E,CAAC;YACD,MAAM,WAAW,GAAG,IAAA,oBAAK,EAAC,iBAAiB,CAAY,CAAC;YACxD,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC;YACpC,IAAI,OAAO,EAAE,CAAC;gBACV,0BAA0B,CAAC,YAAY,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;YACrE,CAAC;QACL,CAAC;IACL,CAAC;IACD,OAAO,YAAY,CAAC;AACxB,CAAC;AA5BD,4EA4BC"}
@@ -0,0 +1,50 @@
1
+ import type { LaunchConfig, LaunchConfigInfo } from '../types';
2
+ import type { Editor } from 'mem-fs-editor';
3
+ import type { Logger } from '@sap-ux/logger';
4
+ /**
5
+ * Returns path to the launch.json file (if exists) for a given root folder.
6
+ *
7
+ * @param rootFolder - workspace root folder.
8
+ * @param memFs - optional, the memfs editor instance.
9
+ * @returns {string | undefined} path to the launch config file.
10
+ */
11
+ export declare function getLaunchJSONFilePath(rootFolder: string, memFs?: Editor): Promise<string | undefined>;
12
+ /**
13
+ * Returns the list of launch.json paths for a given root folders.
14
+ *
15
+ * @param rootFolders - list of root folders in workspace.
16
+ * @param memFs - optional, the memfs editor instance.
17
+ * @returns {string[]} list of launch.json files.
18
+ */
19
+ export declare function getLaunchJSONFilePaths(rootFolders: string | string[], memFs?: Editor): Promise<string[]>;
20
+ /**
21
+ * Returns launch configurations from a given root folder.
22
+ *
23
+ * @param rootFolder - Single path to the root.
24
+ * @param memFs - optional, the memfs editor instance.
25
+ * @returns {LaunchConfig[] | undefined} list of launch configs.
26
+ */
27
+ export declare function getLaunchConfigs(rootFolder: string, memFs?: Editor): Promise<LaunchConfig[] | undefined>;
28
+ /**
29
+ * Returns all launch configurations by file from a given root folders.
30
+ *
31
+ * @param rootFolder - Single path to root or list of root folders.
32
+ * @param memFs - optional, the memfs editor instance.
33
+ * @returns {LaunchConfigInfo[]} list of launch configs.
34
+ */
35
+ export declare function getAllLaunchConfigs(rootFolder: string | string[], memFs?: Editor): Promise<LaunchConfigInfo[]>;
36
+ /**
37
+ * Returns the launch configuration from a given launch configurations path by name.
38
+ *
39
+ * @param launchConfigPath - path to the launch.json file.
40
+ * @param name - name of the launch config.
41
+ * @param options - optional options.
42
+ * @param options.memFs - optional, the memfs editor instance.
43
+ * @param options.logger - optional, the logger instance.
44
+ * @returns {LaunchConfig} launch config.
45
+ */
46
+ export declare function getLaunchConfigByName(launchConfigPath: string, name: string, options?: {
47
+ memFs?: Editor;
48
+ logger?: Logger;
49
+ }): Promise<LaunchConfig>;
50
+ //# sourceMappingURL=read.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/launch-config-crud/read.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAc,MAAM,UAAU,CAAC;AAG3E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAY3G;AAED;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAU9G;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,GAAG,SAAS,CAAC,CAmB9G;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAyBpH;AAED;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CACvC,gBAAgB,EAAE,MAAM,EACxB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9C,OAAO,CAAC,YAAY,CAAC,CAsBvB"}