From b44cdef89029520604db82ec65ccdaa394d8f27b Mon Sep 17 00:00:00 2001 From: Navin Krishnan Date: Mon, 8 Jul 2024 17:08:16 +0530 Subject: [PATCH 1/3] Revert "Test pipeline setup" --- .github/workflows/checkout | 84 +++++++++++--------------------------- package.json | 4 +- 2 files changed, 25 insertions(+), 63 deletions(-) diff --git a/.github/workflows/checkout b/.github/workflows/checkout index 33c7674..51532d6 100755 --- a/.github/workflows/checkout +++ b/.github/workflows/checkout @@ -12,22 +12,23 @@ async function remoteService () { const levelUP = "../../" const INCLUDES = ["srv", "test"] const paths = INCLUDES.map(pattern => join(__dirname, levelUP, TARGET_DIR, pattern)) - const cmd = `cp -r ${paths.join(' ')} ${join(__dirname, levelUP)}` + const cmd = `cp -r ${paths.join(' ')} ${levelUP}` await run(cmd); - const packageJson = JSON.parse(await readFile(join(__dirname, levelUP ,"package.json"), "utf-8")) - const delta = JSON.parse(await readFile(join(__dirname, levelUP, TARGET_DIR, "package.json"), "utf-8")) + const packageJson = JSON.parse(await readFile(join(__dirname, levelUP ,"package.json"), "utf-8")); + const delta = JSON.parse(await readFile(join(__dirname, levelUP, TARGET_DIR, "package.json"), "utf-8")); packageJson.cds.requires["API_BUSINESS_PARTNER"] = delta.cds.requires["API_BUSINESS_PARTNER"] + await writeFile(join(__dirname, levelUP, "package.json"), JSON.stringify(packageJson, null, 2), "utf-8"); // dependencies - const deps = { - "@sap-cloud-sdk/connectivity": "^3", - "@sap-cloud-sdk/http-client": "^3", - "@sap-cloud-sdk/resilience": "^3", - "@sap-cloud-sdk/util": "^3" - } - packageJson.dependencies = {...packageJson.dependencies, ...deps} - return await writeFile(join(__dirname, levelUP, "package.json"), JSON.stringify(packageJson, null, 2), "utf-8"); + const deps = [ + "@sap-cloud-sdk/connectivity", + "@sap-cloud-sdk/http-client", + "@sap-cloud-sdk/resilience", + "@sap-cloud-sdk/util" + ] + console.info("Preparing Incidents-app with Remote Service") + return await run(`npm add ${deps.join(" ")}`) } async function messaging () { @@ -35,58 +36,25 @@ async function messaging () { const levelUP = "../../" const INCLUDES = ["app", "srv", "test"] const paths = INCLUDES.map(pattern => join(__dirname, levelUP, TARGET_DIR, pattern)) - const cmd = `cp -r ${paths.join(' ')} ${join(__dirname, levelUP)}` + const cmd = `cp -r ${paths.join(' ')} ${levelUP}` await run(cmd); const packageJson = JSON.parse(await readFile(join(__dirname, levelUP, "package.json"), "utf-8")); const delta = JSON.parse(await readFile(join(__dirname, levelUP, TARGET_DIR, "package.json"), "utf-8")); packageJson.cds.requires["API_BUSINESS_PARTNER"] = delta.cds.requires["API_BUSINESS_PARTNER"] packageJson.cds.requires["messaging"] = delta.cds.requires["messaging"] + await writeFile(join(__dirname, levelUP, "package.json"), JSON.stringify(packageJson, null, 2), "utf-8"); // dependencies - const deps = { - "@sap-cloud-sdk/connectivity": "^3", - "@sap-cloud-sdk/http-client": "^3", - "@sap-cloud-sdk/resilience": "^3", - "@sap-cloud-sdk/util": "^3", - "@sap/xb-msg-amqp-v100": "^0.9" - } - packageJson.dependencies = {...packageJson.dependencies, ...deps} - return await writeFile(join(__dirname, levelUP, "package.json"), JSON.stringify(packageJson, null, 2), "utf-8") -} - -async function changeTracking() { - const TARGET_DIR = "xmpls" - const levelUP = "../../" - let cmd = `cp -r ${join(__dirname, levelUP, TARGET_DIR ,'change-tracking.cds')} ${join(__dirname, levelUP, 'srv')}` - await run(cmd); - cmd = `cp -r ${join(__dirname, levelUP, TARGET_DIR ,'change-tracking.test.js')} ${join(__dirname, levelUP, 'test')}` - await run(cmd); - const packageJson = JSON.parse(await readFile(join(__dirname, levelUP, "package.json"), "utf-8")); - - // dependencies - const deps = { - "@cap-js/change-tracking": "*" - } - packageJson.dependencies = {...packageJson.dependencies, ...deps} - return await writeFile(join(__dirname, levelUP, "package.json"), JSON.stringify(packageJson, null, 2), "utf-8") -} - -async function auditLog() { - const TARGET_DIR = "xmpls" - const levelUP = "../../" - let cmd = `cp -r ${join(__dirname, levelUP, TARGET_DIR ,'data-privacy.cds')} ${join(__dirname, levelUP, 'srv')}` - await run(cmd); - cmd = `cp -r ${join(__dirname, levelUP, TARGET_DIR ,'audit-log.test.js')} ${join(__dirname, levelUP, 'test')}` - await run(cmd); - const packageJson = JSON.parse(await readFile(join(__dirname, levelUP, "package.json"), "utf-8")); - - // dependencies - const deps = { - "@cap-js/audit-logging": "*" - } - packageJson.dependencies = {...packageJson.dependencies, ...deps} - return await writeFile(join(__dirname, levelUP, "package.json"), JSON.stringify(packageJson, null, 2), "utf-8") + const deps = [ + "@sap-cloud-sdk/connectivity", + "@sap-cloud-sdk/http-client", + "@sap-cloud-sdk/resilience", + "@sap-cloud-sdk/util", + "@sap/xb-msg-amqp-v100" + ] + console.info("Preparing Incidents-app with Messaging") + return await run(`npm add ${deps.join(" ")}`) } function run (cmd, silent) { @@ -110,12 +78,6 @@ switch ($1) { case 'messaging': messaging(); break; - case 'change-tracking': - changeTracking() - break; - case 'audit-log': - auditLog() - break; default: console.log('Usage: ./checkout '); } \ No newline at end of file diff --git a/package.json b/package.json index 2186035..9421f3f 100644 --- a/package.json +++ b/package.json @@ -27,11 +27,11 @@ "watch": "cds watch", "start": "cds-serve", "test": "npx jest --silent", - "add-change-tracking": "./.github/workflows/checkout change-tracking", + "add-change-tracking": "npm add @cap-js/change-tracking && cp xmpls/change-tracking.cds ./srv && cp xmpls/change-tracking.test.js ./test", "add-telemetry": "npm add @cap-js/telemetry", "add-attachments": "npm add @cap-js/attachments && cp -r xmpls/attachments.cds ./db", "add-notifications": "npm add @cap-js/notifications && cp xmpls/alert-notifications.js ./srv && cp xmpls/notification-types.json ./srv", - "add-audit-log": "./.github/workflows/checkout audit-log", + "add-audit-log": "npm add @cap-js/audit-logging && cp xmpls/data-privacy.cds ./srv && cp xmpls/audit-log.test.js ./test", "add-remote-service": "./.github/workflows/checkout remote-service", "add-messaging": "./.github/workflows/checkout messaging", "add-all-xmpls": "npm run add-remote-service && npm run add-messaging && npm run add-change-tracking && npm run add-audit-log", From e042cd79b9d12c509c1915d7595b6aea173777f0 Mon Sep 17 00:00:00 2001 From: i332371 Date: Tue, 9 Jul 2024 10:31:22 +0530 Subject: [PATCH 2/3] keep the path changes --- .github/workflows/checkout | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checkout b/.github/workflows/checkout index 51532d6..77e245e 100755 --- a/.github/workflows/checkout +++ b/.github/workflows/checkout @@ -12,7 +12,7 @@ async function remoteService () { const levelUP = "../../" const INCLUDES = ["srv", "test"] const paths = INCLUDES.map(pattern => join(__dirname, levelUP, TARGET_DIR, pattern)) - const cmd = `cp -r ${paths.join(' ')} ${levelUP}` + const cmd = `cp -r ${paths.join(' ')} ${join(__dirname, levelUP)}` await run(cmd); const packageJson = JSON.parse(await readFile(join(__dirname, levelUP ,"package.json"), "utf-8")); @@ -36,7 +36,7 @@ async function messaging () { const levelUP = "../../" const INCLUDES = ["app", "srv", "test"] const paths = INCLUDES.map(pattern => join(__dirname, levelUP, TARGET_DIR, pattern)) - const cmd = `cp -r ${paths.join(' ')} ${levelUP}` + const cmd = `cp -r ${paths.join(' ')} ${join(__dirname, levelUP)}` await run(cmd); const packageJson = JSON.parse(await readFile(join(__dirname, levelUP, "package.json"), "utf-8")); From c2b3ac0e5b9e40f1b47a7ff70bfb6c8c76036c3e Mon Sep 17 00:00:00 2001 From: i332371 Date: Tue, 9 Jul 2024 11:27:10 +0530 Subject: [PATCH 3/3] remove console logs --- .github/workflows/checkout | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/checkout b/.github/workflows/checkout index 77e245e..a591b78 100755 --- a/.github/workflows/checkout +++ b/.github/workflows/checkout @@ -27,7 +27,6 @@ async function remoteService () { "@sap-cloud-sdk/resilience", "@sap-cloud-sdk/util" ] - console.info("Preparing Incidents-app with Remote Service") return await run(`npm add ${deps.join(" ")}`) } @@ -53,7 +52,6 @@ async function messaging () { "@sap-cloud-sdk/util", "@sap/xb-msg-amqp-v100" ] - console.info("Preparing Incidents-app with Messaging") return await run(`npm add ${deps.join(" ")}`) }