@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.
- package/dist/cli/add/adp-cf-config.js +14 -17
- package/dist/cli/add/annotations-to-odata.js +20 -23
- package/dist/cli/add/cards-generator.js +11 -14
- package/dist/cli/add/cds-plugin-ui.js +11 -14
- package/dist/cli/add/component-usages.js +13 -17
- package/dist/cli/add/deploy-config.js +23 -25
- package/dist/cli/add/eslint-config.js +13 -16
- package/dist/cli/add/flp-embedded-config.js +8 -11
- package/dist/cli/add/html.js +18 -21
- package/dist/cli/add/index.js +33 -36
- package/dist/cli/add/mockserver-config.js +19 -21
- package/dist/cli/add/navigation-config.js +38 -41
- package/dist/cli/add/new-model.js +11 -14
- package/dist/cli/add/smartlinks-config.js +10 -13
- package/dist/cli/add/system.js +22 -25
- package/dist/cli/add/variants-config.js +13 -16
- package/dist/cli/change/change-data-source.js +18 -21
- package/dist/cli/change/change-inbound.js +13 -16
- package/dist/cli/change/index.js +9 -12
- package/dist/cli/change/system.js +12 -15
- package/dist/cli/convert/eslint-config.js +15 -18
- package/dist/cli/convert/index.js +7 -10
- package/dist/cli/convert/preview.js +10 -13
- package/dist/cli/generate/adaptation-project.js +14 -20
- package/dist/cli/generate/index.js +5 -8
- package/dist/cli/get/index.js +5 -8
- package/dist/cli/get/system.js +10 -13
- package/dist/cli/index.js +27 -29
- package/dist/cli/list/index.js +5 -8
- package/dist/cli/list/system.js +9 -12
- package/dist/cli/remove/index.js +7 -10
- package/dist/cli/remove/mockserver-config.js +12 -18
- package/dist/cli/remove/system.js +8 -11
- package/dist/common/index.d.ts +1 -1
- package/dist/common/index.js +4 -9
- package/dist/common/prompts.js +7 -15
- package/dist/index.js +2 -4
- package/dist/tracing/compare.js +12 -16
- package/dist/tracing/index.d.ts +2 -2
- package/dist/tracing/index.js +2 -8
- package/dist/tracing/logger.js +9 -15
- package/dist/tracing/trace.js +11 -14
- package/dist/validation/index.d.ts +1 -1
- package/dist/validation/index.js +1 -8
- package/dist/validation/validation.js +15 -21
- package/package.json +24 -22
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const validation_1 = require("../../validation");
|
|
8
|
-
const system_access_1 = require("@sap-ux/system-access");
|
|
9
|
-
const project_access_1 = require("@sap-ux/project-access");
|
|
1
|
+
import { generateChange, ChangeType, getPromptsForChangeDataSource, getAdpConfig, ManifestService, getVariant, isCFEnvironment } from '@sap-ux/adp-tooling';
|
|
2
|
+
import { getLogger, traceChanges } from '../../tracing/index.js';
|
|
3
|
+
import { promptYUIQuestions } from '../../common/index.js';
|
|
4
|
+
import { validateAdpAppType } from '../../validation/index.js';
|
|
5
|
+
import { createAbapServiceProvider } from '@sap-ux/system-access';
|
|
6
|
+
import { FileName } from '@sap-ux/project-access';
|
|
10
7
|
let loginAttempts = 3;
|
|
11
8
|
/**
|
|
12
9
|
* Add a new sub-command to change the data source of an adaptation project to the given command.
|
|
13
10
|
*
|
|
14
11
|
* @param {Command} cmd - The command to add the change data-source sub-command to.
|
|
15
12
|
*/
|
|
16
|
-
function addChangeDataSourceCommand(cmd) {
|
|
13
|
+
export function addChangeDataSourceCommand(cmd) {
|
|
17
14
|
cmd.command('data-source [path]')
|
|
18
15
|
.description(`Replace the OData Source of the base application in an adaptation project.\n
|
|
19
16
|
This command is not supported for Cloud Foundry projects.\n
|
|
20
17
|
Example:
|
|
21
18
|
\`npx --yes @sap-ux/create@latest change data-source\``)
|
|
22
19
|
.option('-s, --simulate', 'Simulate only. Do not write or install.')
|
|
23
|
-
.option('-c, --config <string>', 'Path to the project configuration file in YAML format.',
|
|
20
|
+
.option('-c, --config <string>', 'Path to the project configuration file in YAML format.', FileName.Ui5Yaml)
|
|
24
21
|
.action(async (path, options) => {
|
|
25
22
|
await changeDataSource(path, !!options.simulate, options.config);
|
|
26
23
|
});
|
|
@@ -33,24 +30,24 @@ Example:
|
|
|
33
30
|
* @param {string} yamlPath - The path to the project configuration file in YAML format.
|
|
34
31
|
*/
|
|
35
32
|
async function changeDataSource(basePath, simulate, yamlPath) {
|
|
36
|
-
const logger =
|
|
33
|
+
const logger = getLogger();
|
|
37
34
|
try {
|
|
38
35
|
if (!basePath) {
|
|
39
36
|
basePath = process.cwd();
|
|
40
37
|
}
|
|
41
|
-
await
|
|
42
|
-
if (await
|
|
38
|
+
await validateAdpAppType(basePath);
|
|
39
|
+
if (await isCFEnvironment(basePath)) {
|
|
43
40
|
throw new Error('This command is not supported for Cloud Foundry projects.');
|
|
44
41
|
}
|
|
45
|
-
const variant = await
|
|
46
|
-
const { target, ignoreCertErrors = false } = await
|
|
47
|
-
const provider = await
|
|
42
|
+
const variant = await getVariant(basePath);
|
|
43
|
+
const { target, ignoreCertErrors = false } = await getAdpConfig(basePath, yamlPath);
|
|
44
|
+
const provider = await createAbapServiceProvider(target, {
|
|
48
45
|
ignoreCertErrors
|
|
49
46
|
}, true, logger);
|
|
50
|
-
const manifestService = await
|
|
47
|
+
const manifestService = await ManifestService.initBaseManifest(provider, variant.reference, logger);
|
|
51
48
|
const dataSources = manifestService.getManifestDataSources();
|
|
52
|
-
const answers = await
|
|
53
|
-
const fs = await
|
|
49
|
+
const answers = await promptYUIQuestions(getPromptsForChangeDataSource(dataSources), false);
|
|
50
|
+
const fs = await generateChange(basePath, ChangeType.CHANGE_DATA_SOURCE, {
|
|
54
51
|
variant,
|
|
55
52
|
dataSources,
|
|
56
53
|
service: answers
|
|
@@ -59,7 +56,7 @@ async function changeDataSource(basePath, simulate, yamlPath) {
|
|
|
59
56
|
await new Promise((resolve) => fs.commit(resolve));
|
|
60
57
|
}
|
|
61
58
|
else {
|
|
62
|
-
await
|
|
59
|
+
await traceChanges(fs);
|
|
63
60
|
}
|
|
64
61
|
}
|
|
65
62
|
catch (error) {
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const adp_tooling_1 = require("@sap-ux/adp-tooling");
|
|
6
|
-
const common_1 = require("../../common");
|
|
7
|
-
const validation_1 = require("../../validation");
|
|
1
|
+
import { getLogger, traceChanges } from '../../tracing/index.js';
|
|
2
|
+
import { ChangeType, generateChange, getPromptsForChangeInbound, getVariant, isCFEnvironment } from '@sap-ux/adp-tooling';
|
|
3
|
+
import { promptYUIQuestions } from '../../common/index.js';
|
|
4
|
+
import { validateAdpAppType, validateCloudAdpProject } from '../../validation/index.js';
|
|
8
5
|
/**
|
|
9
6
|
* Add a new sub-command to change the inbound of an adaptation project to the given command.
|
|
10
7
|
*
|
|
11
8
|
* @param {Command} cmd - The command to add the change inbound sub-command to.
|
|
12
9
|
*/
|
|
13
|
-
function addChangeInboundCommand(cmd) {
|
|
10
|
+
export function addChangeInboundCommand(cmd) {
|
|
14
11
|
cmd.command('inbound [path]')
|
|
15
12
|
.description(`Replace the inbound FLP configurations of the base application in an adaptation project.\n
|
|
16
13
|
This command is not supported for Cloud Foundry projects.\n
|
|
@@ -28,21 +25,21 @@ Example:
|
|
|
28
25
|
* @param {boolean} simulate - If set to true, then no files will be written to the filesystem.
|
|
29
26
|
*/
|
|
30
27
|
async function changeInbound(basePath, simulate) {
|
|
31
|
-
const logger =
|
|
28
|
+
const logger = getLogger();
|
|
32
29
|
try {
|
|
33
30
|
if (!basePath) {
|
|
34
31
|
basePath = process.cwd();
|
|
35
32
|
}
|
|
36
|
-
await
|
|
37
|
-
if (await
|
|
33
|
+
await validateAdpAppType(basePath);
|
|
34
|
+
if (await isCFEnvironment(basePath)) {
|
|
38
35
|
throw new Error('This command is not supported for Cloud Foundry projects.');
|
|
39
36
|
}
|
|
40
|
-
await
|
|
41
|
-
const variant = await
|
|
37
|
+
await validateCloudAdpProject(basePath);
|
|
38
|
+
const variant = await getVariant(basePath);
|
|
42
39
|
const change = variant.content.find((change) => change.changeType === 'appdescr_app_removeAllInboundsExceptOne');
|
|
43
40
|
const inboundId = change?.content?.inboundId;
|
|
44
|
-
const answers = await
|
|
45
|
-
const fs = await
|
|
41
|
+
const answers = await promptYUIQuestions(getPromptsForChangeInbound(), false);
|
|
42
|
+
const fs = await generateChange(basePath, ChangeType.CHANGE_INBOUND, {
|
|
46
43
|
inboundId,
|
|
47
44
|
variant,
|
|
48
45
|
flp: answers
|
|
@@ -51,7 +48,7 @@ async function changeInbound(basePath, simulate) {
|
|
|
51
48
|
await new Promise((resolve) => fs.commit(resolve));
|
|
52
49
|
}
|
|
53
50
|
else {
|
|
54
|
-
await
|
|
51
|
+
await traceChanges(fs);
|
|
55
52
|
}
|
|
56
53
|
}
|
|
57
54
|
catch (error) {
|
package/dist/cli/change/index.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const change_data_source_1 = require("./change-data-source");
|
|
6
|
-
const change_inbound_1 = require("./change-inbound");
|
|
7
|
-
const system_1 = require("./system");
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { addChangeDataSourceCommand } from './change-data-source.js';
|
|
3
|
+
import { addChangeInboundCommand } from './change-inbound.js';
|
|
4
|
+
import { addSystemUpdateCommand } from './system.js';
|
|
8
5
|
/**
|
|
9
6
|
* Return 'create-fiori change *' commands. Commands include also the handler action.
|
|
10
7
|
*
|
|
11
8
|
* @returns - commander command containing change <feature> commands
|
|
12
9
|
*/
|
|
13
|
-
function getChangeCommands() {
|
|
14
|
-
const changeCommands = new
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
export function getChangeCommands() {
|
|
11
|
+
const changeCommands = new Command('change');
|
|
12
|
+
addChangeDataSourceCommand(changeCommands);
|
|
13
|
+
addChangeInboundCommand(changeCommands);
|
|
14
|
+
addSystemUpdateCommand(changeCommands);
|
|
18
15
|
return changeCommands;
|
|
19
16
|
}
|
|
20
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const ui5_config_1 = require("@sap-ux/ui5-config");
|
|
7
|
-
const dotenv_1 = require("dotenv");
|
|
8
|
-
const tracing_1 = require("../../tracing");
|
|
1
|
+
import { isAppStudio } from '@sap-ux/btp-utils';
|
|
2
|
+
import { getService, BackendSystemKey } from '@sap-ux/store';
|
|
3
|
+
import { replaceEnvVariables } from '@sap-ux/ui5-config';
|
|
4
|
+
import { config as loadEnvConfig } from 'dotenv';
|
|
5
|
+
import { getLogger } from '../../tracing/index.js';
|
|
9
6
|
/**
|
|
10
7
|
* Add the "change system" subcommand to a passed command.
|
|
11
8
|
* Updates an existing backend system in the saved systems store (~/.fioritools).
|
|
@@ -13,7 +10,7 @@ const tracing_1 = require("../../tracing");
|
|
|
13
10
|
*
|
|
14
11
|
* @param cmd - commander command to attach the system subcommand to
|
|
15
12
|
*/
|
|
16
|
-
function addSystemUpdateCommand(cmd) {
|
|
13
|
+
export function addSystemUpdateCommand(cmd) {
|
|
17
14
|
cmd.command('system')
|
|
18
15
|
.description(`Update an existing backend system in the saved systems store (\`~/.fioritools\`). The system is identified by its URL and optional SAP client.\n
|
|
19
16
|
|
|
@@ -27,7 +24,7 @@ Example:
|
|
|
27
24
|
.option('--password <string>', "To avoid plain-text credentials in the shell's history, pass an env reference: --password env:MY_VAR")
|
|
28
25
|
.option('--clear-credentials', 'Remove stored credentials from the system')
|
|
29
26
|
.action(async (options) => {
|
|
30
|
-
(
|
|
27
|
+
loadEnvConfig();
|
|
31
28
|
await updateSystem({
|
|
32
29
|
url: options.url,
|
|
33
30
|
client: options.client,
|
|
@@ -50,14 +47,14 @@ Example:
|
|
|
50
47
|
* @param params.clearCredentials - if true, clears stored credentials
|
|
51
48
|
*/
|
|
52
49
|
async function updateSystem(params) {
|
|
53
|
-
const logger =
|
|
50
|
+
const logger = getLogger();
|
|
54
51
|
try {
|
|
55
|
-
if (
|
|
52
|
+
if (isAppStudio()) {
|
|
56
53
|
logger.error('System management using the CLI is not supported in SAP Business Application Studio. Use the built-in system management instead.');
|
|
57
54
|
return;
|
|
58
55
|
}
|
|
59
56
|
const patchRecord = {};
|
|
60
|
-
|
|
57
|
+
replaceEnvVariables(params);
|
|
61
58
|
if (params.name !== undefined) {
|
|
62
59
|
patchRecord.name = params.name;
|
|
63
60
|
}
|
|
@@ -78,8 +75,8 @@ async function updateSystem(params) {
|
|
|
78
75
|
logger.error('No fields to update. Provide at least one of: --name, --username, --password, --clear-credentials');
|
|
79
76
|
return;
|
|
80
77
|
}
|
|
81
|
-
const service = await
|
|
82
|
-
const key = new
|
|
78
|
+
const service = await getService({ entityName: 'system' });
|
|
79
|
+
const key = new BackendSystemKey({ url: params.url, client: params.client });
|
|
83
80
|
const existing = await service.read(key);
|
|
84
81
|
if (!existing) {
|
|
85
82
|
logger.error(`System not found: ${key.getId()}`);
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const common_1 = require("../../common");
|
|
8
|
-
const project_access_1 = require("@sap-ux/project-access");
|
|
9
|
-
const node_path_1 = require("node:path");
|
|
1
|
+
import { getLogger, setLogLevelVerbose, traceChanges } from '../../tracing/index.js';
|
|
2
|
+
import { validateBasePath } from '../../validation/index.js';
|
|
3
|
+
import { convertEslintConfig as migrateEslintConfig } from '@sap-ux/app-config-writer';
|
|
4
|
+
import { runNpmInstallCommand } from '../../common/index.js';
|
|
5
|
+
import { execNpmCommand } from '@sap-ux/project-access';
|
|
6
|
+
import { join } from 'node:path';
|
|
10
7
|
/**
|
|
11
8
|
* Add a new sub-command to convert the eslint configuration of a project to flat config format (eslint version 9).
|
|
12
9
|
*
|
|
13
10
|
* @param {Command} cmd - The command to add the convert sub-command to.
|
|
14
11
|
*/
|
|
15
|
-
function addConvertEslintCommand(cmd) {
|
|
12
|
+
export function addConvertEslintCommand(cmd) {
|
|
16
13
|
cmd.command('eslint-config [path]')
|
|
17
14
|
.description(`Executed in the root folder of an app, it converts the ESLint configuration of the respective app to flat config format (used since ESLint version 9). It also introduces specific ESLint checks for SAP Fiori applications (using the \`@sap-ux/eslint-plugin-fiori-tools\` plugin), and deletes the deprecated \`eslint-plugin-fiori-custom\` plugin. To avoid dependency resolution conflicts, it deletes the \`package-lock.json\` file as well as the \`@sap-ux/eslint-plugin-fiori-tools\` module from the \`node_modules\` folder before running \`npm install\`.\n
|
|
18
15
|
Examples:
|
|
@@ -23,7 +20,7 @@ Examples:
|
|
|
23
20
|
.option('-n, --skip-install', 'Skip the `npm install` step. Also skips deleting the `package-lock.json` file and the `@sap-ux/eslint-plugin-fiori-tools` module from the `node_modules` folder.')
|
|
24
21
|
.action(async (path, options) => {
|
|
25
22
|
if (options.verbose === true || options.simulate) {
|
|
26
|
-
|
|
23
|
+
setLogLevelVerbose();
|
|
27
24
|
}
|
|
28
25
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
29
26
|
await convertEslintConfig(path || process.cwd(), !!options.simulate, options.config, !!options.skipInstall);
|
|
@@ -38,16 +35,16 @@ Examples:
|
|
|
38
35
|
* @param skipInstall - if true, skips the `npm install` step after converting the eslint config
|
|
39
36
|
*/
|
|
40
37
|
async function convertEslintConfig(basePath, simulate, config, skipInstall = false) {
|
|
41
|
-
const logger =
|
|
38
|
+
const logger = getLogger();
|
|
42
39
|
try {
|
|
43
40
|
logger.debug(`Called add eslint-config for path '${basePath}', simulate is '${simulate}'`);
|
|
44
|
-
await
|
|
45
|
-
const fs = await (
|
|
46
|
-
await
|
|
41
|
+
await validateBasePath(basePath);
|
|
42
|
+
const fs = await migrateEslintConfig(basePath, { logger, config });
|
|
43
|
+
await traceChanges(fs);
|
|
47
44
|
if (!simulate) {
|
|
48
45
|
if (!skipInstall) {
|
|
49
46
|
logger.info(`Deleting \`package-lock.json\` to avoid conflicts.`);
|
|
50
|
-
fs.delete(
|
|
47
|
+
fs.delete(join(basePath, 'package-lock.json'));
|
|
51
48
|
}
|
|
52
49
|
await new Promise((resolve) => fs.commit(resolve));
|
|
53
50
|
logger.info(`ESlint configuration converted. Ensure the new configuration is working correctly before deleting old configuration files like '.eslintrc.json' or '.eslintignore'.`);
|
|
@@ -57,13 +54,13 @@ async function convertEslintConfig(basePath, simulate, config, skipInstall = fal
|
|
|
57
54
|
else {
|
|
58
55
|
try {
|
|
59
56
|
logger.info(`Deleting \`@sap-ux/eslint-plugin-fiori-tools\` from \`node_modules\` to avoid dependency resolution conflicts.`);
|
|
60
|
-
await
|
|
57
|
+
await execNpmCommand(['uninstall', '@sap-ux/eslint-plugin-fiori-tools', '--no-save'], {
|
|
61
58
|
cwd: basePath,
|
|
62
59
|
logger: logger
|
|
63
60
|
});
|
|
64
61
|
logger.info('npm uninstall completed successfully.');
|
|
65
62
|
logger.info(`Executing \`npm install\`.`);
|
|
66
|
-
|
|
63
|
+
runNpmInstallCommand(basePath, undefined, { logger });
|
|
67
64
|
}
|
|
68
65
|
catch (error) {
|
|
69
66
|
logger.error(`npm command failed. '${error.message}'`);
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const preview_1 = require("./preview");
|
|
6
|
-
const eslint_config_1 = require("./eslint-config");
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { addConvertPreviewCommand } from './preview.js';
|
|
3
|
+
import { addConvertEslintCommand } from './eslint-config.js';
|
|
7
4
|
/**
|
|
8
5
|
* Return 'create-fiori convert *' commands. Commands include also the handler action.
|
|
9
6
|
*
|
|
10
7
|
* @returns - commander command containing convert <feature> commands
|
|
11
8
|
*/
|
|
12
|
-
function getConvertCommands() {
|
|
13
|
-
const convertCommands = new
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
export function getConvertCommands() {
|
|
10
|
+
const convertCommands = new Command('convert');
|
|
11
|
+
addConvertPreviewCommand(convertCommands);
|
|
12
|
+
addConvertEslintCommand(convertCommands);
|
|
16
13
|
return convertCommands;
|
|
17
14
|
}
|
|
18
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.addConvertPreviewCommand = addConvertPreviewCommand;
|
|
4
|
-
const tracing_1 = require("../../tracing");
|
|
5
|
-
const app_config_writer_1 = require("@sap-ux/app-config-writer");
|
|
1
|
+
import { getLogger, setLogLevelVerbose, traceChanges } from '../../tracing/index.js';
|
|
2
|
+
import { convertToVirtualPreview, simulatePrompt, includeTestRunnersPrompt } from '@sap-ux/app-config-writer';
|
|
6
3
|
/**
|
|
7
4
|
* Add a new sub-command to convert the preview of a project to virtual files.
|
|
8
5
|
*
|
|
9
6
|
* @param {Command} cmd - The command to add the convert sub-command to.
|
|
10
7
|
*/
|
|
11
|
-
function addConvertPreviewCommand(cmd) {
|
|
8
|
+
export function addConvertPreviewCommand(cmd) {
|
|
12
9
|
cmd.command('preview-config [path]')
|
|
13
10
|
.description(`Executed in the root folder of an app, it converts the respective app to the preview with virtual endpoints. It uses the configuration from the scripts in the \`package.json\` file to adjust the UI5 configuration YAML files accordingly. The obsolete JS and TS sources are deleted and the HTML files previously used for the preview are renamed to \`*_old.html\`.\n
|
|
14
11
|
Examples:
|
|
@@ -34,35 +31,35 @@ Examples:
|
|
|
34
31
|
* @param {boolean} verbose - If set to true, then verbose information will be logged.
|
|
35
32
|
*/
|
|
36
33
|
async function convertPreview(basePath, simulate, convertTests, verbose = false) {
|
|
37
|
-
let logger =
|
|
34
|
+
let logger = getLogger();
|
|
38
35
|
if (!basePath) {
|
|
39
36
|
basePath = process.cwd();
|
|
40
37
|
}
|
|
41
38
|
simulate =
|
|
42
39
|
simulate ??
|
|
43
|
-
(await
|
|
40
|
+
(await simulatePrompt().catch((error) => {
|
|
44
41
|
logger.error(error.message);
|
|
45
42
|
return process.exit(1);
|
|
46
43
|
}));
|
|
47
44
|
if (simulate || verbose) {
|
|
48
|
-
|
|
45
|
+
setLogLevelVerbose();
|
|
49
46
|
}
|
|
50
47
|
// Reinitialize logger with verbose log level
|
|
51
|
-
logger =
|
|
48
|
+
logger = getLogger();
|
|
52
49
|
convertTests =
|
|
53
50
|
convertTests ??
|
|
54
|
-
(await
|
|
51
|
+
(await includeTestRunnersPrompt().catch((error) => {
|
|
55
52
|
logger.error(error.message);
|
|
56
53
|
return process.exit(1);
|
|
57
54
|
}));
|
|
58
55
|
logger.debug(`Called convert preview-config for path '${basePath}', simulate is '${simulate}', convert tests is '${convertTests}'.`);
|
|
59
56
|
try {
|
|
60
|
-
const fs = await
|
|
57
|
+
const fs = await convertToVirtualPreview(basePath, { convertTests, logger });
|
|
61
58
|
if (!simulate) {
|
|
62
59
|
fs.commit(() => logger.info(`The changes for preview conversion have been written.`));
|
|
63
60
|
}
|
|
64
61
|
else {
|
|
65
|
-
await
|
|
62
|
+
await traceChanges(fs);
|
|
66
63
|
}
|
|
67
64
|
}
|
|
68
65
|
catch (error) {
|
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
exports.addGenerateAdaptationProjectCommand = addGenerateAdaptationProjectCommand;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const tracing_1 = require("../../tracing");
|
|
9
|
-
const adp_tooling_1 = require("@sap-ux/adp-tooling");
|
|
10
|
-
const common_1 = require("../../common");
|
|
11
|
-
const node_path_1 = require("node:path");
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { getLogger, traceChanges } from '../../tracing/index.js';
|
|
3
|
+
import { promptGeneratorInput, generate, FlexLayer } from '@sap-ux/adp-tooling';
|
|
4
|
+
import { runNpmInstallCommand } from '../../common/index.js';
|
|
5
|
+
import { join } from 'node:path';
|
|
12
6
|
/**
|
|
13
7
|
* Add a new sub-command to generate SAP UI5 adaptation projects the given command.
|
|
14
8
|
*
|
|
15
9
|
* @param cmd main command that is to be enhanced
|
|
16
10
|
*/
|
|
17
|
-
function addGenerateAdaptationProjectCommand(cmd) {
|
|
11
|
+
export function addGenerateAdaptationProjectCommand(cmd) {
|
|
18
12
|
cmd.command('adaptation-project [path]')
|
|
19
13
|
.description(`Generate a new SAPUI5 adaptation project with optional prompts and configuration.\n
|
|
20
14
|
Example:
|
|
@@ -31,7 +25,7 @@ Example:
|
|
|
31
25
|
.option('--package [package]', 'The ABAP package to be used for deployments.')
|
|
32
26
|
.option('--transport [transport]', 'The ABAP transport to be used for deployments.')
|
|
33
27
|
.action(async (path, options) => {
|
|
34
|
-
console.log(`\nThe generation of adaptation projects outside of SAP Business Application Studio is currently ${
|
|
28
|
+
console.log(`\nThe generation of adaptation projects outside of SAP Business Application Studio is currently ${chalk.bold('experimental')}.`);
|
|
35
29
|
console.log('Please report any issues or feedback at https://github.com/SAP/open-ux-tools/issues/new/choose.\n');
|
|
36
30
|
await generateAdaptationProject(path, { ...options }, !!options.yes, !!options.simulate, !!options.skipInstall);
|
|
37
31
|
});
|
|
@@ -46,7 +40,7 @@ Example:
|
|
|
46
40
|
* @param skipInstall if set to true then `npm i` is not executed in the new project
|
|
47
41
|
*/
|
|
48
42
|
async function generateAdaptationProject(basePath, defaults, useDefaults, simulate, skipInstall) {
|
|
49
|
-
const logger =
|
|
43
|
+
const logger = getLogger();
|
|
50
44
|
try {
|
|
51
45
|
logger.debug(`Called generate adaptation-project for path '${basePath}', skip install is '${skipInstall}'`);
|
|
52
46
|
if (defaults.url) {
|
|
@@ -54,21 +48,21 @@ async function generateAdaptationProject(basePath, defaults, useDefaults, simula
|
|
|
54
48
|
defaults.url = url.origin;
|
|
55
49
|
defaults.client = url.searchParams.get('sap-client') ?? undefined;
|
|
56
50
|
}
|
|
57
|
-
const config = useDefaults ? createConfigFromDefaults(defaults) : await
|
|
51
|
+
const config = useDefaults ? createConfigFromDefaults(defaults) : await promptGeneratorInput(defaults, logger);
|
|
58
52
|
if (!basePath) {
|
|
59
|
-
basePath =
|
|
53
|
+
basePath = join(process.cwd(), config.app.id);
|
|
60
54
|
}
|
|
61
55
|
addChangeForResourceModel(config);
|
|
62
|
-
const fs = await
|
|
56
|
+
const fs = await generate(basePath, config);
|
|
63
57
|
if (!simulate) {
|
|
64
58
|
await new Promise((resolve) => fs.commit(resolve));
|
|
65
59
|
if (!skipInstall) {
|
|
66
|
-
|
|
60
|
+
runNpmInstallCommand(basePath);
|
|
67
61
|
logger.info('Executed npm install');
|
|
68
62
|
}
|
|
69
63
|
}
|
|
70
64
|
else {
|
|
71
|
-
await
|
|
65
|
+
await traceChanges(fs);
|
|
72
66
|
}
|
|
73
67
|
}
|
|
74
68
|
catch (error) {
|
|
@@ -87,7 +81,7 @@ function createConfigFromDefaults(defaults) {
|
|
|
87
81
|
app: {
|
|
88
82
|
id: defaults.id,
|
|
89
83
|
reference: defaults.reference,
|
|
90
|
-
layer:
|
|
84
|
+
layer: FlexLayer.CUSTOMER_BASE
|
|
91
85
|
},
|
|
92
86
|
target: {
|
|
93
87
|
url: defaults.url,
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getGenerateCommands = getGenerateCommands;
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const adaptation_project_1 = require("./adaptation-project");
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { addGenerateAdaptationProjectCommand } from './adaptation-project.js';
|
|
6
3
|
/**
|
|
7
4
|
* @returns 'generate *' commands. Commands include also the handler action.
|
|
8
5
|
*/
|
|
9
|
-
function getGenerateCommands() {
|
|
10
|
-
const genCommands = new
|
|
11
|
-
|
|
6
|
+
export function getGenerateCommands() {
|
|
7
|
+
const genCommands = new Command('generate');
|
|
8
|
+
addGenerateAdaptationProjectCommand(genCommands);
|
|
12
9
|
return genCommands;
|
|
13
10
|
}
|
|
14
11
|
//# sourceMappingURL=index.js.map
|
package/dist/cli/get/index.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getGetCommands = getGetCommands;
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const system_1 = require("./system");
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { addSystemGetCommand } from './system.js';
|
|
6
3
|
/**
|
|
7
4
|
* Return 'create-fiori get *' commands. Commands include also the handler action.
|
|
8
5
|
*
|
|
9
6
|
* @returns - commander command containing get <feature> commands
|
|
10
7
|
*/
|
|
11
|
-
function getGetCommands() {
|
|
12
|
-
const getCommands = new
|
|
13
|
-
|
|
8
|
+
export function getGetCommands() {
|
|
9
|
+
const getCommands = new Command('get');
|
|
10
|
+
addSystemGetCommand(getCommands);
|
|
14
11
|
return getCommands;
|
|
15
12
|
}
|
|
16
13
|
//# sourceMappingURL=index.js.map
|
package/dist/cli/get/system.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const store_1 = require("@sap-ux/store");
|
|
6
|
-
const logger_1 = require("@sap-ux/logger");
|
|
7
|
-
const tracing_1 = require("../../tracing");
|
|
1
|
+
import { isAppStudio } from '@sap-ux/btp-utils';
|
|
2
|
+
import { getService, BackendSystemKey } from '@sap-ux/store';
|
|
3
|
+
import { NullTransport, ToolsLogger } from '@sap-ux/logger';
|
|
4
|
+
import { getLogger } from '../../tracing/index.js';
|
|
8
5
|
/**
|
|
9
6
|
* Add the "get system" subcommand to a passed command.
|
|
10
7
|
* Retrieves details of a saved backend system identified by its URL and optional client.
|
|
@@ -12,7 +9,7 @@ const tracing_1 = require("../../tracing");
|
|
|
12
9
|
*
|
|
13
10
|
* @param cmd - commander command to attach the system subcommand to
|
|
14
11
|
*/
|
|
15
|
-
function addSystemGetCommand(cmd) {
|
|
12
|
+
export function addSystemGetCommand(cmd) {
|
|
16
13
|
cmd.command('system')
|
|
17
14
|
.description(`Retrieve details of a saved back-end system by URL. Sensitive data (passwords, tokens) is never included in the output.\n
|
|
18
15
|
Example:
|
|
@@ -34,21 +31,21 @@ Example:
|
|
|
34
31
|
* @param asJson - if true, output as JSON; otherwise print human-readable
|
|
35
32
|
*/
|
|
36
33
|
async function getSystem(url, client, asJson) {
|
|
37
|
-
const logger =
|
|
34
|
+
const logger = getLogger();
|
|
38
35
|
try {
|
|
39
|
-
if (
|
|
36
|
+
if (isAppStudio()) {
|
|
40
37
|
logger.error('System management using the CLI is not supported in SAP Business Application Studio. Use the built-in system management instead.');
|
|
41
38
|
return;
|
|
42
39
|
}
|
|
43
40
|
// When emitting JSON, pass a silent logger to getService so that
|
|
44
41
|
// @sap-ux/store diagnostic messages do not appear on stdout before the
|
|
45
42
|
// JSON payload and break piped consumers.
|
|
46
|
-
const storeLogger = asJson ? new
|
|
47
|
-
const service = await
|
|
43
|
+
const storeLogger = asJson ? new ToolsLogger({ transports: [new NullTransport()] }) : logger;
|
|
44
|
+
const service = await getService({
|
|
48
45
|
entityName: 'system',
|
|
49
46
|
logger: storeLogger
|
|
50
47
|
});
|
|
51
|
-
const key = new
|
|
48
|
+
const key = new BackendSystemKey({ url, client });
|
|
52
49
|
const system = await service.read(key);
|
|
53
50
|
if (!system) {
|
|
54
51
|
logger.error(`System not found: ${key.getId()}`);
|