@zuplo/cli 1.97.0 → 1.98.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="91ee157c-141d-5381-a1b8-ef9f2f5625d8")}catch(e){}}();
|
|
3
3
|
import { captureEvent } from "../../common/analytics/lib.js";
|
|
4
4
|
import setBlocking from "../../common/output.js";
|
|
5
5
|
import { ZuploProjectValidator } from "../../common/validators/file-system-validator.js";
|
|
@@ -26,6 +26,10 @@ export default {
|
|
|
26
26
|
type: "string",
|
|
27
27
|
describe: "The OpenAPI file to import",
|
|
28
28
|
conflicts: ["source-url"],
|
|
29
|
+
})
|
|
30
|
+
.option("destination", {
|
|
31
|
+
type: "string",
|
|
32
|
+
describe: "The destination file name. Defaults to the inferred path from the source name",
|
|
29
33
|
})
|
|
30
34
|
.demandOption(["source"])
|
|
31
35
|
.middleware([setBlocking])
|
|
@@ -39,4 +43,4 @@ export default {
|
|
|
39
43
|
},
|
|
40
44
|
};
|
|
41
45
|
//# sourceMappingURL=import-openapi.js.map
|
|
42
|
-
//# debugId=
|
|
46
|
+
//# debugId=91ee157c-141d-5381-a1b8-ef9f2f5625d8
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="084826a4-e8ee-5dc8-9b9b-486425443698")}catch(e){}}();
|
|
3
3
|
import { confirm } from "@inquirer/prompts";
|
|
4
4
|
import jsYaml from "js-yaml";
|
|
5
5
|
import { existsSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
7
7
|
import { tmpdir } from "node:os";
|
|
8
|
-
import { basename, dirname, extname, join, relative } from "node:path";
|
|
8
|
+
import { basename, dirname, extname, join, relative, sep } from "node:path";
|
|
9
9
|
import prettier from "prettier";
|
|
10
10
|
import { logger } from "../../common/logger.js";
|
|
11
11
|
import { printCriticalFailureToConsoleAndExit, printDiagnosticsToConsole, printResultToConsoleAndExitGracefully, } from "../../common/output.js";
|
|
@@ -76,7 +76,19 @@ export async function importOpenApi(argv) {
|
|
|
76
76
|
const basePath = basename(normalizedFilePath, extName);
|
|
77
77
|
const fileContent = rawOpenApiSpec.toString();
|
|
78
78
|
const parsedOpenApiSpec = await parseOpenApiFile(extName, fileContent);
|
|
79
|
-
|
|
79
|
+
let destinationFilePath = join(process.cwd(), "config", `${basePath.replace(".oas", "")}.oas.json`);
|
|
80
|
+
if (argv.destination) {
|
|
81
|
+
const destination = argv.destination;
|
|
82
|
+
if (destination.includes(sep)) {
|
|
83
|
+
await printCriticalFailureToConsoleAndExit(`File names should not be nested with file separators.`);
|
|
84
|
+
}
|
|
85
|
+
if (destination.endsWith("oas.json")) {
|
|
86
|
+
destinationFilePath = join(process.cwd(), "config", destination);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
destinationFilePath = join(process.cwd(), "config", `${destination.replace(".oas", "")}.oas.json`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
80
92
|
let originalDocument;
|
|
81
93
|
if (!existsSync(destinationFilePath)) {
|
|
82
94
|
originalDocument = (await parseOpenApiFile(".json", BASE_TEMPLATE));
|
|
@@ -130,4 +142,4 @@ export async function importOpenApi(argv) {
|
|
|
130
142
|
await printResultToConsoleAndExitGracefully(`Import successful. File written to ${destinationFilePath}`);
|
|
131
143
|
}
|
|
132
144
|
//# sourceMappingURL=handler.js.map
|
|
133
|
-
//# debugId=
|
|
145
|
+
//# debugId=084826a4-e8ee-5dc8-9b9b-486425443698
|