New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Switch Adaptation Project's generator/wizard to use Open Source writers #1775
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 35a6347 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…/1611/writersForAdpProjects
…SAP/open-ux-tools into feat/1611/writersForAdpProjects
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage is currently at 88.7% and could be improved a little bit.
fs.copyTpl(join(tmplPath, '**/*.*'), join(basePath), config.app, undefined, { | ||
globOptions: { dot: true, ignore: ['**/xs-security.json', '**/approuter/*.*', '**/manifest.appdescr_variant'] }, | ||
processDestinationPath: (filePath: string) => | ||
filePath | ||
.replace(/gitignore.tmpl/g, '.gitignore') | ||
.replace(/i18n\/i18n.properties/g, 'webapp/i18n/i18n.properties') | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can also be a new method that will handle the copying of the files. See the comment below for the full picture.
\\"@ui5/cli\\": \\"^3.9.1\\" | ||
\\"@ui5/cli\\": \\"^3.6.0\\" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question, why did this version change? It was ^3.9.1
before. ^3.6.0
will install the latest too.
…ents and export only one generate method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitHub actions for some reason are not running and I cannot see the result of those voters. Also, there are some merge conflicts to be resolved.
Some comments from before have not been addressed yet. And could you please write what have you changed in my requested changes comments, so I can resolve those comments.
@@ -14,7 +14,7 @@ | |||
"@sap-ux/preview-middleware": "^0.11.1", | |||
"@sap-ux/ui5-proxy-middleware": "^1.3.0", | |||
"@sap-ux/deploy-tooling": "^0.11.7"<%}%>, | |||
"@ui5/cli": "^3.9.1" | |||
"@ui5/cli": "^3.6.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as before, is there any reason for this version "downgrade".
packages/adp-tooling/src/types.ts
Outdated
export interface AdpCustomConfig { | ||
adp: { | ||
safeMode: boolean; | ||
environment: ProjectType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBD: the environment is now 'OnPrem' but our change editors still have checks for 'ABAP'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nikmace Why would the change editors need to know about the target environment?
const appdescrTplPath = join(templatePath, 'webapp/manifest.appdescr_variant'); | ||
const appdescrPath = join(projectPath, 'webapp/manifest.appdescr_variant'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please use the enum from project access for different folders
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry but that one is far away from being acceptable.
Please remove things like a pom.xml
that only make sense for SAP internal projects and also remove all the duplicated files in the templates section.
Projects that are for an ABAP system are almost identical (no matter if on premise, private cloud our public cloud). The only difference is the additional build task and a minor change in the deploy script.
I am not an expert for CF but I am pretty sure that the generated structure is also not aligned with the latest guidance on CF projects.
My recommendation is actually to start from scratch again. Take the existing writer/templates (from main
) and compare its results with the three different options. Then enhance the "core" that is the same for all option and add diffs if required for other targets. I'd recommend you have a look at the fiori-elements-writer
and how it is designed.
…ml content generation
…cture, adapt commands, remove unused dependencie
"@sap-ux/preview-middleware": "^0.11.1", | ||
"@sap-ux/ui5-proxy-middleware": "^1.3.0", | ||
"@sap-ux/deploy-tooling": "^0.11.7"<%}%>, | ||
"@ui5/cli": "^3.9.1" | ||
"@ui5/task-adaptation": "^1.3.0", | ||
"@ui5/cli": "^3.9.2" | ||
}, | ||
"scripts": { | ||
"build": "ui5 build --exclude-task generateFlexChangesBundle generateComponentPreload --clean-dest", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add minify
to the excluded tasks? Otherwise, .map
files will be generated that are rejected by LREP on your ABAP versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
} | ||
await writeUI5DeployYaml(basePath, fullConfig, fs); | ||
await writeUI5Yaml(basePath, fullConfig, fs); | ||
await writeEnvFile(basePath, fullConfig, fs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the user know that we are writing user/password to the filesystem? If not, we cannot do that.
Btw, as far as I understand, both user/password are only used for the additional tasks for S/4HANA Cloud Public Edition scenarios, however, such systems won't allow access with user/password, therefore, I'd strongly prefer to remove this user/password/env thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, please remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
* @returns list of required tasks. | ||
*/ | ||
function getAdpCloudCustomTasks(config: AdpWriterConfig & { target: AbapTarget }): CustomTask[] { | ||
const user = 'env:ABAP_USERNAME'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in my other comment, this shouldn't be here. In the very worst case that there is a valid scenario for this, use at least FIORI_TOOLS_USER
and FIORI_TOOLS_PASSWORD
because they are available if any previous Fiori tools task or middleware relied on user/password.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed on the phone, please remove it.
}; | ||
package?: { | ||
name?: string; | ||
description?: string; | ||
}; | ||
flp?: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That object is odd. bspName
and credentials
are used to access the original app while title
, subtitle
and inboundId
are only being used in the i18n file. Did you miss adding a change to the appdescr if these properties are present or did I miss it in the code or is there some magic backend functionality that does something on deploy?
What is the difference between bspName
and reference
in the app section?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, the title, subtitle and inbound id are only used in the i18n file because the appdescr information comes already filtered after the prompting.
bspName is the base app repoName and reference is the base app id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed on the phone, please add the change for the inbound communication to the appdescr template file with the condtion that the flp object is provided
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change for the inbound it's more complex to be in the aprdescr template and because of that it's passed with other changes in the content
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is too complex for ejs, implement it as a plain function and then add it to the list of changes. Most importantly move the logic here because you have a reference to it in your generated i18n.properties file
packages/adp-tooling/src/types.ts
Outdated
/** | ||
* Enumerates the types of projects that can be made, each representing a specific kind of project structure. | ||
*/ | ||
export const enum ProjectType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both are S/4 systems here, so please change it to something like Cloud
and OnPremise
. Even better would be if you reuse the type OperationsType
(https://github.com/SAP/open-ux-tools/blob/main/packages/axios-extension/src/abap/types/adt-types.ts#L77) because that is exactly what you will get back from the backend as identify during the prompting phase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -7,6 +7,9 @@ | |||
"namespace": "apps/<%- app.reference %>/appVariants/<%- app.id %>/", | |||
"version": "0.1.0", | |||
"content": [ | |||
<%if(app.content){-%><% for(let change of app.content){-%> | |||
<%- JSON.stringify(change) %><%-","%> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be nice to align the spacing of your JSON with the rest of the document e.g. JSON.stringify(change, undefined, 4)
Feat for #1611.
Adds writer functionality for adaptation projects.