@localess/cli 3.0.1-dev.20260405094412 → 3.0.1-dev.20260405190914

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/dist/index.js CHANGED
@@ -72,6 +72,7 @@ var TTLCache = class {
72
72
  constructor(ttlMs = 3e5) {
73
73
  this.ttlMs = ttlMs;
74
74
  }
75
+ ttlMs;
75
76
  cache = /* @__PURE__ */ new Map();
76
77
  set(key, value) {
77
78
  this.cache.set(key, { value, expiresAt: Date.now() + this.ttlMs });
@@ -527,11 +528,11 @@ var import_commander4 = require("commander");
527
528
 
528
529
  // src/commands/types/generate/index.ts
529
530
  var import_commander3 = require("commander");
530
- var import_openapi_typescript = __toESM(require("openapi-typescript"));
531
+ var import_orval = require("orval");
531
532
  var import_node_path3 = require("path");
532
533
  var import_node_process = __toESM(require("process"));
533
- var TYPES_PATH = (0, import_node_path3.join)(import_node_process.default.cwd(), DEFAULT_CONFIG_DIR, "localess.d.ts");
534
- var typesGenerateCommand = new import_commander3.Command("generate").description("Generate types for your schemas").option("-p, --path <path>", "Path to the file where to save the generated types. Default is .localess/localess.d.ts", TYPES_PATH).action(async (options) => {
534
+ var TYPES_PATH = (0, import_node_path3.join)(import_node_process.default.cwd(), DEFAULT_CONFIG_DIR, "localess.ts");
535
+ var typesGenerateCommand = new import_commander3.Command("generate").description("Generate types for your schemas").option("-p, --path <path>", "Path to the file where to save the generated types. Default is .localess/localess.ts", TYPES_PATH).action(async (options) => {
535
536
  console.log("Types in with options:", options);
536
537
  const session = await getSession();
537
538
  if (!session.isLoggedIn) {
@@ -548,14 +549,16 @@ var typesGenerateCommand = new import_commander3.Command("generate").description
548
549
  const specification = await client.getOpenApi();
549
550
  console.log("Generating types from OpenAPI specification...");
550
551
  try {
551
- const minimalSpec = {
552
- openapi: "3.0.0",
553
- info: { title: "Schemas Only", version: "1.0.0" },
554
- components: { schemas: specification.components?.schemas || {} }
555
- };
556
- const ast = await (0, import_openapi_typescript.default)(minimalSpec, { exportType: true, rootTypes: true, rootTypesNoSchemaPrefix: true });
557
- const contents = (0, import_openapi_typescript.astToString)(ast);
558
- await writeFile(options.path, contents);
552
+ await (0, import_orval.generate)({
553
+ input: {
554
+ target: specification
555
+ },
556
+ output: {
557
+ target: options.path,
558
+ client: "fetch",
559
+ mode: "single"
560
+ }
561
+ });
559
562
  console.log(`Types generated successfully at ${options.path}`);
560
563
  } catch (e) {
561
564
  console.error(e);
package/dist/index.mjs CHANGED
@@ -49,6 +49,7 @@ var TTLCache = class {
49
49
  constructor(ttlMs = 3e5) {
50
50
  this.ttlMs = ttlMs;
51
51
  }
52
+ ttlMs;
52
53
  cache = /* @__PURE__ */ new Map();
53
54
  set(key, value) {
54
55
  this.cache.set(key, { value, expiresAt: Date.now() + this.ttlMs });
@@ -504,11 +505,11 @@ import { Command as Command4 } from "commander";
504
505
 
505
506
  // src/commands/types/generate/index.ts
506
507
  import { Command as Command3 } from "commander";
507
- import openapiTS, { astToString } from "openapi-typescript";
508
+ import { generate } from "orval";
508
509
  import { join as join2 } from "path";
509
510
  import process3 from "process";
510
- var TYPES_PATH = join2(process3.cwd(), DEFAULT_CONFIG_DIR, "localess.d.ts");
511
- var typesGenerateCommand = new Command3("generate").description("Generate types for your schemas").option("-p, --path <path>", "Path to the file where to save the generated types. Default is .localess/localess.d.ts", TYPES_PATH).action(async (options) => {
511
+ var TYPES_PATH = join2(process3.cwd(), DEFAULT_CONFIG_DIR, "localess.ts");
512
+ var typesGenerateCommand = new Command3("generate").description("Generate types for your schemas").option("-p, --path <path>", "Path to the file where to save the generated types. Default is .localess/localess.ts", TYPES_PATH).action(async (options) => {
512
513
  console.log("Types in with options:", options);
513
514
  const session = await getSession();
514
515
  if (!session.isLoggedIn) {
@@ -525,14 +526,16 @@ var typesGenerateCommand = new Command3("generate").description("Generate types
525
526
  const specification = await client.getOpenApi();
526
527
  console.log("Generating types from OpenAPI specification...");
527
528
  try {
528
- const minimalSpec = {
529
- openapi: "3.0.0",
530
- info: { title: "Schemas Only", version: "1.0.0" },
531
- components: { schemas: specification.components?.schemas || {} }
532
- };
533
- const ast = await openapiTS(minimalSpec, { exportType: true, rootTypes: true, rootTypesNoSchemaPrefix: true });
534
- const contents = astToString(ast);
535
- await writeFile(options.path, contents);
529
+ await generate({
530
+ input: {
531
+ target: specification
532
+ },
533
+ output: {
534
+ target: options.path,
535
+ client: "fetch",
536
+ mode: "single"
537
+ }
538
+ });
536
539
  console.log(`Types generated successfully at ${options.path}`);
537
540
  } catch (e) {
538
541
  console.error(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@localess/cli",
3
- "version": "3.0.1-dev.20260405094412",
3
+ "version": "3.0.1-dev.20260405190914",
4
4
  "description": "Localess Command Line.",
5
5
  "keywords": [
6
6
  "localess",
@@ -37,6 +37,7 @@
37
37
  },
38
38
  "scripts": {
39
39
  "build": "tsup src/index.ts --format cjs,esm --dts --shims",
40
+ "typecheck": "tsc --noEmit",
40
41
  "test": "vitest"
41
42
  },
42
43
  "license": "MIT",
@@ -44,11 +45,12 @@
44
45
  "@inquirer/prompts": "^8.3.0",
45
46
  "commander": "^14.0.3",
46
47
  "chalk": "^5.6.2",
47
- "openapi-typescript": "^7.12.0",
48
+ "orval": "^8.6.2",
48
49
  "zod": "^4.3.6"
49
50
  },
50
51
  "devDependencies": {
51
52
  "@types/node": "^20",
53
+ "openapi3-ts": "^4.5.0",
52
54
  "tsup": "^8.5.1",
53
55
  "typescript": "^5.0.0"
54
56
  },