-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-from-template.sh
executable file
·79 lines (62 loc) · 2.03 KB
/
update-from-template.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
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
#!/bin/bash
export APP=vue-app
bun create vue@latest ${APP} --ts --vue-router --pinia --vitest --playwright --eslint-with-prettier --force
cd ${APP}
if [ $(ulimit -n) -lt 300 ]
then
echo need to increase maxfiles
sudo launchctl limit maxfiles 2147483646
ulimit -n 2147483646
fi
bun i
bun add -d @vitest/coverage-v8 @vitest/ui
bun add -d dependency-cruiser
cat <<EOL
Setup dependency cruiser. Please choose like below
====================
✔ It looks like this is an ESM package. Is that correct? … yes
✔ Where do your source files live? … src
✔ Do your test files live in a separate folder? … yes
✔ Where do your test files live? … e2e
✔ Looks like you're using a 'tsconfig.json'. Use that? … yes
✔ Full path to your 'tsconfig.json › tsconfig.app.json
✔ Also regard TypeScript dependencies that exist only before compilation? … yes
====================
EOL
bunx depcruise --init
bun add -d tailwindcss postcss autoprefixer
bunx tailwindcss init -p
# make this patch from (R means reverse, no-prefix means no a/, b/ prefix in filepath)
# cf. https://stackoverflow.com/a/4610809/514411
# git diff -R --no-prefix src/assets/base.css > patch/tailwind.patch
patch -p0 < ../patch/tailwind.patch
# This uses node.js and npm. not supported bun yet
CI=true bunx storybook@latest init --disable-telemetry --package-manager bun --yes
rm -rf node_modules package-lock.json
bun i
# does not supports storybook 7
# bun add -d @storybook/addon-postcss
bun add -d eslint-plugin-storybook
bun add -d oxlint
bun run format
patch -p0 < ../patch/storybook-fix-lint-error.patch
../patch/storybook-fix-lint-error.sh
bun run lint
patch -p0 < ../patch/my-config.patch
rm -rf node_modules
rm bun.lockb
find . '(' -name \*.orig ')' -delete
cd ..
# TODO apply patch from git diff
cp -R $(
ls -a1 $APP \
| grep -Ev '^\.\.?$' \
| grep -Ev '^\.git$' \
| grep -Ev '^'$APP'$' \
| xargs -I{} echo "$APP/"{}
) ./
rm -rf node_modules
bun i
echo
echo maybe you need to update e2e snapshots by
echo ./e2e-update-snapshots.sh