feat: Add scripts for cleaning and installing node modules

This commit is contained in:
Simon Larsen
2025-06-26 20:15:16 +01:00
parent eed5ce6ec9
commit 3119b8cfc2
2 changed files with 20 additions and 4 deletions

View File

@@ -37,6 +37,8 @@
"prerun": "bash configure.sh",
"typeorm": "node --require ts-node/register ./node_modules/typeorm/cli.js",
"uninstall": "bash uninstall.sh",
"clean-modules": "bash remove-node-modules.sh",
"install-modules": "bash install-node-modules.sh",
"lint": "export NODE_OPTIONS='--max-old-space-size=32768' && npx eslint . --cache",
"fix-lint": "export NODE_OPTIONS='--max-old-space-size=32768' && npx eslint . --fix --cache --debug",
"fix": "npm run fix-lint",

View File

@@ -1,7 +1,21 @@
#!/bin/bash
echo "Removing node_modules directories..."
for d in */ ; do
cd $d || echo "Cannot cd into $d"
rm -rf node_modules || echo "node_modules directory not found $d"
cd .. || echo "Cannot cd out"
done
if [ -d "$d" ]; then
cd "$d" || { echo "Cannot cd into $d"; continue; }
if [ -d "node_modules" ]; then
echo "Removing node_modules in $d"
rm -rf node_modules || echo "Failed to remove node_modules in $d"
else
echo "No node_modules found in $d"
fi
cd .. || echo "Cannot cd out of $d"
fi
done
echo "Finished removing node_modules directories."