Skip to content

Commit 67af1d9

Browse files
committed
fix: enable npm installation for adp cf projects
1 parent c3c6111 commit 67af1d9

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

packages/generator-adp/src/app/index.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ export default class extends Generator {
385385
}
386386

387387
async install(): Promise<void> {
388-
if (!this.shouldInstallDeps || this.shouldCreateExtProject || this.isCfEnv) {
388+
if (!this.shouldInstallDeps || this.shouldCreateExtProject) {
389389
return;
390390
}
391391

@@ -397,7 +397,7 @@ export default class extends Generator {
397397
}
398398

399399
async end(): Promise<void> {
400-
if (this.shouldCreateExtProject || this.isCfEnv) {
400+
if (this.shouldCreateExtProject) {
401401
return;
402402
}
403403

@@ -413,7 +413,7 @@ export default class extends Generator {
413413
});
414414
}
415415

416-
if (this.isCli) {
416+
if (this.isCli || this.isCfEnv) {
417417
return;
418418
}
419419

@@ -537,7 +537,7 @@ export default class extends Generator {
537537
* Generates the ADP project artifacts for the CF environment.
538538
*/
539539
private async _generateAdpProjectArtifactsCF(): Promise<void> {
540-
const projectPath = this.isMtaYamlFound ? process.cwd() : this.destinationPath();
540+
const projectPath = this.destinationPath();
541541
const publicVersions = await fetchPublicVersions(this.logger);
542542

543543
const manifest = this.cfPrompter.manifest;
@@ -576,6 +576,9 @@ export default class extends Generator {
576576
* @returns {string} The project path from the answers.
577577
*/
578578
private _getProjectPath(): string {
579+
if (this.isCfEnv) {
580+
return join(this.destinationPath(), this.attributeAnswers.projectName);
581+
}
579582
return join(this.attributeAnswers.targetFolder, this.attributeAnswers.projectName);
580583
}
581584

packages/generator-adp/test/app.test.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -642,13 +642,20 @@ describe('Adaptation Project Generator Integration Test', () => {
642642

643643
await expect(runContext.run()).resolves.not.toThrow();
644644

645-
expect(executeCommandSpy).not.toHaveBeenCalled();
646-
expect(sendTelemetryMock).not.toHaveBeenCalled();
647-
648645
const generatedDirs = fs.readdirSync(cfTestOutputDir);
649646
expect(generatedDirs).toContain(answers.projectName);
650647
const projectFolder = join(cfTestOutputDir, answers.projectName);
651648

649+
expect(sendTelemetryMock).toHaveBeenCalledWith(
650+
EventName.ADAPTATION_PROJECT_CREATED,
651+
expect.objectContaining({
652+
OperatingSystem: 'testOS',
653+
Platform: 'testPlatform'
654+
}),
655+
projectFolder
656+
);
657+
expect(executeCommandSpy).not.toHaveBeenCalled();
658+
652659
const manifestPath = join(projectFolder, 'webapp', 'manifest.appdescr_variant');
653660
const i18nPath = join(projectFolder, 'webapp', 'i18n', 'i18n.properties');
654661
const ui5Yaml = join(projectFolder, 'ui5.yaml');

0 commit comments

Comments
 (0)