Skip to content

Commit 4d6ff64

Browse files
eyaprakclaude
andcommitted
feat: add post-clone setup script for template users
- Add scripts/setup-template.js that removes template-specific files - Add npm run setup command to package.json - Update README with setup instructions (step 2) This allows users who git clone the repo to easily remove the Claude reviewer workflow and related files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent fb77d39 commit 4d6ff64

File tree

3 files changed

+124
-5
lines changed

3 files changed

+124
-5
lines changed

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,33 +35,39 @@ git clone https://github.com/eyaprak/vibe-coding-starter.git
3535
cd vibe-coding-starter
3636
```
3737

38-
2. Bağımlılıkları yükleyin:
38+
2. **Öncelikle template kurulum scriptini çalıştırın** (şablon dosyalarını temizler):
39+
40+
```bash
41+
npm run setup
42+
```
43+
44+
3. Bağımlılıkları yükleyin:
3945

4046
```bash
4147
npm install
4248
```
4349

44-
3. Ortam değişkenleri dosyasını kopyalayın:
50+
4. Ortam değişkenleri dosyasını kopyalayın:
4551

4652
```bash
4753
cp .env.example .env
4854
```
4955

50-
4. `.env` dosyasında ortam değişkenlerinizi yapılandırın:
56+
5. `.env` dosyasında ortam değişkenlerinizi yapılandırın:
5157
- Veritabanı URL'i (Supabase PostgreSQL)
5258
- Supabase kimlik bilgileri
5359
- NextAuth gizli anahtarı
5460
- Stripe anahtarları
5561
- Resend API anahtarı
5662
- reCAPTCHA anahtarları
5763

58-
5. Veritabanı şemasını gönderin:
64+
6. Veritabanı şemasını gönderin:
5965

6066
```bash
6167
npm run db:push
6268
```
6369

64-
6. Geliştirme sunucusunu başlatın:
70+
7. Geliştirme sunucusunu başlatın:
6571

6672
```bash
6773
npm run dev
@@ -96,6 +102,7 @@ Uygulamanızı görmek için [http://localhost:3000](http://localhost:3000) adre
96102

97103
| Komut | Açıklama |
98104
| --------------------- | ------------------------------------------ |
105+
| `npm run setup` | Template dosyalarını temizle (ilk kurulum) |
99106
| `npm run dev` | Turbopack ile geliştirme sunucusunu başlat |
100107
| `npm run build` | Üretim için derle |
101108
| `npm run start` | Üretim sunucusunu başlat |

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
6+
"setup": "node scripts/setup-template.js",
67
"dev": "set NODE_OPTIONS=--max-http-header-size=16384 && next dev --turbopack",
78
"build": "prisma generate && next build",
89
"start": "set NODE_OPTIONS=--max-http-header-size=16384 && next start",

scripts/setup-template.js

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* Post-clone setup script for vibe-coding-starter template
5+
* Run this after cloning to remove template-specific files
6+
*
7+
* Usage: node scripts/setup-template.js
8+
*/
9+
10+
const fs = require('fs');
11+
const path = require('path');
12+
13+
const ROOT = path.resolve(__dirname, '..');
14+
15+
const filesToRemove = [
16+
'.github/workflows/claude-review.yml',
17+
'.github/workflows/template-cleanup.yml',
18+
'scripts/claude-pr-review.ts',
19+
];
20+
21+
const devDepsToRemove = [
22+
'@anthropic-ai/sdk',
23+
'@octokit/rest',
24+
];
25+
26+
function removeFile(relativePath) {
27+
const fullPath = path.join(ROOT, relativePath);
28+
if (fs.existsSync(fullPath)) {
29+
fs.unlinkSync(fullPath);
30+
console.log(`Removed: ${relativePath}`);
31+
return true;
32+
}
33+
return false;
34+
}
35+
36+
function removeEmptyDir(relativePath) {
37+
const fullPath = path.join(ROOT, relativePath);
38+
if (fs.existsSync(fullPath)) {
39+
const files = fs.readdirSync(fullPath);
40+
if (files.length === 0) {
41+
fs.rmdirSync(fullPath);
42+
console.log(`Removed empty directory: ${relativePath}`);
43+
return true;
44+
}
45+
}
46+
return false;
47+
}
48+
49+
function cleanPackageJson() {
50+
const pkgPath = path.join(ROOT, 'package.json');
51+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
52+
53+
let modified = false;
54+
55+
if (pkg.devDependencies) {
56+
for (const dep of devDepsToRemove) {
57+
if (pkg.devDependencies[dep]) {
58+
delete pkg.devDependencies[dep];
59+
console.log(`Removed devDependency: ${dep}`);
60+
modified = true;
61+
}
62+
}
63+
}
64+
65+
if (modified) {
66+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
67+
console.log('Updated package.json');
68+
}
69+
70+
return modified;
71+
}
72+
73+
function selfDestruct() {
74+
const scriptPath = __filename;
75+
fs.unlinkSync(scriptPath);
76+
console.log('Removed: scripts/setup-template.js');
77+
}
78+
79+
function main() {
80+
console.log('\n🚀 Setting up your project from template...\n');
81+
82+
// Remove template-specific files
83+
for (const file of filesToRemove) {
84+
removeFile(file);
85+
}
86+
87+
// Clean up empty .github/workflows directory
88+
removeEmptyDir('.github/workflows');
89+
removeEmptyDir('.github');
90+
91+
// Clean package.json
92+
cleanPackageJson();
93+
94+
// Remove this script
95+
selfDestruct();
96+
97+
// Check if scripts folder is now empty (only if it exists)
98+
const scriptsDir = path.join(ROOT, 'scripts');
99+
if (fs.existsSync(scriptsDir)) {
100+
const remaining = fs.readdirSync(scriptsDir);
101+
if (remaining.length === 0) {
102+
fs.rmdirSync(scriptsDir);
103+
console.log('Removed empty directory: scripts');
104+
}
105+
}
106+
107+
console.log('\n✅ Template setup complete!');
108+
console.log(' Run "npm install" to update your dependencies.\n');
109+
}
110+
111+
main();

0 commit comments

Comments
 (0)