-
Notifications
You must be signed in to change notification settings - Fork 0
/
svelte.zsh
51 lines (44 loc) · 1.09 KB
/
svelte.zsh
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
»s() { bun run ${1:-dev} }
s+(){ svelte-add $@ }
# +project from template (shadcn-svelte)
+s() {
local appname="${1:-sv$(word)}"
local local_template="$HOME/.repos/shadcn-svelte-template"
local repo_url="https://github.com/mrgnw/shadcn-svelte-template"
if [ -d "${local_template}/.git" ]; then
git -C "$local_template" pull
else
mkdir -p "$HOME/.repos"
git clone --depth=1 "$repo_url" "$local_template"
fi
cp -R "${local_template}/." "$appname"
chmod -R u+rw "$appname"
cd "$appname" &&
rm -rf .git &&
bun install &&
bun run dev
}
+s0() {
# + svelte project from scratch
local appname="${1:-sv$(word)}"
bunx sv create \
--check-types typescript \
--template minimal \
--no-install "$appname" &&
cd "$appname" &&
bun install &&
git init &&
git add . &&
git commit -m '+𝖘𝖛𝖑𝖙𝖊 New Svelte 5 project!' &&
bun run dev
}
# create a remote repo directly from the template
s_repo() {
appname="${1:-sv$(word)}"
gh repo create $appname \
--template https://github.com/mrgnw/shadcn-svelte-template \
--private --clone
cd $appname
bun install
bun run dev
}