From e86f1c66da97fc1cf190c80a3b0c63816676b818 Mon Sep 17 00:00:00 2001 From: oblomov-dev <102328295+oblomov-dev@users.noreply.github.com> Date: Thu, 3 Oct 2024 22:44:53 +0200 Subject: [PATCH] New bsp (#1474) * update * update setup * update --- .github/workflows/build_bsp.yaml | 31 ++++ abaplint-app.json | 6 +- app/package.json | 2 +- ci/{ => abaplint}/abap_cloud_check.jsonc | 0 ci/{ => abaplint}/abap_standard_check.jsonc | 0 ci/{ => abaplint}/abaplint.jsonc | 0 ci/app2bsp/README.md | 30 ++++ ci/app2bsp/package-lock.json | 13 ++ ci/app2bsp/package.json | 12 ++ ci/app2bsp/run.js | 89 ++++++++++ .../024251849e5a1edfa0b19c97d05e28c2.smim.xml | 9 + ci/app2bsp/static_files/package.devc.xml | 10 ++ ... 0ec96042f38e7e75ceadd96a5.sicf.xml | 17 ++ ... cc3e0011031e2f3f4be478dc5.sicf.xml | 17 ++ .../z2ui5.wapa.ui5repositorypathmapping.xml | 109 ++++++++++++ ci/app2bsp/static_files/z2ui5.wapa.xml | 162 ++++++++++++++++++ .../app2string}/abapClassTemplate.js | 0 .../app2string}/abapXMLTemplate.js | 0 {app/trans => ci/app2string}/abaplint.jsonc | 0 {app/trans => ci/app2string}/trans2abap.js | 2 +- 20 files changed, 504 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/build_bsp.yaml rename ci/{ => abaplint}/abap_cloud_check.jsonc (100%) rename ci/{ => abaplint}/abap_standard_check.jsonc (100%) rename ci/{ => abaplint}/abaplint.jsonc (100%) create mode 100644 ci/app2bsp/README.md create mode 100644 ci/app2bsp/package-lock.json create mode 100644 ci/app2bsp/package.json create mode 100644 ci/app2bsp/run.js create mode 100644 ci/app2bsp/static_files/024251849e5a1edfa0b19c97d05e28c2.smim.xml create mode 100644 ci/app2bsp/static_files/package.devc.xml create mode 100644 ci/app2bsp/static_files/z2ui5 0ec96042f38e7e75ceadd96a5.sicf.xml create mode 100644 ci/app2bsp/static_files/z2ui5 cc3e0011031e2f3f4be478dc5.sicf.xml create mode 100644 ci/app2bsp/static_files/z2ui5.wapa.ui5repositorypathmapping.xml create mode 100644 ci/app2bsp/static_files/z2ui5.wapa.xml rename {app/trans => ci/app2string}/abapClassTemplate.js (100%) rename {app/trans => ci/app2string}/abapXMLTemplate.js (100%) rename {app/trans => ci/app2string}/abaplint.jsonc (100%) rename {app/trans => ci/app2string}/trans2abap.js (98%) diff --git a/.github/workflows/build_bsp.yaml b/.github/workflows/build_bsp.yaml new file mode 100644 index 00000000..88b041f3 --- /dev/null +++ b/.github/workflows/build_bsp.yaml @@ -0,0 +1,31 @@ +name: build_downport + +on: + push: + branches: [main] + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 20 + - run: cd ci/app2bsp & npm i + - run: node run.js + - run: npm run build_bsp + - name: send to bsp repository + uses: peaceiris/actions-gh-pages@v3 + with: + external_repository: abap2UI5-downports/abap2UI5 + user_name: 'github-actions[bot]' + user_email: 'github-actions[bot]@users.noreply.github.com' + publish_branch: main + publish_dir: ./output + deploy_key: ${{ secrets.ACTIONS_BSP_KEY }} + destination_dir: src/02 diff --git a/abaplint-app.json b/abaplint-app.json index 10a4619f..6b63bc5d 100644 --- a/abaplint-app.json +++ b/abaplint-app.json @@ -1,13 +1,13 @@ { "configurations": { "default": { - "filename": "./ci/abaplint.jsonc" + "filename": "./ci/abaplint/abaplint.jsonc" }, "abap_standard_readiness": { - "filename": "./ci/abap_standard_check.jsonc" + "filename": "./ci/abaplint/abap_standard_check.jsonc" }, "abap_cloud_readiness": { - "filename": "./ci/abap_cloud_check.jsonc" + "filename": "./ci/abaplint/abap_cloud_check.jsonc" } } } diff --git a/app/package.json b/app/package.json index 8724b725..5e1144e8 100644 --- a/app/package.json +++ b/app/package.json @@ -31,7 +31,7 @@ "undeploy": "cf undeploy z2ui5 --delete-services --delete-service-keys --delete-service-brokers", "deploy-test": "npm run build && fiori deploy --config ui5-deploy.yaml --testMode true", "build:cf": "ui5 build preload --clean-dest --config ui5-deploy.yaml --include-task=generateCachebusterInfo", - "transform": "node trans/trans2abap.js && abaplint --fix ./trans/abaplint.jsonc", + "transform": "node ../ci/app2string/trans2abap.js && abaplint --fix ../ci/app2string/abaplint.jsonc", "build:mta": "rimraf resources mta_archives && mbt build" }, "sapuxLayer": "CUSTOMER_BASE" diff --git a/ci/abap_cloud_check.jsonc b/ci/abaplint/abap_cloud_check.jsonc similarity index 100% rename from ci/abap_cloud_check.jsonc rename to ci/abaplint/abap_cloud_check.jsonc diff --git a/ci/abap_standard_check.jsonc b/ci/abaplint/abap_standard_check.jsonc similarity index 100% rename from ci/abap_standard_check.jsonc rename to ci/abaplint/abap_standard_check.jsonc diff --git a/ci/abaplint.jsonc b/ci/abaplint/abaplint.jsonc similarity index 100% rename from ci/abaplint.jsonc rename to ci/abaplint/abaplint.jsonc diff --git a/ci/app2bsp/README.md b/ci/app2bsp/README.md new file mode 100644 index 00000000..a1d6cfad --- /dev/null +++ b/ci/app2bsp/README.md @@ -0,0 +1,30 @@ +## abap2UI5 - Connector SAP Fiori Launchpad + +_Running into problems or found a bug? Create an issue [**here**](https://github.com/abap2UI5/abap2UI5/issues)_ + +#### Key Features +* **Launchpad Connector:** Host your abap2UI5 Apps on SAP Fiori Launchpad +* **User-Friendly:** Launch different apps simply by adjusting the start parameter "app_start" +* **Project Consistency:** All abap2UI5 apps can remain unchanged in your ABAP system +* **Compatibility:** Runs minimum with SAP Netweaver v.7.50 or S/4 2021 (Standard ABAP) + +_Lower UI5 releases are not supported, but you can try the experimental branch [here.](https://github.com/abap2UI5-connectors/fiori-launchpad-connector-onpremise/tree/low_ui5_release)_ + +#### Functionality + +Screenshot 2024-06-02 at 16 05 28
+___[Link](https://excalidraw.com/#json=n4Y2VdcMD32F0LvuJWs4-,NREoe051wicmP4XJfOSv5Q)___
+Install with [abapGit](https://abapgit.org) ![abapGit](https://docs.abapgit.org/img/favicon.png), and you will find a UI5 app (BSP Application) in your system. Add it multiple times to your launchpad and maintain different ABAP classes as starting parameters. Each tile will then call a different abap2UI5 app. + +#### Preview +image + +#### Installation & Usage + +[**(1) Installation & Configuration**](https://www.linkedin.com/pulse/copy-abap2ui5-host-your-apps-sap-fiori-launchpad-abap2ui5-ocn2e/)
+[**(2) Features: Title, Parameters, Navigation**](https://www.linkedin.com/pulse/abap2ui5-host-your-apps-sap-fiori-launchpad-23-features-abap2ui5-upche/)
+[**(3) Integration of KPIs**](https://www.linkedin.com/pulse/abap2ui5-host-your-apps-sap-fiori-launchpad-33-kpis-abap2ui5-uuxxe/)
+ +#### FAQ +* check out the [**documentation**](https://github.com/abap2UI5/abap2UI5-documentation) for installation & configuration guidelines +* your comments, questions, wishes and bugs are welcome, please create an [**issue**](https://github.com/abap2UI5/integration-fiori_launchpad_on_premise/issues) diff --git a/ci/app2bsp/package-lock.json b/ci/app2bsp/package-lock.json new file mode 100644 index 00000000..c03b0d2a --- /dev/null +++ b/ci/app2bsp/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "fiori-launchpad-connector-onpremise", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "fiori-launchpad-connector-onpremise", + "version": "1.0.0", + "license": "MIT" + } + } +} diff --git a/ci/app2bsp/package.json b/ci/app2bsp/package.json new file mode 100644 index 00000000..f6b7ab8e --- /dev/null +++ b/ci/app2bsp/package.json @@ -0,0 +1,12 @@ +{ + "name": "fiori-launchpad-connector-onpremise", + "version": "1.0.0", + "description": "Ein Projekt zum Kopieren von Dateien von source nach target21", + "main": "run.js", + "scripts": { + "start": "node run.js" + }, + "author": "Ihr Name", + "license": "MIT", + "dependencies": {} + } \ No newline at end of file diff --git a/ci/app2bsp/run.js b/ci/app2bsp/run.js new file mode 100644 index 00000000..b7c1ac85 --- /dev/null +++ b/ci/app2bsp/run.js @@ -0,0 +1,89 @@ +const fs = require('fs'); +const path = require('path'); + +const sourceDir = '../../app/webapp'; +const staticDir = './static'; +const targetDir = './output'; +const prefix = 'z2ui5.wapa.'; + +function generateTargetFileName(sourcePath, baseDir) { + const relativePath = path.relative(baseDir, sourcePath); + const fileName = prefix + relativePath.replace(/\//g, '_-').replace(/\\/g, '_-').toLowerCase(); + return fileName; +} + +function copyFilesRecursively(source, target, baseDir, renameFiles = true) { + fs.readdir(source, { withFileTypes: true }, (err, entries) => { + if (err) { + console.error('Fehler beim Lesen des Verzeichnisses:', err); + return; + } + + entries.forEach(entry => { + const sourcePath = path.join(source, entry.name); + const targetFileName = renameFiles ? generateTargetFileName(sourcePath, baseDir) : entry.name; + const targetPath = path.join(target, targetFileName); + + if (entry.isDirectory()) { + // Rekursiver Aufruf für Unterordner + copyFilesRecursively(sourcePath, target, baseDir, renameFiles); + } else if (entry.isFile()) { + // Lese die Quelldatei + fs.readFile(sourcePath, 'utf8', (err, data) => { + if (err) { + console.error(`Fehler beim Lesen der Quelldatei ${entry.name}:`, err); + return; + } + + // Erstelle den Zielordner, falls er nicht existiert + fs.mkdir(path.dirname(targetPath), { recursive: true }, (err) => { + if (err) { + console.error('Fehler beim Erstellen des Zielordners:', err); + return; + } + + // Schreibe den Inhalt in die Zieldatei + fs.writeFile(targetPath, data, 'utf8', (err) => { + if (err) { + console.error(`Fehler beim Schreiben der Zieldatei ${entry.name}:`, err); + return; + } + console.log(`Datei ${entry.name} erfolgreich kopiert als ${targetFileName}.`); + }); + }); + }); + } + }); + }); +} + +function deleteFilesRecursively(directory) { + if (fs.existsSync(directory)) { + fs.readdirSync(directory).forEach((file) => { + const curPath = path.join(directory, file); + if (fs.lstatSync(curPath).isDirectory()) { + deleteFilesRecursively(curPath); + } else { + fs.unlinkSync(curPath); + } + }); + fs.rmdirSync(directory); + } +} + +// Lösche alle Dateien im Zielverzeichnis +deleteFilesRecursively(targetDir); + +// Erstelle das Zielverzeichnis, falls es nicht existiert +fs.mkdir(targetDir, { recursive: true }, (err) => { + if (err) { + console.error('Fehler beim Erstellen des Zielverzeichnisses:', err); + return; + } + + // Starte den Kopiervorgang für den Quellordner + copyFilesRecursively(sourceDir, targetDir, sourceDir); + + // Starte den Kopiervorgang für den statischen Ordner ohne Umbenennung + copyFilesRecursively(staticDir, targetDir, staticDir, false); +}); \ No newline at end of file diff --git a/ci/app2bsp/static_files/024251849e5a1edfa0b19c97d05e28c2.smim.xml b/ci/app2bsp/static_files/024251849e5a1edfa0b19c97d05e28c2.smim.xml new file mode 100644 index 00000000..6b34819f --- /dev/null +++ b/ci/app2bsp/static_files/024251849e5a1edfa0b19c97d05e28c2.smim.xml @@ -0,0 +1,9 @@ + + + + + /SAP/BC/BSP/SAP/Z2UI5 + X + + + diff --git a/ci/app2bsp/static_files/package.devc.xml b/ci/app2bsp/static_files/package.devc.xml new file mode 100644 index 00000000..968ac676 --- /dev/null +++ b/ci/app2bsp/static_files/package.devc.xml @@ -0,0 +1,10 @@ + + + + + + abap2UI5 + + + + diff --git a/ci/app2bsp/static_files/z2ui5 0ec96042f38e7e75ceadd96a5.sicf.xml b/ci/app2bsp/static_files/z2ui5 0ec96042f38e7e75ceadd96a5.sicf.xml new file mode 100644 index 00000000..5987cdf6 --- /dev/null +++ b/ci/app2bsp/static_files/z2ui5 0ec96042f38e7e75ceadd96a5.sicf.xml @@ -0,0 +1,17 @@ + + + + + /sap/bc/ui5_ui5/sap/z2ui5/ + + Z2UI5 + z2ui5 + + + Z2UI5 + E + test + + + + diff --git a/ci/app2bsp/static_files/z2ui5 cc3e0011031e2f3f4be478dc5.sicf.xml b/ci/app2bsp/static_files/z2ui5 cc3e0011031e2f3f4be478dc5.sicf.xml new file mode 100644 index 00000000..ed3c3e18 --- /dev/null +++ b/ci/app2bsp/static_files/z2ui5 cc3e0011031e2f3f4be478dc5.sicf.xml @@ -0,0 +1,17 @@ + + + + + /sap/bc/bsp/sap/z2ui5/ + + Z2UI5 + z2ui5 + + + Z2UI5 + E + test + + + + diff --git a/ci/app2bsp/static_files/z2ui5.wapa.ui5repositorypathmapping.xml b/ci/app2bsp/static_files/z2ui5.wapa.ui5repositorypathmapping.xml new file mode 100644 index 00000000..ef1cfe13 --- /dev/null +++ b/ci/app2bsp/static_files/z2ui5.wapa.ui5repositorypathmapping.xml @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ci/app2bsp/static_files/z2ui5.wapa.xml b/ci/app2bsp/static_files/z2ui5.wapa.xml new file mode 100644 index 00000000..8f39fa76 --- /dev/null +++ b/ci/app2bsp/static_files/z2ui5.wapa.xml @@ -0,0 +1,162 @@ + + + + + + Z2UI5 + /UI5/CL_UI5_BSP_APPLICATION + Z2UI5 + X + E + E + test + + + + + Z2UI5 + CC/DEBUGTOOL.FRAGMENT.XML + cc/DebugTool.fragment.xml + X + E + A + E + + + + + Z2UI5 + CC/DEBUGTOOL.JS + cc/DebugTool.js + X + E + A + E + + + + + Z2UI5 + CC/SERVER.JS + cc/Server.js + X + E + A + E + + + + + Z2UI5 + COMPONENT.JS + Component.js + X + E + A + E + + + + + Z2UI5 + CONTROLLER/APP.CONTROLLER.JS + controller/App.controller.js + X + E + A + E + + + + + Z2UI5 + CONTROLLER/VIEW1.CONTROLLER.JS + controller/View1.controller.js + X + E + A + E + + + + + Z2UI5 + CSS/STYLE.CSS + css/style.css + X + E + A + E + + + + + Z2UI5 + INDEX.HTML + index.html + text/html + X + E + A + E + + + + + Z2UI5 + MANIFEST.JSON + manifest.json + X + E + A + E + + + + + Z2UI5 + MODEL/MODELS.JS + model/models.js + X + E + A + E + + + + + Z2UI5 + UI5REPOSITORYPATHMAPPING.XML + UI5RepositoryPathMapping.xml + X + E + A + E + + + + + Z2UI5 + VIEW/APP.VIEW.XML + view/App.view.xml + X + E + A + E + + + + + Z2UI5 + VIEW/VIEW1.VIEW.XML + view/View1.view.xml + X + E + A + E + + + + + + diff --git a/app/trans/abapClassTemplate.js b/ci/app2string/abapClassTemplate.js similarity index 100% rename from app/trans/abapClassTemplate.js rename to ci/app2string/abapClassTemplate.js diff --git a/app/trans/abapXMLTemplate.js b/ci/app2string/abapXMLTemplate.js similarity index 100% rename from app/trans/abapXMLTemplate.js rename to ci/app2string/abapXMLTemplate.js diff --git a/app/trans/abaplint.jsonc b/ci/app2string/abaplint.jsonc similarity index 100% rename from app/trans/abaplint.jsonc rename to ci/app2string/abaplint.jsonc diff --git a/app/trans/trans2abap.js b/ci/app2string/trans2abap.js similarity index 98% rename from app/trans/trans2abap.js rename to ci/app2string/trans2abap.js index 7eb2bcd8..e614870b 100644 --- a/app/trans/trans2abap.js +++ b/ci/app2string/trans2abap.js @@ -4,7 +4,7 @@ const abapClassTemplate = require('./abapClassTemplate'); const xmlTemplate = require('./abapXMLTemplate'); // Define source and target directories -const sourceDir = path.join(__dirname, '../webapp'); +const sourceDir = path.join(__dirname, '../../app/webapp'); const targetDir = path.join(__dirname, '../../src/01/03'); // Initial XML content with BOM