-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoolchain
More file actions
executable file
·107 lines (89 loc) · 2.16 KB
/
toolchain
File metadata and controls
executable file
·107 lines (89 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/sh
set -e
# capp: Create app
ensure_clean() {
git diff-index --quiet HEAD --
}
configure_vscode_for_biome() {
mkdir -p .vscode
cat <<EOF > .vscode/settings.json
{
"files.insertFinalNewline": true,
"editor.formatOnSave": true,
"editor.rulers": [80, 100],
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit",
"source.fixAll": "always",
"source.organizeImports.biome": "explicit"
},
"biome.enabled": true,
"eslint.enable": false,
"prettier.enable": false
}
EOF
git add -A && git commit -m "Configure vscode for biome"
}
init_biome() {
ensure_clean
if [ -f "biome.jsonc" ] || [ -f "biome.json" ]; then
echo "biome.jsonc or biome.json already exists"
exit 0
fi
pnpm add -D @biomejs/biome
pnpm dlx @biomejs/biome init --jsonc
claude-p 'Set vcs.enabled and vcs.useIgnoreFile to true in biome.jsonc'
git add -A && git commit -m "Init biome"
pnpm biome check --write
git add -A && git commit -m "Apply biome"
if [ ! -f ".vscode/settings.json" ]; then
configure_vscode_for_biome
fi
}
init_shadcn() {
ensure_clean
pnpm dlx shadcn@latest init
pnpm dlx shadcn@latest add button
git add -A && git commit -m "Init shadcn/ui"
}
create_next() {
if [ -z "$1" ]; then
echo "Project name is required"
exit 1
fi
# pnpm dlx create-next-app@latest --reset-preferences
pnpm create next-app@latest "$1" --use-pnpm --disable-git --yes
cd "$1"
git init
git commit -m "Initial commit" --allow-empty
git add -A && git commit -m "create-next-app"
init_shadcn
init_biome
}
cloudflare_worker() {
if [ -z "$1" ]; then
echo "Project name is required"
exit 1
fi
pnpm create cloudflare@latest "$1" --type="$2" --no-git --no-deploy
cd "$1"
git commit -m "Initial commit" --allow-empty
git add -A && git commit -m '$ pnpm create cloudflare@latest cron --type=scheduled --no-git --no-deploy'
}
case "$1" in
"next")
create_next "$2"
;;
"cloudflare_worker")
cloudflare_worker "$2" "$3"
;;
"init_biome")
init_biome
;;
"init_shadcn")
init_shadcn
;;
"configure_vscode_for_biome")
configure_vscode_for_biome
;;
esac