Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4f9f9d3
fix: align mta and package.json changes
longieirl Sep 16, 2025
73c31ed
fix: add changeset
longieirl Sep 16, 2025
84e2c1a
fix: fix sub-generator tests
longieirl Sep 16, 2025
d0d12ba
Merge branch 'main' into 3399/resolve-merge-conflicts
longieirl Sep 16, 2025
d6f5149
Merge branch 'main' into 3399/resolve-merge-conflicts
longieirl Sep 16, 2025
6e1eb58
Merge branch 'main' into 3399/resolve-merge-conflicts
longieirl Sep 16, 2025
2f596ae
Merge branch 'main' into 3399/resolve-merge-conflicts
longieirl Sep 17, 2025
22bc1e9
fix: cleanup code
longieirl Sep 17, 2025
bda67a5
Merge branch 'main' into 3399/resolve-merge-conflicts
longieirl Oct 3, 2025
7108f7d
fix: update node:fs
longieirl Oct 3, 2025
8c9ea35
fix: resolve merge conflicts
longieirl Oct 8, 2025
b6b0332
fix: resolve conflicts
longieirl Nov 12, 2025
980b767
Merge branch 'main' into 3399/resolve-merge-conflicts
longieirl Dec 2, 2025
159ba1c
fix: merge master
longieirl Feb 4, 2026
9e555d2
Merge branch 'main' into 3399/resolve-merge-conflicts
longieirl Mar 3, 2026
9ad1326
fix: resolve merge conflicts with main
longieirl Mar 26, 2026
848f7db
Merge remote-tracking branch 'origin/main' into 3399/resolve-merge-co…
longieirl Mar 26, 2026
b75e2c0
chore: update pnpm-lock.yaml after merge with main
longieirl Mar 26, 2026
87e423c
Merge branch 'main' into 3399/resolve-merge-conflicts
longieirl Mar 26, 2026
e71aaf2
Merge branch 'main' into 3399/resolve-merge-conflicts
longieirl Mar 27, 2026
eac08eb
Merge remote-tracking branch 'origin/main' into 3399/resolve-merge-co…
longieirl Mar 27, 2026
2c757ed
chore(cf-deploy-config-writer): remove lodash dependency
longieirl Mar 27, 2026
7d14b65
Merge branch 'main' into 3399/resolve-merge-conflicts
longieirl Mar 27, 2026
6b5c8ee
Merge branch 'main' into 3399/resolve-merge-conflicts
longieirl Mar 30, 2026
fdf1a55
Merge branch 'main' into 3399/resolve-merge-conflicts
longieirl Mar 30, 2026
c09182a
Merge branch 'main' into 3399/resolve-merge-conflicts
longieirl Mar 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/thin-lizards-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sap-ux/cf-deploy-config-writer': patch
---

Align mta.yaml for standalone and ensure external package.json changes are refected
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ resources:
config:
tenant-mode: dedicated
xsappname: sap-ux-test-${space-guid}
path: ./xs-security.json
service: xsuaa
service-name: sap-ux-test-xsuaa-service
service-plan: application
- name: sap-ux-test-html5-repo-runtime
type: org.cloudfoundry.managed-service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ resources:
config:
tenant-mode: dedicated
xsappname: sap-ux-test-${space-guid}
path: ./xs-security.json
service: xsuaa
service-name: sap-ux-test-xsuaa-service
service-plan: application
- name: sap-ux-test-html5-repo-runtime
type: org.cloudfoundry.managed-service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ resources:
config:
tenant-mode: dedicated
xsappname: sap-ux-test-${space-guid}
path: ./xs-security.json
service: xsuaa
service-name: sap-ux-test-xsuaa-service
service-plan: application
- name: sap-ux-test-html5-repo-runtime
type: org.cloudfoundry.managed-service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ resources:
config:
tenant-mode: dedicated
xsappname: sap-ux-test-${space-guid}
path: ./xs-security.json
service: xsuaa
service-name: sap-ux-test-xsuaa-service
service-plan: application
- name: sap-ux-test-html5-repo-runtime
type: org.cloudfoundry.managed-service
Expand Down
4 changes: 3 additions & 1 deletion packages/cf-deploy-config-writer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"i18next": "25.3.0",
"mem-fs": "2.1.0",
"mem-fs-editor": "9.4.0",
"hasbin": "1.2.3"
"hasbin": "1.2.3",
"lodash": "4.17.21"
},
"devDependencies": {
"@types/ejs": "3.1.2",
Expand All @@ -53,6 +54,7 @@
"@types/fs-extra": "9.0.13",
"@types/js-yaml": "4.0.9",
"@types/semver": "7.5.2",
"@types/lodash": "4.14.202",
"memfs": "3.4.13",
"js-yaml": "3.14.0",
"fs-extra": "10.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ async function updateManifest(cfConfig: CFConfig, fs: Editor): Promise<void> {
*/
async function updateHTML5AppPackage(cfConfig: CFConfig, fs: Editor): Promise<void> {
let deployArgs: string[] = [];
if (fileExists(fs, join(cfConfig.appPath, FileName.MtaExtYaml))) {
if (await fileExists(join(cfConfig.appPath, FileName.MtaExtYaml), fs)) {
deployArgs = ['-e', FileName.MtaExtYaml];
}
// Added for all flows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function generateBaseConfig(config: CFBaseConfig, fs?: Editor, logg
}
logger?.debug(`Generate base configuration using: \n ${JSON.stringify(config)}`);
validateMtaConfig(config);
if (fileExists(fs, join(config.mtaPath, config.mtaId))) {
if (await fileExists(join(config.mtaPath, config.mtaId), fs)) {
throw new Error(t('error.mtaFolderAlreadyExists'));
}
createMTA(config as MTABaseConfig);
Expand Down
4 changes: 3 additions & 1 deletion packages/cf-deploy-config-writer/src/mta-config/mta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,10 @@ export class MtaConfig {
name: `${this.prefix?.slice(0, 100)}-uaa`,
type: 'org.cloudfoundry.managed-service',
parameters: {
'service-plan': 'application',
service: 'xsuaa',
'service-plan': 'application',
path: './xs-security.json',
'service-name': `${this.prefix?.slice(0, 100)}-xsuaa-service`,
config: { xsappname: `${this.prefix?.slice(0, 100)}` + '-${space-guid}', 'tenant-mode': 'dedicated' }
}
};
Expand Down
41 changes: 30 additions & 11 deletions packages/cf-deploy-config-writer/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { join, normalize, posix } from 'path';
import { promises as fs, readFileSync } from 'fs';
import { coerce, satisfies } from 'semver';
import type { Editor } from 'mem-fs-editor';
import { CommandRunner } from '@sap-ux/nodejs-utils';
Expand Down Expand Up @@ -33,6 +34,7 @@ import {
CDSPackage
} from './constants';
import { type MTABaseConfig, type CFBaseConfig, type CFAppConfig } from './types';
import merge from 'lodash/merge';

let cachedDestinationsList: Destinations = {};

Expand Down Expand Up @@ -221,29 +223,37 @@ export function setMtaDefaults(config: CFBaseConfig): void {
* @param {object} Options Input params
* @param {string} Options.mtaId - MTA ID to be written to package.json
* @param {string} Options.rootPath - MTA project path
* @param fs - optional reference to a mem-fs editor
* @param memFs - optional reference to a mem-fs editor
*/
export async function updateRootPackage(
{ mtaId, rootPath }: { mtaId: string; rootPath: string },
fs: Editor
memFs: Editor
): Promise<void> {
const packageExists = fileExists(fs, join(rootPath, FileName.Package));
const packageFilePath = join(rootPath, FileName.Package);
const packageExists = await fileExists(packageFilePath, memFs);
// Append package.json only if mta.yaml is at a different level to the HTML5 app
if (packageExists) {
// Align CDS versions if missing otherwise mta.yaml before-all scripts will fail
await alignCdsVersions(rootPath, fs);
await addPackageDevDependency(rootPath, Rimraf, RimrafVersion, fs);
await addPackageDevDependency(rootPath, MbtPackage, MbtPackageVersion, fs);
await alignCdsVersions(rootPath, memFs);
await addPackageDevDependency(rootPath, Rimraf, RimrafVersion, memFs);
await addPackageDevDependency(rootPath, MbtPackage, MbtPackageVersion, memFs);
let deployArgs: string[] = [];
if (fs?.exists(join(rootPath, FileName.MtaExtYaml))) {
if (memFs?.exists(join(rootPath, FileName.MtaExtYaml))) {
deployArgs = ['-e', FileName.MtaExtYaml];
}
for (const script of [
{ name: 'undeploy', run: undeployMTAScript(mtaId) },
{ name: 'build', run: `${MTABuildScript} --mtar archive` },
{ name: 'deploy', run: rootDeployMTAScript(deployArgs) }
]) {
await updatePackageScript(rootPath, script.name, script.run, fs);
await updatePackageScript(rootPath, script.name, script.run, memFs);
}
// Need to handle external changes to package.json i.e. cds and devDependencies.
// Note: disk package.json might not exist, for example, when creating a new project from scratch.
if (await fileExists(packageFilePath)) {
const memoryJson = (memFs?.readJSON(packageFilePath, {}) || {}) as Package;
const diskJson = JSON.parse(readFileSync(packageFilePath, 'utf8')) as Package;
memFs.writeJSON(packageFilePath, merge({}, memoryJson, diskJson));
}
}
}
Expand Down Expand Up @@ -309,10 +319,19 @@ export async function runCommand(cwd: string, cmd: string, args: string[], error
/**
* Check if a file exists in the file system.
*
* @param fs reference to a mem-fs editor
* @param filePath Path to the file
* @param memFs reference to a mem-fs editor
* @returns true if the file exists, false otherwise
*/
export function fileExists(fs: Editor, filePath: string): boolean {
return fs.exists(filePath);
export async function fileExists(filePath: string, memFs?: Editor): Promise<boolean> {
try {
if (memFs) {
return memFs.exists(filePath);
} else {
await fs.access(filePath);
return true;
}
} catch {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,24 @@ exports[`CF Writer with CAP App Frontend Generate deployment config Add HTML5 ap

exports[`CF Writer with CAP App Frontend Generate deployment config Add HTML5 app to CAP App Frontend Project 3`] = `
"{
\\"dependencies\\": {
\\"@sap/cds\\": \\"^8\\",
\\"express\\": \\"^4\\",
\\"@sap/xssec\\": \\"^4\\"
},
\\"devDependencies\\": {
\\"@cap-js/cds-types\\": \\"^0.9.0\\",
\\"@cap-js/sqlite\\": \\"^1\\",
\\"@sap/cds-dk\\": \\"^8\\",
\\"rimraf\\": \\"^5.0.5\\",
\\"mbt\\": \\"^1.2.29\\"
},
\\"cds\\": {},
\\"scripts\\": {
\\"undeploy\\": \\"cf undeploy cappapp --delete-services --delete-service-keys --delete-service-brokers\\",
\\"build\\": \\"rimraf resources mta_archives && mbt build --mtar archive\\",
\\"deploy\\": \\"cf deploy mta_archives/archive.mtar --retries 1\\"
}
\\"dependencies\\": {
\\"@sap/cds\\": \\"^8\\",
\\"express\\": \\"^4\\",
\\"@sap/xssec\\": \\"^4\\"
},
\\"devDependencies\\": {
\\"@cap-js/cds-types\\": \\"^0.9.0\\",
\\"@cap-js/sqlite\\": \\"^1\\",
\\"@sap/cds-dk\\": \\"^8\\",
\\"rimraf\\": \\"^5.0.5\\",
\\"mbt\\": \\"^1.2.29\\"
},
\\"cds\\": {},
\\"scripts\\": {
\\"undeploy\\": \\"cf undeploy cappapp --delete-services --delete-service-keys --delete-service-brokers\\",
\\"build\\": \\"rimraf resources mta_archives && mbt build --mtar archive\\",
\\"deploy\\": \\"cf deploy mta_archives/archive.mtar --retries 1\\"
}
}
"
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,16 +277,16 @@ builder:
},
"package.json": Object {
"contents": "{
\\"cds\\": {},
\\"devDependencies\\": {
\\"rimraf\\": \\"^5.0.5\\",
\\"mbt\\": \\"^1.2.29\\"
},
\\"scripts\\": {
\\"undeploy\\": \\"cf undeploy cappapp --delete-services --delete-service-keys --delete-service-brokers\\",
\\"build\\": \\"rimraf resources mta_archives && mbt build --mtar archive\\",
\\"deploy\\": \\"cf deploy mta_archives/archive.mtar --retries 1\\"
}
\\"cds\\": {},
\\"devDependencies\\": {
\\"rimraf\\": \\"^5.0.5\\",
\\"mbt\\": \\"^1.2.29\\"
},
\\"scripts\\": {
\\"undeploy\\": \\"cf undeploy cappapp --delete-services --delete-service-keys --delete-service-brokers\\",
\\"build\\": \\"rimraf resources mta_archives && mbt build --mtar archive\\",
\\"deploy\\": \\"cf deploy mta_archives/archive.mtar --retries 1\\"
}
}
",
"state": "modified",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,9 @@ resources:
config:
tenant-mode: dedicated
xsappname: standalonewithabapserviceprovider-\${space-guid}
path: ./xs-security.json
service: xsuaa
service-name: standalonewithabapserviceprovider-xsuaa-service
service-plan: application
- name: standalonewithabapserviceprovider-html5-repo-runtime
type: org.cloudfoundry.managed-service
Expand Down Expand Up @@ -478,7 +480,9 @@ resources:
config:
tenant-mode: dedicated
xsappname: standalone-with-connectivity-service-\${space-guid}
path: ./xs-security.json
service: xsuaa
service-name: standalone-with-connectivity-service-xsuaa-service
service-plan: application
- name: standalone-with-connectivity-service-html5-repo-runtime
type: org.cloudfoundry.managed-service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,10 @@ resources:
- name: captestproject-uaa
type: org.cloudfoundry.managed-service
parameters:
service-plan: application
service: xsuaa
service-plan: application
path: ./xs-security.json
service-name: captestproject-xsuaa-service
config:
xsappname: 'captestproject-\${space-guid}'
tenant-mode: dedicated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,10 @@ resources:
- name: standaloneBasic-uaa
type: org.cloudfoundry.managed-service
parameters:
service-plan: application
service: xsuaa
service-plan: application
path: ./xs-security.json
service-name: standaloneBasic-xsuaa-service
config:
xsappname: 'standaloneBasic-\${space-guid}'
tenant-mode: dedicated
Expand Down
8 changes: 7 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.