@tioelvis/next-template 2.4.8 ā 3.0.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 +42 -42
- package/package.json +44 -92
- package/src/actions/configure-package-json.js +32 -0
- package/src/actions/init-project.js +40 -0
- package/src/actions/init-shadcn-ui.js +48 -0
- package/src/actions/init-theme.js +28 -0
- package/src/actions/init-tioelvis-components.js +42 -0
- package/src/actions/install-main-packages.js +51 -0
- package/src/constants.js +234 -97
- package/src/lib/exception.js +9 -0
- package/src/lib/utils.js +55 -0
- package/src/main.js +158 -229
- package/src/template/eslint.config.mjs +15 -13
- package/src/template/postcss.config.mjs +3 -1
- package/src/template/src/app/globals.css +0 -122
- package/src/template/src/app/layout.tsx +7 -15
- package/src/template/src/app/page.tsx +6 -2
- package/src/template/tsconfig.json +9 -2
- package/src/themes/blue.css +141 -0
- package/src/themes/default.css +141 -0
- package/src/themes/green.css +141 -0
- package/src/themes/orange.css +141 -0
- package/src/themes/red.css +141 -0
- package/src/themes/rose.css +141 -0
- package/src/themes/violet.css +141 -0
- package/src/themes/yellow.css +141 -0
- package/src/tioelvis-components/max-width-wrapper.tsx +21 -0
- package/src/app/components/ui/accordion.json +0 -6
- package/src/app/components/ui/accordion.tsx +0 -64
- package/src/app/components/ui/alert-dialog.json +0 -6
- package/src/app/components/ui/alert-dialog.tsx +0 -157
- package/src/app/components/ui/alert.json +0 -6
- package/src/app/components/ui/alert.tsx +0 -66
- package/src/app/components/ui/aspect-ratio.json +0 -6
- package/src/app/components/ui/aspect-ratio.tsx +0 -11
- package/src/app/components/ui/avatar.json +0 -6
- package/src/app/components/ui/avatar.tsx +0 -53
- package/src/app/components/ui/badge.json +0 -6
- package/src/app/components/ui/badge.tsx +0 -46
- package/src/app/components/ui/breadcrumb.json +0 -6
- package/src/app/components/ui/breadcrumb.tsx +0 -107
- package/src/app/components/ui/button.json +0 -6
- package/src/app/components/ui/button.tsx +0 -58
- package/src/app/components/ui/calendar.json +0 -6
- package/src/app/components/ui/calendar.tsx +0 -213
- package/src/app/components/ui/card.json +0 -6
- package/src/app/components/ui/card.tsx +0 -92
- package/src/app/components/ui/carousel.json +0 -6
- package/src/app/components/ui/carousel.tsx +0 -236
- package/src/app/components/ui/chart.json +0 -6
- package/src/app/components/ui/chart.tsx +0 -347
- package/src/app/components/ui/checkbox.json +0 -6
- package/src/app/components/ui/checkbox.tsx +0 -30
- package/src/app/components/ui/collapsible.json +0 -6
- package/src/app/components/ui/collapsible.tsx +0 -33
- package/src/app/components/ui/command.json +0 -6
- package/src/app/components/ui/command.tsx +0 -182
- package/src/app/components/ui/context-menu.json +0 -6
- package/src/app/components/ui/context-menu.tsx +0 -249
- package/src/app/components/ui/dialog.json +0 -6
- package/src/app/components/ui/dialog.tsx +0 -141
- package/src/app/components/ui/drawer.json +0 -6
- package/src/app/components/ui/drawer.tsx +0 -134
- package/src/app/components/ui/dropdown-menu.json +0 -6
- package/src/app/components/ui/dropdown-menu.tsx +0 -256
- package/src/app/components/ui/form.json +0 -12
- package/src/app/components/ui/form.tsx +0 -167
- package/src/app/components/ui/hover-card.json +0 -6
- package/src/app/components/ui/hover-card.tsx +0 -49
- package/src/app/components/ui/input-otp.json +0 -6
- package/src/app/components/ui/input-otp.tsx +0 -76
- package/src/app/components/ui/input.json +0 -6
- package/src/app/components/ui/input.tsx +0 -21
- package/src/app/components/ui/label.json +0 -6
- package/src/app/components/ui/label.tsx +0 -24
- package/src/app/components/ui/menubar.json +0 -6
- package/src/app/components/ui/menubar.tsx +0 -273
- package/src/app/components/ui/navigation-menu.json +0 -6
- package/src/app/components/ui/navigation-menu.tsx +0 -164
- package/src/app/components/ui/pagination.json +0 -6
- package/src/app/components/ui/pagination.tsx +0 -124
- package/src/app/components/ui/popover.json +0 -6
- package/src/app/components/ui/popover.tsx +0 -55
- package/src/app/components/ui/progress.json +0 -6
- package/src/app/components/ui/progress.tsx +0 -30
- package/src/app/components/ui/radio-group.json +0 -6
- package/src/app/components/ui/radio-group.tsx +0 -43
- package/src/app/components/ui/resizable.json +0 -6
- package/src/app/components/ui/resizable.tsx +0 -55
- package/src/app/components/ui/scroll-area.json +0 -6
- package/src/app/components/ui/scroll-area.tsx +0 -55
- package/src/app/components/ui/select.json +0 -6
- package/src/app/components/ui/select.tsx +0 -179
- package/src/app/components/ui/separator.json +0 -6
- package/src/app/components/ui/separator.tsx +0 -28
- package/src/app/components/ui/sheet.json +0 -6
- package/src/app/components/ui/sheet.tsx +0 -145
- package/src/app/components/ui/sidebar.json +0 -6
- package/src/app/components/ui/sidebar.tsx +0 -718
- package/src/app/components/ui/skeleton.json +0 -6
- package/src/app/components/ui/skeleton.tsx +0 -13
- package/src/app/components/ui/slider.json +0 -6
- package/src/app/components/ui/slider.tsx +0 -61
- package/src/app/components/ui/sonner.json +0 -6
- package/src/app/components/ui/sonner.tsx +0 -25
- package/src/app/components/ui/switch.json +0 -6
- package/src/app/components/ui/switch.tsx +0 -30
- package/src/app/components/ui/table.json +0 -6
- package/src/app/components/ui/table.tsx +0 -115
- package/src/app/components/ui/tabs.json +0 -6
- package/src/app/components/ui/tabs.tsx +0 -66
- package/src/app/components/ui/textarea.json +0 -6
- package/src/app/components/ui/textarea.tsx +0 -18
- package/src/app/components/ui/toggle-group.json +0 -6
- package/src/app/components/ui/toggle-group.tsx +0 -71
- package/src/app/components/ui/toggle.json +0 -6
- package/src/app/components/ui/toggle.tsx +0 -47
- package/src/app/components/ui/tooltip.json +0 -6
- package/src/app/components/ui/tooltip.tsx +0 -60
- package/src/app/hooks/use-mobile.ts +0 -21
- package/src/app/lib/utils.ts +0 -6
- package/src/app/tsconfig.json +0 -27
- package/src/template/components.json +0 -21
- package/src/template/next-env.d.ts +0 -5
- package/src/template/public/.gitkeep +0 -0
- package/src/template/src/lib/axios.ts +0 -39
- package/src/template/src/lib/constants.ts +0 -1
- package/src/template/src/lib/utils.ts +0 -6
- package/src/template/src/providers/query.provider.tsx +0 -12
- package/src/template/src/providers/theme.provider.tsx +0 -8
- package/src/utils.js +0 -113
- /package/src/template/{src/app ā public}/favicon.ico +0 -0
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { API } from "@/lib/constants";
|
|
2
|
-
import axios, { isAxiosError } from "axios";
|
|
3
|
-
|
|
4
|
-
export const axios_instance = axios.create({
|
|
5
|
-
baseURL: API,
|
|
6
|
-
withCredentials: true,
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
export class CustomAxiosError extends Error {
|
|
10
|
-
status: number;
|
|
11
|
-
|
|
12
|
-
constructor(error: unknown) {
|
|
13
|
-
let message = "";
|
|
14
|
-
let status = 500;
|
|
15
|
-
|
|
16
|
-
if (isAxiosError(error) === true) {
|
|
17
|
-
status = error.response?.status ?? 500;
|
|
18
|
-
const p = error.response?.data?.message;
|
|
19
|
-
|
|
20
|
-
if (status === 401 || status === 403) {
|
|
21
|
-
message = "Access denied";
|
|
22
|
-
} else if (p !== undefined) {
|
|
23
|
-
message =
|
|
24
|
-
Array.isArray(p?.message) === true ? p.message[0] : p.message ?? p;
|
|
25
|
-
} else {
|
|
26
|
-
message = "Server error";
|
|
27
|
-
}
|
|
28
|
-
} else if (error instanceof Error) {
|
|
29
|
-
message = error.message;
|
|
30
|
-
} else {
|
|
31
|
-
message = "Unknown error";
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
super(message);
|
|
35
|
-
this.name = "CustomAxiosError";
|
|
36
|
-
this.status = status;
|
|
37
|
-
Object.setPrototypeOf(this, CustomAxiosError.prototype);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const API = process.env.NEXT_PUBLIC_API;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
3
|
-
|
|
4
|
-
const client = new QueryClient();
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
children: React.ReactNode;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function QueryProvider({ children }: Readonly<Props>) {
|
|
11
|
-
return <QueryClientProvider client={client}>{children}</QueryClientProvider>;
|
|
12
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { ThemeProvider as NextThemesProvider } from "next-themes";
|
|
3
|
-
|
|
4
|
-
type Props = React.ComponentProps<typeof NextThemesProvider>;
|
|
5
|
-
|
|
6
|
-
export function ThemeProvider({ children, ...props }: Readonly<Props>) {
|
|
7
|
-
return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
|
|
8
|
-
}
|
package/src/utils.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
COMPONENTS_PATH,
|
|
3
|
-
DEPENDENCIES,
|
|
4
|
-
DEV_DEPENDENCIES,
|
|
5
|
-
HOOKS_PATH,
|
|
6
|
-
TEMPLATE_PATH,
|
|
7
|
-
} from "./constants.js";
|
|
8
|
-
import fs from "node:fs";
|
|
9
|
-
import chalk from "chalk";
|
|
10
|
-
import path from "node:path";
|
|
11
|
-
import prompts from "prompts";
|
|
12
|
-
import { execSync } from "node:child_process";
|
|
13
|
-
|
|
14
|
-
function on_cancel() {
|
|
15
|
-
console.log(chalk.yellow("\nš Exiting..."));
|
|
16
|
-
process.exit(0);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function run_command(cmd, cwd) {
|
|
20
|
-
try {
|
|
21
|
-
execSync(cmd, { cwd, stdio: "inherit" });
|
|
22
|
-
} catch (error) {
|
|
23
|
-
throw error;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function copy_template(dest) {
|
|
28
|
-
try {
|
|
29
|
-
fs.cpSync(TEMPLATE_PATH, dest, { recursive: true });
|
|
30
|
-
} catch (error) {
|
|
31
|
-
throw error;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async function copy_components(DEST, components) {
|
|
36
|
-
try {
|
|
37
|
-
for (const component of components) {
|
|
38
|
-
let replace = false;
|
|
39
|
-
|
|
40
|
-
const component_path = path.resolve(COMPONENTS_PATH, `${component}.tsx`);
|
|
41
|
-
const dest_folder = path.resolve(DEST, "src", "components", "ui");
|
|
42
|
-
const final_dest = path.join(dest_folder, `${component}.tsx`);
|
|
43
|
-
|
|
44
|
-
if (fs.existsSync(component_path) === false) {
|
|
45
|
-
throw new Error(`Component ${component} not found`);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (fs.existsSync(dest_folder) === false) {
|
|
49
|
-
fs.mkdirSync(dest_folder, { recursive: true });
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (fs.existsSync(final_dest) === true) {
|
|
53
|
-
const response = await prompts(
|
|
54
|
-
[
|
|
55
|
-
{
|
|
56
|
-
type: "confirm",
|
|
57
|
-
name: "replace",
|
|
58
|
-
message: `Do you want to replace ${component}.tsx?`,
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
{ onCancel: on_cancel }
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
replace = response.replace;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const json_path = path.resolve(COMPONENTS_PATH, `${component}.json`);
|
|
68
|
-
|
|
69
|
-
if (fs.existsSync(json_path) === false) {
|
|
70
|
-
throw new Error(`Json file of ${component} not found`);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const json = JSON.parse(fs.readFileSync(json_path, "utf8"));
|
|
74
|
-
|
|
75
|
-
if (fs.existsSync(final_dest) === false || replace === true) {
|
|
76
|
-
console.log(chalk.gray(`š Add ${component}.tsx file`));
|
|
77
|
-
fs.copyFileSync(component_path, final_dest);
|
|
78
|
-
|
|
79
|
-
for (const hook of json.hooks) {
|
|
80
|
-
const hook_path = path.resolve(HOOKS_PATH, `${hook}.ts`);
|
|
81
|
-
const dest_folder = path.resolve(DEST, "src", "hooks");
|
|
82
|
-
const final_dest = path.join(dest_folder, `${hook}.ts`);
|
|
83
|
-
|
|
84
|
-
if (fs.existsSync(hook_path) === false) {
|
|
85
|
-
throw new Error(`Hook ${hook} not found for component ${e}`);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (fs.existsSync(dest_folder) === false) {
|
|
89
|
-
fs.mkdirSync(dest_folder, { recursive: true });
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
fs.copyFileSync(hook_path, final_dest);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
for (const support of json.supports) {
|
|
97
|
-
await copy_components(DEST, [support]);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
for (const dependence of json.dependencies) {
|
|
101
|
-
DEPENDENCIES.push(dependence);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
for (const dev_dependence of json.dev_dependence) {
|
|
105
|
-
DEV_DEPENDENCIES.push(dev_dependence);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
} catch (error) {
|
|
109
|
-
throw error;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export { on_cancel, run_command, copy_template, copy_components };
|
|
File without changes
|