@intellegens/cornerstone-cli 0.0.7 → 0.0.9
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.
|
@@ -35,9 +35,10 @@ exports.zodSchemaGeneratorCommand = {
|
|
|
35
35
|
.readdirSync(inputPath)
|
|
36
36
|
.filter((file) => file.endsWith('.json'));
|
|
37
37
|
if (files.length === 0) {
|
|
38
|
-
console.error('No JSON schema files found in the input directory.');
|
|
38
|
+
console.error('\u274c No JSON schema files found in the input directory.');
|
|
39
39
|
process.exit(1);
|
|
40
40
|
}
|
|
41
|
+
var exports = {};
|
|
41
42
|
for (const file of files) {
|
|
42
43
|
const filePath = path_1.default.join(inputPath, file);
|
|
43
44
|
const schemaContent = fs_extra_1.default.readFileSync(filePath, 'utf-8');
|
|
@@ -63,13 +64,23 @@ exports.zodSchemaGeneratorCommand = {
|
|
|
63
64
|
const fileName = typeName + '.ts';
|
|
64
65
|
const outputFilePath = path_1.default.join(namespaceDir, fileName);
|
|
65
66
|
fs_extra_1.default.writeFileSync(outputFilePath, zodSchema, 'utf-8');
|
|
66
|
-
console.log(
|
|
67
|
+
console.log(`\ud83d\udfe2 Generated Zod schema: ${outputFilePath}`);
|
|
68
|
+
// Register for (re)export
|
|
69
|
+
exports[typeName] = path_1.default.relative(outputPath, outputFilePath);
|
|
67
70
|
}
|
|
68
|
-
|
|
71
|
+
// Write (re)export file
|
|
72
|
+
let exportFileContent = '';
|
|
73
|
+
for (const typeName in exports) {
|
|
74
|
+
const typePath = exports[typeName];
|
|
75
|
+
exportFileContent += `export * from './${typePath}'; // .NET ${typeName} class\n`;
|
|
76
|
+
}
|
|
77
|
+
fs_extra_1.default.writeFileSync(path_1.default.join(outputPath, './index.ts'), exportFileContent, 'utf-8');
|
|
78
|
+
// Prompt done
|
|
79
|
+
console.log('\u2705 Zod schemas generated successfully!');
|
|
69
80
|
}
|
|
70
81
|
catch (error) {
|
|
71
|
-
console.error('
|
|
82
|
+
console.error('\u274c Error generating Zod schemas:', error);
|
|
72
83
|
process.exit(1);
|
|
73
84
|
}
|
|
74
|
-
}
|
|
85
|
+
},
|
|
75
86
|
};
|