@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
package/src/constants.js CHANGED
@@ -1,97 +1,234 @@
1
- import path from "node:path";
2
- import { fileURLToPath } from "node:url";
3
-
4
- const __filename = fileURLToPath(import.meta.url);
5
- const __dirname = path.dirname(__filename);
6
-
7
- const TEMPLATE_PATH = path.join(__dirname, "template");
8
- const COMPONENTS_PATH = path.join(__dirname, "app", "components", "ui");
9
- const HOOKS_PATH = path.join(__dirname, "app", "hooks");
10
-
11
- const DEPENDENCIES = [
12
- "@tanstack/react-query",
13
- "axios",
14
- "class-variance-authority",
15
- "clsx",
16
- "cookies-next",
17
- "date-fns",
18
- "lucide-react",
19
- "next",
20
- "next-themes",
21
- "react",
22
- "react-dom",
23
- "tailwind-merge",
24
- ];
25
-
26
- const DEV_DEPENDENCIES = [
27
- "@eslint/eslintrc",
28
- "@tailwindcss/postcss",
29
- "@types/node",
30
- "@types/react",
31
- "@types/react-dom",
32
- "eslint",
33
- "eslint-config-next",
34
- "tailwindcss",
35
- "tw-animate-css",
36
- "typescript",
37
- ];
38
-
39
- const COMPONENTS = [
40
- "accordion",
41
- "alert",
42
- "alert-dialog",
43
- "aspect-ratio",
44
- "avatar",
45
- "badge",
46
- "breadcrumb",
47
- "button",
48
- "calendar",
49
- "card",
50
- "carousel",
51
- "chart",
52
- "checkbox",
53
- "collapsible",
54
- "command",
55
- "context-menu",
56
- "dialog",
57
- "drawer",
58
- "dropdown-menu",
59
- "form",
60
- "hover-card",
61
- "input",
62
- "input-otp",
63
- "label",
64
- "menubar",
65
- "navigation-menu",
66
- "pagination",
67
- "popover",
68
- "progress",
69
- "radio-group",
70
- "resizable",
71
- "scroll-area",
72
- "select",
73
- "separator",
74
- "sheet",
75
- "sidebar",
76
- "skeleton",
77
- "slider",
78
- "sonner",
79
- "switch",
80
- "table",
81
- "tabs",
82
- "textarea",
83
- "toggle",
84
- "toggle-group",
85
- "tooltip",
86
- ];
87
-
88
- export {
89
- __dirname,
90
- __filename,
91
- TEMPLATE_PATH,
92
- COMPONENTS_PATH,
93
- HOOKS_PATH,
94
- DEPENDENCIES,
95
- DEV_DEPENDENCIES,
96
- COMPONENTS,
97
- };
1
+ import path from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+
4
+ export const __filename = fileURLToPath(import.meta.url);
5
+ export const __dirname = path.dirname(__filename);
6
+
7
+ export const CWD = path.resolve(process.cwd());
8
+
9
+ export const TEMPLATE_FOLDER_PATH = path.join(__dirname, "template");
10
+ export const THEME_FOLDER_PATH = path.join(__dirname, "themes");
11
+ export const TIOELVIS_COMPONENTS_FOLDER_PATH = path.join(
12
+ __dirname,
13
+ "tioelvis-components"
14
+ );
15
+
16
+ export const MAIN_DEPENDENCIES = [
17
+ "next@latest",
18
+ "react@latest",
19
+ "react-dom@latest",
20
+ ];
21
+
22
+ export const MAIN_DEV_DEPENDENCIES = [
23
+ "@tailwindcss/postcss@latest",
24
+ "@types/node@latest",
25
+ "@types/react@latest",
26
+ "@types/react-dom@latest",
27
+ "eslint@latest",
28
+ "eslint-config-next@latest",
29
+ "tailwindcss@latest",
30
+ "typescript@latest",
31
+ ];
32
+
33
+ export const context = {
34
+ dest: "",
35
+ projectName: null,
36
+ packageManager: null,
37
+ isNewProject: true,
38
+ };
39
+
40
+ export const SHADCN_COMPONENTS = [
41
+ {
42
+ title: "Accordion",
43
+ value: "accordion",
44
+ description: "Collapsible content panels",
45
+ },
46
+ { title: "Alert", value: "alert", description: "Display important messages" },
47
+ {
48
+ title: "Alert Dialog",
49
+ value: "alert-dialog",
50
+ description: "Modal dialog for critical actions",
51
+ },
52
+ {
53
+ title: "Aspect Ratio",
54
+ value: "aspect-ratio",
55
+ description: "Maintain consistent aspect ratios",
56
+ },
57
+ { title: "Avatar", value: "avatar", description: "User profile images" },
58
+ { title: "Badge", value: "badge", description: "Small labels and tags" },
59
+ {
60
+ title: "Breadcrumb",
61
+ value: "breadcrumb",
62
+ description: "Navigation path indicator",
63
+ },
64
+ {
65
+ title: "Button",
66
+ value: "button",
67
+ description: "Interactive clickable elements",
68
+ },
69
+ {
70
+ title: "Calendar",
71
+ value: "calendar",
72
+ description: "Date selection component",
73
+ },
74
+ {
75
+ title: "Card",
76
+ value: "card",
77
+ description: "Container for grouped content",
78
+ },
79
+ {
80
+ title: "Carousel",
81
+ value: "carousel",
82
+ description: "Image and content slider",
83
+ },
84
+ {
85
+ title: "Chart",
86
+ value: "chart",
87
+ description: "Data visualization component",
88
+ },
89
+ { title: "Checkbox", value: "checkbox", description: "Multi-select input" },
90
+ {
91
+ title: "Collapsible",
92
+ value: "collapsible",
93
+ description: "Toggle expandable sections",
94
+ },
95
+ {
96
+ title: "Command",
97
+ value: "command",
98
+ description: "Command palette interface",
99
+ },
100
+ {
101
+ title: "Context Menu",
102
+ value: "context-menu",
103
+ description: "Right-click menu",
104
+ },
105
+ { title: "Dialog", value: "dialog", description: "Modal dialog box" },
106
+ { title: "Drawer", value: "drawer", description: "Side panel overlay" },
107
+ {
108
+ title: "Dropdown Menu",
109
+ value: "dropdown-menu",
110
+ description: "Dropdown action menu",
111
+ },
112
+ { title: "Form", value: "form", description: "Form input wrapper" },
113
+ { title: "Hover Card", value: "hover-card", description: "Tooltip on hover" },
114
+ { title: "Input", value: "input", description: "Text input field" },
115
+ {
116
+ title: "Input OTP",
117
+ value: "input-otp",
118
+ description: "One-time password input",
119
+ },
120
+ { title: "Label", value: "label", description: "Form field label" },
121
+ { title: "Menubar", value: "menubar", description: "Application menu bar" },
122
+ {
123
+ title: "Navigation Menu",
124
+ value: "navigation-menu",
125
+ description: "Horizontal navigation",
126
+ },
127
+ {
128
+ title: "Pagination",
129
+ value: "pagination",
130
+ description: "Page navigation controls",
131
+ },
132
+ { title: "Popover", value: "popover", description: "Floating content box" },
133
+ {
134
+ title: "Progress",
135
+ value: "progress",
136
+ description: "Progress bar indicator",
137
+ },
138
+ {
139
+ title: "Radio Group",
140
+ value: "radio-group",
141
+ description: "Single-select option group",
142
+ },
143
+ {
144
+ title: "Resizable",
145
+ value: "resizable",
146
+ description: "Resizable panel container",
147
+ },
148
+ {
149
+ title: "Scroll Area",
150
+ value: "scroll-area",
151
+ description: "Custom scrollable container",
152
+ },
153
+ { title: "Select", value: "select", description: "Dropdown select field" },
154
+ {
155
+ title: "Separator",
156
+ value: "separator",
157
+ description: "Visual divider line",
158
+ },
159
+ { title: "Sheet", value: "sheet", description: "Modal sheet panel" },
160
+ { title: "Sidebar", value: "sidebar", description: "Side navigation panel" },
161
+ { title: "Skeleton", value: "skeleton", description: "Loading placeholder" },
162
+ { title: "Slider", value: "slider", description: "Range slider input" },
163
+ {
164
+ title: "Sonner",
165
+ value: "sonner",
166
+ description: "Toast notification system",
167
+ },
168
+ { title: "Switch", value: "switch", description: "Toggle switch control" },
169
+ { title: "Table", value: "table", description: "Data table component" },
170
+ { title: "Tabs", value: "tabs", description: "Tabbed content sections" },
171
+ {
172
+ title: "Textarea",
173
+ value: "textarea",
174
+ description: "Multi-line text input",
175
+ },
176
+ { title: "Toggle", value: "toggle", description: "Toggle button control" },
177
+ {
178
+ title: "Toggle Group",
179
+ value: "toggle-group",
180
+ description: "Group of toggle buttons",
181
+ },
182
+ { title: "Tooltip", value: "tooltip", description: "Informative hover text" },
183
+ ];
184
+
185
+ export const THEME_COLORS = [
186
+ {
187
+ title: "Default",
188
+ value: "default",
189
+ hex: "#171717",
190
+ },
191
+ {
192
+ title: "Blue",
193
+ value: "blue",
194
+ hex: "#1447e6",
195
+ },
196
+ {
197
+ title: "Green",
198
+ value: "green",
199
+ hex: "#5ea500",
200
+ },
201
+ {
202
+ title: "Orange",
203
+ value: "orange",
204
+ hex: "#f54a00",
205
+ },
206
+ {
207
+ title: "Red",
208
+ value: "red",
209
+ hex: "#e7000b",
210
+ },
211
+ {
212
+ title: "Rose",
213
+ value: "rose",
214
+ hex: "#ec003f",
215
+ },
216
+ {
217
+ title: "Violet",
218
+ value: "violet",
219
+ hex: "#7f22fe",
220
+ },
221
+ {
222
+ title: "Yellow",
223
+ value: "yellow",
224
+ hex: "#fcc800",
225
+ },
226
+ ];
227
+
228
+ export const TIOELVIS_COMPONENTS = [
229
+ {
230
+ title: "Max Width Wrapper",
231
+ value: "max-width-wrapper",
232
+ description: "A responsive max-width wrapper component.",
233
+ },
234
+ ];
@@ -0,0 +1,9 @@
1
+ export class Exception extends Error {
2
+ deleteDest;
3
+
4
+ constructor(message, { deleteDest } = {}) {
5
+ super(message);
6
+ this.name = "Exception";
7
+ this.deleteDest = deleteDest ?? false;
8
+ }
9
+ }
@@ -0,0 +1,55 @@
1
+ import fs from "node:fs";
2
+ import chalk from "chalk";
3
+ import { context } from "../constants.js";
4
+ import { spawn } from "node:child_process";
5
+
6
+ const activeProcesses = new Set();
7
+
8
+ export function onCancel() {
9
+ console.log(chalk.yellow("\n\nExiting..."));
10
+
11
+ if (activeProcesses.size > 0) {
12
+ activeProcesses.forEach((child) => {
13
+ try {
14
+ child.kill("SIGTERM");
15
+ } catch (e) {
16
+ /* Ignore errors */
17
+ }
18
+ });
19
+ activeProcesses.clear();
20
+ }
21
+
22
+ setTimeout(() => {
23
+ if (context.dest && fs.existsSync(context.dest)) {
24
+ try {
25
+ fs.rmSync(context.dest, { recursive: true, force: true });
26
+ } catch (error) {
27
+ console.log(chalk.red(`Could not delete folder: ${error.message}`));
28
+ }
29
+ }
30
+ process.exit(0);
31
+ }, 500);
32
+ }
33
+
34
+ export function runCommand(command, args, cwd) {
35
+ return new Promise((resolve, reject) => {
36
+ const child = spawn(command, args, {
37
+ cwd,
38
+ stdio: "ignore",
39
+ shell: process.platform === "win32",
40
+ });
41
+
42
+ activeProcesses.add(child);
43
+
44
+ child.on("error", (error) => {
45
+ activeProcesses.delete(child);
46
+ reject(error);
47
+ });
48
+
49
+ child.on("close", (code) => {
50
+ activeProcesses.delete(child);
51
+ if (code === 0) resolve();
52
+ else reject(new Error(`${command} exited with code ${code}`));
53
+ });
54
+ });
55
+ }