Skip to content

Commit ad099e3

Browse files
authored
Merge branch 'main' into 3399/resolve-merge-conflicts
2 parents 6528470 + c196723 commit ad099e3

File tree

29 files changed

+581
-124
lines changed

29 files changed

+581
-124
lines changed

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

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

3+
## 0.1.72
4+
5+
### Patch Changes
6+
7+
- 4b0b8fb: fix: Missing build script for ADP onPremise projects leads to error during deployment
8+
- Updated dependencies [4b0b8fb]
9+
- @sap-ux/abap-deploy-config-writer@0.2.18
10+
311
## 0.1.71
412

513
### 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.71",
9+
"version": "0.1.72",
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: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export default class extends DeploymentGenerator {
5656
private configExists: boolean;
5757
private answers: AbapDeployConfigAnswersInternal;
5858
private projectType: DeployProjectType;
59+
private isAdp: boolean;
5960

6061
/**
6162
* Constructor for the ABAP deploy config generator.
@@ -174,24 +175,24 @@ export default class extends DeploymentGenerator {
174175
}
175176
if (!this.launchDeployConfigAsSubGenerator) {
176177
const appType = await getAppType(this.destinationPath());
177-
const isAdp = appType === 'Fiori Adaptation';
178+
this.isAdp = appType === 'Fiori Adaptation';
178179
const packageAdditionalValidation = {
179-
shouldValidatePackageForStartingPrefix: isAdp,
180-
shouldValidatePackageType: isAdp,
181-
shouldValidateFormatAndSpecialCharacters: isAdp
180+
shouldValidatePackageForStartingPrefix: this.isAdp,
181+
shouldValidatePackageType: this.isAdp,
182+
shouldValidateFormatAndSpecialCharacters: this.isAdp
182183
};
183184
const promptOptions: AbapDeployConfigPromptOptions = {
184-
ui5AbapRepo: { hideIfOnPremise: isAdp },
185-
transportInputChoice: { hideIfOnPremise: isAdp },
185+
ui5AbapRepo: { hideIfOnPremise: this.isAdp },
186+
transportInputChoice: { hideIfOnPremise: this.isAdp },
186187
packageAutocomplete: {
187188
additionalValidation: packageAdditionalValidation
188189
},
189190
packageManual: {
190191
additionalValidation: packageAdditionalValidation
191192
},
192-
targetSystem: { additionalValidation: { shouldRestrictDifferentSystemType: isAdp } }
193+
targetSystem: { additionalValidation: { shouldRestrictDifferentSystemType: this.isAdp } }
193194
};
194-
const indexGenerationAllowed = this.indexGenerationAllowed && !isAdp;
195+
const indexGenerationAllowed = this.indexGenerationAllowed && !this.isAdp;
195196
const { prompts: abapDeployConfigPrompts, answers: abapAnswers = {} } = await getAbapQuestions({
196197
appRootPath: this.destinationRoot(),
197198
connectedSystem: this.options.connectedSystem,
@@ -311,7 +312,8 @@ export default class extends DeploymentGenerator {
311312
} as AbapDeployConfig,
312313
{
313314
baseFile: this.options.base,
314-
deployFile: this.options.config
315+
deployFile: this.options.config,
316+
addBuildToUndeployScript: !this.isAdp
315317
},
316318
this.fs
317319
);

packages/abap-deploy-config-writer/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-writer
22

3+
## 0.2.18
4+
5+
### Patch Changes
6+
7+
- 4b0b8fb: fix: Missing build script for ADP onPremise projects leads to error during deployment
8+
39
## 0.2.17
410

511
### Patch Changes

packages/abap-deploy-config-writer/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-writer"
88
},
9-
"version": "0.2.17",
9+
"version": "0.2.18",
1010
"license": "Apache-2.0",
1111
"main": "dist/index.js",
1212
"scripts": {

packages/abap-deploy-config-writer/src/file.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { join } from 'path';
22
import fg from 'fast-glob';
33
import { platform } from 'os';
4-
import { existsSync } from 'fs';
54
import { FileName, type Package, getReuseLibs } from '@sap-ux/project-access';
65
import { UI5_CLI_LIB, UI5_CLI_MIN_VERSION, UI5_REPO_IGNORE, UI5_REPO_TEXT_FILES } from './constants';
76
import { coerce, satisfies } from 'semver';
@@ -118,15 +117,3 @@ export async function writeUi5RepositoryIgnore(fs: Editor, path?: string): Promi
118117
}
119118
}
120119
}
121-
122-
/**
123-
* Checks if the project is a TypeScript project.
124-
*
125-
* @param fs - the memfs editor instance
126-
* @param basePath - the base path
127-
* @returns true if the project is a TypeScript project, false otherwise
128-
*/
129-
export function isTsProject(fs: Editor, basePath: string): boolean {
130-
const tsconfigPath = join(basePath, FileName.Tsconfig);
131-
return fs.exists(tsconfigPath) || existsSync(tsconfigPath);
132-
}

packages/abap-deploy-config-writer/src/index.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,7 @@ import { create } from 'mem-fs-editor';
44
import cloneDeep from 'lodash/cloneDeep';
55
import { addPackageDevDependency, FileName, getWebappPath, readUi5Yaml } from '@sap-ux/project-access';
66
import { getDeployConfig, updateBaseConfig } from './config';
7-
import {
8-
addUi5Dependency,
9-
getLibraryPath,
10-
isTsProject,
11-
writeUi5RepositoryFiles,
12-
writeUi5RepositoryIgnore
13-
} from './file';
7+
import { addUi5Dependency, getLibraryPath, writeUi5RepositoryFiles, writeUi5RepositoryIgnore } from './file';
148
import { UI5_TASK_FLATTEN_LIB, UI5_TASK_FLATTEN_LIB_VERSION } from './constants';
159
import type { DeployConfigOptions } from './types';
1610
import type { Editor } from 'mem-fs-editor';
@@ -51,8 +45,7 @@ async function generate(
5145
const deployConfig = await getDeployConfig(abapConfig, baseConfig);
5246
fs.write(deployFilePath, deployConfig.toString());
5347

54-
const includeBuildScript = !abapConfig.lrep || isTsProject(fs, basePath);
55-
await updateScripts(basePath, deployConfigFile, fs, includeBuildScript);
48+
await updateScripts(basePath, deployConfigFile, fs, options);
5649

5750
if (isLib) {
5851
// ui5 repo ignore file

packages/abap-deploy-config-writer/src/scripts.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { Editor } from 'mem-fs-editor';
22

33
import { addPackageDevDependency, updatePackageScript } from '@sap-ux/project-access';
44

5+
import type { DeployConfigOptions } from './types';
56
import { BUILD_SCRIPT, DEPLOY_SCRIPT, RIMRAF, RIMRAF_VERSION, UNDEPLOY_SCRIPT } from './constants';
67

78
/**
@@ -10,26 +11,26 @@ import { BUILD_SCRIPT, DEPLOY_SCRIPT, RIMRAF, RIMRAF_VERSION, UNDEPLOY_SCRIPT }
1011
* @param {string} basePath - The path to the base directory.
1112
* @param {string} deployConfigFile - The path to the deploy config file.
1213
* @param {Editor} fs - The file system editor.
13-
* @param {boolean} includeBuildScript - Whether to include build script in deploy commands.
14+
* @param {DeployConfigOptions} options - The deploy config options.
1415
*/
1516
export async function updateScripts(
1617
basePath: string,
1718
deployConfigFile: string,
1819
fs: Editor,
19-
includeBuildScript: boolean = true
20+
options?: DeployConfigOptions
2021
): Promise<void> {
21-
const buildPrefix = includeBuildScript ? `${BUILD_SCRIPT} && ` : '';
22+
const buildPrefix = options?.addBuildToUndeployScript ?? true ? `${BUILD_SCRIPT} && ` : '';
2223

2324
// deploy script
24-
const deployScript = `${buildPrefix}${DEPLOY_SCRIPT} --config ${deployConfigFile}`;
25+
const deployScript = `${BUILD_SCRIPT} && ${DEPLOY_SCRIPT} --config ${deployConfigFile}`;
2526
await updatePackageScript(basePath, 'deploy', deployScript, fs);
2627

2728
// undeploy script
2829
const undeployScript = `${buildPrefix}${UNDEPLOY_SCRIPT} --config ${deployConfigFile}`;
2930
await updatePackageScript(basePath, 'undeploy', undeployScript, fs);
3031

3132
// test mode script
32-
const deployTestModeScript = `${buildPrefix}${DEPLOY_SCRIPT} --config ${deployConfigFile} --testMode true`;
33+
const deployTestModeScript = `${BUILD_SCRIPT} && ${DEPLOY_SCRIPT} --config ${deployConfigFile} --testMode true`;
3334
await updatePackageScript(basePath, 'deploy-test', deployTestModeScript, fs);
3435

3536
// dependencies
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
export interface DeployConfigOptions {
22
baseFile?: string; // e.g ui5.yaml
33
deployFile?: string; // e.g ui5-deploy.yaml
4+
/**
5+
* Default is true. If true, the build script will be added to the undeploy script
6+
*/
7+
addBuildToUndeployScript?: boolean;
48
}

packages/abap-deploy-config-writer/test/unit/__snapshots__/index.test.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ Object {
219219
\\"start\\": \\"start script\\",
220220
\\"build\\": \\"build script\\",
221221
\\"test\\": \\"test script\\",
222-
\\"deploy\\": \\"fiori deploy --config ui5-deploy.yaml\\",
222+
\\"deploy\\": \\"npm run build && fiori deploy --config ui5-deploy.yaml\\",
223223
\\"undeploy\\": \\"fiori undeploy --config ui5-deploy.yaml\\",
224-
\\"deploy-test\\": \\"fiori deploy --config ui5-deploy.yaml --testMode true\\"
224+
\\"deploy-test\\": \\"npm run build && fiori deploy --config ui5-deploy.yaml --testMode true\\"
225225
},
226226
\\"devDependencies\\": {
227227
\\"rimraf\\": \\"^5.0.5\\"
@@ -345,7 +345,7 @@ Object {
345345
\\"build\\": \\"build script\\",
346346
\\"test\\": \\"test script\\",
347347
\\"deploy\\": \\"npm run build && fiori deploy --config ui5-deploy.yaml\\",
348-
\\"undeploy\\": \\"npm run build && fiori undeploy --config ui5-deploy.yaml\\",
348+
\\"undeploy\\": \\"fiori undeploy --config ui5-deploy.yaml\\",
349349
\\"deploy-test\\": \\"npm run build && fiori deploy --config ui5-deploy.yaml --testMode true\\"
350350
},
351351
\\"devDependencies\\": {

0 commit comments

Comments
 (0)