@igniter-js/cli 0.2.4 → 0.2.5

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.mjs CHANGED
@@ -11489,16 +11489,7 @@ function extractRouterSchema(router) {
11489
11489
  };
11490
11490
  }
11491
11491
  const schema = {
11492
- config: {
11493
- baseURL: router.config?.baseURL || "",
11494
- basePATH: router.config?.basePATH || ""
11495
- },
11496
- controllers: controllersSchema,
11497
- processor: {},
11498
- handler: {},
11499
- $context: {},
11500
- $plugins: {},
11501
- $caller: {}
11492
+ controllers: controllersSchema
11502
11493
  };
11503
11494
  return {
11504
11495
  schema,
@@ -11604,28 +11595,40 @@ export type AppRouterSchemaType = typeof AppRouterSchema
11604
11595
  return filePath;
11605
11596
  }
11606
11597
  async function generateClientFile(schema, outputDir, config) {
11607
- const content = `import { createIgniterClient, useIgniterQueryClient } from '@igniter-js/core/client'
11598
+ const filePath = path7.join(outputDir, "igniter.client.ts");
11599
+ if (fs6.existsSync(filePath)) {
11600
+ const logger6 = createChildLogger({ component: "generator" });
11601
+ logger6.info("Skipping client file generation, already exists", { path: filePath });
11602
+ return filePath;
11603
+ }
11604
+ const content = `* eslint-disable */
11605
+ /* prettier-ignore */
11606
+
11607
+ import { createIgniterClient, useIgniterQueryClient } from '@igniter-js/core/client'
11608
11608
  import type { AppRouterType } from './igniter.router'
11609
11609
 
11610
11610
  /**
11611
- * Type-safe API client generated from your Igniter router
11612
- *
11613
- * Usage in Server Components:
11614
- * const users = await api.users.list.query()
11615
- *
11616
- * Usage in Client Components:
11617
- * const { data } = api.users.list.useQuery()
11618
- */
11611
+ * Type-safe API client generated from your Igniter router
11612
+ *
11613
+ * Usage in Server Components:
11614
+ * const users = await api.users.list.query()
11615
+ *
11616
+ * Usage in Client Components:
11617
+ * const { data } = api.users.list.useQuery()
11618
+ *
11619
+ * Note: Adjust environment variable prefixes (e.g., NEXT_PUBLIC_, BUN_PUBLIC_, DENO_PUBLIC_, REACT_APP_)
11620
+ * according to your project's framework/runtime (Next.js, Bun, Deno, React/Vite, etc.).
11621
+ */
11619
11622
  export const api = createIgniterClient<AppRouterType>({
11620
- baseURL: 'http://localhost:3000',
11621
- basePath: '/api/v1/',
11622
- router: () => {
11623
- if (typeof window === 'undefined') {
11624
- return require('./igniter.router').AppRouter
11625
- }
11623
+ baseURL: process.env.NEXT_PUBLIC_IGNITER_API_URL, // Adapt for your needs
11624
+ basePath: process.env.NEXT_PUBLIC_IGNITER_API_BASE_PATH,
11625
+ router: () => {
11626
+ if (typeof window === 'undefined') {
11627
+ return require('./igniter.router').AppRouter
11628
+ }
11626
11629
 
11627
- return require('./igniter.schema').AppRouterSchema
11628
- },
11630
+ return require('./igniter.schema').AppRouterSchema
11631
+ },
11629
11632
  })
11630
11633
 
11631
11634
  /**
@@ -11647,7 +11650,6 @@ export type ApiClient = typeof api
11647
11650
  */
11648
11651
  export const useQueryClient = useIgniterQueryClient<AppRouterType>;
11649
11652
  `;
11650
- const filePath = path7.join(outputDir, "igniter.client.ts");
11651
11653
  await writeFileWithHeader(filePath, content, config);
11652
11654
  return filePath;
11653
11655
  }
@@ -11658,7 +11660,8 @@ async function writeFileWithHeader(filePath, content, config) {
11658
11660
  }
11659
11661
  function generateFileHeader(config) {
11660
11662
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
11661
- return `/* eslint-disable @typescript-eslint/no-var-requires */
11663
+ return `/* eslint-disable */
11664
+ /* prettier-ignore */
11662
11665
 
11663
11666
  /**
11664
11667
  * Generated by @igniter-js/cli
@@ -12736,7 +12739,7 @@ var IGNITER_FEATURES = {
12736
12739
  name: "Redis Store",
12737
12740
  description: "Caching, sessions, and pub/sub messaging",
12738
12741
  dependencies: [
12739
- { name: "@igniter-js/adapter-redis", version: "alpha" },
12742
+ { name: "@igniter-js/adapter-redis", version: "latest" },
12740
12743
  { name: "ioredis", version: "^5.6.1" }
12741
12744
  ],
12742
12745
  devDependencies: [
@@ -12764,8 +12767,8 @@ var IGNITER_FEATURES = {
12764
12767
  name: "BullMQ Jobs",
12765
12768
  description: "Background task processing and job queues",
12766
12769
  dependencies: [
12767
- { name: "@igniter-js/adapter-redis", version: "alpha" },
12768
- { name: "@igniter-js/adapter-bullmq", version: "alpha" },
12770
+ { name: "@igniter-js/adapter-redis", version: "latest" },
12771
+ { name: "@igniter-js/adapter-bullmq", version: "latest" },
12769
12772
  { name: "bullmq", version: "^4.0.0" },
12770
12773
  { name: "ioredis", version: "^5.6.1" }
12771
12774
  ],
@@ -12793,7 +12796,7 @@ var IGNITER_FEATURES = {
12793
12796
  name: "MCP Server",
12794
12797
  description: "Easy expose your API as a MCP server for AI assistants like Cursor, Claude, etc.",
12795
12798
  dependencies: [
12796
- { name: "@igniter-js/adapter-mcp", version: "alpha" },
12799
+ { name: "@igniter-js/adapter-mcp", version: "latest" },
12797
12800
  { name: "@vercel/mcp-adapter", version: "^0.2.0" },
12798
12801
  { name: "@modelcontextprotocol/sdk", version: "^1.10.2" },
12799
12802
  { name: "ioredis", version: "^5.6.1" }
@@ -12825,7 +12828,7 @@ var IGNITER_FEATURES = {
12825
12828
  name: "Enhanced Logging",
12826
12829
  description: "Advanced console logging with structured output",
12827
12830
  dependencies: [
12828
- { name: "@igniter-js/core", version: "alpha" }
12831
+ { name: "@igniter-js/core", version: "latest" }
12829
12832
  ],
12830
12833
  envVars: [
12831
12834
  { key: "IGNITER_LOG_LEVEL", value: "info", description: "Logging level (debug, info, warn, error)" }
@@ -12836,7 +12839,7 @@ var IGNITER_FEATURES = {
12836
12839
  name: "Telemetry",
12837
12840
  description: "Telemetry for tracking requests and errors",
12838
12841
  dependencies: [
12839
- { name: "@igniter-js/core", version: "alpha" }
12842
+ { name: "@igniter-js/core", version: "latest" }
12840
12843
  ],
12841
12844
  envVars: [
12842
12845
  { key: "IGNITER_TELEMETRY_ENABLE_TRACING", value: "true", description: "Enable telemetry tracing" },