@sap-ux/generator-adp 0.10.12 → 1.0.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.
- package/generators/add-annotations-to-odata/index.d.ts +3 -3
- package/generators/add-annotations-to-odata/index.js +15 -19
- package/generators/add-component-usages/index.d.ts +3 -3
- package/generators/add-component-usages/index.js +16 -20
- package/generators/add-new-model/index.d.ts +3 -3
- package/generators/add-new-model/index.js +24 -28
- package/generators/app/extension-project/index.d.ts +1 -1
- package/generators/app/extension-project/index.js +6 -9
- package/generators/app/index.d.ts +1 -1
- package/generators/app/index.js +129 -135
- package/generators/app/layer.js +5 -7
- package/generators/app/questions/attributes.d.ts +2 -2
- package/generators/app/questions/attributes.js +60 -65
- package/generators/app/questions/cf-services.js +48 -52
- package/generators/app/questions/configuration.d.ts +3 -3
- package/generators/app/questions/configuration.js +125 -129
- package/generators/app/questions/helper/additional-messages.js +29 -36
- package/generators/app/questions/helper/choices.js +16 -25
- package/generators/app/questions/helper/conditions.js +14 -23
- package/generators/app/questions/helper/default-values.js +8 -13
- package/generators/app/questions/helper/message.js +7 -11
- package/generators/app/questions/helper/tooltip.js +4 -7
- package/generators/app/questions/helper/validators.js +29 -39
- package/generators/app/questions/key-user.d.ts +1 -1
- package/generators/app/questions/key-user.js +40 -45
- package/generators/app/questions/target-env.d.ts +2 -2
- package/generators/app/questions/target-env.js +22 -27
- package/generators/app/types.js +13 -16
- package/generators/base/questions/credentials.d.ts +1 -1
- package/generators/base/questions/credentials.js +15 -18
- package/generators/base/sub-gen-auth-base.d.ts +3 -3
- package/generators/base/sub-gen-auth-base.js +24 -30
- package/generators/base/sub-gen-base.d.ts +5 -6
- package/generators/base/sub-gen-base.js +11 -17
- package/generators/change-data-source/index.d.ts +3 -3
- package/generators/change-data-source/index.js +8 -12
- package/generators/telemetry/collector.d.ts +1 -1
- package/generators/telemetry/collector.js +6 -10
- package/generators/telemetry/events.js +2 -5
- package/generators/telemetry/index.d.ts +2 -2
- package/generators/telemetry/index.js +2 -18
- package/generators/types.js +2 -5
- package/generators/utils/appWizardCache.d.ts +1 -1
- package/generators/utils/appWizardCache.js +7 -13
- package/generators/utils/deps.js +10 -45
- package/generators/utils/i18n.js +13 -23
- package/generators/utils/logger.js +4 -7
- package/generators/utils/opts.js +3 -6
- package/generators/utils/parse-json-input.d.ts +1 -1
- package/generators/utils/parse-json-input.js +5 -9
- package/generators/utils/steps.d.ts +1 -1
- package/generators/utils/steps.js +37 -48
- package/generators/utils/subgenHelpers.js +9 -14
- package/generators/utils/templates.js +7 -8
- package/generators/utils/type-guards.d.ts +1 -1
- package/generators/utils/type-guards.js +2 -6
- package/generators/utils/workspace.js +7 -13
- package/package.json +19 -17
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import SubGeneratorWithAuthBase from '../base/sub-gen-auth-base';
|
|
2
|
-
import type { GeneratorOpts } from '../utils/opts';
|
|
1
|
+
import SubGeneratorWithAuthBase from '../base/sub-gen-auth-base.js';
|
|
2
|
+
import type { GeneratorOpts } from '../utils/opts.js';
|
|
3
3
|
/**
|
|
4
4
|
* Generator for adding annotations to OData services.
|
|
5
5
|
*/
|
|
@@ -24,5 +24,5 @@ declare class AddAnnotationsToDataGenerator extends SubGeneratorWithAuthBase {
|
|
|
24
24
|
writing(): Promise<void>;
|
|
25
25
|
end(): void;
|
|
26
26
|
}
|
|
27
|
-
export
|
|
27
|
+
export default AddAnnotationsToDataGenerator;
|
|
28
28
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const i18n_1 = require("../utils/i18n");
|
|
9
|
-
const types_1 = require("../types");
|
|
10
|
-
const sub_gen_auth_base_1 = __importDefault(require("../base/sub-gen-auth-base"));
|
|
11
|
-
const templates_1 = require("../utils/templates");
|
|
1
|
+
import { MessageType } from '@sap-devx/yeoman-ui-types';
|
|
2
|
+
import { ChangeType, generateChange, AnnotationFileSelectType, getPromptsForAddAnnotationsToOData } from '@sap-ux/adp-tooling';
|
|
3
|
+
import { getAnnotationNamespaces } from '@sap-ux/odata-service-writer';
|
|
4
|
+
import { t } from '../utils/i18n.js';
|
|
5
|
+
import { GeneratorTypes } from '../types.js';
|
|
6
|
+
import SubGeneratorWithAuthBase from '../base/sub-gen-auth-base.js';
|
|
7
|
+
import { getTemplatesOverwritePath } from '../utils/templates.js';
|
|
12
8
|
/**
|
|
13
9
|
* Generator for adding annotations to OData services.
|
|
14
10
|
*/
|
|
15
|
-
class AddAnnotationsToDataGenerator extends
|
|
11
|
+
class AddAnnotationsToDataGenerator extends SubGeneratorWithAuthBase {
|
|
16
12
|
/**
|
|
17
13
|
* The answers from the prompts.
|
|
18
14
|
*/
|
|
@@ -28,7 +24,7 @@ class AddAnnotationsToDataGenerator extends sub_gen_auth_base_1.default {
|
|
|
28
24
|
* @param {GeneratorOpts} opts - The options for the generator.
|
|
29
25
|
*/
|
|
30
26
|
constructor(args, opts) {
|
|
31
|
-
super(args, opts,
|
|
27
|
+
super(args, opts, GeneratorTypes.ADD_ANNOTATIONS_TO_DATA);
|
|
32
28
|
}
|
|
33
29
|
async initializing() {
|
|
34
30
|
await this.onInit();
|
|
@@ -37,7 +33,7 @@ class AddAnnotationsToDataGenerator extends sub_gen_auth_base_1.default {
|
|
|
37
33
|
try {
|
|
38
34
|
const manifest = await this.getManifest();
|
|
39
35
|
this.dataSources = manifest?.['sap.app']?.dataSources ?? {};
|
|
40
|
-
this.answers = await this.prompt(
|
|
36
|
+
this.answers = await this.prompt(getPromptsForAddAnnotationsToOData(this.projectPath, this.dataSources));
|
|
41
37
|
this.logger.log(`Current OData services\n${JSON.stringify(this.answers, null, 2)}`);
|
|
42
38
|
}
|
|
43
39
|
catch (e) {
|
|
@@ -57,18 +53,18 @@ class AddAnnotationsToDataGenerator extends sub_gen_auth_base_1.default {
|
|
|
57
53
|
if (!this.answers.filePath) {
|
|
58
54
|
if (!this.isCFProject) {
|
|
59
55
|
const metadata = await this.manifestService.getDataSourceMetadata(this.answers.id);
|
|
60
|
-
changeData.annotation.namespaces =
|
|
56
|
+
changeData.annotation.namespaces = getAnnotationNamespaces({ metadata });
|
|
61
57
|
}
|
|
62
58
|
}
|
|
63
|
-
await
|
|
59
|
+
await generateChange(this.projectPath, ChangeType.ADD_ANNOTATIONS_TO_ODATA, changeData, this.fs, getTemplatesOverwritePath());
|
|
64
60
|
this.logger.log('Change written to changes folder');
|
|
65
|
-
if (this.answers.fileSelectOption ===
|
|
66
|
-
this.appWizard.showInformation(
|
|
61
|
+
if (this.answers.fileSelectOption === AnnotationFileSelectType.NewEmptyFile) {
|
|
62
|
+
this.appWizard.showInformation(t('prompts.emptyAnnotationFile'), MessageType.notification);
|
|
67
63
|
}
|
|
68
64
|
}
|
|
69
65
|
end() {
|
|
70
66
|
this.logger.log('Successfully created annotation file!');
|
|
71
67
|
}
|
|
72
68
|
}
|
|
73
|
-
|
|
69
|
+
export default AddAnnotationsToDataGenerator;
|
|
74
70
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { GeneratorOpts } from '../utils/opts';
|
|
2
|
-
import SubGeneratorBase from '../base/sub-gen-base';
|
|
1
|
+
import type { GeneratorOpts } from '../utils/opts.js';
|
|
2
|
+
import SubGeneratorBase from '../base/sub-gen-base.js';
|
|
3
3
|
/**
|
|
4
4
|
* Generator for adding component usages to a project.
|
|
5
5
|
*/
|
|
@@ -34,5 +34,5 @@ declare class AddComponentUsagesGenerator extends SubGeneratorBase {
|
|
|
34
34
|
*/
|
|
35
35
|
private _createComponentUsageData;
|
|
36
36
|
}
|
|
37
|
-
export
|
|
37
|
+
export default AddComponentUsagesGenerator;
|
|
38
38
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
const adp_tooling_1 = require("@sap-ux/adp-tooling");
|
|
7
|
-
const types_1 = require("../types");
|
|
8
|
-
const i18n_1 = require("../utils/i18n");
|
|
9
|
-
const sub_gen_base_1 = __importDefault(require("../base/sub-gen-base"));
|
|
1
|
+
import { MessageType, Prompts } from '@sap-devx/yeoman-ui-types';
|
|
2
|
+
import { ChangeType, generateChange, getPromptsForAddComponentUsages, getVariant } from '@sap-ux/adp-tooling';
|
|
3
|
+
import { GeneratorTypes } from '../types.js';
|
|
4
|
+
import { initI18n, t } from '../utils/i18n.js';
|
|
5
|
+
import SubGeneratorBase from '../base/sub-gen-base.js';
|
|
10
6
|
/**
|
|
11
7
|
* Generator for adding component usages to a project.
|
|
12
8
|
*/
|
|
13
|
-
class AddComponentUsagesGenerator extends
|
|
9
|
+
class AddComponentUsagesGenerator extends SubGeneratorBase {
|
|
14
10
|
/**
|
|
15
11
|
* The answers from the prompts.
|
|
16
12
|
*/
|
|
@@ -30,24 +26,24 @@ class AddComponentUsagesGenerator extends sub_gen_base_1.default {
|
|
|
30
26
|
* @param {GeneratorOpts} opts - The options for the generator.
|
|
31
27
|
*/
|
|
32
28
|
constructor(args, opts) {
|
|
33
|
-
super(args, opts,
|
|
29
|
+
super(args, opts, GeneratorTypes.ADD_COMPONENT_USAGES);
|
|
34
30
|
if (opts.data) {
|
|
35
31
|
this.projectPath = opts.data.path;
|
|
36
32
|
}
|
|
37
33
|
}
|
|
38
34
|
async initializing() {
|
|
39
|
-
await
|
|
35
|
+
await initI18n();
|
|
40
36
|
try {
|
|
41
|
-
this._registerPrompts(new
|
|
37
|
+
this._registerPrompts(new Prompts([
|
|
42
38
|
{
|
|
43
|
-
name:
|
|
44
|
-
description:
|
|
39
|
+
name: t('yuiNavSteps.addComponentUsagesName'),
|
|
40
|
+
description: t('yuiNavSteps.addComponentUsagesDescr')
|
|
45
41
|
}
|
|
46
42
|
]));
|
|
47
|
-
this.variant = await
|
|
43
|
+
this.variant = await getVariant(this.projectPath);
|
|
48
44
|
}
|
|
49
45
|
catch (e) {
|
|
50
|
-
this.appWizard.showError(e.message,
|
|
46
|
+
this.appWizard.showError(e.message, MessageType.notification);
|
|
51
47
|
this.validationError = e;
|
|
52
48
|
this.logger.error(e);
|
|
53
49
|
}
|
|
@@ -57,11 +53,11 @@ class AddComponentUsagesGenerator extends sub_gen_base_1.default {
|
|
|
57
53
|
await this.handleRuntimeCrash(this.validationError.message);
|
|
58
54
|
return;
|
|
59
55
|
}
|
|
60
|
-
this.answers = await this.prompt(
|
|
56
|
+
this.answers = await this.prompt(getPromptsForAddComponentUsages(this.projectPath, this.variant.layer));
|
|
61
57
|
this.logger.log(`Current answers\n${JSON.stringify(this.answers, null, 2)}`);
|
|
62
58
|
}
|
|
63
59
|
async writing() {
|
|
64
|
-
await
|
|
60
|
+
await generateChange(this.projectPath, ChangeType.ADD_COMPONENT_USAGES, this._createComponentUsageData(), this.fs);
|
|
65
61
|
this.logger.log(`Changes written to changes folder`);
|
|
66
62
|
}
|
|
67
63
|
end() {
|
|
@@ -92,5 +88,5 @@ class AddComponentUsagesGenerator extends sub_gen_base_1.default {
|
|
|
92
88
|
};
|
|
93
89
|
}
|
|
94
90
|
}
|
|
95
|
-
|
|
91
|
+
export default AddComponentUsagesGenerator;
|
|
96
92
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { GeneratorOpts } from '../utils/opts';
|
|
2
|
-
import SubGeneratorBase from '../base/sub-gen-base';
|
|
1
|
+
import type { GeneratorOpts } from '../utils/opts.js';
|
|
2
|
+
import SubGeneratorBase from '../base/sub-gen-base.js';
|
|
3
3
|
/**
|
|
4
4
|
* Generator for adding a new model to an OData service.
|
|
5
5
|
*/
|
|
@@ -37,5 +37,5 @@ declare class AddNewModelGenerator extends SubGeneratorBase {
|
|
|
37
37
|
writing(): Promise<void>;
|
|
38
38
|
end(): void;
|
|
39
39
|
}
|
|
40
|
-
export
|
|
40
|
+
export default AddNewModelGenerator;
|
|
41
41
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
|
|
8
|
-
const types_1 = require("../types");
|
|
9
|
-
const i18n_1 = require("../utils/i18n");
|
|
10
|
-
const sub_gen_base_1 = __importDefault(require("../base/sub-gen-base"));
|
|
1
|
+
import { MessageType, Prompts } from '@sap-devx/yeoman-ui-types';
|
|
2
|
+
import { generateChange, ChangeType, getPromptsForNewModel, getVariant, createNewModelData, isCFEnvironment, isLoggedInCf, loadCfConfig, extractCfBuildTask, readUi5Config } from '@sap-ux/adp-tooling';
|
|
3
|
+
import { setYeomanEnvConflicterForce } from '@sap-ux/fiori-generator-shared';
|
|
4
|
+
import { GeneratorTypes } from '../types.js';
|
|
5
|
+
import { initI18n, t } from '../utils/i18n.js';
|
|
6
|
+
import SubGeneratorBase from '../base/sub-gen-base.js';
|
|
11
7
|
/**
|
|
12
8
|
* Generator for adding a new model to an OData service.
|
|
13
9
|
*/
|
|
14
|
-
class AddNewModelGenerator extends
|
|
10
|
+
class AddNewModelGenerator extends SubGeneratorBase {
|
|
15
11
|
/**
|
|
16
12
|
* The answers from the prompts.
|
|
17
13
|
*/
|
|
@@ -35,30 +31,30 @@ class AddNewModelGenerator extends sub_gen_base_1.default {
|
|
|
35
31
|
* @param {GeneratorOpts} opts - The options for the generator.
|
|
36
32
|
*/
|
|
37
33
|
constructor(args, opts) {
|
|
38
|
-
super(args, opts,
|
|
34
|
+
super(args, opts, GeneratorTypes.ADD_NEW_MODEL);
|
|
39
35
|
if (opts.data) {
|
|
40
36
|
this.projectPath = opts.data.path;
|
|
41
37
|
}
|
|
42
38
|
}
|
|
43
39
|
async initializing() {
|
|
44
|
-
await
|
|
45
|
-
|
|
40
|
+
await initI18n();
|
|
41
|
+
setYeomanEnvConflicterForce(this.env, true);
|
|
46
42
|
try {
|
|
47
|
-
if (await
|
|
48
|
-
this.cfConfig =
|
|
49
|
-
const loggedIn = await
|
|
43
|
+
if (await isCFEnvironment(this.projectPath)) {
|
|
44
|
+
this.cfConfig = loadCfConfig(this.logger);
|
|
45
|
+
const loggedIn = await isLoggedInCf(this.cfConfig, this.logger);
|
|
50
46
|
if (!loggedIn) {
|
|
51
|
-
throw new Error(
|
|
47
|
+
throw new Error(t('error.cfNotLoggedIn'));
|
|
52
48
|
}
|
|
53
49
|
await this._checkCfTargetMismatch();
|
|
54
50
|
}
|
|
55
|
-
this._registerPrompts(new
|
|
56
|
-
{ name:
|
|
51
|
+
this._registerPrompts(new Prompts([
|
|
52
|
+
{ name: t('yuiNavSteps.addNewModelName'), description: t('yuiNavSteps.addNewModelDescr') }
|
|
57
53
|
]));
|
|
58
|
-
this.variant = await
|
|
54
|
+
this.variant = await getVariant(this.projectPath);
|
|
59
55
|
}
|
|
60
56
|
catch (e) {
|
|
61
|
-
this.appWizard.showError(e.message,
|
|
57
|
+
this.appWizard.showError(e.message, MessageType.notification);
|
|
62
58
|
this.validationError = e;
|
|
63
59
|
this.logger.error(e);
|
|
64
60
|
}
|
|
@@ -70,8 +66,8 @@ class AddNewModelGenerator extends sub_gen_base_1.default {
|
|
|
70
66
|
async _checkCfTargetMismatch() {
|
|
71
67
|
let buildTask;
|
|
72
68
|
try {
|
|
73
|
-
const ui5Config = await
|
|
74
|
-
buildTask =
|
|
69
|
+
const ui5Config = await readUi5Config(this.projectPath, 'ui5.yaml');
|
|
70
|
+
buildTask = extractCfBuildTask(ui5Config);
|
|
75
71
|
}
|
|
76
72
|
catch (e) {
|
|
77
73
|
this.logger.error(e.message);
|
|
@@ -80,7 +76,7 @@ class AddNewModelGenerator extends sub_gen_base_1.default {
|
|
|
80
76
|
const orgMismatch = this.cfConfig?.org.GUID !== buildTask.org;
|
|
81
77
|
const spaceMismatch = this.cfConfig?.space.GUID !== buildTask.space;
|
|
82
78
|
if (orgMismatch || spaceMismatch) {
|
|
83
|
-
throw new Error(
|
|
79
|
+
throw new Error(t('error.cfTargetMismatch'));
|
|
84
80
|
}
|
|
85
81
|
}
|
|
86
82
|
async prompting() {
|
|
@@ -88,16 +84,16 @@ class AddNewModelGenerator extends sub_gen_base_1.default {
|
|
|
88
84
|
await this.handleRuntimeCrash(this.validationError.message);
|
|
89
85
|
return;
|
|
90
86
|
}
|
|
91
|
-
this.answers = await this.prompt(await
|
|
87
|
+
this.answers = await this.prompt(await getPromptsForNewModel(this.projectPath, this.variant.layer, this.logger, this.appWizard));
|
|
92
88
|
this.logger.log(`Current answers\n${JSON.stringify(this.answers, null, 2)}`);
|
|
93
89
|
}
|
|
94
90
|
async writing() {
|
|
95
|
-
await
|
|
91
|
+
await generateChange(this.projectPath, ChangeType.ADD_NEW_MODEL, await createNewModelData(this.projectPath, this.variant, this.answers, this.logger), this.fs);
|
|
96
92
|
this.logger.log('Change written to changes folder');
|
|
97
93
|
}
|
|
98
94
|
end() {
|
|
99
95
|
this.logger.log('Successfully created change!');
|
|
100
96
|
}
|
|
101
97
|
}
|
|
102
|
-
|
|
98
|
+
export default AddNewModelGenerator;
|
|
103
99
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AttributesAnswers, type ConfigAnswers, type SystemLookup } from '@sap-ux/adp-tooling';
|
|
2
|
-
import type { ExtensionProjectData } from '../types';
|
|
2
|
+
import type { ExtensionProjectData } from '../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Prepares data required for generating an extension project.
|
|
5
5
|
*
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getExtensionProjectData = getExtensionProjectData;
|
|
4
|
-
const adp_tooling_1 = require("@sap-ux/adp-tooling");
|
|
5
|
-
const i18n_1 = require("../../utils/i18n");
|
|
1
|
+
import { getFormattedVersion } from '@sap-ux/adp-tooling';
|
|
2
|
+
import { t } from '../../utils/i18n.js';
|
|
6
3
|
/**
|
|
7
4
|
* Prepares data required for generating an extension project.
|
|
8
5
|
*
|
|
@@ -11,14 +8,14 @@ const i18n_1 = require("../../utils/i18n");
|
|
|
11
8
|
* @param {SystemLookup} systemLookup - The lookup service for system destination info.
|
|
12
9
|
* @returns {Promise<ExtensionProjectData>} A promise resolving to the prepared extension project data object.
|
|
13
10
|
*/
|
|
14
|
-
async function getExtensionProjectData(configAnswers, attributeAnswers, systemLookup) {
|
|
11
|
+
export async function getExtensionProjectData(configAnswers, attributeAnswers, systemLookup) {
|
|
15
12
|
const { application, system, username, password } = configAnswers;
|
|
16
13
|
if (!application) {
|
|
17
|
-
throw new Error(
|
|
14
|
+
throw new Error(t('error.appParameterMissing'));
|
|
18
15
|
}
|
|
19
16
|
const destinationInfo = await systemLookup.getSystemByName(system);
|
|
20
17
|
if (!destinationInfo) {
|
|
21
|
-
throw new Error(
|
|
18
|
+
throw new Error(t('error.destinationInfoMissing'));
|
|
22
19
|
}
|
|
23
20
|
const { projectName, namespace, ui5Version } = attributeAnswers;
|
|
24
21
|
return {
|
|
@@ -32,7 +29,7 @@ async function getExtensionProjectData(configAnswers, attributeAnswers, systemLo
|
|
|
32
29
|
},
|
|
33
30
|
applicationNS: namespace,
|
|
34
31
|
applicationName: projectName,
|
|
35
|
-
userUI5Ver:
|
|
32
|
+
userUI5Ver: getFormattedVersion(ui5Version),
|
|
36
33
|
BSPUrl: application.bspUrl,
|
|
37
34
|
namespace: application.id
|
|
38
35
|
};
|