-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreinstall.sh
executable file
·69 lines (57 loc) · 1.52 KB
/
reinstall.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
#!/bin/bash
#
# Author: Stefan Schulte <stschulte@posteo.de>
#
# Small script to freshly start over installing all
# dependencies.
#
# Script can be used to upgrade all dependencies to
# to the latest version by simply having npm figure out
# the dependency tree again.
#
# Be careful as this will also upgrade over major versions
set -e
RUNTIME_DEPENDENCIES=(
"commander"
"yaml"
)
BUILDTIME_DEPENDENCIES=(
"typescript"
"@types/node"
"eslint"
"@eslint/js"
"eslint-config-flat-gitignore"
"eslint-plugin-perfectionist"
"@stylistic/eslint-plugin"
"typescript-eslint"
"@vitest/eslint-plugin"
"vitest"
"@vitest/coverage-v8"
)
if [[ ! -f package.json ]]; then
echo "No package.json found. Are you executing the script in the right directory? Abort now" 1>&2
exit 3
fi
echo "Cleanup"
rm -rf node_modules package-lock.json *.tgz coverage dist
NEW_PACKAGE_JSON=`mktemp package.json.XXXXXXXXXX`
chmod 0644 "$NEW_PACKAGE_JSON"
jq 'del(.dependencies, .devDependencies)' package.json > "$NEW_PACKAGE_JSON"
mv "$NEW_PACKAGE_JSON" package.json
echo ">> Installing dependencies"
for PKG in "${RUNTIME_DEPENDENCIES[@]}"; do
echo " ● ${PKG}"
done
npm install "${RUNTIME_DEPENDENCIES[@]}"
echo ">> Installing development dependencies"
for PKG in "${BUILDTIME_DEPENDENCIES[@]}"; do
echo " ● ${PKG}"
done
npm install --save-dev "${BUILDTIME_DEPENDENCIES[@]}"
echo ">> DONE"
echo ""
echo "We reinstalled all dependencies. You may want to run"
echo ""
echo " git diff package.json"
echo ""
echo "now"