create-fe-boilerplate 0.2.0 → 0.3.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 (51) hide show
  1. package/bin/index.js +52 -12
  2. package/package.json +11 -3
  3. package/templates/next/ts/tailwind/axios/README.md +36 -0
  4. package/templates/next/ts/tailwind/axios/eslint.config.mjs +18 -0
  5. package/templates/next/ts/tailwind/axios/next.config.ts +7 -0
  6. package/templates/next/ts/tailwind/axios/package-lock.json +6626 -0
  7. package/templates/next/ts/tailwind/axios/package.json +27 -0
  8. package/templates/next/ts/tailwind/axios/postcss.config.mjs +7 -0
  9. package/templates/next/ts/tailwind/axios/public/file.svg +1 -0
  10. package/templates/next/ts/tailwind/axios/public/globe.svg +1 -0
  11. package/templates/next/ts/tailwind/axios/public/next.svg +1 -0
  12. package/templates/next/ts/tailwind/axios/public/vercel.svg +1 -0
  13. package/templates/next/ts/tailwind/axios/public/window.svg +1 -0
  14. package/templates/next/ts/tailwind/axios/src/api/auth.ts +10 -0
  15. package/templates/next/ts/tailwind/axios/src/api/axios.ts +17 -0
  16. package/templates/next/ts/tailwind/axios/src/app/dashboard/page.tsx +32 -0
  17. package/templates/next/ts/tailwind/axios/src/app/favicon.ico +0 -0
  18. package/templates/next/ts/tailwind/axios/src/app/globals.css +26 -0
  19. package/templates/next/ts/tailwind/axios/src/app/layout.tsx +34 -0
  20. package/templates/next/ts/tailwind/axios/src/app/login/page.tsx +71 -0
  21. package/templates/next/ts/tailwind/axios/src/app/page.tsx +5 -0
  22. package/templates/next/ts/tailwind/axios/src/app/signup/page.tsx +56 -0
  23. package/templates/next/ts/tailwind/axios/src/components/AuthGuard.tsx +35 -0
  24. package/templates/next/ts/tailwind/axios/src/components/VerifyOtpModal.tsx +58 -0
  25. package/templates/next/ts/tailwind/axios/tsconfig.json +36 -0
  26. package/templates/react/js/tailwind/axios/vite.config.js +1 -1
  27. package/templates/react/js/tailwind/rtk/README.md +73 -0
  28. package/templates/react/js/tailwind/rtk/eslint.config.js +23 -0
  29. package/templates/react/js/tailwind/rtk/index.html +13 -0
  30. package/templates/react/js/tailwind/rtk/package-lock.json +4597 -0
  31. package/templates/react/js/tailwind/rtk/package.json +37 -0
  32. package/templates/react/js/tailwind/rtk/postcss.config.js +6 -0
  33. package/templates/react/js/tailwind/rtk/public/vite.svg +1 -0
  34. package/templates/react/js/tailwind/rtk/react-ts-tailwind-axios/.env.example +1 -0
  35. package/templates/react/js/tailwind/rtk/src/App.css +0 -0
  36. package/templates/react/js/tailwind/rtk/src/App.jsx +14 -0
  37. package/templates/react/js/tailwind/rtk/src/api/axios.ts +236 -0
  38. package/templates/react/js/tailwind/rtk/src/component/auth/VerifyOtpModal.jsx +60 -0
  39. package/templates/react/js/tailwind/rtk/src/component/common/ui/Toast/Toast.js +59 -0
  40. package/templates/react/js/tailwind/rtk/src/contants/constants.js +45 -0
  41. package/templates/react/js/tailwind/rtk/src/index.css +4 -0
  42. package/templates/react/js/tailwind/rtk/src/main.jsx +14 -0
  43. package/templates/react/js/tailwind/rtk/src/pages/Dashboard.jsx +10 -0
  44. package/templates/react/js/tailwind/rtk/src/pages/Login.jsx +69 -0
  45. package/templates/react/js/tailwind/rtk/src/pages/Signup.jsx +75 -0
  46. package/templates/react/js/tailwind/rtk/src/router/AppRoutes.jsx +19 -0
  47. package/templates/react/js/tailwind/rtk/src/store/index.js +10 -0
  48. package/templates/react/js/tailwind/rtk/src/store/services/api.js +34 -0
  49. package/templates/react/js/tailwind/rtk/src/utils/utils.ts +59 -0
  50. package/templates/react/js/tailwind/rtk/tailwind.config.js +8 -0
  51. package/templates/react/js/tailwind/rtk/vite.config.js +7 -0
package/bin/index.js CHANGED
@@ -5,6 +5,8 @@ import fs from "fs-extra";
5
5
  import path from "path";
6
6
  import { execa } from "execa";
7
7
  import chalk from "chalk";
8
+ import ora from "ora";
9
+ import validatePkgName from "validate-npm-package-name";
8
10
  import { fileURLToPath } from "url";
9
11
 
10
12
  const __filename = fileURLToPath(import.meta.url);
@@ -47,6 +49,18 @@ async function run() {
47
49
  },
48
50
  ]);
49
51
 
52
+ /* ---------------- VALIDATE PROJECT NAME ---------------- */
53
+
54
+ const validation = validatePkgName(answers.projectName);
55
+
56
+ if (!validation.validForNewPackages) {
57
+ console.error(chalk.red("\n❌ Invalid project name\n"));
58
+ validation.errors?.forEach((e) => console.error(`- ${e}`));
59
+ process.exit(1);
60
+ }
61
+
62
+ /* ---------------- RESOLVE TEMPLATE PATH ---------------- */
63
+
50
64
  const templatePath = path.resolve(
51
65
  __dirname,
52
66
  "../templates",
@@ -56,29 +70,55 @@ async function run() {
56
70
  answers.api
57
71
  );
58
72
 
59
- console.log("Using template path:", templatePath);
60
-
61
73
  if (!fs.existsSync(templatePath)) {
74
+ console.error(chalk.red(`\n❌ Template not found:\n${templatePath}\n`));
75
+ process.exit(1);
76
+ }
77
+
78
+ const targetPath = path.join(cwd, answers.projectName);
79
+
80
+ /* ---------------- SAFETY CHECK ---------------- */
81
+
82
+ if (targetPath.startsWith(templatePath)) {
62
83
  console.error(
63
- chalk.red("\n❌ Template not found. Please check templates folder.\n")
84
+ chalk.red("\n❌ Cannot create project inside template directory.\n")
64
85
  );
65
86
  process.exit(1);
66
87
  }
67
88
 
68
- const targetPath = path.join(cwd, answers.projectName);
89
+ if (fs.existsSync(targetPath)) {
90
+ console.error(
91
+ chalk.red(`\n❌ Folder "${answers.projectName}" already exists.\n`)
92
+ );
93
+ process.exit(1);
94
+ }
69
95
 
96
+ /* ---------------- COPY TEMPLATE ---------------- */
97
+
98
+ console.log(chalk.yellow("\n📂 Creating project...\n"));
70
99
  await fs.copy(templatePath, targetPath);
71
100
 
72
- console.log(chalk.yellow("\n📦 Installing dependencies...\n"));
101
+ /* ---------------- INSTALL DEPENDENCIES ---------------- */
102
+
103
+ const spinner = ora("Installing dependencies...").start();
104
+
105
+ try {
106
+ await execa("npm", ["install"], {
107
+ cwd: targetPath,
108
+ stdio: "ignore",
109
+ });
110
+ spinner.succeed("Dependencies installed");
111
+ } catch (err) {
112
+ spinner.fail("Dependency installation failed");
113
+ process.exit(1);
114
+ }
73
115
 
74
- await execa("npm", ["install"], {
75
- cwd: targetPath,
76
- stdio: "inherit",
77
- });
116
+ /* ---------------- FINAL MESSAGE ---------------- */
78
117
 
79
- console.log(chalk.green("\n✅ Done!\n"));
80
- console.log(`cd ${answers.projectName}`);
81
- console.log("npm run dev");
118
+ console.log(chalk.green("\n✅ Project created successfully!\n"));
119
+ console.log("Next steps:\n");
120
+ console.log(chalk.cyan(` cd ${answers.projectName}`));
121
+ console.log(chalk.cyan(" npm run dev\n"));
82
122
  }
83
123
 
84
124
  run();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fe-boilerplate",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "CLI to scaffold React boilerplates with authentication, OTP, Tailwind and Axios",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,7 +13,9 @@
13
13
  "execa": "^8.0.1",
14
14
  "fs-extra": "^11.3.3",
15
15
  "inquirer": "^9.3.8",
16
- "react-toastify": "^11.0.5"
16
+ "ora": "^9.0.0",
17
+ "react-toastify": "^11.0.5",
18
+ "validate-npm-package-name": "^7.0.2"
17
19
  },
18
20
  "main": "index.js",
19
21
  "scripts": {
@@ -21,5 +23,11 @@
21
23
  },
22
24
  "keywords": [],
23
25
  "author": "",
24
- "license": "ISC"
26
+ "license": "ISC",
27
+ "devDependencies": {
28
+ "@types/node": "^25.0.3",
29
+ "@types/react": "^19.2.7",
30
+ "@types/react-dom": "^19.2.3",
31
+ "typescript": "^5.9.3"
32
+ }
25
33
  }
@@ -0,0 +1,36 @@
1
+ This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
2
+
3
+ ## Getting Started
4
+
5
+ First, run the development server:
6
+
7
+ ```bash
8
+ npm run dev
9
+ # or
10
+ yarn dev
11
+ # or
12
+ pnpm dev
13
+ # or
14
+ bun dev
15
+ ```
16
+
17
+ Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18
+
19
+ You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20
+
21
+ This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
22
+
23
+ ## Learn More
24
+
25
+ To learn more about Next.js, take a look at the following resources:
26
+
27
+ - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28
+ - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29
+
30
+ You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
31
+
32
+ ## Deploy on Vercel
33
+
34
+ The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35
+
36
+ Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
@@ -0,0 +1,18 @@
1
+ import { defineConfig, globalIgnores } from "eslint/config";
2
+ import nextVitals from "eslint-config-next/core-web-vitals";
3
+ import nextTs from "eslint-config-next/typescript";
4
+
5
+ const eslintConfig = defineConfig([
6
+ ...nextVitals,
7
+ ...nextTs,
8
+ // Override default ignores of eslint-config-next.
9
+ globalIgnores([
10
+ // Default ignores of eslint-config-next:
11
+ ".next/**",
12
+ "out/**",
13
+ "build/**",
14
+ "next-env.d.ts",
15
+ ]),
16
+ ]);
17
+
18
+ export default eslintConfig;
@@ -0,0 +1,7 @@
1
+ import type { NextConfig } from "next";
2
+
3
+ const nextConfig: NextConfig = {
4
+ /* config options here */
5
+ };
6
+
7
+ export default nextConfig;