Skip to content

Commit 6528470

Browse files
authored
Merge branch 'main' into 3399/resolve-merge-conflicts
2 parents 2cd3986 + 334b2a3 commit 6528470

File tree

29 files changed

+324
-72
lines changed

29 files changed

+324
-72
lines changed

examples/ui-prompting-examples/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @sap-ux-private/ui-prompting-examples
22

3+
## 0.4.2
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [7f652f3]
8+
- @sap-ux/ui-components@1.26.11
9+
- @sap-ux/ui-prompting@0.5.1
10+
311
## 0.4.1
412

513
### Patch Changes

examples/ui-prompting-examples/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sap-ux-private/ui-prompting-examples",
3-
"version": "0.4.1",
3+
"version": "0.4.2",
44
"description": "This project contains UI storybook stories with exampleS with prompt ui and FPM based building blocks.",
55
"license": "Apache-2.0",
66
"private": true,

packages/abap-deploy-config-sub-generator/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @sap-ux/abap-deploy-config-sub-generator
22

3+
## 0.1.71
4+
5+
### Patch Changes
6+
7+
- 30cf923: fix: "lrep" property is not added when the deploy config is created from within the ADP Generator
8+
39
## 0.1.70
410

511
### Patch Changes

packages/abap-deploy-config-sub-generator/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"url": "https://github.com/SAP/open-ux-tools.git",
77
"directory": "packages/abap-deploy-config-sub-generator"
88
},
9-
"version": "0.1.70",
9+
"version": "0.1.71",
1010
"license": "Apache-2.0",
1111
"main": "generators/app/index.js",
1212
"scripts": {

packages/abap-deploy-config-sub-generator/src/app/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ export default class extends DeploymentGenerator {
289289
if (this.abort || this.answers.overwrite === false) {
290290
return;
291291
}
292-
const namespace = await getVariantNamespace(this.destinationPath(), !!this.answers.isS4HC);
292+
const namespace = await getVariantNamespace(this.destinationPath(), !!this.answers.isS4HC, this.fs);
293293
await generateAbapDeployConfig(
294294
this.destinationPath(),
295295
{

packages/abap-deploy-config-sub-generator/src/utils/project.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { FileName, getWebappPath } from '@sap-ux/project-access';
22
import { join } from 'path';
33
import type { Editor } from 'mem-fs-editor';
4-
import { existsSync, readFileSync } from 'fs';
54
import { t } from './i18n';
65
import { DeploymentGenerator } from '@sap-ux/deploy-config-generator-shared';
76

@@ -24,18 +23,19 @@ export async function indexHtmlExists(fs: Editor, path: string): Promise<boolean
2423
*
2524
* @param path - The path to the project.
2625
* @param isS4HC - Whether the project is Cloud.
26+
* @param fs - The file system editor.
2727
* @returns The variant namespace.
2828
*/
29-
export async function getVariantNamespace(path: string, isS4HC: boolean): Promise<string | undefined> {
29+
export async function getVariantNamespace(path: string, isS4HC: boolean, fs: Editor): Promise<string | undefined> {
3030
if (isS4HC) {
3131
return undefined;
3232
}
3333

3434
try {
35-
const webappPath = await getWebappPath(path);
36-
const filePath = join(webappPath, FileName.ManifestAppDescrVar);
37-
if (existsSync(filePath)) {
38-
const descriptor = JSON.parse(readFileSync(filePath, 'utf-8'));
35+
const filePath = join(await getWebappPath(path, fs), FileName.ManifestAppDescrVar);
36+
37+
if (fs.exists(filePath)) {
38+
const descriptor = fs.readJSON(filePath) as unknown as { namespace: string };
3939
return descriptor.namespace;
4040
}
4141
} catch (e) {
Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { join } from 'path';
2+
import type { Editor } from 'mem-fs-editor';
23
import { existsSync, readFileSync } from 'fs';
34

45
import { getWebappPath, FileName } from '@sap-ux/project-access';
@@ -36,64 +37,61 @@ describe('getVariantNamespace', () => {
3637
const mockWebappPath = '/test/project/webapp';
3738
const mockManifestPath = join(mockWebappPath, FileName.ManifestAppDescrVar);
3839

40+
let mockFs: Editor;
41+
let mockFsExists: jest.Mock;
42+
let mockFsReadJSON: jest.Mock;
43+
3944
beforeAll(async () => {
4045
await initI18n();
4146
});
4247

4348
beforeEach(() => {
4449
jest.clearAllMocks();
4550
mockGetWebappPath.mockResolvedValue(mockWebappPath);
51+
52+
mockFsExists = jest.fn();
53+
mockFsReadJSON = jest.fn();
54+
55+
mockFs = {
56+
exists: mockFsExists,
57+
readJSON: mockFsReadJSON
58+
} as unknown as Editor;
4659
});
4760

4861
it('should return undefined for S4HC projects', async () => {
49-
const result = await getVariantNamespace(mockPath, true);
50-
62+
const result = await getVariantNamespace(mockPath, true, mockFs);
5163
expect(result).toBeUndefined();
5264
expect(mockGetWebappPath).not.toHaveBeenCalled();
53-
expect(mockExistsSync).not.toHaveBeenCalled();
5465
});
5566

56-
it('should return namespace from manifest.appdescr_variant file', async () => {
57-
const mockManifest = {
58-
namespace: 'apps/workcenter/appVariants/customer.app.variant'
59-
};
67+
it('should return namespace from memory', async () => {
68+
const mockManifest = { namespace: 'apps/workcenter/appVariants/customer.app.variant' };
69+
mockFsExists.mockReturnValue(true);
70+
mockFsReadJSON.mockReturnValue(mockManifest);
6071

61-
mockExistsSync.mockReturnValue(true);
62-
mockReadFileSync.mockReturnValue(JSON.stringify(mockManifest));
72+
const result = await getVariantNamespace(mockPath, false, mockFs);
6373

64-
const result = await getVariantNamespace(mockPath, false);
65-
66-
expect(result).toBe('apps/workcenter/appVariants/customer.app.variant');
67-
expect(mockGetWebappPath).toHaveBeenCalledWith(mockPath);
68-
expect(mockExistsSync).toHaveBeenCalledWith(mockManifestPath);
69-
expect(mockReadFileSync).toHaveBeenCalledWith(mockManifestPath, 'utf-8');
74+
expect(result).toBe(mockManifest.namespace);
75+
expect(mockGetWebappPath).toHaveBeenCalledWith(mockPath, mockFs);
76+
expect(mockFsExists).toHaveBeenCalledWith(mockManifestPath);
7077
});
7178

72-
it('should return undefined when manifest file does not exist', async () => {
73-
mockExistsSync.mockReturnValue(false);
74-
75-
const result = await getVariantNamespace(mockPath, false);
76-
79+
it('should return undefined when memory file does not exist', async () => {
80+
mockFsExists.mockReturnValue(false);
81+
const result = await getVariantNamespace(mockPath, false, mockFs);
7782
expect(result).toBeUndefined();
78-
expect(mockGetWebappPath).toHaveBeenCalledWith(mockPath);
79-
expect(mockExistsSync).toHaveBeenCalledWith(mockManifestPath);
80-
expect(mockReadFileSync).not.toHaveBeenCalled();
8183
});
8284

83-
it('should handle JSON parsing errors gracefully', async () => {
84-
mockExistsSync.mockReturnValue(true);
85-
mockReadFileSync.mockReturnValue('invalid json content');
85+
it('should handle errors gracefully', async () => {
86+
mockFsExists.mockImplementation(() => {
87+
throw new Error('Memory filesystem error');
88+
});
8689

87-
const result = await getVariantNamespace(mockPath, false);
90+
const result = await getVariantNamespace(mockPath, false, mockFs);
8891

8992
expect(result).toBeUndefined();
90-
expect(mockGetWebappPath).toHaveBeenCalledWith(mockPath);
91-
expect(mockExistsSync).toHaveBeenCalledWith(mockManifestPath);
92-
expect(mockReadFileSync).toHaveBeenCalledWith(mockManifestPath, 'utf-8');
9393
expect(DeploymentGenerator.logger.debug).toHaveBeenCalledWith(
94-
t('debug.lrepNamespaceNotFound', {
95-
error: 'Unexpected token \'i\', "invalid json content" is not valid JSON'
96-
})
94+
t('debug.lrepNamespaceNotFound', { error: 'Memory filesystem error' })
9795
);
9896
});
9997
});

packages/adp-flp-config-sub-generator/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @sap-ux/adp-flp-config-sub-generator
22

3+
## 0.1.78
4+
5+
### Patch Changes
6+
7+
- 487296c: fix: Wrong navigation between steps in FLP Configuration generator for ADP
8+
39
## 0.1.77
410

511
### Patch Changes

packages/adp-flp-config-sub-generator/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@sap-ux/adp-flp-config-sub-generator",
33
"description": "Generator for adding FLP configuration to an Adaptation Project",
4-
"version": "0.1.77",
4+
"version": "0.1.78",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/SAP/open-ux-tools.git",

packages/adp-flp-config-sub-generator/src/app/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ export default class AdpFlpConfigGenerator extends Generator {
127127
}
128128

129129
public async prompting(): Promise<void> {
130-
if (this.authenticationRequired) {
130+
// If authentication was already prompted it should not be skipped as this leads to issues with Yeoman UI navigation
131+
const credentialsPrompted = getFromCache<boolean>(this.appWizard, 'credentialsPrompted', this.logger);
132+
if (this.authenticationRequired || credentialsPrompted) {
131133
await this._promptAuthentication();
132134
}
133135
if (this.abort) {
@@ -197,7 +199,7 @@ export default class AdpFlpConfigGenerator extends Generator {
197199
try {
198200
this.provider = await getAbapServiceProvider(this.ui5Yaml, this.toolsLogger, this.credentials);
199201
this.inbounds = await getBaseAppInbounds(this.appId, this.provider);
200-
addToCache(this.appWizard, { provider: this.provider }, this.logger);
202+
addToCache(this.appWizard, { provider: this.provider, credentialsPrompted: true }, this.logger);
201203
} catch (error) {
202204
if (!isAxiosError(error)) {
203205
this.logger.error(`Base application inbounds fetching failed: ${error}`);

0 commit comments

Comments
 (0)