@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.
Files changed (132) hide show
  1. package/README.md +42 -42
  2. package/package.json +44 -92
  3. package/src/actions/configure-package-json.js +32 -0
  4. package/src/actions/init-project.js +40 -0
  5. package/src/actions/init-shadcn-ui.js +48 -0
  6. package/src/actions/init-theme.js +28 -0
  7. package/src/actions/init-tioelvis-components.js +42 -0
  8. package/src/actions/install-main-packages.js +51 -0
  9. package/src/constants.js +234 -97
  10. package/src/lib/exception.js +9 -0
  11. package/src/lib/utils.js +55 -0
  12. package/src/main.js +158 -229
  13. package/src/template/eslint.config.mjs +15 -13
  14. package/src/template/postcss.config.mjs +3 -1
  15. package/src/template/src/app/globals.css +0 -122
  16. package/src/template/src/app/layout.tsx +7 -15
  17. package/src/template/src/app/page.tsx +6 -2
  18. package/src/template/tsconfig.json +9 -2
  19. package/src/themes/blue.css +141 -0
  20. package/src/themes/default.css +141 -0
  21. package/src/themes/green.css +141 -0
  22. package/src/themes/orange.css +141 -0
  23. package/src/themes/red.css +141 -0
  24. package/src/themes/rose.css +141 -0
  25. package/src/themes/violet.css +141 -0
  26. package/src/themes/yellow.css +141 -0
  27. package/src/tioelvis-components/max-width-wrapper.tsx +21 -0
  28. package/src/app/components/ui/accordion.json +0 -6
  29. package/src/app/components/ui/accordion.tsx +0 -64
  30. package/src/app/components/ui/alert-dialog.json +0 -6
  31. package/src/app/components/ui/alert-dialog.tsx +0 -157
  32. package/src/app/components/ui/alert.json +0 -6
  33. package/src/app/components/ui/alert.tsx +0 -66
  34. package/src/app/components/ui/aspect-ratio.json +0 -6
  35. package/src/app/components/ui/aspect-ratio.tsx +0 -11
  36. package/src/app/components/ui/avatar.json +0 -6
  37. package/src/app/components/ui/avatar.tsx +0 -53
  38. package/src/app/components/ui/badge.json +0 -6
  39. package/src/app/components/ui/badge.tsx +0 -46
  40. package/src/app/components/ui/breadcrumb.json +0 -6
  41. package/src/app/components/ui/breadcrumb.tsx +0 -107
  42. package/src/app/components/ui/button.json +0 -6
  43. package/src/app/components/ui/button.tsx +0 -58
  44. package/src/app/components/ui/calendar.json +0 -6
  45. package/src/app/components/ui/calendar.tsx +0 -213
  46. package/src/app/components/ui/card.json +0 -6
  47. package/src/app/components/ui/card.tsx +0 -92
  48. package/src/app/components/ui/carousel.json +0 -6
  49. package/src/app/components/ui/carousel.tsx +0 -236
  50. package/src/app/components/ui/chart.json +0 -6
  51. package/src/app/components/ui/chart.tsx +0 -347
  52. package/src/app/components/ui/checkbox.json +0 -6
  53. package/src/app/components/ui/checkbox.tsx +0 -30
  54. package/src/app/components/ui/collapsible.json +0 -6
  55. package/src/app/components/ui/collapsible.tsx +0 -33
  56. package/src/app/components/ui/command.json +0 -6
  57. package/src/app/components/ui/command.tsx +0 -182
  58. package/src/app/components/ui/context-menu.json +0 -6
  59. package/src/app/components/ui/context-menu.tsx +0 -249
  60. package/src/app/components/ui/dialog.json +0 -6
  61. package/src/app/components/ui/dialog.tsx +0 -141
  62. package/src/app/components/ui/drawer.json +0 -6
  63. package/src/app/components/ui/drawer.tsx +0 -134
  64. package/src/app/components/ui/dropdown-menu.json +0 -6
  65. package/src/app/components/ui/dropdown-menu.tsx +0 -256
  66. package/src/app/components/ui/form.json +0 -12
  67. package/src/app/components/ui/form.tsx +0 -167
  68. package/src/app/components/ui/hover-card.json +0 -6
  69. package/src/app/components/ui/hover-card.tsx +0 -49
  70. package/src/app/components/ui/input-otp.json +0 -6
  71. package/src/app/components/ui/input-otp.tsx +0 -76
  72. package/src/app/components/ui/input.json +0 -6
  73. package/src/app/components/ui/input.tsx +0 -21
  74. package/src/app/components/ui/label.json +0 -6
  75. package/src/app/components/ui/label.tsx +0 -24
  76. package/src/app/components/ui/menubar.json +0 -6
  77. package/src/app/components/ui/menubar.tsx +0 -273
  78. package/src/app/components/ui/navigation-menu.json +0 -6
  79. package/src/app/components/ui/navigation-menu.tsx +0 -164
  80. package/src/app/components/ui/pagination.json +0 -6
  81. package/src/app/components/ui/pagination.tsx +0 -124
  82. package/src/app/components/ui/popover.json +0 -6
  83. package/src/app/components/ui/popover.tsx +0 -55
  84. package/src/app/components/ui/progress.json +0 -6
  85. package/src/app/components/ui/progress.tsx +0 -30
  86. package/src/app/components/ui/radio-group.json +0 -6
  87. package/src/app/components/ui/radio-group.tsx +0 -43
  88. package/src/app/components/ui/resizable.json +0 -6
  89. package/src/app/components/ui/resizable.tsx +0 -55
  90. package/src/app/components/ui/scroll-area.json +0 -6
  91. package/src/app/components/ui/scroll-area.tsx +0 -55
  92. package/src/app/components/ui/select.json +0 -6
  93. package/src/app/components/ui/select.tsx +0 -179
  94. package/src/app/components/ui/separator.json +0 -6
  95. package/src/app/components/ui/separator.tsx +0 -28
  96. package/src/app/components/ui/sheet.json +0 -6
  97. package/src/app/components/ui/sheet.tsx +0 -145
  98. package/src/app/components/ui/sidebar.json +0 -6
  99. package/src/app/components/ui/sidebar.tsx +0 -718
  100. package/src/app/components/ui/skeleton.json +0 -6
  101. package/src/app/components/ui/skeleton.tsx +0 -13
  102. package/src/app/components/ui/slider.json +0 -6
  103. package/src/app/components/ui/slider.tsx +0 -61
  104. package/src/app/components/ui/sonner.json +0 -6
  105. package/src/app/components/ui/sonner.tsx +0 -25
  106. package/src/app/components/ui/switch.json +0 -6
  107. package/src/app/components/ui/switch.tsx +0 -30
  108. package/src/app/components/ui/table.json +0 -6
  109. package/src/app/components/ui/table.tsx +0 -115
  110. package/src/app/components/ui/tabs.json +0 -6
  111. package/src/app/components/ui/tabs.tsx +0 -66
  112. package/src/app/components/ui/textarea.json +0 -6
  113. package/src/app/components/ui/textarea.tsx +0 -18
  114. package/src/app/components/ui/toggle-group.json +0 -6
  115. package/src/app/components/ui/toggle-group.tsx +0 -71
  116. package/src/app/components/ui/toggle.json +0 -6
  117. package/src/app/components/ui/toggle.tsx +0 -47
  118. package/src/app/components/ui/tooltip.json +0 -6
  119. package/src/app/components/ui/tooltip.tsx +0 -60
  120. package/src/app/hooks/use-mobile.ts +0 -21
  121. package/src/app/lib/utils.ts +0 -6
  122. package/src/app/tsconfig.json +0 -27
  123. package/src/template/components.json +0 -21
  124. package/src/template/next-env.d.ts +0 -5
  125. package/src/template/public/.gitkeep +0 -0
  126. package/src/template/src/lib/axios.ts +0 -39
  127. package/src/template/src/lib/constants.ts +0 -1
  128. package/src/template/src/lib/utils.ts +0 -6
  129. package/src/template/src/providers/query.provider.tsx +0 -12
  130. package/src/template/src/providers/theme.provider.tsx +0 -8
  131. package/src/utils.js +0 -113
  132. /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,6 +0,0 @@
1
- import { twMerge } from "tailwind-merge";
2
- import { clsx, type ClassValue } from "clsx";
3
-
4
- export function cn(...inputs: ClassValue[]) {
5
- return twMerge(clsx(inputs));
6
- }
@@ -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