refactor(nvim): streamline Neovim configuration and plugin management
This commit is contained in:
1 parent
06e0bab7dd
commit
bdf8ad1bb0
27 files changed
+1797
-476
No files matched your search
@@ -0,0 +1,58 @@
|
||||
;; typescript
|
||||
/**
|
||||
* {{_camel_case_file_}} API Client
|
||||
* @author {{_author_}}
|
||||
* @created {{_date_}}
|
||||
*/
|
||||
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
|
||||
// API Types
|
||||
interface {{_camel_case_file_}}Data {
|
||||
{{_cursor_}}
|
||||
}
|
||||
|
||||
// Query Keys
|
||||
export const {{_file_name_}}Keys = {
|
||||
all: ['{{_file_name_}}'] as const,
|
||||
lists: () => [...{{_file_name_}}Keys.all, 'list'] as const,
|
||||
list: (filters: string) => [...{{_file_name_}}Keys.lists(), { filters }] as const,
|
||||
details: () => [...{{_file_name_}}Keys.all, 'detail'] as const,
|
||||
detail: (id: string) => [...{{_file_name_}}Keys.details(), id] as const,
|
||||
}
|
||||
|
||||
// API Functions
|
||||
async function fetch{{_camel_case_file_}}(id: string): Promise<{{_camel_case_file_}}Data> {
|
||||
const response = await fetch(`/api/{{_file_name_}}/${id}`)
|
||||
if (!response.ok) throw new Error('Failed to fetch {{_file_name_}}')
|
||||
return response.json()
|
||||
}
|
||||
|
||||
async function create{{_camel_case_file_}}(data: Partial<{{_camel_case_file_}}Data>): Promise<{{_camel_case_file_}}Data> {
|
||||
const response = await fetch('/api/{{_file_name_}}', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
if (!response.ok) throw new Error('Failed to create {{_file_name_}}')
|
||||
return response.json()
|
||||
}
|
||||
|
||||
// Hooks
|
||||
export function use{{_camel_case_file_}}(id: string) {
|
||||
return useQuery({
|
||||
queryKey: {{_file_name_}}Keys.detail(id),
|
||||
queryFn: () => fetch{{_camel_case_file_}}(id),
|
||||
})
|
||||
}
|
||||
|
||||
export function useCreate{{_camel_case_file_}}() {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
mutationFn: create{{_camel_case_file_}},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: {{_file_name_}}Keys.lists() })
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
;; typescriptreact
|
||||
/**
|
||||
* {{_camel_case_file_}} Component
|
||||
* @author {{_author_}}
|
||||
* @created {{_date_}}
|
||||
*/
|
||||
|
||||
import { memo } from 'react'
|
||||
|
||||
interface {{_camel_case_file_}}Props {
|
||||
{{_cursor_}}
|
||||
}
|
||||
|
||||
export const {{_camel_case_file_}} = memo<{{_camel_case_file_}}Props>(({ }) => {
|
||||
return (
|
||||
<div>
|
||||
|
||||
</div>
|
||||
)
|
||||
})
|
||||
|
||||
{{_camel_case_file_}}.displayName = '{{_camel_case_file_}}'
|
||||
@@ -0,0 +1,24 @@
|
||||
;; typescript
|
||||
/**
|
||||
* {{_camel_case_file_}} Hook
|
||||
* @author {{_author_}}
|
||||
* @created {{_date_}}
|
||||
*/
|
||||
|
||||
import { useState, useEffect } from 'react'
|
||||
|
||||
interface Use{{_camel_case_file_}}Options {
|
||||
{{_cursor_}}
|
||||
}
|
||||
|
||||
export function use{{_camel_case_file_}}(options?: Use{{_camel_case_file_}}Options) {
|
||||
const [data, setData] = useState()
|
||||
|
||||
useEffect(() => {
|
||||
// Hook logic here
|
||||
}, [])
|
||||
|
||||
return {
|
||||
data,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
;; typescriptreact
|
||||
/**
|
||||
* {{_camel_case_file_}} Page Component
|
||||
* @author {{_author_}}
|
||||
* @created {{_date_}}
|
||||
*/
|
||||
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
|
||||
export const Route = createFileRoute('/{{_file_name_}}')({
|
||||
component: {{_camel_case_file_}}Page,
|
||||
})
|
||||
|
||||
function {{_camel_case_file_}}Page() {
|
||||
{{_cursor_}}
|
||||
|
||||
return (
|
||||
<div className="container mx-auto px-4 py-8">
|
||||
<h1 className="text-3xl font-bold mb-6">{{_camel_case_file_}}</h1>
|
||||
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
;; typescript
|
||||
/**
|
||||
* Cloudflare Pages Function - {{_file_name_}}
|
||||
* @author {{_author_}}
|
||||
* @created {{_date_}}
|
||||
*/
|
||||
|
||||
interface Env {
|
||||
// Add your environment bindings here
|
||||
}
|
||||
|
||||
export const onRequest: PagesFunction<Env> = async (context) => {
|
||||
const { request, env, params } = context
|
||||
|
||||
{{_cursor_}}
|
||||
|
||||
return new Response(JSON.stringify({ success: true }), {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
;; typescript
|
||||
/**
|
||||
* Cloudflare Worker - {{_file_name_}}
|
||||
* @author {{_author_}}
|
||||
* @created {{_date_}}
|
||||
*/
|
||||
|
||||
export interface Env {
|
||||
// Add your environment bindings here
|
||||
// Example: DB: D1Database
|
||||
}
|
||||
|
||||
export default {
|
||||
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
|
||||
const url = new URL(request.url);
|
||||
|
||||
{{_cursor_}}
|
||||
|
||||
return new Response('Hello World!', {
|
||||
headers: { 'Content-Type': 'text/plain' },
|
||||
});
|
||||
},
|
||||
} satisfies ExportedHandler<Env>;
|
||||
Reference in new issue
Block a user