-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapply.sh
executable file
·40 lines (30 loc) · 1.13 KB
/
apply.sh
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
#!/bin/bash
set -e
if ! command -v jq >/dev/null 2>&1; then
echo "jq is not installed"
exit 1
fi
cat <<EOF
🚨 This script will add the following dependencies to your Bun project:
- @cstrlcs/configs
- @biomejs/biome
- typescript
It will also edit/overwrite the following files:
- biome.json
- tsconfig.json
- package.json
- .gitattributes
Make sure you have a backup of those files before proceeding.
EOF
read -rp "Are you sure you want to continue? (y/N) " -n 1 -r REPLY
echo
if [[ ! "$REPLY" =~ ^[Yy]$ ]]; then
echo "❌ Aborting..."
exit 0
fi
bun add -D @cstrlcs/configs @biomejs/biome typescript
jq '.scripts |= . + { "lint": "biome check .", "lint:fix": "biome check . --apply-unsafe" }' package.json > package.json.temp && mv package.json.temp package.json
echo '{ "extends": ["@cstrlcs/configs/biome"] }' > biome.json
echo '{ "extends": "@cstrlcs/configs/tsconfig", "compilerOptions": { "baseUrl": ".", "paths": { "@/*": ["./src/*"] } }, "include": ["src"] }' > tsconfig.json
echo -e "* text=auto\n*.* text eol=lf" > .gitattributes
bunx biome check package.json biome.json tsconfig.json --write --unsafe