@sap-ux/create 0.5.102 → 0.5.103

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.
@@ -27,16 +27,18 @@ function addGenerateAdaptationProjectCommand(cmd) {
27
27
  cmd.command('adaptation-project [path]')
28
28
  .option('-n, --skip-install', 'skip npm install step')
29
29
  .option('-s, --simulate', 'simulate only do not write or install')
30
+ .option('-y, --yes', 'use default values for all prompts')
30
31
  .option('--id [id]', 'id of the adaptation project')
31
32
  .option('--reference [reference]', 'id of the original application')
32
33
  .option('--url [url]', 'url pointing to the target system containing the original app')
34
+ .option('--ignoreCertErrors', 'ignore certificate errors when connecting to the target system')
33
35
  .option('--ft', 'enable the Fiori tools for the generated project')
34
36
  .option('--package [package]', 'ABAP package to be used for deployments')
35
37
  .option('--transport [transport]', 'ABAP transport to be used for deployments')
36
38
  .action((path, options) => __awaiter(this, void 0, void 0, function* () {
37
39
  console.log(`\nThe generation of adaptation projects outside of SAP Business Application Studio is currently ${chalk_1.default.bold('experimental')}.`);
38
40
  console.log('Please report any issues or feedback at https://github.com/SAP/open-ux-tools/issues/new/choose.\n');
39
- yield generateAdaptationProject(path, Object.assign({}, options), !!options.simulate, !!options.skipInstall);
41
+ yield generateAdaptationProject(path, Object.assign({}, options), !!options.yes, !!options.simulate, !!options.skipInstall);
40
42
  }));
41
43
  }
42
44
  exports.addGenerateAdaptationProjectCommand = addGenerateAdaptationProjectCommand;
@@ -45,40 +47,22 @@ exports.addGenerateAdaptationProjectCommand = addGenerateAdaptationProjectComman
45
47
  *
46
48
  * @param basePath target folder of the new project
47
49
  * @param defaults optional defaults
50
+ * @param useDefaults if set to true, then default values are used for all prompts and the prompting is skipped
48
51
  * @param simulate if set to true, then no files will be written to the filesystem
49
52
  * @param skipInstall if set to true then `npm i` is not executed in the new project
50
53
  */
51
- function generateAdaptationProject(basePath, defaults, simulate, skipInstall) {
54
+ function generateAdaptationProject(basePath, defaults, useDefaults, simulate, skipInstall) {
52
55
  var _a;
53
56
  return __awaiter(this, void 0, void 0, function* () {
54
57
  const logger = (0, tracing_1.getLogger)();
55
58
  try {
56
59
  logger.debug(`Called generate adaptation-project for path '${basePath}', skip install is '${skipInstall}'`);
57
- let config;
58
- if (defaults.id && defaults.reference && defaults.url) {
60
+ if (defaults.url) {
59
61
  const url = new URL(defaults.url);
60
- config = {
61
- app: {
62
- id: defaults.id,
63
- reference: defaults.reference,
64
- layer: 'CUSTOMER_BASE'
65
- },
66
- target: {
67
- url: url.origin,
68
- client: (_a = url.searchParams.get('sap-client')) !== null && _a !== void 0 ? _a : undefined
69
- },
70
- deploy: {
71
- package: defaults.package ? defaults.package.toUpperCase() : '$TMP',
72
- transport: defaults.transport ? defaults.transport.toUpperCase() : undefined
73
- },
74
- options: {
75
- fioriTools: defaults.ft
76
- }
77
- };
78
- }
79
- else {
80
- config = yield (0, adp_tooling_1.promptGeneratorInput)(defaults, logger);
62
+ defaults.url = url.origin;
63
+ defaults.client = (_a = url.searchParams.get('sap-client')) !== null && _a !== void 0 ? _a : undefined;
81
64
  }
65
+ const config = useDefaults ? createConfigFromDefaults(defaults) : yield (0, adp_tooling_1.promptGeneratorInput)(defaults, logger);
82
66
  if (!basePath) {
83
67
  basePath = (0, path_1.join)(process.cwd(), config.app.id);
84
68
  }
@@ -99,4 +83,35 @@ function generateAdaptationProject(basePath, defaults, simulate, skipInstall) {
99
83
  }
100
84
  });
101
85
  }
86
+ /**
87
+ * Create a writer config based on the given defaults.
88
+ *
89
+ * @param defaults default values provided via command line
90
+ * @returns writer config
91
+ */
92
+ function createConfigFromDefaults(defaults) {
93
+ if (defaults.id && defaults.reference && defaults.url) {
94
+ return {
95
+ app: {
96
+ id: defaults.id,
97
+ reference: defaults.reference,
98
+ layer: 'CUSTOMER_BASE'
99
+ },
100
+ target: {
101
+ url: defaults.url,
102
+ client: defaults.client
103
+ },
104
+ deploy: {
105
+ package: defaults.package ? defaults.package.toUpperCase() : '$TMP',
106
+ transport: defaults.transport ? defaults.transport.toUpperCase() : undefined
107
+ },
108
+ options: {
109
+ fioriTools: defaults.ft
110
+ }
111
+ };
112
+ }
113
+ else {
114
+ throw new Error('Missing required parameters. Please provide --id, --reference and --url.');
115
+ }
116
+ }
102
117
  //# sourceMappingURL=adaptation-project.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/create",
3
3
  "description": "SAP Fiori tools module to add or remove features",
4
- "version": "0.5.102",
4
+ "version": "0.5.103",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -28,7 +28,7 @@
28
28
  "commander": "9.4.0",
29
29
  "diff": "5.1.0",
30
30
  "prompts": "2.4.2",
31
- "@sap-ux/adp-tooling": "0.10.23",
31
+ "@sap-ux/adp-tooling": "0.11.0",
32
32
  "@sap-ux/app-config-writer": "0.3.74",
33
33
  "@sap-ux/cap-config-writer": "0.3.4",
34
34
  "@sap-ux/cards-editor-config-writer": "0.3.6",