@sap-ux/deploy-config-sub-generator 0.6.12 → 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/generators/app/index.d.ts +5 -5
- package/generators/app/index.js +34 -41
- package/generators/app/prompting.d.ts +1 -1
- package/generators/app/prompting.js +4 -7
- package/generators/app/utils.d.ts +1 -1
- package/generators/app/utils.js +4 -8
- package/generators/headless/index.js +19 -22
- package/generators/prompts/deploy-target.d.ts +1 -1
- package/generators/prompts/deploy-target.js +6 -9
- package/generators/prompts/index.d.ts +2 -2
- package/generators/prompts/index.js +2 -7
- package/generators/prompts/sub-gen.d.ts +1 -1
- package/generators/prompts/sub-gen.js +23 -26
- package/generators/types/index.d.ts +1 -1
- package/generators/types/index.js +1 -2
- package/generators/utils/config.d.ts +1 -1
- package/generators/utils/config.js +7 -10
- package/generators/utils/constants.d.ts +1 -1
- package/generators/utils/constants.js +7 -11
- package/generators/utils/environment.js +16 -21
- package/generators/utils/i18n.js +11 -21
- package/generators/utils/index.d.ts +5 -5
- package/generators/utils/index.js +5 -21
- package/generators/utils/targets.d.ts +1 -1
- package/generators/utils/targets.js +14 -16
- package/package.json +19 -17
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DeploymentGenerator } from '@sap-ux/deploy-config-generator-shared';
|
|
2
|
-
import { promptNames } from '../utils';
|
|
3
|
-
import { AppWizard, Prompts } from '@sap-devx/yeoman-ui-types';
|
|
2
|
+
import { promptNames } from '../utils/index.js';
|
|
3
|
+
import type { AppWizard as AppWizardType, Prompts as PromptsType } from '@sap-devx/yeoman-ui-types';
|
|
4
4
|
import type { Answers } from 'inquirer';
|
|
5
|
-
import type { DeployConfigGenerator, DeployConfigOptions, DeployConfigSubGenPromptOptions } from '../types';
|
|
5
|
+
import type { DeployConfigGenerator, DeployConfigOptions, DeployConfigSubGenPromptOptions } from '../types/index.js';
|
|
6
6
|
import type { FioriToolsProxyConfigBackend } from '@sap-ux/ui5-config';
|
|
7
7
|
import type { VSCodeInstance } from '@sap-ux/fiori-generator-shared';
|
|
8
8
|
import type { ApiHubConfig } from '@sap-ux/cf-deploy-config-sub-generator';
|
|
@@ -10,8 +10,8 @@ import type { ApiHubConfig } from '@sap-ux/cf-deploy-config-sub-generator';
|
|
|
10
10
|
* The main deployment configuration generator.
|
|
11
11
|
*/
|
|
12
12
|
export default class extends DeploymentGenerator implements DeployConfigGenerator {
|
|
13
|
-
readonly appWizard:
|
|
14
|
-
readonly prompts:
|
|
13
|
+
readonly appWizard: AppWizardType;
|
|
14
|
+
readonly prompts: PromptsType;
|
|
15
15
|
readonly genNamespace: string;
|
|
16
16
|
readonly launchStandaloneFromYui: boolean;
|
|
17
17
|
readonly apiHubConfig: ApiHubConfig;
|
package/generators/app/index.js
CHANGED
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const project_access_1 = require("@sap-ux/project-access");
|
|
10
|
-
const deploy_config_generator_shared_1 = require("@sap-ux/deploy-config-generator-shared");
|
|
11
|
-
const utils_1 = require("./utils");
|
|
12
|
-
const utils_2 = require("../utils");
|
|
13
|
-
Object.defineProperty(exports, "promptNames", { enumerable: true, get: function () { return utils_2.promptNames; } });
|
|
14
|
-
const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
|
|
15
|
-
const prompting_1 = require("./prompting");
|
|
1
|
+
import dotenv from 'dotenv';
|
|
2
|
+
import { basename, dirname, join } from 'node:path';
|
|
3
|
+
import { getMtaPath, findCapProjectRoot, getAppType } from '@sap-ux/project-access';
|
|
4
|
+
import { bail, DeploymentGenerator, ErrorHandler, TargetName, getExtensionGenPromptOpts } from '@sap-ux/deploy-config-generator-shared';
|
|
5
|
+
import { parseTarget, getYUIDetails } from './utils.js';
|
|
6
|
+
import { getApiHubOptions, getEnvApiHubConfig, t, generatorNamespace, getBackendConfig, getSupportedTargets, generatorTitle, promptNames } from '../utils/index.js';
|
|
7
|
+
import { AppWizard, Prompts } from '@sap-devx/yeoman-ui-types';
|
|
8
|
+
import { promptDeployConfigQuestions } from './prompting.js';
|
|
16
9
|
const deployConfigSubGenNamespace = '@sap-ux/deploy-config-sub-generator';
|
|
17
10
|
/**
|
|
18
11
|
* The main deployment configuration generator.
|
|
19
12
|
*/
|
|
20
|
-
class
|
|
13
|
+
export default class extends DeploymentGenerator {
|
|
21
14
|
appWizard;
|
|
22
15
|
prompts;
|
|
23
16
|
genNamespace;
|
|
@@ -42,11 +35,11 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
|
|
|
42
35
|
*/
|
|
43
36
|
constructor(args, opts) {
|
|
44
37
|
super(args, opts);
|
|
45
|
-
this.appWizard = opts.appWizard ??
|
|
38
|
+
this.appWizard = opts.appWizard ?? AppWizard.create(opts);
|
|
46
39
|
this.genNamespace = opts.namespace;
|
|
47
40
|
this.launchDeployConfigAsSubGenerator = opts.launchDeployConfigAsSubGenerator ?? false;
|
|
48
41
|
this.promptOptions = opts?.subGenPromptOptions;
|
|
49
|
-
this.target =
|
|
42
|
+
this.target = parseTarget(args, opts);
|
|
50
43
|
this.vscode = opts.vscode;
|
|
51
44
|
if (this.rootGeneratorName()) {
|
|
52
45
|
this.env.lookup({ packagePatterns: [this.rootGeneratorName()] });
|
|
@@ -55,26 +48,26 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
|
|
|
55
48
|
if (this.options.data?.destinationRoot) {
|
|
56
49
|
this.launchStandaloneFromYui = true;
|
|
57
50
|
this.launchDeployConfigAsSubGenerator ||= this.options.data.launchDeployConfigAsSubGenerator;
|
|
58
|
-
this.options.appRootPath =
|
|
51
|
+
this.options.appRootPath = join(dirname(this.options.data.destinationRoot), basename(this.options.data.destinationRoot));
|
|
59
52
|
this.options.projectRoot = this.options.data.destinationRoot;
|
|
60
|
-
|
|
53
|
+
dotenv.config({ path: join(this.options.data.destinationRoot, '.env'), quiet: true });
|
|
61
54
|
}
|
|
62
55
|
else {
|
|
63
56
|
if (this.options.projectPath && this.options.projectName) {
|
|
64
|
-
this.options.appRootPath =
|
|
57
|
+
this.options.appRootPath = join(this.options.projectPath, this.options.projectName);
|
|
65
58
|
}
|
|
66
59
|
else {
|
|
67
60
|
this.options.appRootPath = this.destinationRoot(); // probably in a CLI context
|
|
68
61
|
}
|
|
69
62
|
// Load .env file for api hub config
|
|
70
|
-
|
|
71
|
-
this.apiHubConfig = this.options.apiHubConfig ??
|
|
63
|
+
dotenv.config({ quiet: true });
|
|
64
|
+
this.apiHubConfig = this.options.apiHubConfig ?? getEnvApiHubConfig();
|
|
72
65
|
this.launchStandaloneFromYui = false;
|
|
73
66
|
}
|
|
74
67
|
// If launched standalone, set the header, title and description
|
|
75
68
|
if (this.launchStandaloneFromYui) {
|
|
76
|
-
this.appWizard.setHeaderTitle(
|
|
77
|
-
this.prompts = new
|
|
69
|
+
this.appWizard.setHeaderTitle(generatorTitle);
|
|
70
|
+
this.prompts = new Prompts(getYUIDetails(this.options.projectRoot));
|
|
78
71
|
this.setPromptsCallback = (fn) => {
|
|
79
72
|
if (this.prompts) {
|
|
80
73
|
this.prompts.setCallback(fn);
|
|
@@ -87,26 +80,26 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
|
|
|
87
80
|
*/
|
|
88
81
|
async initializing() {
|
|
89
82
|
await super.initializing();
|
|
90
|
-
const promptOptions = await
|
|
83
|
+
const promptOptions = await getExtensionGenPromptOpts(this.env.create.bind(this.env), deployConfigSubGenNamespace, this.vscode);
|
|
91
84
|
this.promptOptions = {
|
|
92
85
|
...promptOptions,
|
|
93
86
|
...this.promptOptions
|
|
94
87
|
};
|
|
95
|
-
const capRoot = await
|
|
88
|
+
const capRoot = await findCapProjectRoot(this.options.appRootPath);
|
|
96
89
|
this.isCap = !!capRoot;
|
|
97
|
-
this.mtaPath = (await
|
|
90
|
+
this.mtaPath = (await getMtaPath(this.options.appRootPath))?.mtaPath;
|
|
98
91
|
if (this.isCap && !this.mtaPath) {
|
|
99
|
-
this.target =
|
|
92
|
+
this.target = TargetName.CF; // when CAP project and no mta.yaml, default to Cloud Foundry
|
|
100
93
|
}
|
|
101
|
-
const appType = await
|
|
94
|
+
const appType = await getAppType(this.options.appRootPath);
|
|
102
95
|
const isAdp = appType === 'Fiori Adaptation';
|
|
103
96
|
if (isAdp) {
|
|
104
|
-
this.target =
|
|
97
|
+
this.target = TargetName.ABAP; // Adp projects support only ABAP deployment
|
|
105
98
|
this.launchDeployConfigAsSubGenerator = false;
|
|
106
99
|
}
|
|
107
|
-
this.options.projectRoot = capRoot ?? (this.mtaPath &&
|
|
108
|
-
({ backendConfig: this.backendConfig, isLibrary: this.isLibrary } = await
|
|
109
|
-
const { destinationName, servicePath } = await
|
|
100
|
+
this.options.projectRoot = capRoot ?? (this.mtaPath && dirname(this.mtaPath)) ?? this.options.appRootPath;
|
|
101
|
+
({ backendConfig: this.backendConfig, isLibrary: this.isLibrary } = await getBackendConfig(this.fs, this.options, this.launchStandaloneFromYui, this.options.appRootPath));
|
|
102
|
+
const { destinationName, servicePath } = await getApiHubOptions(this.fs, {
|
|
110
103
|
appPath: this.options.appRootPath,
|
|
111
104
|
servicePath: this.options.appGenServicePath
|
|
112
105
|
});
|
|
@@ -117,17 +110,17 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
|
|
|
117
110
|
* Prompting phase for deployment configuration.
|
|
118
111
|
*/
|
|
119
112
|
async prompting() {
|
|
120
|
-
const supportedTargets = await
|
|
113
|
+
const supportedTargets = await getSupportedTargets(this.fs, this.options.appRootPath, this.isCap, !!this.mtaPath, this.apiHubConfig);
|
|
121
114
|
// target may have been passed in from the cli or determined in the init phase
|
|
122
115
|
if (this.target) {
|
|
123
116
|
const checkTarget = supportedTargets.find((t) => t.name === this.target);
|
|
124
117
|
if (!checkTarget) {
|
|
125
|
-
|
|
118
|
+
bail(ErrorHandler.unrecognizedTarget(this.target));
|
|
126
119
|
}
|
|
127
120
|
}
|
|
128
121
|
if (!this.target || this.launchDeployConfigAsSubGenerator) {
|
|
129
122
|
// if there is no specified target then prompting will occur
|
|
130
|
-
const { target, answers } = await
|
|
123
|
+
const { target, answers } = await promptDeployConfigQuestions(this.fs, this.options, this.prompt.bind(this), {
|
|
131
124
|
launchDeployConfigAsSubGenerator: this.launchDeployConfigAsSubGenerator,
|
|
132
125
|
launchStandaloneFromYui: this.launchStandaloneFromYui,
|
|
133
126
|
promptOptions: this.promptOptions,
|
|
@@ -145,7 +138,7 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
|
|
|
145
138
|
await this._composeWithSubGenerator(this.target, this.answers);
|
|
146
139
|
}
|
|
147
140
|
else {
|
|
148
|
-
|
|
141
|
+
DeploymentGenerator.logger?.debug(t('debug.exit'));
|
|
149
142
|
process.exit(0); // only relevant for CLI
|
|
150
143
|
}
|
|
151
144
|
}
|
|
@@ -171,12 +164,12 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
|
|
|
171
164
|
if (this.apiHubConfig) {
|
|
172
165
|
subGenOpts.apiHubConfig = this.apiHubConfig;
|
|
173
166
|
}
|
|
174
|
-
await this.composeWith(
|
|
167
|
+
await this.composeWith(generatorNamespace(this.genNamespace, generatorName), subGenOpts);
|
|
175
168
|
}
|
|
176
169
|
catch (error) {
|
|
177
|
-
|
|
170
|
+
DeploymentGenerator.logger?.error(error.message);
|
|
178
171
|
}
|
|
179
172
|
}
|
|
180
173
|
}
|
|
181
|
-
|
|
174
|
+
export { promptNames };
|
|
182
175
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AbapDeployConfigAnswersInternal } from '@sap-ux/abap-deploy-config-sub-generator';
|
|
2
2
|
import type { ApiHubConfig, CfDeployConfigAnswers } from '@sap-ux/cf-deploy-config-sub-generator';
|
|
3
|
-
import type { Target, DeployConfigOptions, DeployConfigSubGenPromptOptions } from '../types';
|
|
3
|
+
import type { Target, DeployConfigOptions, DeployConfigSubGenPromptOptions } from '../types/index.js';
|
|
4
4
|
import type { FioriToolsProxyConfigBackend } from '@sap-ux/ui5-config';
|
|
5
5
|
import type { Editor } from 'mem-fs-editor';
|
|
6
6
|
import type { GeneratorOptions } from 'yeoman-generator';
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.promptDeployConfigQuestions = promptDeployConfigQuestions;
|
|
4
|
-
const prompts_1 = require("../prompts");
|
|
1
|
+
import { getSubGenPrompts, getDeployTargetQuestion } from '../prompts/index.js';
|
|
5
2
|
/**
|
|
6
3
|
* Determines the target deployment and runs all prompting if required.
|
|
7
4
|
*
|
|
@@ -21,10 +18,10 @@ const prompts_1 = require("../prompts");
|
|
|
21
18
|
* @param targetDeployment - target deployment
|
|
22
19
|
* @returns - target deployment CF | ABAP and answers
|
|
23
20
|
*/
|
|
24
|
-
async function promptDeployConfigQuestions(fs, options, prompt, { launchDeployConfigAsSubGenerator, launchStandaloneFromYui, promptOptions, supportedTargets, backendConfig, cfDestination, isCap, apiHubConfig, isLibrary }, targetDeployment) {
|
|
21
|
+
export async function promptDeployConfigQuestions(fs, options, prompt, { launchDeployConfigAsSubGenerator, launchStandaloneFromYui, promptOptions, supportedTargets, backendConfig, cfDestination, isCap, apiHubConfig, isLibrary }, targetDeployment) {
|
|
25
22
|
let answers = {};
|
|
26
23
|
if (launchDeployConfigAsSubGenerator) {
|
|
27
|
-
const { questions, abapAnswers } = await
|
|
24
|
+
const { questions, abapAnswers } = await getSubGenPrompts(fs, options, {
|
|
28
25
|
launchDeployConfigAsSubGenerator,
|
|
29
26
|
launchStandaloneFromYui,
|
|
30
27
|
promptOptions,
|
|
@@ -40,7 +37,7 @@ async function promptDeployConfigQuestions(fs, options, prompt, { launchDeployCo
|
|
|
40
37
|
answers.overwrite = subGenAnswers.overwriteAbapConfig ?? subGenAnswers.overwriteCfConfig;
|
|
41
38
|
}
|
|
42
39
|
else {
|
|
43
|
-
answers = await prompt(
|
|
40
|
+
answers = await prompt(getDeployTargetQuestion([...supportedTargets], options.projectRoot));
|
|
44
41
|
}
|
|
45
42
|
const target = supportedTargets.find((t) => t.name === answers?.targetName || t.name === targetDeployment)?.name;
|
|
46
43
|
return { target, answers };
|
package/generators/app/utils.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseTarget = parseTarget;
|
|
4
|
-
exports.getYUIDetails = getYUIDetails;
|
|
5
|
-
const node_path_1 = require("node:path");
|
|
1
|
+
import { basename } from 'node:path';
|
|
6
2
|
/**
|
|
7
3
|
* Parses the target from the CLI args or the options.
|
|
8
4
|
*
|
|
@@ -10,7 +6,7 @@ const node_path_1 = require("node:path");
|
|
|
10
6
|
* @param opts - options
|
|
11
7
|
* @returns - the target
|
|
12
8
|
*/
|
|
13
|
-
function parseTarget(args, opts) {
|
|
9
|
+
export function parseTarget(args, opts) {
|
|
14
10
|
let result;
|
|
15
11
|
if (typeof args === 'string') {
|
|
16
12
|
result = args;
|
|
@@ -29,11 +25,11 @@ function parseTarget(args, opts) {
|
|
|
29
25
|
* @param appRootPath - path to the application to be displayed in YUI step description
|
|
30
26
|
* @returns step details
|
|
31
27
|
*/
|
|
32
|
-
function getYUIDetails(appRootPath) {
|
|
28
|
+
export function getYUIDetails(appRootPath) {
|
|
33
29
|
return [
|
|
34
30
|
{
|
|
35
31
|
name: 'Deployment Configuration',
|
|
36
|
-
description: `Configure Deployment settings - ${
|
|
32
|
+
description: `Configure Deployment settings - ${basename(appRootPath)}`
|
|
37
33
|
}
|
|
38
34
|
];
|
|
39
35
|
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const utils_1 = require("../utils");
|
|
7
|
-
const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
|
|
1
|
+
import { join, resolve } from 'node:path';
|
|
2
|
+
import { unlinkSync } from 'node:fs';
|
|
3
|
+
import { DeploymentGenerator } from '@sap-ux/deploy-config-generator-shared';
|
|
4
|
+
import { t, generatorNamespace, abapChoice, cfChoice } from '../utils/index.js';
|
|
5
|
+
import { DeployTarget } from '@sap-ux/fiori-generator-shared';
|
|
8
6
|
/**
|
|
9
7
|
* Headless deployment generator
|
|
10
8
|
*/
|
|
11
|
-
class
|
|
9
|
+
export default class extends DeploymentGenerator {
|
|
12
10
|
genNamespace;
|
|
13
11
|
absAppConfigPath;
|
|
14
12
|
appConfig;
|
|
@@ -25,12 +23,12 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
|
|
|
25
23
|
try {
|
|
26
24
|
this.argument('appConfig', {
|
|
27
25
|
type: String,
|
|
28
|
-
description:
|
|
26
|
+
description: t('headless.info.generatorArgAppConfig'),
|
|
29
27
|
required: false
|
|
30
28
|
});
|
|
31
29
|
// Is this a file path or app config as string
|
|
32
30
|
if (Object.keys(this.options.appConfig ?? {}).length === 0) {
|
|
33
|
-
throw Error(
|
|
31
|
+
throw Error(t('headless.error.headlessGenOptions'));
|
|
34
32
|
}
|
|
35
33
|
// Support direct cli/process execution
|
|
36
34
|
if (typeof this.options.appConfig === 'object') {
|
|
@@ -38,7 +36,7 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
|
|
|
38
36
|
}
|
|
39
37
|
else if (this.fs.exists(this.options.appConfig)) {
|
|
40
38
|
this.appConfig = JSON.parse(this.fs.read(this.options.appConfig));
|
|
41
|
-
this.absAppConfigPath =
|
|
39
|
+
this.absAppConfigPath = resolve(this.options.appConfig);
|
|
42
40
|
}
|
|
43
41
|
else {
|
|
44
42
|
this.appConfig = JSON.parse(this.options.appConfig);
|
|
@@ -46,12 +44,12 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
|
|
|
46
44
|
this.deployTarget = this.appConfig.deployConfig?.deployTarget;
|
|
47
45
|
}
|
|
48
46
|
catch (error) {
|
|
49
|
-
|
|
47
|
+
DeploymentGenerator.logger?.error(t('headless.error.generationExiting'));
|
|
50
48
|
this.env.error(error);
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
51
|
async initializing() {
|
|
54
|
-
|
|
52
|
+
DeploymentGenerator.logger?.info(t('headless.info.generatorNameVersion', {
|
|
55
53
|
generatorName: this.rootGeneratorName(),
|
|
56
54
|
generatorVersion: this.rootGeneratorVersion()
|
|
57
55
|
}));
|
|
@@ -61,8 +59,8 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
|
|
|
61
59
|
};
|
|
62
60
|
const deployConfigOpts = this.transformExtConfig();
|
|
63
61
|
if (deployConfigOpts && this.deployTarget) {
|
|
64
|
-
const subGen = this.deployTarget ===
|
|
65
|
-
await this.composeWith(
|
|
62
|
+
const subGen = this.deployTarget === DeployTarget.CF ? cfChoice.name : abapChoice.name;
|
|
63
|
+
await this.composeWith(generatorNamespace(this.genNamespace, subGen), {
|
|
66
64
|
arguments: this.args,
|
|
67
65
|
...Object.assign(this.options, deployConfigOpts, {
|
|
68
66
|
telemetryData: additionalTelemetryData
|
|
@@ -77,7 +75,7 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
|
|
|
77
75
|
*/
|
|
78
76
|
transformExtConfig() {
|
|
79
77
|
let options;
|
|
80
|
-
if (this.deployTarget ===
|
|
78
|
+
if (this.deployTarget === DeployTarget.CF) {
|
|
81
79
|
const cf = this.appConfig.deployConfig;
|
|
82
80
|
if (this.appConfig.project.targetFolder) {
|
|
83
81
|
options = {
|
|
@@ -86,18 +84,18 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
|
|
|
86
84
|
destinationAuthType: cf.destinationAuthType,
|
|
87
85
|
addManagedAppRouter: cf.addToManagedAppRouter,
|
|
88
86
|
launchDeployConfigAsSubGenerator: true, // ensures prompting is skipped within cf sub gen
|
|
89
|
-
appRootPath:
|
|
87
|
+
appRootPath: join(this.appConfig.project.targetFolder, this.appConfig.project.name),
|
|
90
88
|
addMTADestination: cf.addMTADestination,
|
|
91
89
|
lcapModeOnly: cf.lcapModeOnly,
|
|
92
90
|
cloudServiceName: cf.cloudServiceName
|
|
93
91
|
};
|
|
94
92
|
}
|
|
95
93
|
}
|
|
96
|
-
else if (this.deployTarget ===
|
|
94
|
+
else if (this.deployTarget === DeployTarget.ABAP) {
|
|
97
95
|
const abap = this.appConfig.deployConfig;
|
|
98
96
|
if (this.appConfig.project.targetFolder) {
|
|
99
97
|
options = {
|
|
100
|
-
appRootPath:
|
|
98
|
+
appRootPath: join(this.appConfig.project.targetFolder, this.appConfig.project.name),
|
|
101
99
|
destination: abap?.destination,
|
|
102
100
|
url: abap?.url ?? '', // URL may not be provided in BAS but will be determined in the generator
|
|
103
101
|
client: abap?.client,
|
|
@@ -114,10 +112,9 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
|
|
|
114
112
|
}
|
|
115
113
|
end() {
|
|
116
114
|
if (this.options.deleteFile && this.fs.exists(this.absAppConfigPath)) {
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
DeploymentGenerator.logger?.info(t('headless.info.deletingApplicationConfigFile', { filepath: this.absAppConfigPath }));
|
|
116
|
+
unlinkSync(this.absAppConfigPath);
|
|
119
117
|
}
|
|
120
118
|
}
|
|
121
119
|
}
|
|
122
|
-
exports.default = default_1;
|
|
123
120
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDeployTargetQuestion = getDeployTargetQuestion;
|
|
4
|
-
const utils_1 = require("../utils");
|
|
1
|
+
import { isMTAInstalled, promptNames, t } from '../utils/index.js';
|
|
5
2
|
/**
|
|
6
3
|
* Returns the deployment target question.
|
|
7
4
|
*
|
|
@@ -9,17 +6,17 @@ const utils_1 = require("../utils");
|
|
|
9
6
|
* @param projectRoot - path to the project
|
|
10
7
|
* @returns - the deployment target question
|
|
11
8
|
*/
|
|
12
|
-
function getDeployTargetQuestion(supportedTargets, projectRoot) {
|
|
9
|
+
export function getDeployTargetQuestion(supportedTargets, projectRoot) {
|
|
13
10
|
return [
|
|
14
11
|
{
|
|
15
12
|
type: 'list',
|
|
16
|
-
name:
|
|
13
|
+
name: promptNames.targetName,
|
|
17
14
|
guiOptions: {
|
|
18
|
-
breadcrumb:
|
|
15
|
+
breadcrumb: t('prompts.deployTarget.breadcrumb')
|
|
19
16
|
},
|
|
20
|
-
message:
|
|
17
|
+
message: t('prompts.deployTarget.message'),
|
|
21
18
|
default: () => supportedTargets[0].name,
|
|
22
|
-
validate: (choice) =>
|
|
19
|
+
validate: (choice) => isMTAInstalled(choice, projectRoot),
|
|
23
20
|
choices: supportedTargets.map((target) => ({ name: target.description, value: target.name }))
|
|
24
21
|
}
|
|
25
22
|
];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { getDeployTargetQuestion } from './deploy-target';
|
|
2
|
-
export { getSubGenPrompts } from './sub-gen';
|
|
1
|
+
export { getDeployTargetQuestion } from './deploy-target.js';
|
|
2
|
+
export { getSubGenPrompts } from './sub-gen.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getSubGenPrompts = exports.getDeployTargetQuestion = void 0;
|
|
4
|
-
var deploy_target_1 = require("./deploy-target");
|
|
5
|
-
Object.defineProperty(exports, "getDeployTargetQuestion", { enumerable: true, get: function () { return deploy_target_1.getDeployTargetQuestion; } });
|
|
6
|
-
var sub_gen_1 = require("./sub-gen");
|
|
7
|
-
Object.defineProperty(exports, "getSubGenPrompts", { enumerable: true, get: function () { return sub_gen_1.getSubGenPrompts; } });
|
|
1
|
+
export { getDeployTargetQuestion } from './deploy-target.js';
|
|
2
|
+
export { getSubGenPrompts } from './sub-gen.js';
|
|
8
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -3,7 +3,7 @@ import type { Editor } from 'mem-fs-editor';
|
|
|
3
3
|
import type { ApiHubConfig } from '@sap-ux/cf-deploy-config-sub-generator';
|
|
4
4
|
import type { AbapDeployConfigAnswersInternal } from '@sap-ux/abap-deploy-config-sub-generator';
|
|
5
5
|
import type { Question } from 'inquirer';
|
|
6
|
-
import type { DeployConfigOptions, DeployConfigSubGenPromptOptions, Target } from '../types';
|
|
6
|
+
import type { DeployConfigOptions, DeployConfigSubGenPromptOptions, Target } from '../types/index.js';
|
|
7
7
|
/**
|
|
8
8
|
* Retrieves the combined sub generator prompts.
|
|
9
9
|
*
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const cf_deploy_config_sub_generator_1 = require("@sap-ux/cf-deploy-config-sub-generator");
|
|
10
|
-
const project_access_1 = require("@sap-ux/project-access");
|
|
11
|
-
const deploy_target_1 = require("./deploy-target");
|
|
1
|
+
import { extendWithOptions, withCondition } from '@sap-ux/inquirer-common';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { t } from '../utils/index.js';
|
|
4
|
+
import { DeploymentGenerator, showOverwriteQuestion, TargetName } from '@sap-ux/deploy-config-generator-shared';
|
|
5
|
+
import { getAbapQuestions, indexHtmlExists } from '@sap-ux/abap-deploy-config-sub-generator';
|
|
6
|
+
import { getCFQuestions } from '@sap-ux/cf-deploy-config-sub-generator';
|
|
7
|
+
import { FileName } from '@sap-ux/project-access';
|
|
8
|
+
import { getDeployTargetQuestion } from './deploy-target.js';
|
|
12
9
|
/**
|
|
13
10
|
* Retrieves the combined sub generator prompts.
|
|
14
11
|
*
|
|
@@ -27,16 +24,16 @@ const deploy_target_1 = require("./deploy-target");
|
|
|
27
24
|
* @param targetDeployment - target deployment
|
|
28
25
|
* @returns - deployment configuration answers
|
|
29
26
|
*/
|
|
30
|
-
async function getSubGenPrompts(fs, options, { launchDeployConfigAsSubGenerator, launchStandaloneFromYui, promptOptions, supportedTargets, backendConfig, cfDestination, isCap, apiHubConfig, isLibrary }, targetDeployment) {
|
|
31
|
-
|
|
32
|
-
const configExists = fs.exists(
|
|
33
|
-
const showOverwrite =
|
|
34
|
-
const indexGenerationAllowed = !isLibrary && launchStandaloneFromYui && !(await
|
|
27
|
+
export async function getSubGenPrompts(fs, options, { launchDeployConfigAsSubGenerator, launchStandaloneFromYui, promptOptions, supportedTargets, backendConfig, cfDestination, isCap, apiHubConfig, isLibrary }, targetDeployment) {
|
|
28
|
+
DeploymentGenerator.logger?.debug(t('debug.loadingPrompts'));
|
|
29
|
+
const configExists = fs.exists(join(options.appRootPath, options.config || FileName.UI5DeployYaml));
|
|
30
|
+
const showOverwrite = showOverwriteQuestion(configExists, launchDeployConfigAsSubGenerator, launchStandaloneFromYui, options.overwrite);
|
|
31
|
+
const indexGenerationAllowed = !isLibrary && launchStandaloneFromYui && !(await indexHtmlExists(fs, options.appRootPath));
|
|
35
32
|
let abapPrompts = [];
|
|
36
33
|
let abapAnswers = {};
|
|
37
34
|
// ABAP prompts
|
|
38
|
-
if (!targetDeployment || targetDeployment ===
|
|
39
|
-
({ prompts: abapPrompts, answers: abapAnswers } = await
|
|
35
|
+
if (!targetDeployment || targetDeployment === TargetName.ABAP) {
|
|
36
|
+
({ prompts: abapPrompts, answers: abapAnswers } = await getAbapQuestions({
|
|
40
37
|
appRootPath: options.appRootPath,
|
|
41
38
|
connectedSystem: options.connectedSystem,
|
|
42
39
|
backendConfig,
|
|
@@ -44,13 +41,13 @@ async function getSubGenPrompts(fs, options, { launchDeployConfigAsSubGenerator,
|
|
|
44
41
|
indexGenerationAllowed,
|
|
45
42
|
showOverwriteQuestion: showOverwrite,
|
|
46
43
|
promptOptions: options?.subGenPromptOptions,
|
|
47
|
-
logger:
|
|
44
|
+
logger: DeploymentGenerator.logger
|
|
48
45
|
}));
|
|
49
46
|
}
|
|
50
47
|
// CF prompts
|
|
51
48
|
let cfPrompts = [];
|
|
52
|
-
if (!targetDeployment || targetDeployment ===
|
|
53
|
-
cfPrompts = await
|
|
49
|
+
if (!targetDeployment || targetDeployment === TargetName.CF) {
|
|
50
|
+
cfPrompts = await getCFQuestions({
|
|
54
51
|
projectRoot: options.projectRoot,
|
|
55
52
|
isAbapDirectServiceBinding: options.isAbapDirectServiceBinding,
|
|
56
53
|
cfDestination: cfDestination,
|
|
@@ -71,7 +68,7 @@ async function getSubGenPrompts(fs, options, { launchDeployConfigAsSubGenerator,
|
|
|
71
68
|
});
|
|
72
69
|
}
|
|
73
70
|
else {
|
|
74
|
-
questions = targetDeployment ===
|
|
71
|
+
questions = targetDeployment === TargetName.ABAP ? abapPrompts : cfPrompts;
|
|
75
72
|
}
|
|
76
73
|
return { questions, abapAnswers: abapAnswers };
|
|
77
74
|
}
|
|
@@ -87,11 +84,11 @@ async function getSubGenPrompts(fs, options, { launchDeployConfigAsSubGenerator,
|
|
|
87
84
|
* @returns - all the different prompts combined
|
|
88
85
|
*/
|
|
89
86
|
function combineAllPrompts(projectRoot, { supportedTargets, abapPrompts, cfPrompts, promptOptions }) {
|
|
90
|
-
const questions =
|
|
91
|
-
questions.push(...
|
|
92
|
-
questions.push(...
|
|
87
|
+
const questions = getDeployTargetQuestion(supportedTargets, projectRoot);
|
|
88
|
+
questions.push(...withCondition(abapPrompts, (answers) => answers.targetName === TargetName.ABAP));
|
|
89
|
+
questions.push(...withCondition(cfPrompts, (answers) => answers.targetName === TargetName.CF));
|
|
93
90
|
return promptOptions
|
|
94
|
-
?
|
|
91
|
+
? extendWithOptions(questions, promptOptions)
|
|
95
92
|
: questions;
|
|
96
93
|
}
|
|
97
94
|
//# sourceMappingURL=sub-gen.js.map
|
|
@@ -8,7 +8,7 @@ import type { FioriToolsProxyConfigBackend } from '@sap-ux/ui5-config';
|
|
|
8
8
|
import type { AbapDeployConfigPromptOptions } from '@sap-ux/abap-deploy-config-sub-generator';
|
|
9
9
|
import type { CfDeployConfigPromptOptions } from '@sap-ux/cf-deploy-config-sub-generator';
|
|
10
10
|
import type { CommonPromptOptions } from '@sap-ux/inquirer-common';
|
|
11
|
-
import type { promptNames } from '../utils';
|
|
11
|
+
import type { promptNames } from '../utils/index.js';
|
|
12
12
|
export type DeployConfigSubGenPromptOptions = {
|
|
13
13
|
[promptNames.targetName]: CommonPromptOptions;
|
|
14
14
|
} | AbapDeployConfigPromptOptions | CfDeployConfigPromptOptions;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FioriToolsProxyConfigBackend } from '@sap-ux/ui5-config';
|
|
2
2
|
import type { Editor } from 'mem-fs-editor';
|
|
3
|
-
import type { DeployConfigOptions } from '../types';
|
|
3
|
+
import type { DeployConfigOptions } from '../types/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* Retrieves backend configuration from either the base config (ui5.yaml) or from the options passed in.
|
|
6
6
|
*
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const abap_deploy_config_sub_generator_1 = require("@sap-ux/abap-deploy-config-sub-generator");
|
|
6
|
-
const ui5_config_1 = require("@sap-ux/ui5-config");
|
|
7
|
-
const project_access_1 = require("@sap-ux/project-access");
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { DeployProjectType } from '@sap-ux/abap-deploy-config-sub-generator';
|
|
3
|
+
import { UI5Config } from '@sap-ux/ui5-config';
|
|
4
|
+
import { FileName } from '@sap-ux/project-access';
|
|
8
5
|
/**
|
|
9
6
|
* Retrieves backend configuration from either the base config (ui5.yaml) or from the options passed in.
|
|
10
7
|
*
|
|
@@ -14,7 +11,7 @@ const project_access_1 = require("@sap-ux/project-access");
|
|
|
14
11
|
* @param projectRoot - project root
|
|
15
12
|
* @returns - backend configuration
|
|
16
13
|
*/
|
|
17
|
-
async function getBackendConfig(fs, options, launchStandaloneFromYui, projectRoot) {
|
|
14
|
+
export async function getBackendConfig(fs, options, launchStandaloneFromYui, projectRoot) {
|
|
18
15
|
let backendConfig;
|
|
19
16
|
let isLibrary = false;
|
|
20
17
|
// This is called when this generator is called as a subgenerator from
|
|
@@ -22,9 +19,9 @@ async function getBackendConfig(fs, options, launchStandaloneFromYui, projectRoo
|
|
|
22
19
|
if (launchStandaloneFromYui) {
|
|
23
20
|
// Launched from app modeler where deploy config might already exist
|
|
24
21
|
// need to retrieve backendConfig information.
|
|
25
|
-
const ui5Config = await
|
|
22
|
+
const ui5Config = await UI5Config.newInstance(fs.read(join(projectRoot, options.base ?? FileName.Ui5Yaml)));
|
|
26
23
|
backendConfig = ui5Config.getBackendConfigsFromFioriToolsProxyMiddleware()[0];
|
|
27
|
-
isLibrary = ui5Config.getType() ===
|
|
24
|
+
isLibrary = ui5Config.getType() === DeployProjectType.Library;
|
|
28
25
|
}
|
|
29
26
|
else {
|
|
30
27
|
// Launched as subgenerator from app gen
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Target } from '../types';
|
|
1
|
+
import type { Target } from '../types/index.js';
|
|
2
2
|
export declare const generatorNamespace: (bundledRootGeneratorName: string, subGenName: string) => string;
|
|
3
3
|
export declare const generatorTitle = "Deployment Configuration Generator";
|
|
4
4
|
export declare const abapChoice: Target;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.promptNames = exports.cfChoice = exports.abapChoice = exports.generatorTitle = exports.generatorNamespace = void 0;
|
|
4
1
|
// When deployment generator is bundled the namespacing is relative to the root generator
|
|
5
|
-
|
|
6
|
-
const generatorNamespace = (bundledRootGeneratorName, subGenName) => `${bundledRootGeneratorName}_${subGenName}`;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var promptNames;
|
|
2
|
+
import { TargetName } from '@sap-ux/deploy-config-generator-shared';
|
|
3
|
+
export const generatorNamespace = (bundledRootGeneratorName, subGenName) => `${bundledRootGeneratorName}_${subGenName}`;
|
|
4
|
+
export const generatorTitle = 'Deployment Configuration Generator';
|
|
5
|
+
export const abapChoice = { name: TargetName.ABAP, description: 'ABAP' };
|
|
6
|
+
export const cfChoice = { name: TargetName.CF, description: 'Cloud Foundry' };
|
|
7
|
+
export var promptNames;
|
|
12
8
|
(function (promptNames) {
|
|
13
9
|
promptNames["targetName"] = "targetName";
|
|
14
|
-
})(promptNames || (
|
|
10
|
+
})(promptNames || (promptNames = {}));
|
|
15
11
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isMTAInstalled = isMTAInstalled;
|
|
4
|
-
exports.getEnvApiHubConfig = getEnvApiHubConfig;
|
|
5
|
-
exports.getApiHubOptions = getApiHubOptions;
|
|
6
1
|
// Legacy package, dependent on external dependencies for async operations and no 'type: module' defined in package.json
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import hasbin from 'hasbin';
|
|
3
|
+
import { API_BUSINESS_HUB_ENTERPRISE_PREFIX, ApiHubType, loadManifest } from '@sap-ux/cf-deploy-config-sub-generator';
|
|
4
|
+
import { DeploymentGenerator, ERROR_TYPE, ErrorHandler, generateDestinationName, mtaExecutable } from '@sap-ux/deploy-config-generator-shared';
|
|
5
|
+
import { existsSync } from 'node:fs';
|
|
6
|
+
import { join } from 'node:path';
|
|
12
7
|
/**
|
|
13
8
|
* Check if the MTA is installed.
|
|
14
9
|
*
|
|
@@ -16,11 +11,11 @@ const node_path_1 = require("node:path");
|
|
|
16
11
|
* @param projectPath - path to the project
|
|
17
12
|
* @returns - true if the MTA is installed, otherwise an error message
|
|
18
13
|
*/
|
|
19
|
-
function isMTAInstalled(choice, projectPath) {
|
|
20
|
-
if ((choice === 'cf' && !hasbin.sync(
|
|
21
|
-
(choice === 'abap' && !hasbin.sync(
|
|
22
|
-
const errMsg =
|
|
23
|
-
|
|
14
|
+
export function isMTAInstalled(choice, projectPath) {
|
|
15
|
+
if ((choice === 'cf' && !hasbin.sync(mtaExecutable)) ||
|
|
16
|
+
(choice === 'abap' && !hasbin.sync(mtaExecutable) && existsSync(join(projectPath, 'mta.yaml')))) {
|
|
17
|
+
const errMsg = ErrorHandler.getErrorMsgFromType(ERROR_TYPE.NO_MTA_BIN);
|
|
18
|
+
DeploymentGenerator.logger?.warn(errMsg);
|
|
24
19
|
return errMsg;
|
|
25
20
|
}
|
|
26
21
|
return true;
|
|
@@ -30,14 +25,14 @@ function isMTAInstalled(choice, projectPath) {
|
|
|
30
25
|
*
|
|
31
26
|
* @returns The api hub enterprise config or undefined if the key is not found.
|
|
32
27
|
*/
|
|
33
|
-
function getEnvApiHubConfig() {
|
|
28
|
+
export function getEnvApiHubConfig() {
|
|
34
29
|
const apiHubKey = process.env['API_HUB_API_KEY'];
|
|
35
30
|
const apiHubType = process.env['API_HUB_TYPE'];
|
|
36
31
|
// Legacy apps .env file will not define a type variable
|
|
37
32
|
return apiHubKey
|
|
38
33
|
? {
|
|
39
34
|
apiHubKey,
|
|
40
|
-
apiHubType: apiHubType ===
|
|
35
|
+
apiHubType: apiHubType === ApiHubType.apiHubEnterprise ? ApiHubType.apiHubEnterprise : ApiHubType.apiHub
|
|
41
36
|
}
|
|
42
37
|
: undefined;
|
|
43
38
|
}
|
|
@@ -51,16 +46,16 @@ function getEnvApiHubConfig() {
|
|
|
51
46
|
* @param apiHubConfig - API Hub Config
|
|
52
47
|
* @returns - destination name
|
|
53
48
|
*/
|
|
54
|
-
async function getApiHubOptions(memFs, { appPath, servicePath }, apiHubConfig) {
|
|
49
|
+
export async function getApiHubOptions(memFs, { appPath, servicePath }, apiHubConfig) {
|
|
55
50
|
let destinationName;
|
|
56
|
-
if (apiHubConfig?.apiHubType ===
|
|
51
|
+
if (apiHubConfig?.apiHubType === ApiHubType.apiHubEnterprise) {
|
|
57
52
|
// appGenDestination may not have been passed in options e.g. launched from app modeler
|
|
58
53
|
if (!servicePath) {
|
|
59
54
|
// Load service path from manifest.json file
|
|
60
|
-
const manifest = await
|
|
55
|
+
const manifest = await loadManifest(memFs, appPath);
|
|
61
56
|
servicePath = manifest?.['sap.app'].dataSources?.mainService?.uri;
|
|
62
57
|
}
|
|
63
|
-
destinationName =
|
|
58
|
+
destinationName = generateDestinationName(API_BUSINESS_HUB_ENTERPRISE_PREFIX, servicePath);
|
|
64
59
|
}
|
|
65
60
|
return { destinationName, servicePath };
|
|
66
61
|
}
|
package/generators/utils/i18n.js
CHANGED
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.i18n = void 0;
|
|
7
|
-
exports.initI18n = initI18n;
|
|
8
|
-
exports.t = t;
|
|
9
|
-
const i18next_1 = __importDefault(require("i18next"));
|
|
10
|
-
const deploy_config_sub_generator_i18n_json_1 = __importDefault(require("../translations/deploy-config-sub-generator.i18n.json"));
|
|
11
|
-
const inquirer_common_1 = require("@sap-ux/inquirer-common");
|
|
1
|
+
import i18next from 'i18next';
|
|
2
|
+
import translations from '../translations/deploy-config-sub-generator.i18n.json' with { type: 'json' };
|
|
3
|
+
import { addi18nResourceBundle as addInquirerCommonTexts } from '@sap-ux/inquirer-common';
|
|
12
4
|
const deployConfigSubGen = 'deploy-config-sub-generator';
|
|
13
|
-
|
|
5
|
+
export const i18n = i18next.createInstance();
|
|
14
6
|
/**
|
|
15
7
|
* Initialize i18next with the translations for this module.
|
|
16
8
|
*/
|
|
17
|
-
async function initI18n() {
|
|
18
|
-
await
|
|
9
|
+
export async function initI18n() {
|
|
10
|
+
await i18n.init({
|
|
19
11
|
lng: 'en',
|
|
20
12
|
fallbackLng: 'en',
|
|
21
13
|
showSupportNotice: false
|
|
22
14
|
});
|
|
23
|
-
|
|
24
|
-
(
|
|
15
|
+
i18n.addResourceBundle('en', deployConfigSubGen, translations);
|
|
16
|
+
addInquirerCommonTexts();
|
|
25
17
|
}
|
|
26
18
|
/**
|
|
27
19
|
* Helper function facading the call to i18next. Unless a namespace option is provided the local namespace will be used.
|
|
@@ -30,13 +22,11 @@ async function initI18n() {
|
|
|
30
22
|
* @param options additional options
|
|
31
23
|
* @returns {string} localized string stored for the given key
|
|
32
24
|
*/
|
|
33
|
-
function t(key, options) {
|
|
25
|
+
export function t(key, options) {
|
|
34
26
|
if (!options?.ns) {
|
|
35
27
|
options = Object.assign(options ?? {}, { ns: deployConfigSubGen });
|
|
36
28
|
}
|
|
37
|
-
return
|
|
29
|
+
return i18n.t(key, options);
|
|
38
30
|
}
|
|
39
|
-
initI18n().catch(() =>
|
|
40
|
-
// Needed for lint
|
|
41
|
-
});
|
|
31
|
+
void initI18n().catch(() => undefined);
|
|
42
32
|
//# sourceMappingURL=i18n.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './config';
|
|
2
|
-
export * from './constants';
|
|
3
|
-
export * from './i18n';
|
|
4
|
-
export * from './environment';
|
|
5
|
-
export * from './targets';
|
|
1
|
+
export * from './config.js';
|
|
2
|
+
export * from './constants.js';
|
|
3
|
+
export * from './i18n.js';
|
|
4
|
+
export * from './environment.js';
|
|
5
|
+
export * from './targets.js';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
__exportStar(require("./config"), exports);
|
|
18
|
-
__exportStar(require("./constants"), exports);
|
|
19
|
-
__exportStar(require("./i18n"), exports);
|
|
20
|
-
__exportStar(require("./environment"), exports);
|
|
21
|
-
__exportStar(require("./targets"), exports);
|
|
1
|
+
export * from './config.js';
|
|
2
|
+
export * from './constants.js';
|
|
3
|
+
export * from './i18n.js';
|
|
4
|
+
export * from './environment.js';
|
|
5
|
+
export * from './targets.js';
|
|
22
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Editor } from 'mem-fs-editor';
|
|
2
|
-
import type { Target } from '../types';
|
|
2
|
+
import type { Target } from '../types/index.js';
|
|
3
3
|
import type { ApiHubConfig } from '@sap-ux/cf-deploy-config-sub-generator';
|
|
4
4
|
/**
|
|
5
5
|
* Generate a list of targets i.e. CF | ABAP and order based on the project type i.e. library, CF, abap or CAP.
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const node_path_1 = require("node:path");
|
|
8
|
-
const constants_1 = require("./constants");
|
|
1
|
+
import { DeployProjectType } from '@sap-ux/abap-deploy-config-sub-generator';
|
|
2
|
+
import { ApiHubType } from '@sap-ux/cf-deploy-config-sub-generator';
|
|
3
|
+
import { FileName } from '@sap-ux/project-access';
|
|
4
|
+
import { UI5Config } from '@sap-ux/ui5-config';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { cfChoice, abapChoice } from './constants.js';
|
|
9
7
|
/**
|
|
10
8
|
* Generate a list of targets i.e. CF | ABAP and order based on the project type i.e. library, CF, abap or CAP.
|
|
11
9
|
*
|
|
@@ -17,27 +15,27 @@ const constants_1 = require("./constants");
|
|
|
17
15
|
* @param configFile - config file to read UI5 properties, default to ui5.yaml
|
|
18
16
|
* @returns a list of Target options i.e. CF | ABAP
|
|
19
17
|
*/
|
|
20
|
-
async function getSupportedTargets(fs, projectPath, isCap = false, hasMtaConfig = false, apiHubConfig, configFile =
|
|
21
|
-
const isApiHubEnt = apiHubConfig?.apiHubType ===
|
|
22
|
-
const isProjectExtension = fs.exists(
|
|
18
|
+
export async function getSupportedTargets(fs, projectPath, isCap = false, hasMtaConfig = false, apiHubConfig, configFile = FileName.Ui5Yaml) {
|
|
19
|
+
const isApiHubEnt = apiHubConfig?.apiHubType === ApiHubType.apiHubEnterprise;
|
|
20
|
+
const isProjectExtension = fs.exists(join(projectPath, '.extconfig.json'));
|
|
23
21
|
let isLibrary = false;
|
|
24
22
|
try {
|
|
25
|
-
const ui5Config = await
|
|
26
|
-
isLibrary = ui5Config.getType() ===
|
|
23
|
+
const ui5Config = await UI5Config.newInstance(fs.read(join(projectPath, configFile)));
|
|
24
|
+
isLibrary = ui5Config.getType() === DeployProjectType.Library;
|
|
27
25
|
}
|
|
28
26
|
catch {
|
|
29
27
|
// Ignore error, ui5.yaml may not be written yet
|
|
30
28
|
}
|
|
31
29
|
if (isApiHubEnt || isCap) {
|
|
32
|
-
return [
|
|
30
|
+
return [cfChoice];
|
|
33
31
|
}
|
|
34
32
|
else if (isLibrary || isProjectExtension) {
|
|
35
|
-
return [
|
|
33
|
+
return [abapChoice]; // Extension projects, Library and systems using Reentrance tickets for auth
|
|
36
34
|
}
|
|
37
35
|
else {
|
|
38
36
|
// If there's an mta.yaml in the hierarchy, it's probably a CF project
|
|
39
37
|
// Offer that first and let the user decide
|
|
40
|
-
return hasMtaConfig ? [
|
|
38
|
+
return hasMtaConfig ? [cfChoice, abapChoice] : [abapChoice, cfChoice];
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
41
|
//# sourceMappingURL=targets.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/deploy-config-sub-generator",
|
|
3
3
|
"description": "Main generator for configuring ABAP or Cloud Foundry deployment configuration",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"bugs": {
|
|
11
11
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue"
|
|
12
12
|
},
|
|
13
|
+
"type": "module",
|
|
13
14
|
"license": "Apache-2.0",
|
|
14
15
|
"main": "generators/app/index.js",
|
|
15
16
|
"files": [
|
|
@@ -24,18 +25,19 @@
|
|
|
24
25
|
"hasbin": "1.2.3",
|
|
25
26
|
"i18next": "25.10.10",
|
|
26
27
|
"yeoman-generator": "5.10.0",
|
|
27
|
-
"@sap-ux/btp-utils": "
|
|
28
|
-
"@sap-ux/cf-deploy-config-sub-generator": "0.
|
|
29
|
-
"@sap-ux/abap-deploy-config-sub-generator": "0.
|
|
30
|
-
"@sap-ux/deploy-config-generator-shared": "0.
|
|
31
|
-
"@sap-ux/fiori-generator-shared": "0.
|
|
32
|
-
"@sap-ux/inquirer-common": "0.
|
|
33
|
-
"@sap-ux/odata-service-inquirer": "
|
|
34
|
-
"@sap-ux/project-access": "
|
|
35
|
-
"@sap-ux/store": "
|
|
36
|
-
"@sap-ux/ui5-config": "0.
|
|
28
|
+
"@sap-ux/btp-utils": "2.0.0",
|
|
29
|
+
"@sap-ux/cf-deploy-config-sub-generator": "1.0.1",
|
|
30
|
+
"@sap-ux/abap-deploy-config-sub-generator": "1.0.1",
|
|
31
|
+
"@sap-ux/deploy-config-generator-shared": "1.0.1",
|
|
32
|
+
"@sap-ux/fiori-generator-shared": "1.0.1",
|
|
33
|
+
"@sap-ux/inquirer-common": "1.0.1",
|
|
34
|
+
"@sap-ux/odata-service-inquirer": "3.0.1",
|
|
35
|
+
"@sap-ux/project-access": "2.0.1",
|
|
36
|
+
"@sap-ux/store": "2.0.0",
|
|
37
|
+
"@sap-ux/ui5-config": "1.0.0"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
40
|
+
"@jest/globals": "30.3.0",
|
|
39
41
|
"@types/fs-extra": "11.0.4",
|
|
40
42
|
"@types/hasbin": "1.2.2",
|
|
41
43
|
"@types/inquirer": "8.2.6",
|
|
@@ -51,10 +53,10 @@
|
|
|
51
53
|
"rimraf": "6.1.3",
|
|
52
54
|
"unionfs": "4.6.0",
|
|
53
55
|
"yeoman-test": "6.3.0",
|
|
54
|
-
"@sap-ux/abap-deploy-config-inquirer": "
|
|
55
|
-
"@sap-ux/cf-deploy-config-inquirer": "0.
|
|
56
|
-
"@sap-ux/cf-deploy-config-writer": "0.
|
|
57
|
-
"@sap-ux/jest-file-matchers": "0.
|
|
56
|
+
"@sap-ux/abap-deploy-config-inquirer": "2.0.1",
|
|
57
|
+
"@sap-ux/cf-deploy-config-inquirer": "1.0.1",
|
|
58
|
+
"@sap-ux/cf-deploy-config-writer": "1.0.1",
|
|
59
|
+
"@sap-ux/jest-file-matchers": "1.0.0"
|
|
58
60
|
},
|
|
59
61
|
"engines": {
|
|
60
62
|
"node": ">=22.x"
|
|
@@ -65,8 +67,8 @@
|
|
|
65
67
|
"watch": "tsc --watch",
|
|
66
68
|
"lint": "eslint",
|
|
67
69
|
"lint:fix": "eslint --fix",
|
|
68
|
-
"test": "jest --ci --forceExit --detectOpenHandles --colors",
|
|
69
|
-
"test-u": "jest --ci --forceExit --detectOpenHandles --colors -u",
|
|
70
|
+
"test": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors",
|
|
71
|
+
"test-u": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors -u",
|
|
70
72
|
"link": "pnpm link --global",
|
|
71
73
|
"unlink": "pnpm unlink --global"
|
|
72
74
|
}
|