@igniter-js/cli 0.2.72 → 0.4.0
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 +213 -27
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +3556 -19993
- package/dist/index.mjs.map +1 -1
- package/package.json +38 -53
- package/templates/add-ons/auth/better-auth/auth.hbs +37 -0
- package/templates/add-ons/bots/nextjs/route-handler.hbs +10 -0
- package/templates/add-ons/bots/sample-bot.hbs +26 -0
- package/templates/add-ons/bots/tanstack-start/route-handler.hbs +15 -0
- package/templates/add-ons/database/prisma/lib.hbs +11 -0
- package/templates/add-ons/database/prisma/prisma.config.hbs +13 -0
- package/templates/add-ons/database/prisma/schema.hbs +15 -0
- package/templates/add-ons/jobs/jobs.ts.hbs +32 -0
- package/templates/add-ons/jobs/redis.ts.hbs +13 -0
- package/templates/add-ons/jobs/store.ts.hbs +12 -0
- package/templates/add-ons/logging/logger.ts.hbs +14 -0
- package/templates/add-ons/mcp/mcp.ts.hbs +21 -0
- package/templates/add-ons/mcp/nextjs/route-handler.hbs +11 -0
- package/templates/add-ons/mcp/tanstack-start/route-handler.hbs +19 -0
- package/templates/add-ons/store/redis.ts.hbs +13 -0
- package/templates/add-ons/store/store.ts.hbs +12 -0
- package/templates/add-ons/telemetry/telemetry.ts.hbs +20 -0
- package/templates/generate/feature/empty.controller.hbs +20 -0
- package/templates/generate/feature/empty.interfaces.hbs +5 -0
- package/templates/generate/feature/procedure.hbs +23 -0
- package/templates/generate/feature/schema.controller.hbs +73 -0
- package/templates/generate/feature/schema.interfaces.hbs +23 -0
- package/templates/generate/feature/schema.procedure.hbs +23 -0
- package/templates/scaffold/example-feature/example.controller.hbs +23 -0
- package/templates/scaffold/example-feature/example.interfaces.hbs +14 -0
- package/templates/scaffold/example-feature/example.procedure.hbs +28 -0
- package/templates/scaffold/igniter.schema.hbs +21 -0
- package/templates/starters/igniter.client.hbs +52 -0
- package/templates/starters/igniter.context.hbs +10 -0
- package/templates/starters/igniter.hbs +43 -0
- package/templates/starters/igniter.router.hbs +14 -0
- package/templates/starters/nextjs/route-handler.hbs +8 -0
- package/templates/starters/nextjs/tsconfig.hbs +35 -0
- package/templates/starters/open-api.hbs +45 -0
- package/templates/starters/tanstack-start/route-handler.hbs +13 -0
- package/templates/starters/tanstack-start/tsconfig.hbs +15 -0
- package/bin/igniter +0 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -20309
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { igniter } from "@/igniter";
|
|
2
|
+
import type { ExampleHelloResponse } from "../example.interfaces";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @description Example procedure demonstrating Igniter.js features
|
|
6
|
+
* @see https://igniterjs.com/docs/core/procedures
|
|
7
|
+
*/
|
|
8
|
+
export const ExampleProcedure = igniter.procedure({
|
|
9
|
+
name: 'ExampleProcedure',
|
|
10
|
+
handler(options, { request, response, context }) {
|
|
11
|
+
return {
|
|
12
|
+
example: {
|
|
13
|
+
hello: (): ExampleHelloResponse => {
|
|
14
|
+
return {
|
|
15
|
+
status: 'ok',
|
|
16
|
+
timestamp: new Date().toISOString(),
|
|
17
|
+
features: {
|
|
18
|
+
store: !!igniter.store,
|
|
19
|
+
jobs: !!igniter.jobs,
|
|
20
|
+
logging: !!igniter.logger,
|
|
21
|
+
telemetry: !!igniter.telemetry,
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* prettier-ignore */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generated by @igniter-js/cli
|
|
6
|
+
*
|
|
7
|
+
* WARNING: DO NOT EDIT THIS FILE MANUALLY
|
|
8
|
+
*
|
|
9
|
+
* This file was automatically generated from your Igniter router.
|
|
10
|
+
* Any changes made to this file will be overwritten when the CLI regenerates it.
|
|
11
|
+
*
|
|
12
|
+
* To modify the client API, update your controller files instead.
|
|
13
|
+
*
|
|
14
|
+
* Generated: {{generatedAt}}
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// Generated by @igniter-js/cli - DO NOT EDIT
|
|
18
|
+
|
|
19
|
+
export const AppRouterSchema = {{{schemaString}}} as const
|
|
20
|
+
|
|
21
|
+
export type AppRouterSchemaType = typeof AppRouterSchema
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* prettier-ignore */
|
|
3
|
+
/* biome-ignore */
|
|
4
|
+
|
|
5
|
+
import { createIgniterClient, useIgniterQueryClient } from '@igniter-js/core/client'
|
|
6
|
+
import type { AppRouterType } from './igniter.router'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* ⚠️ WARNING! ⚠️
|
|
10
|
+
*
|
|
11
|
+
* This file is auto-generated.
|
|
12
|
+
* DO NOT EDIT OR MODIFY THIS FILE DIRECTLY!
|
|
13
|
+
* Your changes will be lost if this file is regenerated.
|
|
14
|
+
*
|
|
15
|
+
* Any manual changes should be made in your source router or schema files.
|
|
16
|
+
* For more information, visit:
|
|
17
|
+
* https://igniterjs.com/docs/core/client
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Type-safe API client generated from your Igniter router
|
|
23
|
+
*
|
|
24
|
+
* Usage in Server Components:
|
|
25
|
+
* const users = await api.users.list.query()
|
|
26
|
+
*
|
|
27
|
+
* Usage in Client Components:
|
|
28
|
+
* const { data } = api.users.list.useQuery()
|
|
29
|
+
*
|
|
30
|
+
* Note: Adjust environment variable prefixes (e.g., NEXT_PUBLIC_, BUN_PUBLIC_, DENO_PUBLIC_, REACT_APP_)
|
|
31
|
+
* @see https://igniterjs.com/docs/core/client
|
|
32
|
+
*/
|
|
33
|
+
export const api = createIgniterClient<AppRouterType>({
|
|
34
|
+
baseURL: process.env.IGNITER_API_URL || 'http://localhost:3000',
|
|
35
|
+
basePATH: process.env.IGNITER_API_BASE_PATH || '/api/v1',
|
|
36
|
+
router: () => {
|
|
37
|
+
if (typeof window === 'undefined') {
|
|
38
|
+
return require('./igniter.router').AppRouter
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return require('./igniter.schema').AppRouterSchema
|
|
42
|
+
},
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Type-safe query client generated from your Igniter router
|
|
47
|
+
*
|
|
48
|
+
* Usage in Client Components:
|
|
49
|
+
* const { invalidate } = useQueryClient()
|
|
50
|
+
* @see https://igniterjs.com/docs/core/client
|
|
51
|
+
*/
|
|
52
|
+
export const useQueryClient = useIgniterQueryClient<AppRouterType>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @description Create the context of the Igniter.js application
|
|
4
|
+
* @see https://igniterjs.com/docs/core/context
|
|
5
|
+
*/
|
|
6
|
+
export const createIgniterAppContext = () => {
|
|
7
|
+
return {
|
|
8
|
+
// Add application-wide context properties here, like database clients.
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Igniter } from '@igniter-js/core'
|
|
2
|
+
import { createIgniterAppContext } from "./igniter.context"
|
|
3
|
+
import openapi from './docs/openapi.json'
|
|
4
|
+
{{#if (includes enabledAddOns "store") }}
|
|
5
|
+
import { store } from "@/services/store"
|
|
6
|
+
{{/if}}
|
|
7
|
+
{{#if (includes enabledAddOns "jobs") }}
|
|
8
|
+
import { REGISTERED_JOBS } from "@/services/jobs"
|
|
9
|
+
{{/if}}
|
|
10
|
+
{{#if (includes enabledAddOns "logger") }}
|
|
11
|
+
import { logger } from "@/services/logger"
|
|
12
|
+
{{/if}}
|
|
13
|
+
{{#if (includes enabledAddOns "telemetry") }}
|
|
14
|
+
import { telemetry } from "@/services/telemetry"
|
|
15
|
+
{{/if}}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @description Initialize the Igniter.js
|
|
19
|
+
* @see https://igniterjs.com/docs/core/builder
|
|
20
|
+
*/
|
|
21
|
+
export const igniter = Igniter
|
|
22
|
+
.context(createIgniterAppContext())
|
|
23
|
+
{{#if (includes enabledAddOns "store") }}
|
|
24
|
+
.store(store)
|
|
25
|
+
{{/if}}
|
|
26
|
+
{{#if (includes enabledAddOns "jobs") }}
|
|
27
|
+
.jobs(REGISTERED_JOBS)
|
|
28
|
+
{{/if}}
|
|
29
|
+
{{#if (includes enabledAddOns "logger") }}
|
|
30
|
+
.logger(logger)
|
|
31
|
+
{{/if}}
|
|
32
|
+
{{#if (includes enabledAddOns "telemetry") }}
|
|
33
|
+
.telemetry(telemetry)
|
|
34
|
+
{{/if}}
|
|
35
|
+
.docs({
|
|
36
|
+
openapi,
|
|
37
|
+
info: {
|
|
38
|
+
title: '{{capitalizeSlug projectName}}',
|
|
39
|
+
version: '1.0.0',
|
|
40
|
+
description: 'Just another Igniter.js REST API',
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
.create()
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { igniter } from '@/igniter'
|
|
2
|
+
import { ExampleController } from '@/features/example/controllers/example.controller'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @description Main application router configuration
|
|
6
|
+
* @see https://igniterjs.com/docs/core/router
|
|
7
|
+
*/
|
|
8
|
+
export const AppRouter = igniter.router({
|
|
9
|
+
controllers: {
|
|
10
|
+
example: ExampleController
|
|
11
|
+
}
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export type AppRouterType = typeof AppRouter
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AppRouter } from '@/igniter.router'
|
|
2
|
+
import { nextRouteHandlerAdapter } from '@igniter-js/core/adapters'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @description Next.js route handler adapter for Igniter.js
|
|
6
|
+
* @see https://igniterjs.com/docs/core/nextjs
|
|
7
|
+
*/
|
|
8
|
+
export const { GET, POST, PUT, DELETE, PATCH } = nextRouteHandlerAdapter(AppRouter)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2017",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"module": "esnext",
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"jsx": "react-jsx",
|
|
15
|
+
"incremental": true,
|
|
16
|
+
"plugins": [
|
|
17
|
+
{
|
|
18
|
+
"name": "next"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"paths": {
|
|
22
|
+
"@/*": ["./src/*"]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"include": [
|
|
26
|
+
"next-env.d.ts",
|
|
27
|
+
"**/*.ts",
|
|
28
|
+
"**/*.tsx",
|
|
29
|
+
".next/types/**/*.ts",
|
|
30
|
+
".next/dev/types/**/*.ts",
|
|
31
|
+
"**/*.mts",
|
|
32
|
+
"prisma/client/**/*"
|
|
33
|
+
],
|
|
34
|
+
"exclude": ["node_modules"]
|
|
35
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.0.0",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "{{capitalizeSlug projectName}}",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"description": "Just another Igniter.js REST API"
|
|
7
|
+
},
|
|
8
|
+
"servers": [
|
|
9
|
+
{
|
|
10
|
+
"url": "http://localhost:3000/api/v1",
|
|
11
|
+
"description": "Default server"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"tags": [
|
|
15
|
+
{
|
|
16
|
+
"name": "Example"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"paths": {
|
|
20
|
+
"/example": {
|
|
21
|
+
"get": {
|
|
22
|
+
"summary": "Health check",
|
|
23
|
+
"operationId": "health",
|
|
24
|
+
"tags": [
|
|
25
|
+
"Example"
|
|
26
|
+
],
|
|
27
|
+
"parameters": [],
|
|
28
|
+
"responses": {
|
|
29
|
+
"200": {
|
|
30
|
+
"description": "Success",
|
|
31
|
+
"content": {
|
|
32
|
+
"application/json": {
|
|
33
|
+
"schema": {}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"components": {
|
|
42
|
+
"schemas": {},
|
|
43
|
+
"securitySchemes": {}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createFileRoute } from '@tanstack/react-router'
|
|
2
|
+
import { AppRouter } from '@/igniter.router'
|
|
3
|
+
import { tanstackStartRouteHandlerAdapter } from '@igniter-js/core/adapters'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @description TanStack Start route handler adapter for Igniter.js
|
|
7
|
+
* @see https://igniterjs.com/docs/core/tanstack-start
|
|
8
|
+
*/
|
|
9
|
+
export const Route = createFileRoute('/api/v1/$')({
|
|
10
|
+
server: {
|
|
11
|
+
handlers: tanstackStartRouteHandlerAdapter(AppRouter),
|
|
12
|
+
}
|
|
13
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": ["**/*.ts", "**/*.tsx"],
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"jsx": "react-jsx",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"target": "ES2022",
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"strictNullChecks": true,
|
|
10
|
+
"baseUrl": ".",
|
|
11
|
+
"paths": {
|
|
12
|
+
"@/*": ["./src/*"]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
package/bin/igniter
DELETED
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|