Skip to content
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

Revert "Test pipeline setup" #68

Merged
merged 3 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
78 changes: 19 additions & 59 deletions .github/workflows/checkout
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ async function remoteService () {
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"))
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"
]
return await run(`npm add ${deps.join(" ")}`)
}

async function messaging () {
Expand All @@ -42,51 +42,17 @@ async function messaging () {
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"
]
return await run(`npm add ${deps.join(" ")}`)
}

function run (cmd, silent) {
Expand All @@ -110,12 +76,6 @@ switch ($1) {
case 'messaging':
messaging();
break;
case 'change-tracking':
changeTracking()
break;
case 'audit-log':
auditLog()
break;
default:
console.log('Usage: ./checkout <command>');
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down