@intellegens/cornerstone-cli 0.0.45 → 0.0.9999-alpha-1

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.
package/LICENSE.md CHANGED
File without changes
package/README.md CHANGED
File without changes
File without changes
@@ -1,13 +1,7 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.openApiGeneratorCommand = void 0;
7
- const orval_1 = require("orval");
8
- const fs_1 = __importDefault(require("fs"));
9
- const path_1 = __importDefault(require("path"));
10
- exports.openApiGeneratorCommand = {
1
+ import { generate } from 'orval';
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+ export const openApiGeneratorCommand = {
11
5
  command: 'openapi-gen',
12
6
  describe: 'Generate Zod schemas from JSON schemas',
13
7
  builder: {
@@ -74,10 +68,10 @@ exports.openApiGeneratorCommand = {
74
68
  },
75
69
  async handler(args) {
76
70
  try {
77
- const absoluteInputPath = path_1.default.resolve(args.input);
78
- const absoluteOutputPath = path_1.default.resolve(args.output);
71
+ const absoluteInputPath = path.resolve(args.input);
72
+ const absoluteOutputPath = path.resolve(args.output);
79
73
  // Check if input file exists
80
- if (!fs_1.default.existsSync(absoluteInputPath)) {
74
+ if (!fs.existsSync(absoluteInputPath)) {
81
75
  console.error('🔴 OpenAPI schema file not found:', absoluteInputPath);
82
76
  process.exit(1);
83
77
  }
@@ -151,7 +145,7 @@ exports.openApiGeneratorCommand = {
151
145
  }
152
146
  // Generate
153
147
  for (const config of configs) {
154
- await (0, orval_1.generate)(config, absoluteOutputPath, { projectName: args.project });
148
+ await generate(config, absoluteOutputPath, { projectName: args.project });
155
149
  }
156
150
  console.log('🟢 Schemas generated successfully!');
157
151
  }
File without changes
@@ -1,14 +1,8 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.zodSchemaGeneratorCommand = void 0;
7
- const fs_extra_1 = __importDefault(require("fs-extra"));
8
- const path_1 = __importDefault(require("path"));
9
- const json_schema_to_zod_1 = require("json-schema-to-zod");
10
- const json_refs_1 = require("json-refs");
11
- exports.zodSchemaGeneratorCommand = {
1
+ import fs from 'fs-extra';
2
+ import path from 'path';
3
+ import { jsonSchemaToZod } from 'json-schema-to-zod';
4
+ import { resolveRefs } from 'json-refs';
5
+ export const zodSchemaGeneratorCommand = {
12
6
  command: 'zod-gen',
13
7
  describe: 'Generate Zod schemas from JSON schemas',
14
8
  builder: {
@@ -28,39 +22,39 @@ exports.zodSchemaGeneratorCommand = {
28
22
  async handler(args) {
29
23
  try {
30
24
  const { input: inputPath, output: outputPath } = args;
31
- if (!fs_extra_1.default.existsSync(inputPath)) {
25
+ if (!fs.existsSync(inputPath)) {
32
26
  console.warn('🟡 Input directory not found.');
33
27
  process.exit(0);
34
28
  }
35
- const files = fs_extra_1.default
29
+ const files = fs
36
30
  .readdirSync(inputPath)
37
31
  .filter((file) => file.endsWith('.json'));
38
32
  if (files.length === 0) {
39
33
  console.warn('🟡 No JSON schema files found in the input directory.');
40
34
  process.exit(0);
41
35
  }
42
- if (!fs_extra_1.default.existsSync(outputPath)) {
43
- fs_extra_1.default.emptyDirSync(outputPath);
36
+ if (!fs.existsSync(outputPath)) {
37
+ fs.emptyDirSync(outputPath);
44
38
  }
45
39
  else {
46
- fs_extra_1.default.mkdirSync(outputPath, { recursive: true });
40
+ fs.mkdirSync(outputPath, { recursive: true });
47
41
  }
48
42
  var exports = {};
49
43
  for (const file of files) {
50
- const filePath = path_1.default.join(inputPath, file);
51
- const schemaContent = fs_extra_1.default.readFileSync(filePath, 'utf-8');
44
+ const filePath = path.join(inputPath, file);
45
+ const schemaContent = fs.readFileSync(filePath, 'utf-8');
52
46
  const schema = JSON.parse(schemaContent);
53
- const fullName = path_1.default.basename(file, '.json');
47
+ const fullName = path.basename(file, '.json');
54
48
  const parts = fullName.split('.');
55
49
  // Last part is the type name, everything before is namespace
56
50
  const typeName = parts[parts.length - 1];
57
51
  const namespaceParts = parts.slice(0, -1);
58
52
  // Create the namespace folder structure
59
- const namespaceDir = path_1.default.join(outputPath, ...namespaceParts);
60
- fs_extra_1.default.mkdirSync(namespaceDir, { recursive: true });
61
- const { resolved } = await (0, json_refs_1.resolveRefs)(schema);
53
+ const namespaceDir = path.join(outputPath, ...namespaceParts);
54
+ fs.mkdirSync(namespaceDir, { recursive: true });
55
+ const { resolved } = await resolveRefs(schema);
62
56
  // Convert JSON Schema to Zod
63
- const zodSchema = (0, json_schema_to_zod_1.jsonSchemaToZod)(resolved, {
57
+ const zodSchema = jsonSchemaToZod(resolved, {
64
58
  withJsdocs: true,
65
59
  module: 'esm',
66
60
  type: true,
@@ -69,12 +63,12 @@ exports.zodSchemaGeneratorCommand = {
69
63
  });
70
64
  // Generate TypeScript file
71
65
  const fileName = `${typeName}.ts`;
72
- const outputFilePath = path_1.default.join(namespaceDir, fileName);
73
- const outputTypePath = path_1.default.join(namespaceDir, typeName);
74
- fs_extra_1.default.writeFileSync(outputFilePath, zodSchema, 'utf-8');
66
+ const outputFilePath = path.join(namespaceDir, fileName);
67
+ const outputTypePath = path.join(namespaceDir, typeName);
68
+ fs.writeFileSync(outputFilePath, zodSchema, 'utf-8');
75
69
  console.log(`- Generated Zod schema: ${outputFilePath}`);
76
70
  // Register for (re)export
77
- exports[typeName] = path_1.default.relative(outputPath, outputTypePath);
71
+ exports[typeName] = path.relative(outputPath, outputTypePath);
78
72
  }
79
73
  // Write (re)export file
80
74
  let exportFileContent = '';
@@ -82,7 +76,7 @@ exports.zodSchemaGeneratorCommand = {
82
76
  const typePath = `./${exports[typeName]}`.replace(/\\/g, '/');
83
77
  exportFileContent += `export * from '${typePath}'; // .NET ${typeName} class\n`;
84
78
  }
85
- fs_extra_1.default.writeFileSync(path_1.default.join(outputPath, './index.ts'), exportFileContent, 'utf-8');
79
+ fs.writeFileSync(path.join(outputPath, './index.ts'), exportFileContent, 'utf-8');
86
80
  // Prompt done
87
81
  console.log('🟢 Zod schemas generated successfully!');
88
82
  }
package/index.d.ts CHANGED
File without changes
package/index.js CHANGED
@@ -1,17 +1,12 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const yargs_1 = __importDefault(require("yargs"));
8
- const helpers_1 = require("yargs/helpers");
9
- const zod_schema_generator_1 = require("./commands/zod-schema-generator");
10
- const openapi_generator_1 = require("./commands/openapi-generator");
11
- (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
2
+ import yargs from 'yargs';
3
+ import { hideBin } from 'yargs/helpers';
4
+ import { zodSchemaGeneratorCommand } from './commands/zod-schema-generator';
5
+ import { openApiGeneratorCommand } from './commands/openapi-generator';
6
+ yargs(hideBin(process.argv))
12
7
  .scriptName('cornerstone-ts')
13
- .command(zod_schema_generator_1.zodSchemaGeneratorCommand)
14
- .command(openapi_generator_1.openApiGeneratorCommand)
8
+ .command(zodSchemaGeneratorCommand)
9
+ .command(openApiGeneratorCommand)
15
10
  .demandCommand(1, 'You need to specify a command')
16
11
  .strict()
17
12
  .alias('h', 'help')
package/package.json CHANGED
@@ -1,19 +1,28 @@
1
1
  {
2
2
  "name": "@intellegens/cornerstone-cli",
3
- "version": "0.0.45",
3
+ "version": "0.0.9999-alpha-1",
4
+ "private": false,
5
+ "publishable": true,
4
6
  "main": "./index.js",
7
+ "types": "./index.d.ts",
8
+ "type": "module",
9
+ "author": "Intellegens",
10
+ "license": "MIT",
11
+ "description": "",
12
+ "keywords": [
13
+ "intellegens",
14
+ "cornerstone"
15
+ ],
5
16
  "bin": {
6
17
  "cornerstone-ts": "./index.js"
7
18
  },
8
19
  "scripts": {
9
- "clean": "node -e \"require('fs-extra').emptyDir('./dist');\"",
20
+ "clean": "npx --yes rimraf '{dist}'",
21
+ "test": "echo 'TBD'",
22
+ "coverage": "echo 'TBD'",
10
23
  "build": "npm run clean && tsc && tsc-alias",
11
- "cli": "tsx ./src/index.ts"
24
+ "start": "tsx ./src/index.ts"
12
25
  },
13
- "keywords": [],
14
- "author": "",
15
- "license": "MIT",
16
- "description": "",
17
26
  "dependencies": {
18
27
  "fs-extra": "^11.3.0",
19
28
  "json-refs": "^3.0.15",
@@ -27,7 +36,6 @@
27
36
  "@types/fs-extra": "^11.0.4",
28
37
  "@types/node": "^22.13.4",
29
38
  "@types/yargs": "^17.0.33",
30
- "prettier": "^3.5.1",
31
39
  "tsc-alias": "^1.8.11",
32
40
  "tsx": "^4.19.2"
33
41
  }