MCPcopy Create free account
hub / github.com/SAP-samples/cloud-sdk-js / forAll

Function forAll

scripts/set-sdk-version.ts:14–32  ·  view source on GitHub ↗

* We can not use workspaces because we want single package-lock.json files in each samples. * Also the e2e test and update repo https://github.tools.sap/cloudsdk/k8s-e2e-app replaces the local pacakge.json files with one with the same name.

()

Source from the content-addressed store, hash-verified

12 * Also the e2e test and update repo https://github.tools.sap/cloudsdk/k8s-e2e-app replaces the local pacakge.json files with one with the same name.
13 */
14async function forAll() {
15 for (let i = 0; i < samples.length; i++) {
16 const packageJsonPath = resolve(
17 __dirname,
18 '../',
19 samples[i],
20 'package.json'
21 );
22 const jsonContent = JSON.parse(
23 readFileSync(packageJsonPath, { encoding: 'utf-8' })
24 );
25 setSdkVersion(jsonContent.dependencies);
26 setSdkVersion(jsonContent.devDependencies);
27 await writeFile(packageJsonPath, JSON.stringify(jsonContent, null, 2), {
28 encoding: 'utf-8'
29 });
30 console.log(`Package.json updated in ${samples[i]}`);
31 }
32}
33
34function setSdkVersion(dependencies: Record<string, string>) {
35 Object.keys(dependencies).forEach(key => {

Callers 1

set-sdk-version.tsFile · 0.70

Calls 1

setSdkVersionFunction · 0.85

Tested by

no test coverage detected