@intellegens/cornerstone-cli 0.0.11 → 0.0.13

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.
@@ -28,15 +28,22 @@ exports.zodSchemaGeneratorCommand = {
28
28
  async handler(args) {
29
29
  try {
30
30
  const { input: inputPath, output: outputPath } = args;
31
- if (!fs_extra_1.default.existsSync(outputPath)) {
32
- fs_extra_1.default.mkdirSync(outputPath, { recursive: true });
31
+ if (!fs_extra_1.default.existsSync(inputPath)) {
32
+ console.warn('🟡 Input directory not found.');
33
+ process.exit(0);
33
34
  }
34
35
  const files = fs_extra_1.default
35
36
  .readdirSync(inputPath)
36
37
  .filter((file) => file.endsWith('.json'));
37
38
  if (files.length === 0) {
38
- console.error('\u274c No JSON schema files found in the input directory.');
39
- process.exit(1);
39
+ console.warn('🟡 No JSON schema files found in the input directory.');
40
+ process.exit(0);
41
+ }
42
+ if (!fs_extra_1.default.existsSync(outputPath)) {
43
+ fs_extra_1.default.emptyDirSync(outputPath);
44
+ }
45
+ else {
46
+ fs_extra_1.default.mkdirSync(outputPath, { recursive: true });
40
47
  }
41
48
  var exports = {};
42
49
  for (const file of files) {
@@ -61,12 +68,13 @@ exports.zodSchemaGeneratorCommand = {
61
68
  depth: 5,
62
69
  });
63
70
  // Generate TypeScript file
64
- const fileName = typeName;
71
+ const fileName = `${typeName}.ts`;
65
72
  const outputFilePath = path_1.default.join(namespaceDir, fileName);
73
+ const outputTypePath = path_1.default.join(namespaceDir, typeName);
66
74
  fs_extra_1.default.writeFileSync(outputFilePath, zodSchema, 'utf-8');
67
- console.log(`\ud83d\udfe2 Generated Zod schema: ${outputFilePath}`);
75
+ console.log(`- Generated Zod schema: ${outputFilePath}`);
68
76
  // Register for (re)export
69
- exports[typeName] = path_1.default.relative(outputPath, outputFilePath);
77
+ exports[typeName] = path_1.default.relative(outputPath, outputTypePath);
70
78
  }
71
79
  // Write (re)export file
72
80
  let exportFileContent = '';
@@ -76,10 +84,10 @@ exports.zodSchemaGeneratorCommand = {
76
84
  }
77
85
  fs_extra_1.default.writeFileSync(path_1.default.join(outputPath, './index.ts'), exportFileContent, 'utf-8');
78
86
  // Prompt done
79
- console.log('\u2705 Zod schemas generated successfully!');
87
+ console.log('🟢 Zod schemas generated successfully!');
80
88
  }
81
89
  catch (error) {
82
- console.error('\u274c Error generating Zod schemas:', error);
90
+ console.error('🔴 Error generating Zod schemas:', error);
83
91
  process.exit(1);
84
92
  }
85
93
  },
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@intellegens/cornerstone-cli",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "main": "./index.js",
5
5
  "bin": {
6
6
  "cornerstone-ts": "./index.js"
7
7
  },
8
8
  "scripts": {
9
- "build": "tsc",
9
+ "build": "tsc && tsc-alias",
10
10
  "cli": "tsx ./src/index.ts"
11
11
  },
12
12
  "keywords": [],
@@ -26,6 +26,7 @@
26
26
  "@types/node": "^22.13.4",
27
27
  "@types/yargs": "^17.0.33",
28
28
  "prettier": "^3.5.1",
29
+ "tsc-alias": "^1.8.11",
29
30
  "tsx": "^4.19.2"
30
31
  }
31
32
  }