mikes-macos-developer-disk-cleanup 1.0.4 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- 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/modules/android-avd.sh +6 -5
- package/modules/android-sdk.sh +9 -7
- package/modules/homebrew-caches.sh +16 -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'] };
|
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,8 +2,8 @@ androidSDK() {
|
|
2
2
|
local THISMODULEDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
3
3
|
|
4
4
|
# Android SDK Manager Cleanup
|
5
|
-
command -v ${ANDROID_HOME}/tools/bin/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 ==="
|
@@ -17,13 +17,15 @@ androidSDK() {
|
|
17
17
|
# create temporary output file
|
18
18
|
local OUTFILENAME=$(mktemp)
|
19
19
|
|
20
|
-
local SDKMANAGER_OUTPUT=$(
|
20
|
+
local SDKMANAGER_OUTPUT=$(${SDKMANAGER_COMMAND} --list_installed --include_obsolete)
|
21
|
+
|
21
22
|
echo "${SDKMANAGER_OUTPUT}" |
|
22
23
|
awk -f "${THISMODULEDIR}/android-sdk.awk" -v outputFile="${OUTFILENAME}"
|
23
24
|
|
24
25
|
if [ $? -ne 0 ]; then
|
25
|
-
echo " WARNING: we
|
26
|
-
echo " (very likely there
|
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}"
|
27
29
|
return 100
|
28
30
|
fi
|
29
31
|
|
@@ -31,14 +33,14 @@ androidSDK() {
|
|
31
33
|
cat "${OUTFILENAME}" | sed 's/^/ - /'
|
32
34
|
|
33
35
|
echo " - uninstalling packages..."
|
34
|
-
|
36
|
+
${SDKMANAGER_COMMAND} --uninstall --package_file="${OUTFILENAME}"
|
35
37
|
local ANDROIDHOME_AFTER=$(du -hs $ANDROID_HOME | cut -f1)
|
36
38
|
|
37
39
|
echo " - BEFORE ANDROID SDKMANAGER CLEANUP: ${ANDROIDHOME_BEFORE} (${ANDROID_HOME})"
|
38
40
|
echo " - AFTER ANDROID SDKMANAGER CLEANUP: ${ANDROIDHOME_AFTER}"
|
39
41
|
addHint "- You may need to run android's SDK manager to restore the Android SDK versions you were using"
|
40
42
|
} || {
|
41
|
-
echo "'${ANDROID_HOME}/tools/bin/sdkmanager' command not found"
|
43
|
+
echo "'${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager' command not found"
|
42
44
|
return 1
|
43
45
|
}
|
44
46
|
}
|
@@ -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/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
|
}
|