@sap-ux/deploy-config-sub-generator 0.0.26 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DeploymentGenerator } from '@sap-ux/deploy-config-generator-shared';
|
|
2
|
+
import { DeployTarget } from '@sap-ux/fiori-generator-shared';
|
|
3
|
+
import type { CfDeployConfigOptions } from '@sap-ux/cf-deploy-config-sub-generator';
|
|
4
|
+
import type { AbapDeployConfigOptions } from '@sap-ux/abap-deploy-config-sub-generator';
|
|
5
|
+
import type { AppConfig } from '@sap-ux/fiori-app-sub-generator';
|
|
6
|
+
/**
|
|
7
|
+
* Headless deployment generator
|
|
8
|
+
*/
|
|
9
|
+
export default class extends DeploymentGenerator {
|
|
10
|
+
readonly genNamespace: string;
|
|
11
|
+
absAppConfigPath: string;
|
|
12
|
+
appConfig: AppConfig;
|
|
13
|
+
deployTarget?: DeployTarget;
|
|
14
|
+
/**
|
|
15
|
+
* Constructor for the headless deployment config generator.
|
|
16
|
+
*
|
|
17
|
+
* @param args - the arguments passed in
|
|
18
|
+
* @param opts - the options passed in
|
|
19
|
+
*/
|
|
20
|
+
constructor(args: string | string[], opts: any);
|
|
21
|
+
initializing(): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Transforms the external headless config to the deployment config options.
|
|
24
|
+
*
|
|
25
|
+
* @returns the deployment configuration options
|
|
26
|
+
*/
|
|
27
|
+
transformExtConfig(): CfDeployConfigOptions | AbapDeployConfigOptions | undefined;
|
|
28
|
+
end(): void;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const path_1 = require("path");
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const deploy_config_generator_shared_1 = require("@sap-ux/deploy-config-generator-shared");
|
|
6
|
+
const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
/**
|
|
9
|
+
* Headless deployment generator
|
|
10
|
+
*/
|
|
11
|
+
class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
|
|
12
|
+
genNamespace;
|
|
13
|
+
absAppConfigPath;
|
|
14
|
+
appConfig;
|
|
15
|
+
deployTarget;
|
|
16
|
+
/**
|
|
17
|
+
* Constructor for the headless deployment config generator.
|
|
18
|
+
*
|
|
19
|
+
* @param args - the arguments passed in
|
|
20
|
+
* @param opts - the options passed in
|
|
21
|
+
*/
|
|
22
|
+
constructor(args, opts) {
|
|
23
|
+
super(args, opts);
|
|
24
|
+
this.genNamespace = opts.namespace;
|
|
25
|
+
try {
|
|
26
|
+
this.argument('appConfig', {
|
|
27
|
+
type: String,
|
|
28
|
+
description: (0, utils_1.t)('headless.info.generatorArgAppConfig'),
|
|
29
|
+
required: false
|
|
30
|
+
});
|
|
31
|
+
// Is this a file path or app config as string
|
|
32
|
+
if (Object.keys(this.options.appConfig ?? {}).length === 0) {
|
|
33
|
+
throw Error((0, utils_1.t)('headless.error.headlessGenOptions'));
|
|
34
|
+
}
|
|
35
|
+
// Support direct cli/process execution
|
|
36
|
+
if (typeof this.options.appConfig === 'object') {
|
|
37
|
+
this.appConfig = this.options.appConfig;
|
|
38
|
+
}
|
|
39
|
+
else if (this.fs.exists(this.options.appConfig)) {
|
|
40
|
+
this.appConfig = JSON.parse(this.fs.read(this.options.appConfig));
|
|
41
|
+
this.absAppConfigPath = (0, path_1.resolve)(this.options.appConfig);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
this.appConfig = JSON.parse(this.options.appConfig);
|
|
45
|
+
} // Limited by OS max cli arg length
|
|
46
|
+
this.deployTarget = this.appConfig.deployConfig?.deployTarget;
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
deploy_config_generator_shared_1.DeploymentGenerator.logger?.error((0, utils_1.t)('headless.error.generationExiting'));
|
|
50
|
+
this.env.error(error);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async initializing() {
|
|
54
|
+
deploy_config_generator_shared_1.DeploymentGenerator.logger?.info((0, utils_1.t)('headless.info.generatorNameVersion', {
|
|
55
|
+
generatorName: this.rootGeneratorName(),
|
|
56
|
+
generatorVersion: this.rootGeneratorVersion()
|
|
57
|
+
}));
|
|
58
|
+
const additionalTelemetryData = {
|
|
59
|
+
AppGenLaunchSource: this.options.appConfig.telemetryData?.generationSourceName ?? 'Headless',
|
|
60
|
+
AppGenLaunchSourceVersion: this.options.appConfig.telemetryData?.generationSourceVersion ?? 'Not Provided'
|
|
61
|
+
};
|
|
62
|
+
const deployConfigOpts = this.transformExtConfig();
|
|
63
|
+
if (deployConfigOpts && this.deployTarget) {
|
|
64
|
+
this.composeWith((0, utils_1.generatorNamespace)(this.genNamespace, this.deployTarget), {
|
|
65
|
+
arguments: this.args,
|
|
66
|
+
...Object.assign(this.options, deployConfigOpts, {
|
|
67
|
+
telemetryData: additionalTelemetryData
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Transforms the external headless config to the deployment config options.
|
|
74
|
+
*
|
|
75
|
+
* @returns the deployment configuration options
|
|
76
|
+
*/
|
|
77
|
+
transformExtConfig() {
|
|
78
|
+
let options;
|
|
79
|
+
if (this.deployTarget === fiori_generator_shared_1.DeployTarget.CF) {
|
|
80
|
+
const cf = this.appConfig.deployConfig;
|
|
81
|
+
if (this.appConfig.project.targetFolder) {
|
|
82
|
+
options = {
|
|
83
|
+
projectRoot: this.appConfig.project.targetFolder,
|
|
84
|
+
destinationName: cf.destinationName,
|
|
85
|
+
destinationAuthType: cf.destinationAuthType,
|
|
86
|
+
addManagedAppRouter: cf.addToManagedAppRouter,
|
|
87
|
+
launchDeployConfigAsSubGenerator: true,
|
|
88
|
+
appRootPath: (0, path_1.join)(this.appConfig.project.targetFolder, this.appConfig.project.name),
|
|
89
|
+
addMTADestination: cf.addMTADestination,
|
|
90
|
+
lcapModeOnly: cf.lcapModeOnly,
|
|
91
|
+
cloudServiceName: cf.cloudServiceName
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// ABAP support will be added in the future
|
|
96
|
+
return options;
|
|
97
|
+
}
|
|
98
|
+
end() {
|
|
99
|
+
if (this.options.deleteFile && this.fs.exists(this.absAppConfigPath)) {
|
|
100
|
+
deploy_config_generator_shared_1.DeploymentGenerator.logger?.info((0, utils_1.t)('headless.info.deletingApplicationConfigFile', { filepath: this.absAppConfigPath }));
|
|
101
|
+
(0, fs_1.unlinkSync)(this.absAppConfigPath);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.default = default_1;
|
|
106
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -8,5 +8,16 @@
|
|
|
8
8
|
"debug": {
|
|
9
9
|
"exit": "Exiting the deployment generator",
|
|
10
10
|
"loadingPrompts": "Loading deploy prompts..."
|
|
11
|
+
},
|
|
12
|
+
"headless": {
|
|
13
|
+
"info": {
|
|
14
|
+
"generatorArgAppConfig": "Path to the application config file or application config as a string",
|
|
15
|
+
"generatorNameVersion": "Generating application with {{- generatorName}} {{generatorVersion}}",
|
|
16
|
+
"deletingApplicationConfigFile": "Deleting application config file: {{- filepath}}"
|
|
17
|
+
},
|
|
18
|
+
"error": {
|
|
19
|
+
"headlessGenOptions": "Please provide one of the following: 1) The first argument of the filepath to the app config, 2) The first argument of the app config file as a json string or, 3) An option 'appconfig' as a json object",
|
|
20
|
+
"generationExiting": "Application generation exiting due to error: {{- error}}"
|
|
21
|
+
}
|
|
11
22
|
}
|
|
12
23
|
}
|
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.0
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -27,20 +27,21 @@
|
|
|
27
27
|
"yeoman-generator": "5.10.0",
|
|
28
28
|
"@sap-ux/axios-extension": "1.19.2",
|
|
29
29
|
"@sap-ux/btp-utils": "1.0.2",
|
|
30
|
-
"@sap-ux/cf-deploy-config-sub-generator": "0.1.
|
|
31
|
-
"@sap-ux/abap-deploy-config-sub-generator": "0.0.
|
|
32
|
-
"@sap-ux/deploy-config-generator-shared": "0.0.
|
|
33
|
-
"@sap-ux/fiori-generator-shared": "0.
|
|
30
|
+
"@sap-ux/cf-deploy-config-sub-generator": "0.1.40",
|
|
31
|
+
"@sap-ux/abap-deploy-config-sub-generator": "0.0.58",
|
|
32
|
+
"@sap-ux/deploy-config-generator-shared": "0.0.40",
|
|
33
|
+
"@sap-ux/fiori-generator-shared": "0.10.0",
|
|
34
34
|
"@sap-ux/i18n": "0.2.3",
|
|
35
|
-
"@sap-ux/inquirer-common": "0.6.
|
|
35
|
+
"@sap-ux/inquirer-common": "0.6.33",
|
|
36
36
|
"@sap-ux/nodejs-utils": "0.1.8",
|
|
37
|
-
"@sap-ux/odata-service-inquirer": "2.2.
|
|
37
|
+
"@sap-ux/odata-service-inquirer": "2.2.28",
|
|
38
38
|
"@sap-ux/project-access": "1.29.18",
|
|
39
39
|
"@sap-ux/store": "1.0.0",
|
|
40
40
|
"@sap-ux/ui5-config": "0.26.5"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@jest/types": "29.6.3",
|
|
44
|
+
"@types/fs-extra": "9.0.13",
|
|
44
45
|
"@types/hasbin": "1.2.2",
|
|
45
46
|
"@types/inquirer": "8.2.6",
|
|
46
47
|
"@types/inquirer-autocomplete-prompt": "2.0.1",
|
|
@@ -51,13 +52,16 @@
|
|
|
51
52
|
"@types/yeoman-environment": "2.10.11",
|
|
52
53
|
"@types/yeoman-test": "4.0.6",
|
|
53
54
|
"@sap/mta-lib": "1.7.4",
|
|
55
|
+
"fs-extra": "10.0.0",
|
|
54
56
|
"js-yaml": "4.1.0",
|
|
55
57
|
"memfs": "3.4.13",
|
|
56
58
|
"rimraf": "5.0.5",
|
|
57
59
|
"unionfs": "4.4.0",
|
|
58
60
|
"yeoman-test": "6.3.0",
|
|
59
|
-
"@sap-ux/cf-deploy-config-inquirer": "0.2.
|
|
61
|
+
"@sap-ux/cf-deploy-config-inquirer": "0.2.24",
|
|
60
62
|
"@sap-ux/cf-deploy-config-writer": "0.2.0",
|
|
63
|
+
"@sap-ux/fiori-app-sub-generator": "0.0.2",
|
|
64
|
+
"@sap-ux/jest-file-matchers": "0.2.1",
|
|
61
65
|
"@sap-ux/logger": "0.6.0"
|
|
62
66
|
},
|
|
63
67
|
"engines": {
|