Skip to content

Commit 729a735

Browse files
authored
Merge pull request #1644 from SciCatProject/fix-sdk-local-generation
fixed sdk local generation for linux
2 parents 53186ae + 0d897af commit 729a735

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

scripts/generate-nestjs-sdk.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@
55
*/
66

77
const execSync = require("child_process").execSync;
8+
const os = require("os");
9+
10+
function isWindows() {
11+
return os.platform() === "win32";
12+
}
13+
14+
function getCurrentDirectory() {
15+
if (isWindows()) {
16+
return "%cd%";
17+
}
18+
19+
return "$(pwd)";
20+
}
821

922
// NOTE: First do some cleanup before starting the generation
1023
console.log("Cleanup old files...");
@@ -15,7 +28,7 @@ execSync(
1528

1629
console.log("Generating the new sdk...");
1730
const generationOutput = execSync(
18-
'docker run --rm -v "%cd%:/local" openapitools/openapi-generator-cli:v7.9.0 generate -i http://host.docker.internal:3000/explorer-json -g typescript-angular -o local/@scicatproject/scicat-sdk-ts --additional-properties=ngVersion=16.2.12,npmName=@scicatproject/scicat-sdk-ts,supportsES6=true,npmVersion=10.8.2,withInterfaces=true',
31+
`docker run --rm --add-host host.docker.internal:host-gateway -v "${getCurrentDirectory()}:/local" openapitools/openapi-generator-cli:v7.9.0 generate -i http://host.docker.internal:3000/explorer-json -g typescript-angular -o local/@scicatproject/scicat-sdk-ts --additional-properties=ngVersion=16.2.12,npmName=@scicatproject/scicat-sdk-ts,supportsES6=true,npmVersion=10.8.2,withInterfaces=true`,
1932
{ encoding: "utf-8" },
2033
);
2134
console.log(generationOutput);

0 commit comments

Comments
 (0)