mikes-macos-developer-disk-cleanup 1.0.3 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.conventional-changelog-config.json +26 -0
- package/.env +8 -0
- package/.husky/commit-msg +1 -0
- package/.husky/pre-commit +1 -0
- package/.nvmrc +1 -0
- package/.release-it.json +16 -0
- package/.vscode/settings.json +22 -0
- package/CHANGELOG.md +57 -0
- package/README.md +2 -2
- package/cliff.toml +67 -0
- package/commitlint.config.js +1 -0
- package/mikes-macos-disk-cleanup.sh +31 -3
- package/modules/android-avd.sh +6 -5
- package/modules/android-sdk.sh +19 -10
- package/modules/cocoapods.sh +32 -0
- package/modules/hints.sh +9 -0
- package/modules/homebrew-caches.sh +16 -3
- package/modules/node-modules.sh +5 -0
- package/modules/ruby-gems.sh +4 -0
- package/modules/xcode-artifacts.sh +3 -3
- package/package.json +17 -3
@@ -0,0 +1,26 @@
|
|
1
|
+
{
|
2
|
+
"options": {
|
3
|
+
"infile": "CHANGELOG.md",
|
4
|
+
"header": "# Changelog",
|
5
|
+
"preset": {
|
6
|
+
"name": "conventionalchangelog",
|
7
|
+
"types": [
|
8
|
+
{ "type": "feat", "section": "Features" },
|
9
|
+
{ "type": "feature", "section": "Features" },
|
10
|
+
{ "type": "fix", "section": "Bug Fixes" },
|
11
|
+
{ "type": "perf", "section": "Performance Improvements" },
|
12
|
+
{ "type": "revert", "section": "Reverts" },
|
13
|
+
{ "type": "docs", "section": "Documentation" },
|
14
|
+
{ "type": "style", "section": "Styles" },
|
15
|
+
{ "type": "chore", "section": "Miscellaneous Chores" },
|
16
|
+
{ "type": "refactor", "section": "Code Refactoring" },
|
17
|
+
{ "type": "test", "section": "Tests" },
|
18
|
+
{ "type": "build", "section": "Build System" },
|
19
|
+
{ "type": "ci", "section": "Continuous Integration" }
|
20
|
+
]
|
21
|
+
},
|
22
|
+
"writerOpts": {
|
23
|
+
"groupBy": "type"
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
package/.env
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
#/-------------------[DOTENV_PUBLIC_KEY]--------------------/
|
2
|
+
#/ public-key encryption for .env files /
|
3
|
+
#/ [how it works](https://dotenvx.com/encryption) /
|
4
|
+
#/----------------------------------------------------------/
|
5
|
+
DOTENV_PUBLIC_KEY="036dc3b1c538f3b753f28504685c42364d6aa3fd3cdc0d544ffab9dbe9c8d2afef"
|
6
|
+
|
7
|
+
# .env
|
8
|
+
GITHUB_TOKEN="encrypted:BNnSFezPjmz67d7bbIftawwuKLB65j8o5QStETBFPmMqZMlWMk0V1qF1NkhYKFvMcnjsv/qIV+1gT/Dkt4IzGZu8bXGhJ6cBfpZJ/QP79YvYGvrn/4qCLj/QsBtsNZc2iCpDJvU7dAzey7gi+2qCCDkZpjv042tsZtTcviAK+JbF31UBqsYTjxSM2FcaXwlbGlQjx6ygDk5AXJbTtQpCa1iAjfeW7ma9MypeKGGfSUBkCDMW42MZmXJZ+TN/Dw=="
|
@@ -0,0 +1 @@
|
|
1
|
+
npx --no -- commitlint --edit $1
|
@@ -0,0 +1 @@
|
|
1
|
+
|
package/.nvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
20
|
package/.release-it.json
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "https://unpkg.com/release-it@17/schema/release-it.json",
|
3
|
+
"git": {
|
4
|
+
"commitMessage": "chore: release ${version}",
|
5
|
+
"requireCleanWorkingDir": false
|
6
|
+
},
|
7
|
+
"github": {
|
8
|
+
"release": true
|
9
|
+
},
|
10
|
+
"npm": {
|
11
|
+
"publish": false
|
12
|
+
},
|
13
|
+
"hooks": {
|
14
|
+
"after:bump": "npm run release-changelog ${version}"
|
15
|
+
}
|
16
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
{
|
2
|
+
"conventionalCommits.scopes": [
|
3
|
+
"android-avd",
|
4
|
+
"android-build-folders",
|
5
|
+
"android-sdk",
|
6
|
+
"bun-cache",
|
7
|
+
"cocoapods",
|
8
|
+
"docker-files",
|
9
|
+
"gradle-shared",
|
10
|
+
"hints",
|
11
|
+
"homebrew-caches",
|
12
|
+
"library-caches",
|
13
|
+
"meteor-builds-and-packages",
|
14
|
+
"node-modules",
|
15
|
+
"npm-cache",
|
16
|
+
"ruby-gems",
|
17
|
+
"trash",
|
18
|
+
"xcode-artifacts",
|
19
|
+
"yarn-cache",
|
20
|
+
"infra"
|
21
|
+
]
|
22
|
+
}
|
package/CHANGELOG.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
## 1.0.7 - 2025-02-05
|
6
|
+
|
7
|
+
[88faf33](88faf333e35787b53a8988f8a42647e5fde4bfdc)...[30f323d](30f323da067b92b69f912cea5ce85b90997cef44)
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
- :recycle: try to detect brew location ([2aace79](2aace79ab5570049af7bfd87908cbfd4a5f9334f))
|
12
|
+
- :bug: fix avdmanager path error ([9b28ba2](9b28ba2f4163454a5d36e48af93c3e51509a8b9c))
|
13
|
+
|
14
|
+
### Documentation
|
15
|
+
|
16
|
+
- :bookmark: fix changelog for previous version ([8792d75](8792d759de54c46be3cf3471a7ef3c18f937a41c))
|
17
|
+
|
18
|
+
### Miscellaneous Tasks
|
19
|
+
|
20
|
+
- :construction_worker: fix changelog generation ([30f323d](30f323da067b92b69f912cea5ce85b90997cef44))
|
21
|
+
|
22
|
+
## 1.0.6 - 2024-12-09
|
23
|
+
|
24
|
+
[462ee69](462ee6964edfa65a224b1cc56f1f7cc15fdc600a)...[88faf33](88faf333e35787b53a8988f8a42647e5fde4bfdc)
|
25
|
+
|
26
|
+
### Miscellaneous Tasks
|
27
|
+
|
28
|
+
- :hammer: add GITHUB_TOKEN ([4d14cbf](4d14cbfae18980d645d60f10a7feef9ce7650b06))
|
29
|
+
- :arrow_up: update dependency to node >= 18 ([ca92511](ca925115cb3137e795d55769dfa7332cf38b89cf))
|
30
|
+
- Release 1.0.6 ([88faf33](88faf333e35787b53a8988f8a42647e5fde4bfdc))
|
31
|
+
|
32
|
+
## 1.0.5 - 2024-12-09
|
33
|
+
|
34
|
+
[bc39b3e](bc39b3e006b19b68acd7deb3b30a8be93b50a52b)...[462ee69](462ee6964edfa65a224b1cc56f1f7cc15fdc600a)
|
35
|
+
|
36
|
+
### Bug Fixes
|
37
|
+
|
38
|
+
- :bug: fix issue with android sdkmanager path ([6bb0ba6](6bb0ba6fcca63f56f44808eff220eda86579ce85))
|
39
|
+
|
40
|
+
### Features
|
41
|
+
|
42
|
+
- Add commit linting and release-it ([12729bd](12729bd019abd9219e6cb3eeda040fc90e836228))
|
43
|
+
|
44
|
+
### Miscellaneous Tasks
|
45
|
+
|
46
|
+
- :hammer: add vscode conventional commit scopes ([84e7ca5](84e7ca516dccec2ea1a798859480fbd65e77b935))
|
47
|
+
- :hammer: add vscode conventional commit scopes ([5979eed](5979eed216a65ef6faa733bf71d2a5f47ffb708b))
|
48
|
+
- :hammer: add release-it config ([639b8bb](639b8bb2122be6c4d7a83267c516636458d1743c))
|
49
|
+
- Release 1.0.5 ([462ee69](462ee6964edfa65a224b1cc56f1f7cc15fdc600a))
|
50
|
+
|
51
|
+
## 1.0.4 - 2024-10-03
|
52
|
+
|
53
|
+
[d44b8c0](d44b8c0a12b30f9b4d8f15f89a1ee80150d147cd)...[bc39b3e](bc39b3e006b19b68acd7deb3b30a8be93b50a52b)
|
54
|
+
|
55
|
+
## 1.0.3 - 2024-10-03
|
56
|
+
|
57
|
+
<!-- generated by git-cliff -->
|
package/README.md
CHANGED
@@ -42,7 +42,7 @@ Currently it searches for (and cleans) the following items:
|
|
42
42
|
|
43
43
|
## Version History
|
44
44
|
|
45
|
-
-
|
45
|
+
- See [Changelog][Changelog]
|
46
46
|
|
47
47
|
|
48
48
|
<!--
|
@@ -50,7 +50,7 @@ Currently it searches for (and cleans) the following items:
|
|
50
50
|
--->
|
51
51
|
|
52
52
|
<!-- LINKS -->
|
53
|
-
|
53
|
+
[Changelog]:./CHANGELOG.md
|
54
54
|
|
55
55
|
<!-- IMAGES -->
|
56
56
|
|
package/cliff.toml
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# git-cliff ~ configuration file
|
2
|
+
# https://git-cliff.org/docs/configuration
|
3
|
+
|
4
|
+
[changelog]
|
5
|
+
# template for the changelog header
|
6
|
+
header = """
|
7
|
+
# Changelog\n
|
8
|
+
All notable changes to this project will be documented in this file.\n
|
9
|
+
"""
|
10
|
+
# template for the changelog body
|
11
|
+
# https://keats.github.io/tera/docs/#introduction
|
12
|
+
body = """
|
13
|
+
{% if version %}\
|
14
|
+
## {{ version | trim_start_matches(pat="v") }} - {{ timestamp | date(format="%Y-%m-%d") }}
|
15
|
+
{% else %}\
|
16
|
+
## Unreleased
|
17
|
+
{% endif %}\
|
18
|
+
{% if previous %}\
|
19
|
+
{% if previous.commit_id and commit_id %}
|
20
|
+
[{{ previous.commit_id | truncate(length=7, end="") }}]({{ previous.commit_id }})...\
|
21
|
+
[{{ commit_id | truncate(length=7, end="") }}]({{ commit_id }})
|
22
|
+
{% endif %}\
|
23
|
+
{% endif %}\
|
24
|
+
{% for group, commits in commits | group_by(attribute="group") %}
|
25
|
+
### {{ group | upper_first }}
|
26
|
+
{% for commit in commits %}
|
27
|
+
- {{ commit.message | split(pat="\n") | first | upper_first | trim }} ([{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }}))\
|
28
|
+
{% for footer in commit.footers -%}
|
29
|
+
, {{ footer.token }}{{ footer.separator }}{{ footer.value }}\
|
30
|
+
{% endfor %}\
|
31
|
+
{% endfor %}
|
32
|
+
{% endfor %}\n
|
33
|
+
"""
|
34
|
+
# template for the changelog footer
|
35
|
+
footer = """
|
36
|
+
<!-- generated by git-cliff -->
|
37
|
+
"""
|
38
|
+
# remove the leading and trailing whitespace from the templates
|
39
|
+
trim = true
|
40
|
+
|
41
|
+
[git]
|
42
|
+
# parse the commits based on https://www.conventionalcommits.org
|
43
|
+
conventional_commits = true
|
44
|
+
# filter out the commits that are not conventional
|
45
|
+
filter_unconventional = false
|
46
|
+
# regex for parsing and grouping commits
|
47
|
+
commit_parsers = [
|
48
|
+
{ message = "^feat", group = "Features" },
|
49
|
+
{ message = "^fix", group = "Bug Fixes" },
|
50
|
+
{ message = "^doc", group = "Documentation" },
|
51
|
+
{ message = "^perf", group = "Performance" },
|
52
|
+
{ message = "^refactor", group = "Refactor" },
|
53
|
+
{ message = "^style", group = "Styling" },
|
54
|
+
{ message = "^test", group = "Testing" },
|
55
|
+
{ message = "^chore\\(deps.*\\)", skip = true },
|
56
|
+
{ message = "^chore\\(pr\\)", skip = true },
|
57
|
+
{ message = "^chore\\(pull\\)", skip = true },
|
58
|
+
{ message = "^chore\\(release\\): prepare for", skip = true },
|
59
|
+
{ message = "^chore|^ci", group = "Miscellaneous Tasks" },
|
60
|
+
{ body = ".*security", group = "Security" },
|
61
|
+
]
|
62
|
+
# filter out the commits that are not matched by commit parsers
|
63
|
+
filter_commits = false
|
64
|
+
# sort the tags topologically
|
65
|
+
topo_order = false
|
66
|
+
# sort the commits inside sections by oldest/newest order
|
67
|
+
sort_commits = "oldest"
|
@@ -0,0 +1 @@
|
|
1
|
+
module.exports = { extends: ['@commitlint/config-conventional'] };
|
@@ -26,6 +26,7 @@
|
|
26
26
|
# - Android SDK packages
|
27
27
|
# - Android AVDs
|
28
28
|
# - Homebrew caches
|
29
|
+
# - CocoaPods
|
29
30
|
|
30
31
|
# ==== CONFIGURATION DEFAULTS - change as needed ====
|
31
32
|
CONFIGFILE="${HOME}/.config/mikes-macos-disk-cleanup.env" # you'll be prompted to create this if it doesn't exist
|
@@ -68,9 +69,16 @@ if [ ${INITIALISED:-0} -ne 1 ]; then
|
|
68
69
|
fi
|
69
70
|
printf "DEVELOPMENT_BASE_DIR=${DEVELOPMENT_BASE_DIR}\n" >${CONFIGFILE}
|
70
71
|
echo "Configuration saved to ${CONFIGFILE}"
|
72
|
+
echo "NOTE: subsequent invocations will immediately commence deleting files!"
|
71
73
|
else
|
72
74
|
echo "Not saving configuration..."
|
73
75
|
fi
|
76
|
+
|
77
|
+
read -p "Deleting is about to start! Proceed? [y/n]" SHOULD_PROCEED
|
78
|
+
if [ "${SHOULD_PROCEED}" != "y" ]; then
|
79
|
+
echo "Exiting..."
|
80
|
+
exit 1
|
81
|
+
fi
|
74
82
|
fi
|
75
83
|
|
76
84
|
echo "Using development base directory: ${DEVELOPMENT_BASE_DIR}"
|
@@ -120,6 +128,13 @@ INITIALSPACE=$(
|
|
120
128
|
)
|
121
129
|
echo "DISK USAGE BEFORE CLEANUP: ${INITIALSPACE}"
|
122
130
|
|
131
|
+
# addHint function
|
132
|
+
source "${DIR}/modules/hints.sh"
|
133
|
+
|
134
|
+
# CocoaPods
|
135
|
+
source "${DIR}/modules/cocoapods.sh"
|
136
|
+
cocoapods
|
137
|
+
|
123
138
|
# remove everything in ~/Library/Caches
|
124
139
|
source "${DIR}/modules/library-caches.sh"
|
125
140
|
libraryCaches
|
@@ -170,7 +185,20 @@ androidBuildFolders
|
|
170
185
|
|
171
186
|
# Android SDKs
|
172
187
|
source "${DIR}/modules/android-sdk.sh"
|
188
|
+
set +e ; # don't exit on error
|
173
189
|
androidSDK
|
190
|
+
RETCODE=$?
|
191
|
+
set -e; # exit on error
|
192
|
+
|
193
|
+
if [ ${RETCODE} -ne 0 ]; then
|
194
|
+
if [ ${RETCODE} -eq 100 ]; then
|
195
|
+
echo "Android SDK packages already only have one version installed. Proceeding."
|
196
|
+
else
|
197
|
+
echo "!!! Failed to clean up Android SDKs !!!"
|
198
|
+
echo " check the output above for more info"
|
199
|
+
exit ${RETCODE}
|
200
|
+
fi
|
201
|
+
fi
|
174
202
|
|
175
203
|
# Android AVDs
|
176
204
|
source "${DIR}/modules/android-avd.sh"
|
@@ -190,8 +218,8 @@ FINALSPACE=$(
|
|
190
218
|
}'
|
191
219
|
)
|
192
220
|
|
193
|
-
echo "
|
221
|
+
echo "============================== FINISHED! ================================="
|
194
222
|
|
195
|
-
echo "
|
196
|
-
echo "
|
223
|
+
echo "BEFORE CLEANUP: ${INITIALSPACE}"
|
224
|
+
echo "NOW: ${FINALSPACE}"
|
197
225
|
echo "${HINTS_UPON_FINISH}"
|
package/modules/android-avd.sh
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
androidAVD() {
|
2
2
|
# Android Virtual Device Cleanup
|
3
|
-
|
3
|
+
local AVDMANAGER=${ANDROID_HOME}/cmdline-tools/latest/bin/avdmanager
|
4
|
+
command -v ${AVDMANAGER} >/dev/null 2>&1 && {
|
4
5
|
# get the full path from one of the AVDs
|
5
|
-
local FIRST_AVD_PATH=$(
|
6
|
+
local FIRST_AVD_PATH=$(${AVDMANAGER} list avd | grep "Path:" | head -1 | tr -s " "| cut -f3 -d" ")
|
6
7
|
|
7
8
|
if [ -z "${FIRST_AVD_PATH}" ]; then
|
8
9
|
echo "no avds found"
|
@@ -13,15 +14,15 @@ androidAVD() {
|
|
13
14
|
local FIRST_AVD_PARENTPATH=$(dirname "${FIRST_AVD_PATH}")
|
14
15
|
local AVDFOLDERSIZEBEFORE=$(du -hs "${FIRST_AVD_PARENTPATH}" | cut -f1)
|
15
16
|
echo "=== removing avds from ${FIRST_AVD_PARENTPATH} (${AVDFOLDERSIZEBEFORE}) ==="
|
16
|
-
for AVD in $(
|
17
|
+
for AVD in $(${AVDMANAGER} list avd -c); do
|
17
18
|
printf " - deleting AVD %s ..."
|
18
|
-
|
19
|
+
${AVDMANAGER} delete avd -n "${AVD}"
|
19
20
|
echo "done"
|
20
21
|
done
|
21
22
|
local AVDFOLDERSIZEAFTER=$(du -hs "${FIRST_AVD_PARENTPATH}" | cut -f1)
|
22
23
|
echo " AVD folder size before: ${AVDFOLDERSIZEBEFORE}; after: ${AVDFOLDERSIZEAFTER}"
|
23
24
|
} || {
|
24
|
-
echo "'
|
25
|
+
echo "'${AVDMANAGER}' command not found"
|
25
26
|
return 1
|
26
27
|
}
|
27
28
|
}
|
package/modules/android-sdk.sh
CHANGED
@@ -2,36 +2,45 @@ androidSDK() {
|
|
2
2
|
local THISMODULEDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
3
3
|
|
4
4
|
# Android SDK Manager Cleanup
|
5
|
-
command -v sdkmanager >/dev/null 2>&1 && {
|
6
|
-
|
5
|
+
command -v ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager >/dev/null 2>&1 && {
|
6
|
+
local SDKMANAGER_COMMAND="${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager"
|
7
7
|
local ANDROIDHOME_BEFORE=$(du -hs $ANDROID_HOME | cut -f1)
|
8
8
|
|
9
9
|
echo "=== android sdkmanager cleanup ==="
|
10
10
|
echo " - BEFORE CLEANUP: ${ANDROIDHOME_BEFORE} (${ANDROID_HOME})"
|
11
11
|
|
12
|
+
# remove .downloadIntermediates folder if it exists
|
13
|
+
if [ -d "${ANDROID_HOME}/.downloadIntermediates" ]; then
|
14
|
+
echo " - removing ${ANDROID_HOME}/.downloadIntermediates"
|
15
|
+
rm -rf "${ANDROID_HOME}/.downloadIntermediates"
|
16
|
+
fi
|
12
17
|
# create temporary output file
|
13
18
|
local OUTFILENAME=$(mktemp)
|
14
19
|
|
15
|
-
|
20
|
+
local SDKMANAGER_OUTPUT=$(${SDKMANAGER_COMMAND} --list_installed --include_obsolete)
|
21
|
+
|
22
|
+
echo "${SDKMANAGER_OUTPUT}" |
|
16
23
|
awk -f "${THISMODULEDIR}/android-sdk.awk" -v outputFile="${OUTFILENAME}"
|
17
24
|
|
18
25
|
if [ $? -ne 0 ]; then
|
19
|
-
echo " WARNING: we
|
20
|
-
echo " (
|
21
|
-
|
26
|
+
echo " WARNING: we could not parse the output of 'sdkmanager --list_installed --include_obsolete'"
|
27
|
+
echo " \(very likely there is just nothing to remove\)"
|
28
|
+
cat "${OUTFILENAME}"
|
29
|
+
return 100
|
22
30
|
fi
|
23
31
|
|
24
32
|
echo " - packages to remove: "
|
25
33
|
cat "${OUTFILENAME}" | sed 's/^/ - /'
|
26
34
|
|
27
35
|
echo " - uninstalling packages..."
|
28
|
-
|
36
|
+
${SDKMANAGER_COMMAND} --uninstall --package_file="${OUTFILENAME}"
|
29
37
|
local ANDROIDHOME_AFTER=$(du -hs $ANDROID_HOME | cut -f1)
|
30
38
|
|
31
|
-
echo " - BEFORE CLEANUP: ${ANDROIDHOME_BEFORE} (${ANDROID_HOME})"
|
32
|
-
echo " - AFTER CLEANUP: ${ANDROIDHOME_AFTER}"
|
39
|
+
echo " - BEFORE ANDROID SDKMANAGER CLEANUP: ${ANDROIDHOME_BEFORE} (${ANDROID_HOME})"
|
40
|
+
echo " - AFTER ANDROID SDKMANAGER CLEANUP: ${ANDROIDHOME_AFTER}"
|
41
|
+
addHint "- You may need to run android's SDK manager to restore the Android SDK versions you were using"
|
33
42
|
} || {
|
34
|
-
echo "'sdkmanager' command not found"
|
43
|
+
echo "'${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager' command not found"
|
35
44
|
return 1
|
36
45
|
}
|
37
46
|
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
cocoapods() {
|
2
|
+
if [ -d ${HOME}/.cocoapods ]; then
|
3
|
+
# Pods folders
|
4
|
+
echo "=== clearing Pods folders ==="
|
5
|
+
pod cache clean --all
|
6
|
+
echo " - looking for Pods folders in ${DEVELOPMENT_BASE_DIR}... "
|
7
|
+
local PODS_FOLDERS=$(
|
8
|
+
find -E "${DEVELOPMENT_BASE_DIR}" -type d \
|
9
|
+
-regex '^.*Pods$' \
|
10
|
+
-not -regex "${HOME}/\..*" \
|
11
|
+
-not -regex "^.*Pods.+"
|
12
|
+
)
|
13
|
+
echo " - found Pods folders:"
|
14
|
+
IFS=$'\n' # make newlines the only separator
|
15
|
+
for PODS_FOLDER in ${PODS_FOLDERS}; do
|
16
|
+
echo " - ${PODS_FOLDER}"
|
17
|
+
done
|
18
|
+
echo " - running 'rm -rf ' in each of the above"
|
19
|
+
local PODS_WERE_REMOVED=0
|
20
|
+
for PODS_FOLDER in ${PODS_FOLDERS}; do
|
21
|
+
PODS_WERE_REMOVED=1
|
22
|
+
local PODS_FOLDER_SIZE=$(du -hs "${PODS_FOLDER}" | cut -f1)
|
23
|
+
printf " - removing '${PODS_FOLDER}' (${PODS_FOLDER_SIZE}) ... "
|
24
|
+
rm -rf "${PODS_FOLDER}"
|
25
|
+
echo "done"
|
26
|
+
done
|
27
|
+
unset IFS
|
28
|
+
if [ ${PODS_WERE_REMOVED} -eq 1 ]; then
|
29
|
+
addHint "- You'll need to perform a 'pod install' (or npx pod-install) in each of your projects"
|
30
|
+
fi
|
31
|
+
fi
|
32
|
+
}
|
package/modules/hints.sh
ADDED
@@ -1,11 +1,21 @@
|
|
1
1
|
homebrewCaches(){
|
2
|
+
local BREW;
|
3
|
+
if [ -f /opt/homebrew/bin/brew]; then
|
4
|
+
# apple silicon
|
5
|
+
BREW=/opt/homebrew/bin/brew
|
6
|
+
elif [ -f /usr/local/bin/brew ]; then
|
7
|
+
# intel mac
|
8
|
+
BREW=/usr/local/bin/brew
|
9
|
+
else
|
10
|
+
BREW=/home/linuxbrew/.linuxbrew/bin/brew
|
11
|
+
fi
|
2
12
|
# Homebrew Caches
|
3
|
-
command -v
|
13
|
+
command -v ${BREW} >/dev/null 2>&1 && {
|
4
14
|
echo "=== cleaning up homebrew caches ==="
|
5
15
|
local SIZEBEFORE=$(du -hs ${HOME}/Library/Caches/Homebrew | cut -f1)
|
6
16
|
# set +e: don't exit on error (brew cleanup sometimes has permissions problems)
|
7
17
|
set +e
|
8
|
-
|
18
|
+
${BREW} cleanup --prune=all
|
9
19
|
if [ $? -ne 0 ]; then
|
10
20
|
echo "!!! failed to clean up homebrew caches !!!"
|
11
21
|
echo " check the output above for more info"
|
@@ -14,5 +24,8 @@ homebrewCaches(){
|
|
14
24
|
set -e
|
15
25
|
local SIZEAFTER=$(du -hs ${HOME}/Library/Caches/Homebrew | cut -f1)
|
16
26
|
echo " cache size before: ${SIZEBEFORE}; after: ${SIZEAFTER}"
|
27
|
+
} || {
|
28
|
+
echo "brew command not found"
|
29
|
+
return 1;
|
17
30
|
}
|
18
|
-
}
|
31
|
+
}
|
package/modules/node-modules.sh
CHANGED
@@ -13,13 +13,18 @@ nodeModules() {
|
|
13
13
|
for NODE_MODULE_FOLDER in ${NODE_MODULE_FOLDERS}; do
|
14
14
|
echo " - ${NODE_MODULE_FOLDER}"
|
15
15
|
done
|
16
|
+
local MODULESWERE_REMOVED=0
|
16
17
|
echo " - running 'rm -rf ' in each of the above"
|
17
18
|
for NODE_MODULE_FOLDER in ${NODE_MODULE_FOLDERS}; do
|
19
|
+
MODULESWERE_REMOVED=1
|
18
20
|
local NODE_MODULE_SIZE=$(du -hs "${NODE_MODULE_FOLDER}" | cut -f1)
|
19
21
|
printf " - removing '${NODE_MODULE_FOLDER}' (${NODE_MODULE_SIZE}) ... "
|
20
22
|
rm -rf "${NODE_MODULE_FOLDER}"
|
21
23
|
echo "done"
|
22
24
|
done
|
23
25
|
unset IFS
|
26
|
+
if [ ${MODULESWERE_REMOVED} -eq 1 ]; then
|
27
|
+
addHint "- You will need to reinstall node modules in each of your projects"
|
28
|
+
fi
|
24
29
|
|
25
30
|
}
|
package/modules/ruby-gems.sh
CHANGED
@@ -20,7 +20,7 @@ xcodeArtifacts() {
|
|
20
20
|
# Xcode DeviceLogs
|
21
21
|
if [ -d ${HOME}/Library/Developer/CoreSimulator/Caches ]; then
|
22
22
|
local XCCACHESIZE=$(du -hs ${HOME}/Library/Developer/CoreSimulator/Caches | cut -f1)
|
23
|
-
echo " removing Xcode Caches (${XCCACHESIZE})..."
|
23
|
+
echo " removing Xcode CoreSimulator Caches (${XCCACHESIZE})..."
|
24
24
|
rm -rf ${HOME}/Library/Developer/CoreSimulator/Caches
|
25
25
|
fi
|
26
26
|
|
@@ -35,11 +35,11 @@ xcodeArtifacts() {
|
|
35
35
|
awk '{\
|
36
36
|
r=$0;\
|
37
37
|
gsub(/^[^[:space:]]+[[:space:]]+/,"",r);\
|
38
|
-
printf("- This command would recover %s:\n rm -rf \"%s\"\n",$1, r);\
|
38
|
+
printf("- This command would recover an additional %s:\n rm -rf \"%s\"\n",$1, r);\
|
39
39
|
}'
|
40
40
|
)
|
41
41
|
echo "${DEVICESUPPORTCOMMAND}"
|
42
|
-
|
42
|
+
addHint "${DEVICESUPPORTCOMMAND}"
|
43
43
|
fi
|
44
44
|
fi # xcode
|
45
45
|
}
|
package/package.json
CHANGED
@@ -1,17 +1,31 @@
|
|
1
1
|
{
|
2
2
|
"name": "mikes-macos-developer-disk-cleanup",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.7",
|
4
4
|
"description": "Cleans up a developer's mac disk space. Aggressively.",
|
5
5
|
"bin": {
|
6
6
|
"mikes-macos-disk-cleanup": "mikes-macos-disk-cleanup.sh"
|
7
7
|
},
|
8
8
|
"scripts": {
|
9
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
9
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
10
|
+
"release-changelog": "git-cliff --unreleased --prepend CHANGELOG.md --tag ",
|
11
|
+
"release": "dotenvx run release-it -- -i -u",
|
12
|
+
"prepare": "husky"
|
10
13
|
},
|
11
14
|
"keywords": [],
|
12
15
|
"author": "Mike Cunneen",
|
16
|
+
"readme": "README.md",
|
13
17
|
"repository": {
|
14
18
|
"url": "https://github.com/cunneen/mikes-macos-developer-disk-cleanup"
|
15
19
|
},
|
16
|
-
"license": "MIT"
|
20
|
+
"license": "MIT",
|
21
|
+
"devDependencies": {
|
22
|
+
"@commitlint/cli": "^19.7.1",
|
23
|
+
"@commitlint/config-conventional": "^19.7.1",
|
24
|
+
"git-cliff": "^2.8.0",
|
25
|
+
"husky": "^9.1.7",
|
26
|
+
"release-it": "^18.1.2"
|
27
|
+
},
|
28
|
+
"engines": {
|
29
|
+
"node": ">=20"
|
30
|
+
}
|
17
31
|
}
|