@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/README.md CHANGED
@@ -31,7 +31,7 @@ The `init` command scaffolds a new, production-ready Igniter.js project from scr
31
31
  npx @igniter-js/cli init my-api
32
32
  ```
33
33
 
34
- For more details, see the **[igniter init documentation](https://github.com/felipebarcelospro/igniter-js/wiki/05-CLI-and-Tooling/01-igniter-init.md)**.
34
+ For more details, see the **[igniter init documentation](https://igniterjs.com/docs/cli-and-tooling/igniter-init)**.
35
35
 
36
36
  ### `igniter dev`
37
37
 
@@ -46,7 +46,7 @@ igniter dev --interactive
46
46
  igniter dev --interactive --framework nextjs
47
47
  ```
48
48
 
49
- For more details, see the **[igniter dev documentation](https://github.com/felipebarcelospro/igniter-js/wiki/05-CLI-and-Tooling/02-igniter-dev.md)**.
49
+ For more details, see the **[igniter dev documentation](https://igniterjs.com/docs/cli-and-tooling/igniter-dev)**.
50
50
 
51
51
  ## Contributing
52
52
 
package/dist/index.js CHANGED
@@ -11482,16 +11482,7 @@ function extractRouterSchema(router) {
11482
11482
  };
11483
11483
  }
11484
11484
  const schema = {
11485
- config: {
11486
- baseURL: router.config?.baseURL || "",
11487
- basePATH: router.config?.basePATH || ""
11488
- },
11489
- controllers: controllersSchema,
11490
- processor: {},
11491
- handler: {},
11492
- $context: {},
11493
- $plugins: {},
11494
- $caller: {}
11485
+ controllers: controllersSchema
11495
11486
  };
11496
11487
  return {
11497
11488
  schema,
@@ -11597,28 +11588,40 @@ export type AppRouterSchemaType = typeof AppRouterSchema
11597
11588
  return filePath;
11598
11589
  }
11599
11590
  async function generateClientFile(schema, outputDir, config) {
11600
- const content = `import { createIgniterClient, useIgniterQueryClient } from '@igniter-js/core/client'
11591
+ const filePath = path7.join(outputDir, "igniter.client.ts");
11592
+ if (fs6.existsSync(filePath)) {
11593
+ const logger6 = createChildLogger({ component: "generator" });
11594
+ logger6.info("Skipping client file generation, already exists", { path: filePath });
11595
+ return filePath;
11596
+ }
11597
+ const content = `* eslint-disable */
11598
+ /* prettier-ignore */
11599
+
11600
+ import { createIgniterClient, useIgniterQueryClient } from '@igniter-js/core/client'
11601
11601
  import type { AppRouterType } from './igniter.router'
11602
11602
 
11603
11603
  /**
11604
- * Type-safe API client generated from your Igniter router
11605
- *
11606
- * Usage in Server Components:
11607
- * const users = await api.users.list.query()
11608
- *
11609
- * Usage in Client Components:
11610
- * const { data } = api.users.list.useQuery()
11611
- */
11604
+ * Type-safe API client generated from your Igniter router
11605
+ *
11606
+ * Usage in Server Components:
11607
+ * const users = await api.users.list.query()
11608
+ *
11609
+ * Usage in Client Components:
11610
+ * const { data } = api.users.list.useQuery()
11611
+ *
11612
+ * Note: Adjust environment variable prefixes (e.g., NEXT_PUBLIC_, BUN_PUBLIC_, DENO_PUBLIC_, REACT_APP_)
11613
+ * according to your project's framework/runtime (Next.js, Bun, Deno, React/Vite, etc.).
11614
+ */
11612
11615
  export const api = createIgniterClient<AppRouterType>({
11613
- baseURL: 'http://localhost:3000',
11614
- basePath: '/api/v1/',
11615
- router: () => {
11616
- if (typeof window === 'undefined') {
11617
- return require('./igniter.router').AppRouter
11618
- }
11616
+ baseURL: process.env.NEXT_PUBLIC_IGNITER_API_URL, // Adapt for your needs
11617
+ basePath: process.env.NEXT_PUBLIC_IGNITER_API_BASE_PATH,
11618
+ router: () => {
11619
+ if (typeof window === 'undefined') {
11620
+ return require('./igniter.router').AppRouter
11621
+ }
11619
11622
 
11620
- return require('./igniter.schema').AppRouterSchema
11621
- },
11623
+ return require('./igniter.schema').AppRouterSchema
11624
+ },
11622
11625
  })
11623
11626
 
11624
11627
  /**
@@ -11640,7 +11643,6 @@ export type ApiClient = typeof api
11640
11643
  */
11641
11644
  export const useQueryClient = useIgniterQueryClient<AppRouterType>;
11642
11645
  `;
11643
- const filePath = path7.join(outputDir, "igniter.client.ts");
11644
11646
  await writeFileWithHeader(filePath, content, config);
11645
11647
  return filePath;
11646
11648
  }
@@ -11651,7 +11653,8 @@ async function writeFileWithHeader(filePath, content, config) {
11651
11653
  }
11652
11654
  function generateFileHeader(config) {
11653
11655
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
11654
- return `/* eslint-disable @typescript-eslint/no-var-requires */
11656
+ return `/* eslint-disable */
11657
+ /* prettier-ignore */
11655
11658
 
11656
11659
  /**
11657
11660
  * Generated by @igniter-js/cli
@@ -12732,7 +12735,7 @@ var IGNITER_FEATURES = {
12732
12735
  name: "Redis Store",
12733
12736
  description: "Caching, sessions, and pub/sub messaging",
12734
12737
  dependencies: [
12735
- { name: "@igniter-js/adapter-redis", version: "alpha" },
12738
+ { name: "@igniter-js/adapter-redis", version: "latest" },
12736
12739
  { name: "ioredis", version: "^5.6.1" }
12737
12740
  ],
12738
12741
  devDependencies: [
@@ -12760,8 +12763,8 @@ var IGNITER_FEATURES = {
12760
12763
  name: "BullMQ Jobs",
12761
12764
  description: "Background task processing and job queues",
12762
12765
  dependencies: [
12763
- { name: "@igniter-js/adapter-redis", version: "alpha" },
12764
- { name: "@igniter-js/adapter-bullmq", version: "alpha" },
12766
+ { name: "@igniter-js/adapter-redis", version: "latest" },
12767
+ { name: "@igniter-js/adapter-bullmq", version: "latest" },
12765
12768
  { name: "bullmq", version: "^4.0.0" },
12766
12769
  { name: "ioredis", version: "^5.6.1" }
12767
12770
  ],
@@ -12789,7 +12792,7 @@ var IGNITER_FEATURES = {
12789
12792
  name: "MCP Server",
12790
12793
  description: "Easy expose your API as a MCP server for AI assistants like Cursor, Claude, etc.",
12791
12794
  dependencies: [
12792
- { name: "@igniter-js/adapter-mcp", version: "alpha" },
12795
+ { name: "@igniter-js/adapter-mcp", version: "latest" },
12793
12796
  { name: "@vercel/mcp-adapter", version: "^0.2.0" },
12794
12797
  { name: "@modelcontextprotocol/sdk", version: "^1.10.2" },
12795
12798
  { name: "ioredis", version: "^5.6.1" }
@@ -12821,7 +12824,7 @@ var IGNITER_FEATURES = {
12821
12824
  name: "Enhanced Logging",
12822
12825
  description: "Advanced console logging with structured output",
12823
12826
  dependencies: [
12824
- { name: "@igniter-js/core", version: "alpha" }
12827
+ { name: "@igniter-js/core", version: "latest" }
12825
12828
  ],
12826
12829
  envVars: [
12827
12830
  { key: "IGNITER_LOG_LEVEL", value: "info", description: "Logging level (debug, info, warn, error)" }
@@ -12832,7 +12835,7 @@ var IGNITER_FEATURES = {
12832
12835
  name: "Telemetry",
12833
12836
  description: "Telemetry for tracking requests and errors",
12834
12837
  dependencies: [
12835
- { name: "@igniter-js/core", version: "alpha" }
12838
+ { name: "@igniter-js/core", version: "latest" }
12836
12839
  ],
12837
12840
  envVars: [
12838
12841
  { key: "IGNITER_TELEMETRY_ENABLE_TRACING", value: "true", description: "Enable telemetry tracing" },