@sap-ux/create 0.17.6 → 1.0.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.
Files changed (46) hide show
  1. package/dist/cli/add/adp-cf-config.js +14 -17
  2. package/dist/cli/add/annotations-to-odata.js +20 -23
  3. package/dist/cli/add/cards-generator.js +11 -14
  4. package/dist/cli/add/cds-plugin-ui.js +11 -14
  5. package/dist/cli/add/component-usages.js +13 -17
  6. package/dist/cli/add/deploy-config.js +23 -25
  7. package/dist/cli/add/eslint-config.js +13 -16
  8. package/dist/cli/add/flp-embedded-config.js +8 -11
  9. package/dist/cli/add/html.js +18 -21
  10. package/dist/cli/add/index.js +33 -36
  11. package/dist/cli/add/mockserver-config.js +19 -21
  12. package/dist/cli/add/navigation-config.js +38 -41
  13. package/dist/cli/add/new-model.js +11 -14
  14. package/dist/cli/add/smartlinks-config.js +10 -13
  15. package/dist/cli/add/system.js +22 -25
  16. package/dist/cli/add/variants-config.js +13 -16
  17. package/dist/cli/change/change-data-source.js +18 -21
  18. package/dist/cli/change/change-inbound.js +13 -16
  19. package/dist/cli/change/index.js +9 -12
  20. package/dist/cli/change/system.js +12 -15
  21. package/dist/cli/convert/eslint-config.js +15 -18
  22. package/dist/cli/convert/index.js +7 -10
  23. package/dist/cli/convert/preview.js +10 -13
  24. package/dist/cli/generate/adaptation-project.js +14 -20
  25. package/dist/cli/generate/index.js +5 -8
  26. package/dist/cli/get/index.js +5 -8
  27. package/dist/cli/get/system.js +10 -13
  28. package/dist/cli/index.js +27 -29
  29. package/dist/cli/list/index.js +5 -8
  30. package/dist/cli/list/system.js +9 -12
  31. package/dist/cli/remove/index.js +7 -10
  32. package/dist/cli/remove/mockserver-config.js +12 -18
  33. package/dist/cli/remove/system.js +8 -11
  34. package/dist/common/index.d.ts +1 -1
  35. package/dist/common/index.js +4 -9
  36. package/dist/common/prompts.js +7 -15
  37. package/dist/index.js +2 -4
  38. package/dist/tracing/compare.js +12 -16
  39. package/dist/tracing/index.d.ts +2 -2
  40. package/dist/tracing/index.js +2 -8
  41. package/dist/tracing/logger.js +9 -15
  42. package/dist/tracing/trace.js +11 -14
  43. package/dist/validation/index.d.ts +1 -1
  44. package/dist/validation/index.js +1 -8
  45. package/dist/validation/validation.js +15 -21
  46. package/package.json +24 -22
@@ -1,26 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addAdaptationProjectCFConfigCommand = addAdaptationProjectCFConfigCommand;
4
- const tracing_1 = require("../../tracing");
5
- const validation_1 = require("../../validation");
6
- const adp_tooling_1 = require("@sap-ux/adp-tooling");
7
- const project_access_1 = require("@sap-ux/project-access");
1
+ import { getLogger, setLogLevelVerbose } from '../../tracing/index.js';
2
+ import { validateBasePath, validateAdpAppType } from '../../validation/index.js';
3
+ import { isLoggedInCf, loadCfConfig, setupCfPreview, isCFEnvironment } from '@sap-ux/adp-tooling';
4
+ import { FileName } from '@sap-ux/project-access';
8
5
  /**
9
6
  * Add the "adp-cf-config" sub-command.
10
7
  *
11
8
  * @param cmd - commander command for setting up CF adaptation project
12
9
  */
13
- function addAdaptationProjectCFConfigCommand(cmd) {
10
+ export function addAdaptationProjectCFConfigCommand(cmd) {
14
11
  cmd.command('adp-cf-config [path]')
15
12
  .description(`Configure an existing Cloud Foundry adaptation project for local preview by fetching reusable libraries, building the project, and configuring ui5.yaml file middlewares.\n
16
13
  **⚠️ Experimental**: This command is experimental and may be subject to breaking changes or even removal in future versions. Use with caution and be prepared to update your configuration or migrate to alternative solutions, if needed.\n
17
14
  Example:
18
15
  \`npx --yes @sap-ux/create@latest add adp-cf-config\``)
19
16
  .option('-v, --verbose', 'Show verbose information.')
20
- .option('-c, --config <string>', 'Path to the project configuration file in YAML format.', project_access_1.FileName.Ui5Yaml)
17
+ .option('-c, --config <string>', 'Path to the project configuration file in YAML format.', FileName.Ui5Yaml)
21
18
  .action(async (path, options) => {
22
19
  if (options.verbose === true) {
23
- (0, tracing_1.setLogLevelVerbose)();
20
+ setLogLevelVerbose();
24
21
  }
25
22
  await setupAdaptationProjectCF(path ?? process.cwd(), options.config);
26
23
  });
@@ -32,18 +29,18 @@ Example:
32
29
  * @param yamlPath - path to the project configuration file in YAML format
33
30
  */
34
31
  async function setupAdaptationProjectCF(basePath, yamlPath) {
35
- const logger = (0, tracing_1.getLogger)();
36
- await (0, validation_1.validateBasePath)(basePath);
37
- await (0, validation_1.validateAdpAppType)(basePath);
38
- if (!(await (0, adp_tooling_1.isCFEnvironment)(basePath))) {
32
+ const logger = getLogger();
33
+ await validateBasePath(basePath);
34
+ await validateAdpAppType(basePath);
35
+ if (!(await isCFEnvironment(basePath))) {
39
36
  throw new Error('This command can only be used for Cloud Foundry adaptation projects.');
40
37
  }
41
- const cfConfig = (0, adp_tooling_1.loadCfConfig)(logger);
42
- if (!(await (0, adp_tooling_1.isLoggedInCf)(cfConfig, logger))) {
38
+ const cfConfig = loadCfConfig(logger);
39
+ if (!(await isLoggedInCf(cfConfig, logger))) {
43
40
  throw new Error('You are not logged in to Cloud Foundry or your session has expired. Please run "cf login" first.');
44
41
  }
45
42
  try {
46
- await (0, adp_tooling_1.setupCfPreview)(basePath, yamlPath, cfConfig, logger);
43
+ await setupCfPreview(basePath, yamlPath, cfConfig, logger);
47
44
  }
48
45
  catch (error) {
49
46
  logger.error(`Failed to setup CF adaptation project: ${error.message}`);
@@ -1,27 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addAnnotationsToOdataCommand = addAnnotationsToOdataCommand;
4
- const adp_tooling_1 = require("@sap-ux/adp-tooling");
5
- const system_access_1 = require("@sap-ux/system-access");
6
- const odata_service_writer_1 = require("@sap-ux/odata-service-writer");
7
- const common_1 = require("../../common");
8
- const tracing_1 = require("../../tracing");
9
- const validation_1 = require("../../validation/validation");
10
- const project_access_1 = require("@sap-ux/project-access");
1
+ import { generateChange, ChangeType, getPromptsForAddAnnotationsToOData, getAdpConfig, ManifestService, getVariant, isCFEnvironment } from '@sap-ux/adp-tooling';
2
+ import { createAbapServiceProvider } from '@sap-ux/system-access';
3
+ import { getAnnotationNamespaces } from '@sap-ux/odata-service-writer';
4
+ import { promptYUIQuestions } from '../../common/index.js';
5
+ import { getLogger, traceChanges } from '../../tracing/index.js';
6
+ import { validateAdpAppType } from '../../validation/index.js';
7
+ import { FileName } from '@sap-ux/project-access';
11
8
  let loginAttempts = 3;
12
9
  /**
13
10
  * Add a new sub-command to add annotations to odata service of an adaptation project to the given command.
14
11
  *
15
12
  * @param {Command} cmd - The command to add the add annotations-to-odata sub-command to.
16
13
  */
17
- function addAnnotationsToOdataCommand(cmd) {
14
+ export function addAnnotationsToOdataCommand(cmd) {
18
15
  cmd.command('annotations [path]')
19
16
  .description(`Adds an annotation to the OData Source of the base application in an adaptation project.\n
20
17
  This command is not supported for Cloud Foundry projects.\n
21
18
  Example:
22
19
  \`npx --yes @sap-ux/create@latest add annotations\``)
23
20
  .option('-s, --simulate', 'Simulate only. Do not write or install.')
24
- .option('-c, --config <string>', 'Path to the project configuration file in YAML format.', project_access_1.FileName.Ui5Yaml)
21
+ .option('-c, --config <string>', 'Path to the project configuration file in YAML format.', FileName.Ui5Yaml)
25
22
  .action(async (path, options) => {
26
23
  await addAnnotationsToOdata(path, !!options.simulate, options.config);
27
24
  });
@@ -34,29 +31,29 @@ Example:
34
31
  * @param {string} yamlPath - The path to the project configuration file in YAML format.
35
32
  */
36
33
  async function addAnnotationsToOdata(basePath, simulate, yamlPath) {
37
- const logger = (0, tracing_1.getLogger)();
34
+ const logger = getLogger();
38
35
  try {
39
36
  if (!basePath) {
40
37
  basePath = process.cwd();
41
38
  }
42
- await (0, validation_1.validateAdpAppType)(basePath);
43
- if (await (0, adp_tooling_1.isCFEnvironment)(basePath)) {
39
+ await validateAdpAppType(basePath);
40
+ if (await isCFEnvironment(basePath)) {
44
41
  throw new Error('This command is not supported for Cloud Foundry projects.');
45
42
  }
46
- const variant = await (0, adp_tooling_1.getVariant)(basePath);
47
- const { target, ignoreCertErrors = false } = await (0, adp_tooling_1.getAdpConfig)(basePath, yamlPath);
48
- const provider = await (0, system_access_1.createAbapServiceProvider)(target, {
43
+ const variant = await getVariant(basePath);
44
+ const { target, ignoreCertErrors = false } = await getAdpConfig(basePath, yamlPath);
45
+ const provider = await createAbapServiceProvider(target, {
49
46
  ignoreCertErrors
50
47
  }, true, logger);
51
- const manifestService = await adp_tooling_1.ManifestService.initMergedManifest(provider, basePath, variant, logger);
48
+ const manifestService = await ManifestService.initMergedManifest(provider, basePath, variant, logger);
52
49
  const dataSources = manifestService.getManifestDataSources();
53
- const answers = await (0, common_1.promptYUIQuestions)((0, adp_tooling_1.getPromptsForAddAnnotationsToOData)(basePath, dataSources), false);
50
+ const answers = await promptYUIQuestions(getPromptsForAddAnnotationsToOData(basePath, dataSources), false);
54
51
  let namespaces = [];
55
52
  if (!answers.filePath) {
56
53
  const metadata = await manifestService.getDataSourceMetadata(answers.id);
57
- namespaces = (0, odata_service_writer_1.getAnnotationNamespaces)({ metadata });
54
+ namespaces = getAnnotationNamespaces({ metadata });
58
55
  }
59
- const fs = await (0, adp_tooling_1.generateChange)(basePath, "appdescr_app_addAnnotationsToOData" /* ChangeType.ADD_ANNOTATIONS_TO_ODATA */, {
56
+ const fs = await generateChange(basePath, ChangeType.ADD_ANNOTATIONS_TO_ODATA, {
60
57
  variant,
61
58
  annotation: {
62
59
  dataSource: answers.id,
@@ -70,7 +67,7 @@ async function addAnnotationsToOdata(basePath, simulate, yamlPath) {
70
67
  await new Promise((resolve) => fs.commit(resolve));
71
68
  }
72
69
  else {
73
- await (0, tracing_1.traceChanges)(fs);
70
+ await traceChanges(fs);
74
71
  }
75
72
  }
76
73
  catch (error) {
@@ -1,26 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addCardsEditorConfigCommand = addCardsEditorConfigCommand;
4
- const app_config_writer_1 = require("@sap-ux/app-config-writer");
5
- const tracing_1 = require("../../tracing");
6
- const validation_1 = require("../../validation");
7
- const project_access_1 = require("@sap-ux/project-access");
1
+ import { enableCardGeneratorConfig } from '@sap-ux/app-config-writer';
2
+ import { getLogger, traceChanges, setLogLevelVerbose } from '../../tracing/index.js';
3
+ import { validateBasePath } from '../../validation/index.js';
4
+ import { FileName } from '@sap-ux/project-access';
8
5
  /**
9
6
  * Add the cards-editor command.
10
7
  *
11
8
  * @param cmd - commander command for adding card editor config command
12
9
  */
13
- function addCardsEditorConfigCommand(cmd) {
10
+ export function addCardsEditorConfigCommand(cmd) {
14
11
  cmd.command('cards-editor [path]')
15
12
  .description(`Add the necessary configuration to an existing YAML file and the script to the \`package.json\` file for cards generation. It uses the configuration from the YAML file passed by the CLI or default to \`ui5.yaml\`, as provided by the \`fiori-tools-preview\` or \`preview-middleware\`.\n
16
13
  Example:
17
14
  \`npx --yes @sap-ux/create@latest add cards-editor\``)
18
- .option('-c, --config <string>', 'Path to the project configuration file in YAML format.', project_access_1.FileName.Ui5Yaml)
15
+ .option('-c, --config <string>', 'Path to the project configuration file in YAML format.', FileName.Ui5Yaml)
19
16
  .option('-s, --simulate', 'Simulate only. Do not write to the config file. Also, sets `--verbose`')
20
17
  .option('-v, --verbose', 'Show verbose information.')
21
18
  .action(async (path, options) => {
22
19
  if (options.verbose === true || options.simulate) {
23
- (0, tracing_1.setLogLevelVerbose)();
20
+ setLogLevelVerbose();
24
21
  }
25
22
  await addCardsGeneratorConfig(path ?? process.cwd(), !!options.simulate, options.config);
26
23
  });
@@ -33,16 +30,16 @@ Example:
33
30
  * @param yamlPath - path to the ui5*.yaml file passed by cli
34
31
  */
35
32
  async function addCardsGeneratorConfig(basePath, simulate, yamlPath) {
36
- const logger = (0, tracing_1.getLogger)();
33
+ const logger = getLogger();
37
34
  try {
38
35
  logger.debug(`Called add cards-generator-config for path '${basePath}', simulate is '${simulate}'`);
39
- await (0, validation_1.validateBasePath)(basePath);
40
- const fs = await (0, app_config_writer_1.enableCardGeneratorConfig)(basePath, yamlPath, logger);
36
+ await validateBasePath(basePath);
37
+ const fs = await enableCardGeneratorConfig(basePath, yamlPath, logger);
41
38
  if (!simulate) {
42
39
  fs.commit(() => logger.info(`Card Generator configuration written.`));
43
40
  }
44
41
  else {
45
- await (0, tracing_1.traceChanges)(fs);
42
+ await traceChanges(fs);
46
43
  }
47
44
  }
48
45
  catch (error) {
@@ -1,16 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addAddCdsPluginUi5Command = addAddCdsPluginUi5Command;
4
- const node_path_1 = require("node:path");
5
- const cap_config_writer_1 = require("@sap-ux/cap-config-writer");
6
- const tracing_1 = require("../../tracing");
7
- const common_1 = require("../../common");
1
+ import { relative } from 'node:path';
2
+ import { enableCdsUi5Plugin } from '@sap-ux/cap-config-writer';
3
+ import { getLogger, setLogLevelVerbose, traceChanges } from '../../tracing/index.js';
4
+ import { runNpmInstallCommand } from '../../common/index.js';
8
5
  /**
9
6
  * Add the "add cds-plugin-ui5" command to passed command.
10
7
  *
11
8
  * @param cmd - commander command for adding cds-plugin-ui5 command
12
9
  */
13
- function addAddCdsPluginUi5Command(cmd) {
10
+ export function addAddCdsPluginUi5Command(cmd) {
14
11
  cmd.command('cds-plugin-ui5 [path]')
15
12
  .description(`Add the \`cds-plugin-ui5\` module and all prerequisites to a CAP project for UI5 server integration.\n
16
13
  Example:
@@ -20,7 +17,7 @@ Example:
20
17
  .option('-v, --verbose', 'Show verbose information.')
21
18
  .action(async (path, options) => {
22
19
  if (options.verbose === true || options.simulate) {
23
- (0, tracing_1.setLogLevelVerbose)();
20
+ setLogLevelVerbose();
24
21
  }
25
22
  await addCdsPluginUi5(path || process.cwd(), !!options.simulate, !!options.skipInstall);
26
23
  });
@@ -33,17 +30,17 @@ Example:
33
30
  * @param skipInstall - if true, skip execution of npm install
34
31
  */
35
32
  async function addCdsPluginUi5(basePath, simulate, skipInstall) {
36
- const logger = (0, tracing_1.getLogger)();
33
+ const logger = getLogger();
37
34
  try {
38
35
  logger.debug(`Called add cds-plugin-ui5 for path '${basePath}', simulate is '${simulate}', skip install is '${skipInstall}'`);
39
- const fs = await (0, cap_config_writer_1.enableCdsUi5Plugin)(basePath);
40
- await (0, tracing_1.traceChanges)(fs);
36
+ const fs = await enableCdsUi5Plugin(basePath);
37
+ await traceChanges(fs);
41
38
  if (!simulate) {
42
39
  await new Promise((resolve) => fs.commit(resolve));
43
40
  logger.info(`Changes to enable cds-plugin-ui5 written`);
44
41
  if (skipInstall) {
45
42
  logger.warn('To finish enablement of cds-plugin-ui5 run commands:');
46
- const relPath = (0, node_path_1.relative)(basePath, process.cwd());
43
+ const relPath = relative(basePath, process.cwd());
47
44
  if (relPath) {
48
45
  logger.info(`cd ${relPath}`);
49
46
  }
@@ -51,7 +48,7 @@ async function addCdsPluginUi5(basePath, simulate, skipInstall) {
51
48
  }
52
49
  else {
53
50
  logger.debug('Running npm install command');
54
- (0, common_1.runNpmInstallCommand)(basePath);
51
+ runNpmInstallCommand(basePath);
55
52
  }
56
53
  }
57
54
  }
@@ -1,17 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addComponentUsagesCommand = addComponentUsagesCommand;
4
- exports.addComponentUsages = addComponentUsages;
5
- const adp_tooling_1 = require("@sap-ux/adp-tooling");
6
- const tracing_1 = require("../../tracing");
7
- const validation_1 = require("../../validation/validation");
8
- const common_1 = require("../../common");
1
+ import { generateChange, getVariant, ChangeType, getPromptsForAddComponentUsages, isCFEnvironment } from '@sap-ux/adp-tooling';
2
+ import { getLogger, traceChanges } from '../../tracing/index.js';
3
+ import { validateAdpAppType } from '../../validation/index.js';
4
+ import { promptYUIQuestions } from '../../common/index.js';
9
5
  /**
10
6
  * Add a new sub-command to add component usages of an adaptation project to the given command.
11
7
  *
12
8
  * @param {Command} cmd - The command to add the add component-usages sub-command to.
13
9
  */
14
- function addComponentUsagesCommand(cmd) {
10
+ export function addComponentUsagesCommand(cmd) {
15
11
  cmd.command('component-usages [path]')
16
12
  .description(`Add the component usages to an adaptation project.\n
17
13
  Example:
@@ -27,24 +23,24 @@ Example:
27
23
  * @param {string} basePath - The path to the adaptation project.
28
24
  * @param {boolean} simulate - If set to true, then no files will be written to the filesystem.
29
25
  */
30
- async function addComponentUsages(basePath, simulate) {
31
- const logger = (0, tracing_1.getLogger)();
26
+ export async function addComponentUsages(basePath, simulate) {
27
+ const logger = getLogger();
32
28
  try {
33
29
  if (!basePath) {
34
30
  basePath = process.cwd();
35
31
  }
36
- await (0, validation_1.validateAdpAppType)(basePath);
37
- if (await (0, adp_tooling_1.isCFEnvironment)(basePath)) {
32
+ await validateAdpAppType(basePath);
33
+ if (await isCFEnvironment(basePath)) {
38
34
  throw new Error('This command is not supported for CF projects.');
39
35
  }
40
- const variant = await (0, adp_tooling_1.getVariant)(basePath);
41
- const answers = await (0, common_1.promptYUIQuestions)((0, adp_tooling_1.getPromptsForAddComponentUsages)(basePath, variant.layer), false);
42
- const fs = await (0, adp_tooling_1.generateChange)(basePath, "appdescr_ui5_addComponentUsages" /* ChangeType.ADD_COMPONENT_USAGES */, createComponentUsageData(variant, answers));
36
+ const variant = await getVariant(basePath);
37
+ const answers = await promptYUIQuestions(getPromptsForAddComponentUsages(basePath, variant.layer), false);
38
+ const fs = await generateChange(basePath, ChangeType.ADD_COMPONENT_USAGES, createComponentUsageData(variant, answers));
43
39
  if (!simulate) {
44
40
  await new Promise((resolve) => fs.commit(resolve));
45
41
  }
46
42
  else {
47
- await (0, tracing_1.traceChanges)(fs);
43
+ await traceChanges(fs);
48
44
  }
49
45
  }
50
46
  catch (error) {
@@ -1,21 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addDeployConfigCommand = addDeployConfigCommand;
4
- const project_access_1 = require("@sap-ux/project-access");
5
- const abap_deploy_config_writer_1 = require("@sap-ux/abap-deploy-config-writer");
6
- const tracing_1 = require("../../tracing");
7
- const validation_1 = require("../../validation");
8
- const abap_deploy_config_inquirer_1 = require("@sap-ux/abap-deploy-config-inquirer");
9
- const prompts_1 = require("prompts");
10
- const common_1 = require("../../common");
11
- const adp_tooling_1 = require("@sap-ux/adp-tooling");
12
- const axios_extension_1 = require("@sap-ux/axios-extension");
1
+ import { FileName, getAppType } from '@sap-ux/project-access';
2
+ import { generate as generateDeployConfig } from '@sap-ux/abap-deploy-config-writer';
3
+ import { getLogger, traceChanges, setLogLevelVerbose } from '../../tracing/index.js';
4
+ import { validateBasePath } from '../../validation/index.js';
5
+ import { getPrompts as getAbapDeployConfigPrompts, reconcileAnswers } from '@sap-ux/abap-deploy-config-inquirer';
6
+ import prompts from 'prompts';
7
+ import { promptYUIQuestions } from '../../common/index.js';
8
+ import { getExistingAdpProjectType } from '@sap-ux/adp-tooling';
9
+ import { AdaptationProjectType } from '@sap-ux/axios-extension';
10
+ const { prompt } = prompts;
13
11
  /**
14
12
  * Add the "add deploy config" command to a passed command.
15
13
  *
16
14
  * @param cmd - commander command for adding deploy config command
17
15
  */
18
- function addDeployConfigCommand(cmd) {
16
+ export function addDeployConfigCommand(cmd) {
19
17
  cmd.command('deploy-config [path]')
20
18
  .description(`Prompt for ABAP deployment configuration details and adds and updates the project files accordingly.\n
21
19
  Example:
@@ -27,9 +25,9 @@ Example:
27
25
  .option('-d, --deploy-file <string>', 'The name of the deploy config file to be written. _(default: "ui5-deploy.yaml")_')
28
26
  .action(async (path, options) => {
29
27
  if (options.verbose === true || options.simulate) {
30
- (0, tracing_1.setLogLevelVerbose)();
28
+ setLogLevelVerbose();
31
29
  }
32
- await addDeployConfig(path || process.cwd(), options.target, options.simulate, options.baseFile ?? project_access_1.FileName.Ui5Yaml, options.deployFile ?? project_access_1.FileName.UI5DeployYaml);
30
+ await addDeployConfig(path || process.cwd(), options.target, options.simulate, options.baseFile ?? FileName.Ui5Yaml, options.deployFile ?? FileName.UI5DeployYaml);
33
31
  });
34
32
  }
35
33
  /**
@@ -49,7 +47,7 @@ async function getTarget(target) {
49
47
  // { title: 'Cloud Foundry', value: 'cf' }
50
48
  ]
51
49
  };
52
- return (await (0, prompts_1.prompt)(question)).target;
50
+ return (await prompt(question)).target;
53
51
  }
54
52
  else {
55
53
  return target;
@@ -65,9 +63,9 @@ async function getTarget(target) {
65
63
  * @param deployFile - deploy file name
66
64
  */
67
65
  async function addDeployConfig(basePath, target, simulate = false, baseFile, deployFile) {
68
- const logger = (0, tracing_1.getLogger)();
66
+ const logger = getLogger();
69
67
  try {
70
- const appType = await (0, project_access_1.getAppType)(basePath);
68
+ const appType = await getAppType(basePath);
71
69
  const isAdp = isAdpProject(appType);
72
70
  if (!isAdp) {
73
71
  target = await getTarget(target);
@@ -81,9 +79,9 @@ async function addDeployConfig(basePath, target, simulate = false, baseFile, dep
81
79
  }
82
80
  else if (target === 'abap') {
83
81
  logger.debug(`Called add deploy-config for path '${basePath}', simulate is '${simulate}'`);
84
- await (0, validation_1.validateBasePath)(basePath);
85
- const adpProjectType = await (0, adp_tooling_1.getExistingAdpProjectType)(basePath);
86
- const hideIfOnPremise = isAdp && adpProjectType === axios_extension_1.AdaptationProjectType.ON_PREMISE;
82
+ await validateBasePath(basePath);
83
+ const adpProjectType = await getExistingAdpProjectType(basePath);
84
+ const hideIfOnPremise = isAdp && adpProjectType === AdaptationProjectType.ON_PREMISE;
87
85
  const promptOptions = {
88
86
  ui5AbapRepo: { hideIfOnPremise },
89
87
  packageAutocomplete: {
@@ -102,8 +100,8 @@ async function addDeployConfig(basePath, target, simulate = false, baseFile, dep
102
100
  transportInputChoice: { hideIfOnPremise },
103
101
  adpProjectType
104
102
  };
105
- const { prompts: abapPrompts, answers: abapAnswers } = await (0, abap_deploy_config_inquirer_1.getPrompts)(promptOptions, logger, false);
106
- const answers = (0, abap_deploy_config_inquirer_1.reconcileAnswers)(await (0, common_1.promptYUIQuestions)(abapPrompts, false), abapAnswers);
103
+ const { prompts: abapPrompts, answers: abapAnswers } = await getAbapDeployConfigPrompts(promptOptions, logger, false);
104
+ const answers = reconcileAnswers(await promptYUIQuestions(abapPrompts, false), abapAnswers);
107
105
  const config = {
108
106
  target: {
109
107
  url: answers.url,
@@ -120,12 +118,12 @@ async function addDeployConfig(basePath, target, simulate = false, baseFile, dep
120
118
  index: answers.index
121
119
  };
122
120
  logger.debug(`Adding deployment configuration : ${JSON.stringify(config, null, 2)}`);
123
- const fs = await (0, abap_deploy_config_writer_1.generate)(basePath, config, {
121
+ const fs = await generateDeployConfig(basePath, config, {
124
122
  baseFile,
125
123
  deployFile,
126
124
  addBuildToUndeployScript: !isAdp
127
125
  });
128
- await (0, tracing_1.traceChanges)(fs);
126
+ await traceChanges(fs);
129
127
  if (!simulate) {
130
128
  fs.commit(() => {
131
129
  logger.info(`Changes written.`);
@@ -1,17 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addAddEslintConfigCommand = addAddEslintConfigCommand;
4
- const app_config_writer_1 = require("@sap-ux/app-config-writer");
5
- const tracing_1 = require("../../tracing");
6
- const validation_1 = require("../../validation");
7
- const project_access_1 = require("@sap-ux/project-access");
8
- const common_1 = require("../../common");
1
+ import { generateEslintConfig } from '@sap-ux/app-config-writer';
2
+ import { getLogger, traceChanges, setLogLevelVerbose } from '../../tracing/index.js';
3
+ import { validateBasePath } from '../../validation/index.js';
4
+ import { getProjectType } from '@sap-ux/project-access';
5
+ import { runNpmInstallCommand } from '../../common/index.js';
9
6
  /**
10
7
  * Add the "add eslint config" command to a passed command.
11
8
  *
12
9
  * @param cmd - commander command for adding eslint config command
13
10
  */
14
- function addAddEslintConfigCommand(cmd) {
11
+ export function addAddEslintConfigCommand(cmd) {
15
12
  cmd.command('eslint-config [path]')
16
13
  .description(`Add an ESLint configuration to a project including the SAP Fiori tools lint plugin (\`@sap-ux/eslint-plugin-fiori-tools\`).\n
17
14
  Example:
@@ -22,7 +19,7 @@ Example:
22
19
  .option('-n, --skip-install', 'Skip the `npm install` step.')
23
20
  .action(async (path, options) => {
24
21
  if (options.verbose === true || options.simulate) {
25
- (0, tracing_1.setLogLevelVerbose)();
22
+ setLogLevelVerbose();
26
23
  }
27
24
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
28
25
  await addEslintConfig(path || process.cwd(), !!options.simulate, options.config, !!options.skipInstall);
@@ -37,12 +34,12 @@ Example:
37
34
  * @param skipInstall - if true, skips the `npm install` step after adding the eslint config
38
35
  */
39
36
  async function addEslintConfig(basePath, simulate, config, skipInstall = false) {
40
- const logger = (0, tracing_1.getLogger)();
37
+ const logger = getLogger();
41
38
  try {
42
39
  logger.debug(`Called add eslint-config for path '${basePath}', simulate is '${simulate}'`);
43
- await (0, validation_1.validateBasePath)(basePath);
44
- const fs = await (0, app_config_writer_1.generateEslintConfig)(basePath, { logger, config });
45
- await (0, tracing_1.traceChanges)(fs);
40
+ await validateBasePath(basePath);
41
+ const fs = await generateEslintConfig(basePath, { logger, config });
42
+ await traceChanges(fs);
46
43
  if (!simulate) {
47
44
  await new Promise((resolve) => fs.commit(resolve));
48
45
  logger.info(`ESlint configuration written. Ensure you install the new dependency by executing 'npm install'.`);
@@ -51,7 +48,7 @@ async function addEslintConfig(basePath, simulate, config, skipInstall = false)
51
48
  }
52
49
  else {
53
50
  logger.info(`Executing \`npm install\`.`);
54
- (0, common_1.runNpmInstallCommand)(basePath, undefined, { logger });
51
+ runNpmInstallCommand(basePath, undefined, { logger });
55
52
  }
56
53
  }
57
54
  }
@@ -59,7 +56,7 @@ async function addEslintConfig(basePath, simulate, config, skipInstall = false)
59
56
  logger.error(`Error while executing add eslint-config. '${error.message}'`);
60
57
  logger.debug(error);
61
58
  }
62
- if ((await (0, project_access_1.getProjectType)(basePath)) !== 'EDMXBackend') {
59
+ if ((await getProjectType(basePath)) !== 'EDMXBackend') {
63
60
  logger.info(`You can execute \`npm run lint --workspaces --if-present\` from the CAP project root to lint app.`);
64
61
  logger.info(`You can add a command such as \`&& npm run lint --workspaces --if-present\` to an existing command in the CAP project root where linting is executed.
65
62
  A complete command is similar to the following:
@@ -1,14 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addFlpEmbeddedConfigCommand = addFlpEmbeddedConfigCommand;
4
- const tracing_1 = require("../../tracing");
5
- const app_config_writer_1 = require("@sap-ux/app-config-writer");
1
+ import { getLogger, traceChanges, setLogLevelVerbose } from '../../tracing/index.js';
2
+ import { generateFlpEmbeddedConfig, DEFAULT_FLP_PATH } from '@sap-ux/app-config-writer';
6
3
  /**
7
4
  * Add the "add flp-embedded-config" command to a passed command.
8
5
  *
9
6
  * @param cmd - commander command to attach the flp-embedded-config subcommand to
10
7
  */
11
- function addFlpEmbeddedConfigCommand(cmd) {
8
+ export function addFlpEmbeddedConfigCommand(cmd) {
12
9
  cmd.command('flp-embedded-config [path]')
13
10
  .description(`Add the necessary configuration for running a Fiori app in FLP Embedded Mode.
14
11
  Adds a \`start-embedded\` script to \`package.json\` and creates an \`flp.yaml\` file
@@ -18,12 +15,12 @@ Example:
18
15
  \`npx --yes @sap-ux/create@latest add flp-embedded-config --bspApplication my-bsp-app\``)
19
16
  .requiredOption('-b, --bspApplication <string>', 'BSP application name of the deployed app')
20
17
  .option('-c, --config <string>', 'Path (relative to project root) to the ui5.yaml to use as base for flp.yaml', 'ui5.yaml')
21
- .option('--flp <string>', 'FLP URL path used in the start-embedded script', app_config_writer_1.DEFAULT_FLP_PATH)
18
+ .option('--flp <string>', 'FLP URL path used in the start-embedded script', DEFAULT_FLP_PATH)
22
19
  .option('-s, --simulate', 'Simulate only. Do not write files. Also sets `--verbose`.')
23
20
  .option('-v, --verbose', 'Show verbose information.')
24
21
  .action(async (path, options) => {
25
22
  if (options.verbose === true || options.simulate) {
26
- (0, tracing_1.setLogLevelVerbose)();
23
+ setLogLevelVerbose();
27
24
  }
28
25
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
29
26
  await runFlpEmbeddedConfig(path || process.cwd(), options);
@@ -40,12 +37,12 @@ Example:
40
37
  * @param options.simulate - if true, simulate only and do not write files
41
38
  */
42
39
  async function runFlpEmbeddedConfig(basePath, options) {
43
- const logger = (0, tracing_1.getLogger)();
40
+ const logger = getLogger();
44
41
  try {
45
42
  logger.debug(`Called add flp-embedded-config for path '${basePath}', bspApplication '${options.bspApplication}'`);
46
- const fs = await (0, app_config_writer_1.generateFlpEmbeddedConfig)(basePath, options.bspApplication, options.flp, options.config, undefined, logger);
43
+ const fs = await generateFlpEmbeddedConfig(basePath, options.bspApplication, options.flp, options.config, undefined, logger);
47
44
  if (options.simulate) {
48
- await (0, tracing_1.traceChanges)(fs);
45
+ await traceChanges(fs);
49
46
  }
50
47
  else {
51
48
  await new Promise((resolve, reject) => {
@@ -1,30 +1,27 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addAddHtmlFilesCmd = addAddHtmlFilesCmd;
4
- const tracing_1 = require("../../tracing");
5
- const validation_1 = require("../../validation");
6
- const preview_middleware_1 = require("@sap-ux/preview-middleware");
7
- const node_path_1 = require("node:path");
8
- const ui5_config_1 = require("@sap-ux/ui5-config");
9
- const mem_fs_editor_1 = require("mem-fs-editor");
10
- const mem_fs_1 = require("mem-fs");
11
- const project_access_1 = require("@sap-ux/project-access");
1
+ import { getLogger, traceChanges, setLogLevelVerbose } from '../../tracing/index.js';
2
+ import { validateBasePath } from '../../validation/index.js';
3
+ import { generatePreviewFiles } from '@sap-ux/preview-middleware';
4
+ import { isAbsolute, join } from 'node:path';
5
+ import { UI5Config } from '@sap-ux/ui5-config';
6
+ import { create } from 'mem-fs-editor';
7
+ import { create as createStorage } from 'mem-fs';
8
+ import { FileName } from '@sap-ux/project-access';
12
9
  /**
13
10
  * Adds a command to add the virtual html files hosted by the preview middleware to the file system.
14
11
  *
15
12
  * @param cmd - commander command for adding navigation inbounds config command
16
13
  */
17
- function addAddHtmlFilesCmd(cmd) {
14
+ export function addAddHtmlFilesCmd(cmd) {
18
15
  cmd.command('html [path]')
19
16
  .description(`Add HTML files for local preview and testing to the project. It uses the configuration from the \`ui5.yaml\` file as default, as provided by the \`fiori-tools-preview\` or \`preview-middleware\`.\n
20
17
  Example:
21
18
  \`npx --yes @sap-ux/create@latest add html\``)
22
- .option('-c, --config <string>', 'Path to the project configuration file in YAML format.', project_access_1.FileName.Ui5Yaml)
19
+ .option('-c, --config <string>', 'Path to the project configuration file in YAML format.', FileName.Ui5Yaml)
23
20
  .option('-s, --simulate', 'Simulate only. Do not write to the config file. Also, sets `--verbose`')
24
21
  .option('-v, --verbose', 'Show verbose information.')
25
22
  .action(async (path, options) => {
26
23
  if (options.verbose === true || options.simulate) {
27
- (0, tracing_1.setLogLevelVerbose)();
24
+ setLogLevelVerbose();
28
25
  }
29
26
  await addHtmlFiles(path || process.cwd(), !!options.simulate, options.config);
30
27
  });
@@ -37,21 +34,21 @@ Example:
37
34
  * @param yamlPath - path to the ui5*.yaml file
38
35
  */
39
36
  async function addHtmlFiles(basePath, simulate, yamlPath) {
40
- const logger = (0, tracing_1.getLogger)();
37
+ const logger = getLogger();
41
38
  try {
42
39
  logger.debug(`Called add html for path '${basePath}', simulate is '${simulate}'`);
43
- const ui5ConfigPath = (0, node_path_1.isAbsolute)(yamlPath) ? yamlPath : (0, node_path_1.join)(basePath, yamlPath);
44
- await (0, validation_1.validateBasePath)(basePath, ui5ConfigPath);
45
- const fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
46
- const ui5Conf = await ui5_config_1.UI5Config.newInstance(fs.read(ui5ConfigPath));
40
+ const ui5ConfigPath = isAbsolute(yamlPath) ? yamlPath : join(basePath, yamlPath);
41
+ await validateBasePath(basePath, ui5ConfigPath);
42
+ const fs = create(createStorage());
43
+ const ui5Conf = await UI5Config.newInstance(fs.read(ui5ConfigPath));
47
44
  const preview = ui5Conf.findCustomMiddleware('fiori-tools-preview') ??
48
45
  ui5Conf.findCustomMiddleware('preview-middleware');
49
- await (0, preview_middleware_1.generatePreviewFiles)(basePath, preview?.configuration ?? {}, fs, logger);
46
+ await generatePreviewFiles(basePath, preview?.configuration ?? {}, fs, logger);
50
47
  if (!simulate) {
51
48
  await new Promise((resolve) => fs.commit(resolve));
52
49
  }
53
50
  else {
54
- await (0, tracing_1.traceChanges)(fs);
51
+ await traceChanges(fs);
55
52
  }
56
53
  }
57
54
  catch (error) {