@intellegens/cornerstone-cli 0.0.39 → 0.0.40
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.
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.openApiGeneratorCommand = void 0;
|
|
7
7
|
const orval_1 = require("orval");
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
9
10
|
exports.openApiGeneratorCommand = {
|
|
10
11
|
command: 'openapi-gen',
|
|
11
12
|
describe: 'Generate Zod schemas from JSON schemas',
|
|
@@ -73,16 +74,18 @@ exports.openApiGeneratorCommand = {
|
|
|
73
74
|
},
|
|
74
75
|
async handler(args) {
|
|
75
76
|
try {
|
|
77
|
+
const absoluteInputPath = path_1.default.resolve(args.input);
|
|
78
|
+
const absoluteOutputPath = path_1.default.resolve(args.output);
|
|
76
79
|
// Check if input file exists
|
|
77
|
-
if (!fs_1.default.existsSync(
|
|
78
|
-
console.error('🔴 OpenAPI schema file not found:',
|
|
80
|
+
if (!fs_1.default.existsSync(absoluteInputPath)) {
|
|
81
|
+
console.error('🔴 OpenAPI schema file not found:', absoluteInputPath);
|
|
79
82
|
process.exit(1);
|
|
80
83
|
}
|
|
81
84
|
let configs = [];
|
|
82
85
|
// Add configurations based on selected options
|
|
83
86
|
if ((!args.fetchClient && !args.angularClient) || args.zod) {
|
|
84
87
|
configs.push({
|
|
85
|
-
input:
|
|
88
|
+
input: absoluteInputPath,
|
|
86
89
|
output: {
|
|
87
90
|
mode: 'tags-split',
|
|
88
91
|
target: './zod',
|
|
@@ -108,7 +111,7 @@ exports.openApiGeneratorCommand = {
|
|
|
108
111
|
}
|
|
109
112
|
if (args.fetchClient) {
|
|
110
113
|
configs.push({
|
|
111
|
-
input:
|
|
114
|
+
input: absoluteInputPath,
|
|
112
115
|
output: {
|
|
113
116
|
mode: 'tags-split',
|
|
114
117
|
target: './endpoints',
|
|
@@ -126,7 +129,7 @@ exports.openApiGeneratorCommand = {
|
|
|
126
129
|
}
|
|
127
130
|
if (args.angularClient) {
|
|
128
131
|
configs.push({
|
|
129
|
-
input:
|
|
132
|
+
input: absoluteInputPath,
|
|
130
133
|
output: {
|
|
131
134
|
mode: 'tags-split',
|
|
132
135
|
target: './endpoints',
|
|
@@ -148,7 +151,7 @@ exports.openApiGeneratorCommand = {
|
|
|
148
151
|
}
|
|
149
152
|
// Generate
|
|
150
153
|
for (const config of configs) {
|
|
151
|
-
await (0, orval_1.generate)(config,
|
|
154
|
+
await (0, orval_1.generate)(config, absoluteOutputPath, { projectName: args.project });
|
|
152
155
|
}
|
|
153
156
|
console.log('🟢 Schemas generated successfully!');
|
|
154
157
|
}
|