@igniter-js/cli 0.1.11 → 0.2.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.
Files changed (65) hide show
  1. package/bin/igniter +2 -0
  2. package/dist/index.d.mts +1 -0
  3. package/dist/index.d.ts +0 -1
  4. package/dist/index.js +14390 -523
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +14427 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/package.json +37 -51
  9. package/dist/templates/components.json.hbs +0 -21
  10. package/dist/templates/copilot.feature.instructions.hbs +0 -145
  11. package/dist/templates/copilot.form.instructions.hbs +0 -1021
  12. package/dist/templates/copilot.igniter.instructions.hbs +0 -753
  13. package/dist/templates/copilot.instructions.hbs +0 -117
  14. package/dist/templates/copilot.next.instructions.hbs +0 -67
  15. package/dist/templates/copilot.review.instructions.hbs +0 -42
  16. package/dist/templates/copilot.test.instructions.hbs +0 -55
  17. package/dist/templates/docker-compose.hbs +0 -15
  18. package/dist/templates/env.hbs +0 -33
  19. package/dist/templates/eslintrc.hbs +0 -6
  20. package/dist/templates/express.server.hbs +0 -33
  21. package/dist/templates/feature.controller.hbs +0 -95
  22. package/dist/templates/feature.index.hbs +0 -5
  23. package/dist/templates/feature.interface.hbs +0 -101
  24. package/dist/templates/feature.procedure.hbs +0 -88
  25. package/dist/templates/globals.hbs +0 -123
  26. package/dist/templates/igniter.client.hbs +0 -21
  27. package/dist/templates/igniter.context.hbs +0 -23
  28. package/dist/templates/igniter.hbs +0 -8
  29. package/dist/templates/igniter.router.hbs +0 -29
  30. package/dist/templates/layout.hbs +0 -39
  31. package/dist/templates/page.hbs +0 -117
  32. package/dist/templates/prisma.hbs +0 -9
  33. package/dist/templates/readme.hbs +0 -119
  34. package/dist/templates/route.hbs +0 -4
  35. package/dist/templates/use-form-with-zod.hbs +0 -39
  36. package/dist/templates/vitest.config.hbs +0 -11
  37. package/dist/templates/vscode.settings.hbs +0 -53
  38. package/dist/utils/analyze.d.ts +0 -17
  39. package/dist/utils/analyze.js +0 -185
  40. package/dist/utils/analyze.js.map +0 -1
  41. package/dist/utils/cli-style.d.ts +0 -55
  42. package/dist/utils/cli-style.js +0 -171
  43. package/dist/utils/cli-style.js.map +0 -1
  44. package/dist/utils/consts.d.ts +0 -19
  45. package/dist/utils/consts.js +0 -30
  46. package/dist/utils/consts.js.map +0 -1
  47. package/dist/utils/handlebars-helpers.d.ts +0 -1
  48. package/dist/utils/handlebars-helpers.js +0 -88
  49. package/dist/utils/handlebars-helpers.js.map +0 -1
  50. package/dist/utils/helpers.d.ts +0 -13
  51. package/dist/utils/helpers.js +0 -112
  52. package/dist/utils/helpers.js.map +0 -1
  53. package/dist/utils/platform-utils.d.ts +0 -46
  54. package/dist/utils/platform-utils.js +0 -95
  55. package/dist/utils/platform-utils.js.map +0 -1
  56. package/dist/utils/prisma-schema-parser.d.ts +0 -60
  57. package/dist/utils/prisma-schema-parser.js +0 -255
  58. package/dist/utils/prisma-schema-parser.js.map +0 -1
  59. package/dist/utils/project-utils.d.ts +0 -32
  60. package/dist/utils/project-utils.js +0 -123
  61. package/dist/utils/project-utils.js.map +0 -1
  62. package/dist/utils/template-handler.d.ts +0 -6
  63. package/dist/utils/template-handler.js +0 -32
  64. package/dist/utils/template-handler.js.map +0 -1
  65. package/readme.md +0 -165
@@ -1,123 +0,0 @@
1
- @import "tailwindcss";
2
- @import "tw-animate-css";
3
-
4
- @custom-variant dark (&:is(.dark *));
5
-
6
- :root {
7
- --background: oklch(1 0 0);
8
- --foreground: oklch(0.145 0 0);
9
- --card: oklch(1 0 0);
10
- --card-foreground: oklch(0.145 0 0);
11
- --popover: oklch(1 0 0);
12
- --popover-foreground: oklch(0.145 0 0);
13
- --primary: oklch(0.205 0 0);
14
- --primary-foreground: oklch(0.985 0 0);
15
- --secondary: oklch(0.97 0 0);
16
- --secondary-foreground: oklch(0.205 0 0);
17
- --muted: oklch(0.97 0 0);
18
- --muted-foreground: oklch(0.556 0 0);
19
- --accent: oklch(0.97 0 0);
20
- --accent-foreground: oklch(0.205 0 0);
21
- --destructive: oklch(0.577 0.245 27.325);
22
- --destructive-foreground: oklch(0.577 0.245 27.325);
23
- --border: oklch(0.922 0 0);
24
- --input: oklch(0.922 0 0);
25
- --ring: oklch(0.708 0 0);
26
- --chart-1: oklch(0.646 0.222 41.116);
27
- --chart-2: oklch(0.6 0.118 184.704);
28
- --chart-3: oklch(0.398 0.07 227.392);
29
- --chart-4: oklch(0.828 0.189 84.429);
30
- --chart-5: oklch(0.769 0.188 70.08);
31
- --radius: 0.625rem;
32
- --sidebar: oklch(0.985 0 0);
33
- --sidebar-foreground: oklch(0.145 0 0);
34
- --sidebar-primary: oklch(0.205 0 0);
35
- --sidebar-primary-foreground: oklch(0.985 0 0);
36
- --sidebar-accent: oklch(0.97 0 0);
37
- --sidebar-accent-foreground: oklch(0.205 0 0);
38
- --sidebar-border: oklch(0.922 0 0);
39
- --sidebar-ring: oklch(0.708 0 0);
40
- }
41
-
42
- .dark {
43
- --background: oklch(0.145 0 0);
44
- --foreground: oklch(0.985 0 0);
45
- --card: oklch(0.145 0 0);
46
- --card-foreground: oklch(0.985 0 0);
47
- --popover: oklch(0.145 0 0);
48
- --popover-foreground: oklch(0.985 0 0);
49
- --primary: oklch(0.985 0 0);
50
- --primary-foreground: oklch(0.205 0 0);
51
- --secondary: oklch(0.269 0 0);
52
- --secondary-foreground: oklch(0.985 0 0);
53
- --muted: oklch(0.269 0 0);
54
- --muted-foreground: oklch(0.708 0 0);
55
- --accent: oklch(0.269 0 0);
56
- --accent-foreground: oklch(0.985 0 0);
57
- --destructive: oklch(0.396 0.141 25.723);
58
- --destructive-foreground: oklch(0.637 0.237 25.331);
59
- --border: oklch(0.269 0 0);
60
- --input: oklch(0.269 0 0);
61
- --ring: oklch(0.439 0 0);
62
- --chart-1: oklch(0.488 0.243 264.376);
63
- --chart-2: oklch(0.696 0.17 162.48);
64
- --chart-3: oklch(0.769 0.188 70.08);
65
- --chart-4: oklch(0.627 0.265 303.9);
66
- --chart-5: oklch(0.645 0.246 16.439);
67
- --sidebar: oklch(0.205 0 0);
68
- --sidebar-foreground: oklch(0.985 0 0);
69
- --sidebar-primary: oklch(0.488 0.243 264.376);
70
- --sidebar-primary-foreground: oklch(0.985 0 0);
71
- --sidebar-accent: oklch(0.269 0 0);
72
- --sidebar-accent-foreground: oklch(0.985 0 0);
73
- --sidebar-border: oklch(0.269 0 0);
74
- --sidebar-ring: oklch(0.439 0 0);
75
- }
76
-
77
- @theme inline {
78
- --color-background: var(--background);
79
- --color-foreground: var(--foreground);
80
- --color-card: var(--card);
81
- --color-card-foreground: var(--card-foreground);
82
- --color-popover: var(--popover);
83
- --color-popover-foreground: var(--popover-foreground);
84
- --color-primary: var(--primary);
85
- --color-primary-foreground: var(--primary-foreground);
86
- --color-secondary: var(--secondary);
87
- --color-secondary-foreground: var(--secondary-foreground);
88
- --color-muted: var(--muted);
89
- --color-muted-foreground: var(--muted-foreground);
90
- --color-accent: var(--accent);
91
- --color-accent-foreground: var(--accent-foreground);
92
- --color-destructive: var(--destructive);
93
- --color-destructive-foreground: var(--destructive-foreground);
94
- --color-border: var(--border);
95
- --color-input: var(--input);
96
- --color-ring: var(--ring);
97
- --color-chart-1: var(--chart-1);
98
- --color-chart-2: var(--chart-2);
99
- --color-chart-3: var(--chart-3);
100
- --color-chart-4: var(--chart-4);
101
- --color-chart-5: var(--chart-5);
102
- --radius-sm: calc(var(--radius) - 4px);
103
- --radius-md: calc(var(--radius) - 2px);
104
- --radius-lg: var(--radius);
105
- --radius-xl: calc(var(--radius) + 4px);
106
- --color-sidebar: var(--sidebar);
107
- --color-sidebar-foreground: var(--sidebar-foreground);
108
- --color-sidebar-primary: var(--sidebar-primary);
109
- --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
110
- --color-sidebar-accent: var(--sidebar-accent);
111
- --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
112
- --color-sidebar-border: var(--sidebar-border);
113
- --color-sidebar-ring: var(--sidebar-ring);
114
- }
115
-
116
- @layer base {
117
- * {
118
- @apply border-border outline-ring/50;
119
- }
120
- body {
121
- @apply bg-background text-foreground;
122
- }
123
- }
@@ -1,21 +0,0 @@
1
- import { AppRouter } from './igniter.router';
2
- import { createIgniterClient, useIgniterQueryClient } from '@igniter-js/core/client'
3
-
4
- /**
5
- * Client for Igniter
6
- *
7
- * This client is used to fetch data on the client-side
8
- * It uses the createIgniterClient function to create a client instance
9
- *
10
- */
11
- export const api = createIgniterClient(AppRouter);
12
-
13
-
14
- /**
15
- * Query client for Igniter
16
- *
17
- * This client provides access to the Igniter query functions
18
- * and handles data fetching with respect to the application router.
19
- * It will enable the necessary hooks for query management.
20
- */
21
- export const useQueryClient = useIgniterQueryClient<typeof AppRouter>;
@@ -1,23 +0,0 @@
1
- import { prisma } from "@/providers/prisma";
2
-
3
- /**
4
- * @description Create the context of the application
5
- *
6
- * @returns {Object} The application context containing providers
7
- */
8
- export const createIgniterAppContext = () => {
9
- return {
10
- providers: {
11
- database: prisma
12
- }
13
- }
14
- }
15
-
16
- /**
17
- * @description The context of the application
18
- *
19
- * @type {Object} context The context object containing providers
20
- * @property {Object} providers The providers used in the application
21
- * @property {Object} providers.database The Prisma database provider
22
- */
23
- export type IgniterAppContext = Awaited<ReturnType<typeof createIgniterAppContext>>;
@@ -1,8 +0,0 @@
1
- import { Igniter } from "@igniter-js/core";
2
- import type { IgniterAppContext } from "./igniter.context";
3
-
4
- /**
5
- * @description Initialize the Igniter Router instance for application routing
6
- * @type {IgniterRouter<IgniterAppContext>}
7
- */
8
- export const igniter = Igniter.context<IgniterAppContext>().create()
@@ -1,29 +0,0 @@
1
- import { igniter } from "./igniter";
2
- import { createIgniterAppContext } from "./igniter.context";
3
-
4
- /**
5
- * @description Initialize the Igniter Router with controllers and context
6
- * @param {Object} config Router configuration object
7
- * @param {string} config.baseURL Base URL for the API endpoints
8
- * @param {string} config.basePATH Base path prefix for all routes
9
- * @param {Function} config.context Function to create context for each request
10
- * @param {Object} config.controllers Object containing controller definitions
11
- * @returns {Router} Initialized Igniter Router instance
12
- * @example
13
- * const router = appRouter({
14
- * baseURL: 'http://api.example.com',
15
- * basePATH: '/v1',
16
- * context: createContext,
17
- * controllers: {
18
- * users: UsersController
19
- * }
20
- * })
21
- */
22
- export const AppRouter = igniter.router({
23
- baseURL: process.env.IGNITER_APP_URL,
24
- basePATH: process.env.IGNITER_APP_BASE_PATH,
25
- context: createIgniterAppContext,
26
- controllers: {
27
- // add your controllers here
28
- }
29
- })
@@ -1,39 +0,0 @@
1
- import type { Metadata } from "next";
2
-
3
- import { Geist, Geist_Mono } from "next/font/google";
4
- import { IgniterProvider } from '@igniter-js/core/client'
5
-
6
- import "./globals.css"
7
-
8
- const geistSans = Geist({
9
- variable: "--font-geist-sans",
10
- subsets: ["latin"],
11
- });
12
-
13
- const geistMono = Geist_Mono({
14
- variable: "--font-geist-mono",
15
- subsets: ["latin"],
16
- });
17
-
18
- export const metadata: Metadata = {
19
- title: "Igniter.js Boilerplate",
20
- description: "A customizable boilerplate for Igniter.js applications",
21
- };
22
-
23
- export default function RootLayout({
24
- children,
25
- }: Readonly<{
26
- children: React.ReactNode;
27
- }>) {
28
- return (
29
- <html lang="en" suppressHydrationWarning>
30
- <body
31
- className={`${geistSans.variable} ${geistMono.variable} antialiased dark`}
32
- >
33
- <IgniterProvider>
34
- {children}
35
- </IgniterProvider>
36
- </body>
37
- </html>
38
- );
39
- }
@@ -1,117 +0,0 @@
1
- 'use client'
2
-
3
- import * as React from "react"
4
- import Link from "next/link"
5
-
6
- import { ArrowRight, Code2, Github, Twitter, Youtube } from "lucide-react"
7
- import { FileText } from "lucide-react"
8
- import { Badge } from "@/components/ui/badge"
9
- import { Button } from "@/components/ui/button"
10
- import { Card, CardContent } from "@/components/ui/card"
11
-
12
- export default function Home() {
13
- return (
14
- <div className="min-h-screen flex flex-col pt-12 space-y-12">
15
- <header className="max-w-2xl w-full space-y-8 mx-auto my-auto">
16
- <div className="space-y-6 text-center">
17
- <Badge variant="outline" className="mx-auto rounded-full px-3 py-1 text-sm font-medium bg-cyan-500/10 text-cyan-500 border-cyan-300/10/20" aria-label="Beta version">
18
- BETA
19
- </Badge>
20
-
21
- <h1 className="text-4xl sm:text-5xl font-bold tracking-tight bg-gradient-to-r from-primary to-primary/60 bg-clip-text text-transparent">
22
- Welcome to <br />Igniter Boilerplate
23
- </h1>
24
- <p className="text-base sm:text-lg text-muted-foreground max-w-md mx-auto leading-relaxed">
25
- Igniter is a modern, type-safe HTTP framework designed to streamline the development of scalable TypeScript applications.
26
- </p>
27
-
28
- <div className="flex items-center justify-center gap-4">
29
- <Button variant="outline" size="icon" asChild>
30
- <a href="https://github.com/felipebarcelospro/igniter-js" target="_blank" rel="noopener noreferrer">
31
- <Github className="h-4 w-4" />
32
- <span className="sr-only">GitHub Repository</span>
33
- </a>
34
- </Button>
35
- <Button variant="outline" size="icon" asChild>
36
- <a href="https://twitter.com/feldbarcelospro" target="_blank" rel="noopener noreferrer">
37
- <Twitter className="h-4 w-4" />
38
- <span className="sr-only">X (Twitter) Profile</span>
39
- </a>
40
- </Button>
41
- <Button variant="outline" size="icon" asChild>
42
- <a href="https://youtube.com/@vibedev.official" target="_blank" rel="noopener noreferrer">
43
- <Youtube className="h-4 w-4" />
44
- <span className="sr-only">YouTube Channel</span>
45
- </a>
46
- </Button>
47
- </div>
48
- </div>
49
-
50
- <section className="grid gap-4 sm:grid-cols-2" aria-label="Resources">
51
- <article>
52
- <Card className="rounded-2xl shadow-sm hover:shadow-md transition-shadow bg-card">
53
- <CardContent className="space-y-2">
54
- <span className="h-10 w-10 rounded-lg border border-cyan-300/10 bg-cyan-500/10 flex items-center justify-center mb-4">
55
- <FileText className="w-5 h-5 text-cyan-500" aria-hidden="true" />
56
- </span>
57
- <div className="flex items-center gap-2">
58
- <h3 className="font-semibold">Documentation</h3>
59
- </div>
60
- <p className="text-sm text-muted-foreground">
61
- Learn more about Igniter Framework features and API.
62
- </p>
63
- <Button variant="outline" className="w-full !mt-8 rounded-xl" asChild>
64
- <Link href="https://github.com/felipebarcelospro/igniter-js">
65
- Read Docs
66
- <ArrowRight className="w-4 h-4 ml-auto" aria-hidden="true" />
67
- </Link>
68
- </Button>
69
- </CardContent>
70
- </Card>
71
- </article>
72
-
73
- <article>
74
- <Card className="rounded-2xl shadow-sm hover:shadow-md transition-shadow bg-card">
75
- <CardContent className="space-y-2">
76
- <span className="h-10 w-10 rounded-lg border border-cyan-300/10 bg-cyan-500/10 flex items-center justify-center mb-4">
77
- <Code2 className="w-5 h-5 text-cyan-500" aria-hidden="true" />
78
- </span>
79
- <div className="flex items-center gap-2">
80
- <h3 className="font-semibold">Igniter CLI</h3>
81
- </div>
82
- <p className="text-sm text-muted-foreground">
83
- Generate code and manage your Igniter projects.
84
- </p>
85
- <Button variant="outline" className="w-full !mt-8 rounded-xl" asChild>
86
- <Link href="https://github.com/felipebarcelospro/igniter-cli">
87
- Get Started
88
- <ArrowRight className="w-4 h-4 ml-auto" aria-hidden="true" />
89
- </Link>
90
- </Button>
91
- </CardContent>
92
- </Card>
93
- </article>
94
- </section>
95
- </header>
96
-
97
- <footer className="border-t py-6 text-center w-full text-sm text-muted-foreground">
98
- <div className="container max-w-2xl mx-auto flex items-center justify-between">
99
- <nav aria-label="Footer Links">
100
- <p>
101
- Built by{" "}
102
- <a
103
- href="https://x.com/feldbarcelospro"
104
- target="_blank"
105
- rel="noopener noreferrer"
106
- className="font-medium underline underline-offset-4 hover:text-primary transition-colors"
107
- aria-label="Visit shadcn/ui website"
108
- >
109
- @felipebarcelospro
110
- </a>
111
- </p>
112
- </nav>
113
- </div>
114
- </footer>
115
- </div>
116
- )
117
- }
@@ -1,9 +0,0 @@
1
- import { PrismaClient } from '@prisma/client'
2
-
3
- const globalForPrisma = globalThis as unknown as {
4
- prisma: PrismaClient | undefined
5
- }
6
-
7
- export const prisma = globalForPrisma.prisma ?? new PrismaClient()
8
-
9
- if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma
@@ -1,119 +0,0 @@
1
- # {{name}}
2
-
3
- A modern web application built with [Igniter Framework](https://github.com/felipebarcelospro/igniter-js) - A feature-first framework for Next.js projects.
4
-
5
- ## 🚀 Quick Start
6
-
7
- 1. **Install Dependencies**
8
- ```bash
9
- npm install
10
- # or
11
- yarn install
12
- ```
13
-
14
- 2. **Setup Docker and Database**
15
- ```bash
16
- # Start Docker containers
17
- docker compose up -d
18
-
19
- # Generate Prisma Client
20
- npx prisma migrate dev
21
- ```
22
-
23
- 3. **Start Development Server**
24
- ```bash
25
- npm run dev
26
- # or
27
- yarn dev
28
- ```
29
-
30
- Open [http://localhost:3000](http://localhost:3000) to view your application.
31
-
32
- ## 📖 Project Structure
33
-
34
- ```
35
- ├── src/
36
- │ ├── app/ # Next.js app directory (If is Igniter Fullstack APP)
37
- │ ├── design-system/ # UI components (shadcn/ui) (If is Igniter Fullstack APP)
38
- │ ├── providers/ # Context providers
39
- │ ├── utils/ # Shared utilities
40
- │ ├── features/ # Feature modules
41
- │ │ └── [feature]/ # Feature-specific code
42
- │ │ ├── index.ts # Feature entry point
43
- │ │ ├── controllers/ # HTTP request handlers
44
- │ │ │ └── [feature].controller.ts
45
- │ │ ├── procedures/ # Business logic
46
- │ │ │ └── [feature].procedure.ts
47
- │ │ ├── [feature].interface.ts # Feature types
48
- │ │ └── [feature].ts # Feature configuration
49
- │ └── configs/ # Configuration files
50
- ├── public/ # Static files
51
- └── .github/ # GitHub configuration
52
- ```
53
-
54
- ## 🛠 Available Scripts
55
-
56
- - `npm run dev` - Start development server
57
- - `npm run build` - Build for production
58
- - `npm run start` - Start production server
59
- - `npm run lint` - Run ESLint
60
-
61
- ### Igniter CLI Commands
62
- - `npx @igniter-js/cli generate feature [name]` - Generate a new feature
63
-
64
- ## 🏗 Feature Generation
65
- Generate a new feature using the Igniter CLI:
66
-
67
- ```bash
68
- npx @igniter-js/cli generate feature
69
- ```
70
-
71
- This will create a new feature with the following structure:
72
- ```
73
- src/features/users/
74
- ├── features/ # Feature modules
75
- │ └── [feature]/ # Feature-specific code
76
- │ ├── index.ts # Feature entry point
77
- │ ├── controllers/ # HTTP request handlers
78
- │ │ └── [feature].controller.ts
79
- │ ├── procedures/ # Business logic
80
- │ │ └── [feature].procedure.ts
81
- │ ├── [feature].interface.ts # Feature types
82
- │ └── [feature].ts # Feature configuration
83
- ```
84
-
85
- ## 🧩 Tech Stack
86
-
87
- - **Framework**: Igniter.js (Next.js 15)
88
- - **Language**: TypeScript
89
- - **Styling**: Tailwind CSS
90
- - **UI Components**: shadcn/ui
91
- - **Database**: Prisma
92
- - **Testing**: Vitest
93
- - **State Management**: React Context
94
- - **API Layer**: Feature-based controllers
95
- - **Validation**: Zod
96
- - **Development**: Docker
97
-
98
- ## 📚 Documentation
99
-
100
- For more detailed documentation:
101
-
102
- - [Igniter Framework Documentation](https://github.com/felipebarcelospro/igniter-js)
103
- - [Next.js Documentation](https://nextjs.org/docs)
104
- - [Prisma Documentation](https://www.prisma.io/docs)
105
- - [shadcn/ui Documentation](https://ui.shadcn.com)
106
- - [Tailwind CSS Documentation](https://tailwindcss.com/docs)
107
- - [Zod Documentation](https://zod.dev)
108
-
109
- ## 🤝 Contributing
110
-
111
- 1. Fork the repository
112
- 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
113
- 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
114
- 4. Push to the branch (`git push origin feature/amazing-feature`)
115
- 5. Open a Pull Request
116
-
117
- ## 📝 License
118
-
119
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -1,4 +0,0 @@
1
- import { AppRouter } from '@/igniter.router'
2
- import { nextRouteHandlerAdapter } from '@igniter-js/core/adapters'
3
-
4
- export const { GET, POST, PUT, DELETE } = nextRouteHandlerAdapter(AppRouter)
@@ -1,39 +0,0 @@
1
- import { zodResolver } from "@hookform/resolvers/zod";
2
- import { useEffect, useRef } from "react";
3
- import { useForm } from "react-hook-form";
4
- import type { z } from "zod";
5
-
6
- interface UseFormOptions<T extends z.ZodType> {
7
- schema: T;
8
- defaultValues?: z.infer<T>;
9
- onSubmit?: (values: z.infer<T>) => void;
10
- }
11
-
12
- export function useFormWithZod<T extends z.ZodType>({
13
- schema,
14
- defaultValues,
15
- onSubmit,
16
- ...rest
17
- }: UseFormOptions<T>) {
18
- const form = useForm<z.infer<T>>({
19
- resolver: zodResolver(schema),
20
- defaultValues,
21
- ...rest,
22
- });
23
-
24
- const prevDefaultValuesRef = useRef(defaultValues);
25
-
26
- useEffect(() => {
27
- const isDefaultValuesDifferent = JSON.stringify(prevDefaultValuesRef.current) !== JSON.stringify(defaultValues);
28
-
29
- if (defaultValues && isDefaultValuesDifferent) {
30
- prevDefaultValuesRef.current = defaultValues;
31
- form.reset(defaultValues);
32
- }
33
- }, [defaultValues, form]);
34
-
35
- return {
36
- ...form,
37
- onSubmit: form.handleSubmit(onSubmit || (() => {})),
38
- };
39
- }
@@ -1,11 +0,0 @@
1
- /// <reference types="vitest" />
2
- import { defineConfig } from 'vitest/config'
3
- import react from '@vitejs/plugin-react'
4
- import tsconfigPaths from 'vite-tsconfig-paths'
5
-
6
- export default defineConfig({
7
- plugins: [tsconfigPaths(), react()],
8
- test: {
9
- environment: 'jsdom',
10
- },
11
- })
@@ -1,53 +0,0 @@
1
- {
2
- // Git Settings
3
- "git.ignoreLimitWarning": true,
4
-
5
- // Chat General Settings
6
- "chat.promptFiles": true,
7
-
8
- // GitHub Copilot Chat Settings
9
- "github.copilot.chat.edits.codesearch.enabled": true, // Enable code search in chat edits
10
- "github.copilot.chat.edits.suggestRelatedFilesFromGitHistory": true, // Suggest related files from git history
11
- "github.copilot.chat.edits.temporalContext.enabled": true, // Enable temporal context in chat edits
12
-
13
- // GitHub Copilot Instructions Configuration
14
- "github.copilot.chat.codeGeneration.useInstructionFiles": true,
15
- "github.copilot.chat.codeGeneration.instructions": [
16
- {
17
- "file": "/.github/copilot.instructions.md" // General instructions
18
- },
19
- {
20
- "file": "/.github/copilot.feature.instructions.md" // Feature-specific instructions
21
- },
22
- {
23
- "file": "/.github/copilot.igniter.instructions.md" // Igniter.js specific instructions
24
- },
25
- {
26
- "file": "/.github/copilot.next.instructions.md" // Next.js specific instructions
27
- },
28
- {
29
- "file": "/.github/copilot.form.instructions.md" // Form specific instructions
30
- }
31
- ],
32
-
33
- // Test Generation Instructions
34
- "github.copilot.chat.testGeneration.instructions": [
35
- {
36
- "file": "/.github/copilot.test.instructions.md" // Test-specific instructions
37
- }
38
- ],
39
-
40
- // Code Review Instructions
41
- "github.copilot.chat.reviewSelection.instructions": [
42
- {
43
- "file": "/.github/copilot.review.instructions.md" // Review-specific instructions
44
- }
45
- ],
46
-
47
- // Commit Message Configuration
48
- "github.copilot.chat.commitMessageGeneration.instructions": [
49
- {
50
- "text": "Follow Conventional Commits format. For example, 'feat: add new feature'." // Commit message format instructions
51
- }
52
- ]
53
- }
@@ -1,17 +0,0 @@
1
- import { CLIHelper } from './helpers';
2
- export declare class AnalyzeCommand extends CLIHelper {
3
- private readonly schemaParser;
4
- private report;
5
- private spinner;
6
- constructor(basePath?: string);
7
- private initializeReport;
8
- analyze(): Promise<void>;
9
- private analyzeSchema;
10
- private analyzeFeatures;
11
- private analyzeDependencies;
12
- private analyzePerformance;
13
- private getAllFiles;
14
- private countApiEndpoints;
15
- private calculateBundleSize;
16
- private displayReport;
17
- }