create-next-pro-stack 1.0.2 → 1.0.4

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/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import { execSync } from "child_process";
4
4
  import fs from "fs";
5
5
  import path from "path";
6
- import { fileURLToPath } from "url";
6
+ import { fileURLToPath, pathToFileURL } from "url";
7
7
  import readline from "readline";
8
8
 
9
9
  const __filename = fileURLToPath(import.meta.url);
@@ -51,7 +51,7 @@ async function main() {
51
51
  // 1. Create Next.js using official create-next-app (Latest)
52
52
  console.log("\n📦 Initializing Next.js project...");
53
53
  const tsFlag = isTypeScript ? "--ts" : "--js";
54
- const craCommand = `npx create-next-app@latest ${projectName} ${tsFlag} --tailwind --eslint --app --src-dir --import-alias "@/*" --use-npm --no-git`;
54
+ const craCommand = `npx create-next-app@latest "${projectName}" ${tsFlag} --tailwind --eslint --app --src-dir --import-alias "@/*" --use-npm --no-git`;
55
55
 
56
56
  run(craCommand);
57
57
 
@@ -67,7 +67,7 @@ async function main() {
67
67
  console.log("\nInstalling core stack packages...");
68
68
 
69
69
  const dependencies = [
70
- "axios",
70
+ "axios@1.14.0",
71
71
  "@reduxjs/toolkit",
72
72
  "react-redux",
73
73
  "@tanstack/react-query",
@@ -79,7 +79,6 @@ async function main() {
79
79
  "sonner",
80
80
  "recharts",
81
81
  "lucide-react",
82
- "react-router-dom",
83
82
  "localforage",
84
83
  "match-sorter",
85
84
  "sort-by",
@@ -90,15 +89,15 @@ async function main() {
90
89
  ];
91
90
 
92
91
  console.log("\nInstalling dependencies...");
93
- run(`cd ${projectName} && npm install ${dependencies.join(" ")}`);
92
+ run(`cd "${projectName}" && npm install ${dependencies.join(" ")}`);
94
93
 
95
94
  // 2.5 Initialize Shadcn UI (Default/Non-interactive)
96
95
  console.log("\n🎨 Initializing Shadcn UI...");
97
- run(`cd ${projectName} && npx shadcn@latest init -d`);
96
+ run(`cd "${projectName}" && npx shadcn@latest init -d`);
98
97
 
99
98
  // Install common shadcn components
100
99
  console.log("\n🧩 Installing Shadcn components (Button)...");
101
- run(`cd ${projectName} && npx shadcn@latest add button -y`);
100
+ run(`cd "${projectName}" && npx shadcn@latest add button -y`);
102
101
 
103
102
  // 3. Run Custom Templates (Folder structure, setups)
104
103
  console.log("\n📁 Applying custom folder structure and templates...");
@@ -113,6 +112,7 @@ async function main() {
113
112
  "react-query-setup.js",
114
113
  "providers-setup.js",
115
114
  "page-files.js",
115
+ "next-config-setup.js",
116
116
  "gitignore-setup.js",
117
117
  "vercel-setup.js",
118
118
  "env-setup.js",
@@ -122,7 +122,7 @@ async function main() {
122
122
  for (const moduleName of setupModules) {
123
123
  const modulePath = path.join(templatesDir, moduleName);
124
124
  if (fs.existsSync(modulePath)) {
125
- const module = await import(`file://${modulePath}`);
125
+ const module = await import(pathToFileURL(modulePath).href);
126
126
  if (module.default) {
127
127
  await module.default(projectName, isTypeScript);
128
128
  }
@@ -130,7 +130,7 @@ async function main() {
130
130
  }
131
131
 
132
132
  console.log("\n✨ Setup complete! Starting development server... 🚀\n");
133
- run(`cd ${projectName} && npm run dev`);
133
+ run(`cd "${projectName}" && npm run dev`);
134
134
  } catch (err) {
135
135
  console.error("\n❌ Something went wrong:", err.message);
136
136
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-next-pro-stack",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "A professional CLI tool to quickly scaffold Next.js projects with Redux, React Query, TailwindCSS, and premium UI.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -2,7 +2,8 @@ import fs from "fs";
2
2
  import path from "path";
3
3
 
4
4
  export default async function setup(projectName) {
5
- // Create an empty .env file
6
- fs.writeFileSync(path.join(projectName, ".env"), "");
5
+ // Create a .env file with placeholders
6
+ const envContent = `NEXT_PUBLIC_BASE_URL=http://localhost:5000\n`;
7
+ fs.writeFileSync(path.join(projectName, ".env"), envContent);
7
8
  console.log(" ✅ .env file created.");
8
9
  }
@@ -0,0 +1,29 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+
4
+ export default async function setup(projectName, isTypeScript) {
5
+ const appDir = projectName;
6
+ const configPath = path.join(appDir, "next.config.mjs");
7
+
8
+ const configContent = `import path from "path";
9
+ import { fileURLToPath } from "url";
10
+
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = path.dirname(__filename);
13
+
14
+ /** @type {import('next').NextConfig} */
15
+ const nextConfig = {
16
+ /* Turbopack root — must be absolute (Next.js 15+ / 16) */
17
+ turbopack: {
18
+ root: path.resolve(__dirname),
19
+ },
20
+ };
21
+
22
+ export default nextConfig;
23
+ `;
24
+
25
+ // যদি ফাইলটি আগে থেকেই থাকে (create-next-app দিয়ে তৈরি হওয়া), আমরা সেটি ওভাররাইট করব
26
+ fs.writeFileSync(configPath, configContent);
27
+
28
+ console.log(" ✅ Next.js Config updated: Turbopack root fixed.");
29
+ }
@@ -3,7 +3,7 @@ import path from "path";
3
3
 
4
4
  export default async function setup(projectName) {
5
5
  const vercelConfig = `{
6
- "rewrites": [{ "source": "/(.*)", "destination": "/" }]
6
+ "version": 2
7
7
  }`;
8
8
 
9
9
  fs.writeFileSync(path.join(projectName, "vercel.json"), vercelConfig);