stackkit 0.2.0 → 0.2.1
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 +4 -7
- package/dist/cli/add.js +40 -105
- package/dist/cli/create.js +28 -15
- package/dist/cli/doctor.js +203 -21
- package/dist/cli/list.js +37 -1
- package/dist/index.js +104 -6
- package/dist/lib/discovery/module-discovery.d.ts +0 -7
- package/dist/lib/discovery/module-discovery.js +26 -23
- package/dist/lib/discovery/shared.d.ts +6 -0
- package/dist/lib/discovery/shared.js +50 -0
- package/dist/lib/framework/framework-utils.js +43 -3
- package/dist/lib/pm/package-manager.js +58 -31
- package/modules/auth/authjs/generator.json +1 -1
- package/modules/auth/better-auth/files/lib/auth.ts +5 -1
- package/package.json +1 -1
- package/templates/express/README.md +4 -9
- package/templates/express/template.json +9 -1
- package/templates/nextjs/.env.example +1 -0
- package/templates/nextjs/README.md +2 -5
- package/templates/nextjs/template.json +2 -0
- package/templates/react/README.md +2 -5
- package/templates/react/src/lib/queryClient.ts +2 -2
- package/templates/react/src/utils/utils.ts +3 -0
- package/templates/react/template.json +2 -0
- package/templates/react/src/config/constants.ts +0 -5
- package/templates/react/src/hooks/index.ts +0 -64
- package/templates/react/src/utils/helpers.ts +0 -51
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Production-ready React starter with TypeScript, Vite, and essential libraries.
|
|
4
4
|
|
|
5
|
-
Requirements
|
|
6
|
-
------------
|
|
5
|
+
## Requirements
|
|
7
6
|
|
|
8
7
|
- Node.js 18+ (LTS recommended)
|
|
9
8
|
- pnpm (recommended) or npm
|
|
10
9
|
|
|
11
|
-
Quick Start
|
|
12
|
-
-----------
|
|
10
|
+
## Quick Start
|
|
13
11
|
|
|
14
12
|
Install dependencies and run the dev server:
|
|
15
13
|
|
|
@@ -89,4 +87,3 @@ This project was scaffolded using **StackKit** — a CLI toolkit for building pr
|
|
|
89
87
|
|
|
90
88
|
Learn more about StackKit:
|
|
91
89
|
https://github.com/tariqul420/stackkit
|
|
92
|
-
|
|
@@ -3,8 +3,8 @@ import { QueryClient } from "@tanstack/react-query";
|
|
|
3
3
|
export const queryClient = new QueryClient({
|
|
4
4
|
defaultOptions: {
|
|
5
5
|
queries: {
|
|
6
|
-
staleTime: 1000 * 60 * 5,
|
|
7
|
-
gcTime: 1000 * 60 * 10,
|
|
6
|
+
staleTime: 1000 * 60 * 5,
|
|
7
|
+
gcTime: 1000 * 60 * 10,
|
|
8
8
|
retry: 1,
|
|
9
9
|
refetchOnWindowFocus: false,
|
|
10
10
|
},
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export const APP_NAME = import.meta.env.VITE_APP_NAME || "React App";
|
|
2
|
-
export const APP_VERSION = import.meta.env.VITE_APP_VERSION || "1.0.0";
|
|
3
|
-
export const API_URL = import.meta.env.VITE_API_URL || "http://localhost:3000/api";
|
|
4
|
-
export const IS_DEV = import.meta.env.DEV;
|
|
5
|
-
export const IS_PROD = import.meta.env.PROD;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
|
|
3
|
-
export function useDebounce<T>(value: T, delay: number): T {
|
|
4
|
-
const [debouncedValue, setDebouncedValue] = useState<T>(value);
|
|
5
|
-
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
const handler = setTimeout(() => {
|
|
8
|
-
setDebouncedValue(value);
|
|
9
|
-
}, delay);
|
|
10
|
-
|
|
11
|
-
return () => {
|
|
12
|
-
clearTimeout(handler);
|
|
13
|
-
};
|
|
14
|
-
}, [value, delay]);
|
|
15
|
-
|
|
16
|
-
return debouncedValue;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function useLocalStorage<T>(
|
|
20
|
-
key: string,
|
|
21
|
-
initialValue: T,
|
|
22
|
-
): [T, (value: T | ((val: T) => T)) => void] {
|
|
23
|
-
const [storedValue, setStoredValue] = useState<T>(() => {
|
|
24
|
-
try {
|
|
25
|
-
const item = window.localStorage.getItem(key);
|
|
26
|
-
return item ? JSON.parse(item) : initialValue;
|
|
27
|
-
} catch (error) {
|
|
28
|
-
console.error(error);
|
|
29
|
-
return initialValue;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const setValue = (value: T | ((val: T) => T)) => {
|
|
34
|
-
try {
|
|
35
|
-
const valueToStore = value instanceof Function ? value(storedValue) : value;
|
|
36
|
-
setStoredValue(valueToStore);
|
|
37
|
-
window.localStorage.setItem(key, JSON.stringify(valueToStore));
|
|
38
|
-
} catch (error) {
|
|
39
|
-
console.error(error);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
return [storedValue, setValue];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function useMediaQuery(query: string): boolean {
|
|
47
|
-
const [matches, setMatches] = useState(() => {
|
|
48
|
-
if (typeof window !== "undefined") {
|
|
49
|
-
return window.matchMedia(query).matches;
|
|
50
|
-
}
|
|
51
|
-
return false;
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
const media = window.matchMedia(query);
|
|
56
|
-
|
|
57
|
-
const listener = () => setMatches(media.matches);
|
|
58
|
-
media.addEventListener("change", listener);
|
|
59
|
-
|
|
60
|
-
return () => media.removeEventListener("change", listener);
|
|
61
|
-
}, [query]);
|
|
62
|
-
|
|
63
|
-
return matches;
|
|
64
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
export function cn(...classes: (string | boolean | undefined | null)[]): string {
|
|
2
|
-
return classes.filter(Boolean).join(" ");
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export function formatDate(date: Date | string): string {
|
|
6
|
-
const d = typeof date === "string" ? new Date(date) : date;
|
|
7
|
-
return d.toLocaleDateString("en-US", {
|
|
8
|
-
year: "numeric",
|
|
9
|
-
month: "long",
|
|
10
|
-
day: "numeric",
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function truncate(str: string, maxLength: number): string {
|
|
15
|
-
if (str.length <= maxLength) return str;
|
|
16
|
-
return str.slice(0, maxLength) + "...";
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function delay(ms: number): Promise<void> {
|
|
20
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function debounce<T extends (...args: never[]) => unknown>(
|
|
24
|
-
func: T,
|
|
25
|
-
wait: number,
|
|
26
|
-
): (...args: Parameters<T>) => void {
|
|
27
|
-
let timeout: ReturnType<typeof setTimeout> | null = null;
|
|
28
|
-
|
|
29
|
-
return function executedFunction(...args: Parameters<T>) {
|
|
30
|
-
const later = () => {
|
|
31
|
-
timeout = null;
|
|
32
|
-
func(...args);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
if (timeout) clearTimeout(timeout);
|
|
36
|
-
timeout = setTimeout(later, wait);
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function capitalize(str: string): string {
|
|
41
|
-
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function slugify(str: string): string {
|
|
45
|
-
return str
|
|
46
|
-
.toLowerCase()
|
|
47
|
-
.trim()
|
|
48
|
-
.replace(/[^\w\s-]/g, "")
|
|
49
|
-
.replace(/[\s_-]+/g, "-")
|
|
50
|
-
.replace(/^-+|-+$/g, "");
|
|
51
|
-
}
|