@tioelvis/next-ui 1.0.10 → 1.0.12
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 +14 -0
- package/package.json +1 -1
- package/src/actions/configure-package-json.js +1 -3
- package/src/actions/copying-template-files.js +1 -3
- package/src/actions/creating-project.js +2 -4
- package/src/actions/init-shadcn-ui.js +58 -0
- package/src/actions/install-all-dependencies.js +15 -5
- package/src/actions/set-theme-color.js +25 -0
- package/src/constants.js +319 -0
- package/src/main.js +38 -10
- 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/README.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
1
|
# Interactive CLI UI Project Generator
|
|
2
2
|
|
|
3
3
|
This project is a command-line tool to scaffold a modern Next.js + Typescript + TailwindCSS project
|
|
4
|
+
|
|
5
|
+
## 🛠️ Usage
|
|
6
|
+
|
|
7
|
+
Using npm:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx @tioelvis/next-ui
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Using pnpm:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpx @tioelvis/next-ui
|
|
17
|
+
```
|
package/package.json
CHANGED
|
@@ -7,8 +7,6 @@ import { context } from "../main.js";
|
|
|
7
7
|
import { Exception } from "../lib/exception.js";
|
|
8
8
|
|
|
9
9
|
export function configurePackageJson() {
|
|
10
|
-
console.log(chalk.white("\nConfiguring package.json..."));
|
|
11
|
-
|
|
12
10
|
const packageJSON = {
|
|
13
11
|
name: context.projectName,
|
|
14
12
|
version: "1.0.0",
|
|
@@ -25,7 +23,7 @@ export function configurePackageJson() {
|
|
|
25
23
|
|
|
26
24
|
try {
|
|
27
25
|
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJSON, null, 2));
|
|
28
|
-
console.log(chalk.
|
|
26
|
+
console.log(chalk.white("\nPackage.json configured."));
|
|
29
27
|
} catch (error) {
|
|
30
28
|
throw new Exception("Failed to configure package.json. Please try again.");
|
|
31
29
|
}
|
|
@@ -7,11 +7,9 @@ import { Exception } from "../lib/exception.js";
|
|
|
7
7
|
import { TEMPLATE_FOLDER_PATH } from "../constants.js";
|
|
8
8
|
|
|
9
9
|
export function copyingTemplateFiles() {
|
|
10
|
-
console.log(chalk.white(`Copying template files...`));
|
|
11
|
-
|
|
12
10
|
try {
|
|
13
11
|
fs.cpSync(TEMPLATE_FOLDER_PATH, context.dest, { recursive: true });
|
|
14
|
-
console.log(chalk.
|
|
12
|
+
console.log(chalk.white("\nCopying template files."));
|
|
15
13
|
} catch (error) {
|
|
16
14
|
throw new Exception(`Could not copy template files: ${error.message}`);
|
|
17
15
|
}
|
|
@@ -6,17 +6,15 @@ import { context } from "../main.js";
|
|
|
6
6
|
import { Exception } from "../lib/exception.js";
|
|
7
7
|
|
|
8
8
|
export function creatingProject() {
|
|
9
|
-
console.log(chalk.white(`Creating project "${context.projectName}"...`));
|
|
10
|
-
|
|
11
9
|
if (fs.existsSync(context.dest)) {
|
|
12
|
-
throw new
|
|
10
|
+
throw new Error(
|
|
13
11
|
`Directory ${context.projectName} already exists. Choose a different project name.`,
|
|
14
12
|
);
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
try {
|
|
18
16
|
fs.mkdirSync(context.dest, { recursive: true });
|
|
19
|
-
console.log(chalk.
|
|
17
|
+
console.log(chalk.white(`\nCreating project ${context.projectName}.`));
|
|
20
18
|
} catch (error) {
|
|
21
19
|
throw new Exception(`Could not create project folder: ${error.message}`);
|
|
22
20
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import ora from "ora";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
|
|
4
|
+
import { context } from "../main.js";
|
|
5
|
+
import { runCommand } from "../lib/utils.js";
|
|
6
|
+
import { Exception } from "../lib/exception.js";
|
|
7
|
+
|
|
8
|
+
async function installComponents(components) {
|
|
9
|
+
const spinner = ora("Installing shadcn/ui components...").start();
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
for (const component of components) {
|
|
13
|
+
await runCommand(
|
|
14
|
+
"npx",
|
|
15
|
+
["shadcn@latest", "add", component],
|
|
16
|
+
context.dest,
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
spinner.succeed("shadcn/ui components installed.");
|
|
21
|
+
} catch (error) {
|
|
22
|
+
spinner.fail("Failed to install shadcn/ui components.");
|
|
23
|
+
throw new Exception("Failed to install shadcn/ui components.");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export async function initShadcnUI(components) {
|
|
28
|
+
console.log(
|
|
29
|
+
chalk.white("\nInitializing shadcn/ui with the following components:"),
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
components.forEach((comp) => {
|
|
33
|
+
console.log(chalk.white(" - "), chalk.greenBright(comp));
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
if (components.length === 0) {
|
|
37
|
+
console.log(chalk.yellow("No components selected."));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const spinner = ora("Installing shadcn/ui...").start();
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
await runCommand(
|
|
44
|
+
"npx",
|
|
45
|
+
["shadcn@latest", "init", "--base-color", "neutral"],
|
|
46
|
+
context.dest,
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
spinner.succeed("shadcn/ui installed");
|
|
50
|
+
} catch (error) {
|
|
51
|
+
spinner.fail("Failed to install shadcn/ui.");
|
|
52
|
+
throw new Exception("Failed to install shadcn/ui.");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (components.length > 0) {
|
|
56
|
+
await installComponents(components);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import ora from "ora";
|
|
2
|
+
import chalk from "chalk";
|
|
2
3
|
|
|
3
4
|
import { context } from "../main.js";
|
|
4
5
|
import { runCommand } from "../lib/utils.js";
|
|
@@ -6,17 +7,26 @@ import { Exception } from "../lib/exception.js";
|
|
|
6
7
|
import { MAIN_DEPENDENCIES, MAIN_DEV_DEPENDENCIES } from "../constants.js";
|
|
7
8
|
|
|
8
9
|
export async function installAllDependencies() {
|
|
9
|
-
const spinner = ora("Installing main packages...").start();
|
|
10
|
-
|
|
11
10
|
const { packageManager: pm, dest } = context;
|
|
12
11
|
|
|
12
|
+
console.log(chalk.white("\nInstalling dependencies:"));
|
|
13
|
+
MAIN_DEPENDENCIES.forEach((dep) => {
|
|
14
|
+
console.log(chalk.white(" - "), chalk.greenBright(dep));
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
console.log(chalk.white("\nInstalling devDependencies:"));
|
|
18
|
+
MAIN_DEV_DEPENDENCIES.forEach((dep) => {
|
|
19
|
+
console.log(chalk.white(" - "), chalk.greenBright(dep));
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const spinner = ora("Installing main packages...").start();
|
|
13
23
|
try {
|
|
14
24
|
await runCommand(pm, ["install", ...MAIN_DEPENDENCIES], dest);
|
|
15
25
|
await runCommand(pm, ["install", "-D", ...MAIN_DEV_DEPENDENCIES], dest);
|
|
16
26
|
|
|
17
|
-
spinner.succeed("
|
|
27
|
+
spinner.succeed("Dependencies installed successfully.");
|
|
18
28
|
} catch (error) {
|
|
19
|
-
spinner.fail("Failed to install
|
|
20
|
-
throw new Exception(`Failed to install
|
|
29
|
+
spinner.fail("Failed to install dependencies.");
|
|
30
|
+
throw new Exception(`Failed to install dependencies: ${error.message}`);
|
|
21
31
|
}
|
|
22
32
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
|
|
6
|
+
import { context } from "../main.js";
|
|
7
|
+
import { Exception } from "../lib/exception.js";
|
|
8
|
+
import { THEME_FOLDER_PATH } from "../constants.js";
|
|
9
|
+
|
|
10
|
+
export function setThemeColor(themeColor) {
|
|
11
|
+
const themeFilePath = path.join(THEME_FOLDER_PATH, `${themeColor}.css`);
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
if (!themeColor || !fs.existsSync(themeFilePath)) {
|
|
15
|
+
throw new Error("Invalid theme color selected.");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const dest = path.join(context.dest, "src/app/globals.css");
|
|
19
|
+
|
|
20
|
+
fs.copyFileSync(themeFilePath, dest);
|
|
21
|
+
console.log(chalk.white("\nTheme color set successfully."));
|
|
22
|
+
} catch (error) {
|
|
23
|
+
throw new Exception(`Could not set theme color: ${error.message}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
package/src/constants.js
CHANGED
|
@@ -6,6 +6,7 @@ export const __dirname = path.dirname(__filename);
|
|
|
6
6
|
|
|
7
7
|
export const CWD = path.resolve(process.cwd());
|
|
8
8
|
|
|
9
|
+
export const THEME_FOLDER_PATH = path.join(__dirname, "themes");
|
|
9
10
|
export const TEMPLATE_FOLDER_PATH = path.join(__dirname, "template");
|
|
10
11
|
|
|
11
12
|
export const MAIN_DEPENDENCIES = [
|
|
@@ -19,8 +20,326 @@ export const MAIN_DEV_DEPENDENCIES = [
|
|
|
19
20
|
"@types/node@latest",
|
|
20
21
|
"@types/react@latest",
|
|
21
22
|
"@types/react-dom@latest",
|
|
23
|
+
"babel-plugin-react-compiler@latest",
|
|
22
24
|
"eslint@latest",
|
|
23
25
|
"eslint-config-next@latest",
|
|
24
26
|
"tailwindcss@latest",
|
|
25
27
|
"typescript@latest",
|
|
28
|
+
"tw-animate-css@latest",
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export const THEME_COLORS = [
|
|
32
|
+
{
|
|
33
|
+
title: "Default",
|
|
34
|
+
value: "default",
|
|
35
|
+
hex: "#171717",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
title: "Blue",
|
|
39
|
+
value: "blue",
|
|
40
|
+
hex: "#1447e6",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
title: "Green",
|
|
44
|
+
value: "green",
|
|
45
|
+
hex: "#5ea500",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
title: "Orange",
|
|
49
|
+
value: "orange",
|
|
50
|
+
hex: "#f54a00",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
title: "Red",
|
|
54
|
+
value: "red",
|
|
55
|
+
hex: "#e7000b",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
title: "Rose",
|
|
59
|
+
value: "rose",
|
|
60
|
+
hex: "#ec003f",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
title: "Violet",
|
|
64
|
+
value: "violet",
|
|
65
|
+
hex: "#7f22fe",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
title: "Yellow",
|
|
69
|
+
value: "yellow",
|
|
70
|
+
hex: "#fcc800",
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
export const SHADCN_COMPONENTS = [
|
|
75
|
+
{
|
|
76
|
+
title: "Accordion",
|
|
77
|
+
value: "accordion",
|
|
78
|
+
description: "Collapsible content panels.",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
title: "Alert",
|
|
82
|
+
value: "alert",
|
|
83
|
+
description: "Display important messages.",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
title: "Alert Dialog",
|
|
87
|
+
value: "alert-dialog",
|
|
88
|
+
description: "Modal dialog for critical actions.",
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
title: "Aspect Ratio",
|
|
92
|
+
value: "aspect-ratio",
|
|
93
|
+
description: "Maintain consistent aspect ratios.",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
title: "Avatar",
|
|
97
|
+
value: "avatar",
|
|
98
|
+
description: "User profile images.",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
title: "Badge",
|
|
102
|
+
value: "badge",
|
|
103
|
+
description: "Small labels and tags.",
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
title: "Breadcrumb",
|
|
107
|
+
value: "breadcrumb",
|
|
108
|
+
description: "Navigation path indicator.",
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
title: "Button",
|
|
112
|
+
value: "button",
|
|
113
|
+
description: "Interactive clickable elements.",
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
title: "Button Group",
|
|
117
|
+
value: "button-group",
|
|
118
|
+
description: "Group of buttons with shared actions.",
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
title: "Calendar",
|
|
122
|
+
value: "calendar",
|
|
123
|
+
description: "Date selection component.",
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
title: "Card",
|
|
127
|
+
value: "card",
|
|
128
|
+
description: "Container for grouped content.",
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
title: "Carousel",
|
|
132
|
+
value: "carousel",
|
|
133
|
+
description: "Image and content slider.",
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
title: "Chart",
|
|
137
|
+
value: "chart",
|
|
138
|
+
description: "Data visualization component.",
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
title: "Checkbox",
|
|
142
|
+
value: "checkbox",
|
|
143
|
+
description: "Multi-select input.",
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
title: "Collapsible",
|
|
147
|
+
value: "collapsible",
|
|
148
|
+
description: "Toggle expandable sections.",
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
title: "Combobox",
|
|
152
|
+
value: "combobox",
|
|
153
|
+
description: "Dropdown input with search functionality.",
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
title: "Command",
|
|
157
|
+
value: "command",
|
|
158
|
+
description: "Command palette interface.",
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
title: "Context Menu",
|
|
162
|
+
value: "context-menu",
|
|
163
|
+
description: "Right-click menu.",
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
title: "Dialog",
|
|
167
|
+
value: "dialog",
|
|
168
|
+
description: "Modal dialog box.",
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
title: "Direction",
|
|
172
|
+
value: "direction",
|
|
173
|
+
description: "Sets the text direction for your application.",
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
title: "Drawer",
|
|
177
|
+
value: "drawer",
|
|
178
|
+
description: "Side panel overlay.",
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
title: "Dropdown Menu",
|
|
182
|
+
value: "dropdown-menu",
|
|
183
|
+
description: "Dropdown action menu.",
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
title: "Empty",
|
|
187
|
+
value: "empty",
|
|
188
|
+
description: "Component to display an empty state.",
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
title: "Field",
|
|
192
|
+
value: "field",
|
|
193
|
+
description: "Form field component.",
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
title: "Hover Card",
|
|
197
|
+
value: "hover-card",
|
|
198
|
+
description: "Tooltip on hover.",
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
title: "Input",
|
|
202
|
+
value: "input",
|
|
203
|
+
description: "Text input field.",
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
title: "Input Group",
|
|
207
|
+
value: "input-group",
|
|
208
|
+
description: "Add addons, buttons, and helper content to inputs.",
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
title: "Input OTP",
|
|
212
|
+
value: "input-otp",
|
|
213
|
+
description: "One-time password input.",
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
title: "Item",
|
|
217
|
+
value: "item",
|
|
218
|
+
description: "Versatile component for displaying content.",
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
title: "Kbd",
|
|
222
|
+
value: "kbd",
|
|
223
|
+
description: "Used to display textual user input from keyboard.",
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
title: "Label",
|
|
227
|
+
value: "label",
|
|
228
|
+
description: "Form field label.",
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
title: "Menubar",
|
|
232
|
+
value: "menubar",
|
|
233
|
+
description: "Application menu bar.",
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
title: "Native Select",
|
|
237
|
+
value: "native-select",
|
|
238
|
+
description: "Native select dropdown.",
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
title: "Navigation Menu",
|
|
242
|
+
value: "navigation-menu",
|
|
243
|
+
description: "Horizontal navigation.",
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
title: "Pagination",
|
|
247
|
+
value: "pagination",
|
|
248
|
+
description: "Page navigation controls.",
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
title: "Popover",
|
|
252
|
+
value: "popover",
|
|
253
|
+
description: "Floating content box.",
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
title: "Progress",
|
|
257
|
+
value: "progress",
|
|
258
|
+
description: "Progress bar indicator.",
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
title: "Radio Group",
|
|
262
|
+
value: "radio-group",
|
|
263
|
+
description: "Single-select option group.",
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
title: "Resizable",
|
|
267
|
+
value: "resizable",
|
|
268
|
+
description: "Resizable panel container.",
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
title: "Scroll Area",
|
|
272
|
+
value: "scroll-area",
|
|
273
|
+
description: "Custom scrollable container.",
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
title: "Select",
|
|
277
|
+
value: "select",
|
|
278
|
+
description: "Dropdown select field.",
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
title: "Separator",
|
|
282
|
+
value: "separator",
|
|
283
|
+
description: "Visual divider line",
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
title: "Sheet",
|
|
287
|
+
value: "sheet",
|
|
288
|
+
description: "Modal sheet panel.",
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
title: "Sidebar",
|
|
292
|
+
value: "sidebar",
|
|
293
|
+
description: "Side navigation panel.",
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
title: "Skeleton",
|
|
297
|
+
value: "skeleton",
|
|
298
|
+
description: "Loading placeholder.",
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
title: "Slider",
|
|
302
|
+
value: "slider",
|
|
303
|
+
description: "Range slider input.",
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
title: "Sonner",
|
|
307
|
+
value: "sonner",
|
|
308
|
+
description: "Toast notification system.",
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
title: "Switch",
|
|
312
|
+
value: "switch",
|
|
313
|
+
description: "Toggle switch control.",
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
title: "Table",
|
|
317
|
+
value: "table",
|
|
318
|
+
description: "Data table component.",
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
title: "Tabs",
|
|
322
|
+
value: "tabs",
|
|
323
|
+
description: "Tabbed content sections.",
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
title: "Textarea",
|
|
327
|
+
value: "textarea",
|
|
328
|
+
description: "Multi-line text input.",
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
title: "Toggle",
|
|
332
|
+
value: "toggle",
|
|
333
|
+
description: "Toggle button control.",
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
title: "Toggle Group",
|
|
337
|
+
value: "toggle-group",
|
|
338
|
+
description: "Group of toggle buttons.",
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
title: "Tooltip",
|
|
342
|
+
value: "tooltip",
|
|
343
|
+
description: "Informative hover text.",
|
|
344
|
+
},
|
|
26
345
|
];
|
package/src/main.js
CHANGED
|
@@ -6,10 +6,12 @@ import path from "node:path";
|
|
|
6
6
|
import chalk from "chalk";
|
|
7
7
|
import prompts from "prompts";
|
|
8
8
|
|
|
9
|
-
import { CWD } from "./constants.js";
|
|
10
9
|
import { onCancel } from "./lib/utils.js";
|
|
11
10
|
import { Exception } from "./lib/exception.js";
|
|
11
|
+
import { initShadcnUI } from "./actions/init-shadcn-ui.js";
|
|
12
|
+
import { setThemeColor } from "./actions/set-theme-color.js";
|
|
12
13
|
import { creatingProject } from "./actions/creating-project.js";
|
|
14
|
+
import { CWD, SHADCN_COMPONENTS, THEME_COLORS } from "./constants.js";
|
|
13
15
|
import { copyingTemplateFiles } from "./actions/copying-template-files.js";
|
|
14
16
|
import { configurePackageJson } from "./actions/configure-package-json.js";
|
|
15
17
|
import { installAllDependencies } from "./actions/install-all-dependencies.js";
|
|
@@ -54,19 +56,39 @@ async function bootstrap() {
|
|
|
54
56
|
message: "What is the name of your Next.js project?",
|
|
55
57
|
initial: "my-app",
|
|
56
58
|
},
|
|
59
|
+
{
|
|
60
|
+
type: "select",
|
|
61
|
+
name: "themeColor",
|
|
62
|
+
message: "Which theme color would you like to use?",
|
|
63
|
+
choices: THEME_COLORS.map((e) => {
|
|
64
|
+
return {
|
|
65
|
+
title: `${chalk.hex(e.hex)("●")} ${e.title}`,
|
|
66
|
+
value: e.value,
|
|
67
|
+
};
|
|
68
|
+
}),
|
|
69
|
+
initial: 0,
|
|
70
|
+
},
|
|
57
71
|
{
|
|
58
72
|
type: "confirm",
|
|
59
|
-
name: "
|
|
60
|
-
message: "
|
|
73
|
+
name: "useShadcnUI",
|
|
74
|
+
message: "Would you like to include shadcn/ui components?",
|
|
61
75
|
initial: true,
|
|
62
76
|
},
|
|
63
77
|
{
|
|
64
|
-
type: (prev) => (prev ? "
|
|
78
|
+
type: (prev) => (prev ? "multiselect" : null),
|
|
79
|
+
name: "shadcnComponents",
|
|
80
|
+
message: "Which shadcn/ui components would you like to use?",
|
|
81
|
+
choices: SHADCN_COMPONENTS.map((e) => {
|
|
82
|
+
return { ...e };
|
|
83
|
+
}),
|
|
84
|
+
instructions: false,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
type: "select",
|
|
65
88
|
name: "packageManager",
|
|
66
89
|
message: "Which package manager do you want to use?",
|
|
67
90
|
choices: [
|
|
68
91
|
{ title: "npm", value: "npm" },
|
|
69
|
-
{ title: "yarn", value: "yarn" },
|
|
70
92
|
{ title: "pnpm", value: "pnpm" },
|
|
71
93
|
],
|
|
72
94
|
initial: 0,
|
|
@@ -75,7 +97,13 @@ async function bootstrap() {
|
|
|
75
97
|
{ onCancel },
|
|
76
98
|
);
|
|
77
99
|
|
|
78
|
-
const {
|
|
100
|
+
const {
|
|
101
|
+
projectName,
|
|
102
|
+
packageManager,
|
|
103
|
+
themeColor,
|
|
104
|
+
useShadcnUI,
|
|
105
|
+
shadcnComponents,
|
|
106
|
+
} = responses;
|
|
79
107
|
|
|
80
108
|
context.projectName = projectName;
|
|
81
109
|
context.dest = path.join(CWD, context.projectName);
|
|
@@ -84,11 +112,11 @@ async function bootstrap() {
|
|
|
84
112
|
creatingProject();
|
|
85
113
|
copyingTemplateFiles();
|
|
86
114
|
configurePackageJson();
|
|
87
|
-
|
|
88
|
-
|
|
115
|
+
setThemeColor(themeColor);
|
|
116
|
+
await installAllDependencies();
|
|
117
|
+
if (useShadcnUI) {
|
|
118
|
+
await initShadcnUI(shadcnComponents);
|
|
89
119
|
}
|
|
90
|
-
// Install shadcn if user wants to use it
|
|
91
|
-
// Init theme color
|
|
92
120
|
|
|
93
121
|
console.log(chalk.green("\nProject setup complete!"));
|
|
94
122
|
} catch (error) {
|