datacap/configure/clean/clean-dependencie.sh
2024-11-17 17:00:42 +08:00

24 lines
583 B
Bash

#!/bin/bash
echo "Clean dependencies"
echo "Task: check dependencies"
depcheck --json > depcheck-output.json
echo "Task: remove unused dependencies"
UNUSED_DEPENDENCIES=$(jq -r '.dependencies[]' depcheck-output.json)
for PACKAGE in $UNUSED_DEPENDENCIES; do
pnpm remove $PACKAGE
done
echo "Task: remove unused dev dependencies"
UNUSED_DEV_DEPENDENCIES=$(jq -r '.devDependencies[]' depcheck-output.json)
for PACKAGE in $UNUSED_DEV_DEPENDENCIES; do
pnpm remove $PACKAGE --save-dev
done
echo "Task: install dependencies again"
pnpm install --fix
echo "Clean dependencies done"