create-next-rkk 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.
Files changed (2) hide show
  1. package/dist/index.js +27 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -84,27 +84,44 @@ program
84
84
  },
85
85
  ]);
86
86
  const targetDir = projectName || answers.projectName;
87
+ const projectPath = path.join(process.cwd(), targetDir);
87
88
  // Step 1: Create Next.js app
88
89
  const spinner = (0, ora_1.default)('Creating Next.js application...').start();
89
90
  try {
90
- const createNextAppCmd = answers.typescript
91
- ? `npx create-next-app@latest ${targetDir} --typescript --eslint --no-tailwind --src-dir --import-alias "@/*"`
92
- : `npx create-next-app@latest ${targetDir} --javascript --eslint --no-tailwind --src-dir --import-alias "@/*"`;
93
- (0, child_process_1.execSync)(createNextAppCmd, { stdio: 'inherit' });
91
+ // Use create-next-app with all options specified to avoid prompts
92
+ const createNextAppCmd = [
93
+ 'npx',
94
+ 'create-next-app@latest',
95
+ targetDir,
96
+ answers.typescript ? '--typescript' : '--js',
97
+ '--eslint',
98
+ '--no-tailwind',
99
+ '--src-dir',
100
+ '--app',
101
+ '--import-alias', '@/*',
102
+ '--no-git'
103
+ ].join(' ');
104
+ (0, child_process_1.execSync)(createNextAppCmd, {
105
+ stdio: 'inherit',
106
+ cwd: process.cwd()
107
+ });
94
108
  spinner.succeed('Next.js application created!');
109
+ // Verify directory exists
110
+ if (!fs.existsSync(projectPath)) {
111
+ throw new Error(`Project directory ${targetDir} was not created`);
112
+ }
95
113
  // Step 2: Install rkk-next
96
114
  if (answers.installDeps) {
97
115
  spinner.start('Installing rkk-next...');
98
- process.chdir(targetDir);
99
- (0, child_process_1.execSync)('npm install rkk-next', { stdio: 'inherit' });
116
+ (0, child_process_1.execSync)('npm install rkk-next', {
117
+ stdio: 'inherit',
118
+ cwd: projectPath
119
+ });
100
120
  spinner.succeed('rkk-next installed!');
101
121
  }
102
- else {
103
- process.chdir(targetDir);
104
- }
105
122
  // Step 3: Setup template files
106
123
  spinner.start('Setting up rkk-next configuration...');
107
- setupTemplateFiles(targetDir, answers.router, answers.typescript);
124
+ setupTemplateFiles(projectPath, answers.router, answers.typescript);
108
125
  spinner.succeed('Configuration complete!');
109
126
  // Success message
110
127
  console.log(chalk_1.default.green.bold('\n✨ Success! Created ' + targetDir));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-next-rkk",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "CLI tool to create Next.js apps with rkk-next pre-configured",
5
5
  "author": "Rohit Kumar Kundu",
6
6
  "license": "MIT",