mikes-macos-developer-disk-cleanup 1.0.4 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -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": true
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,77 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## 1.0.8 - 2025-02-05
6
+
7
+ [64546f9](64546f9fb87b06d86703311de819256761e2f7ad)...[e452923](e452923ade48217127cc9c786a6e12af2eab3829)
8
+
9
+ ### Bug Fixes
10
+
11
+ - :bug: docker daemon detection ([24321d5](24321d58fb062a28cacaa1fd809da5c37f7d6e79))
12
+ - :bug: docker daemon detection ([6045125](604512591d2763cb5be4bc425b79d968c1697de6))
13
+ - :pencil2: typo ([720298f](720298fedd74c008c8b888d5169188a1aaca865b))
14
+ - :pencil2: typo ([e6620de](e6620deacacfbce8ae0292d208f4a1c2f3117aee))
15
+ - :bug: handle permissions issue ([7c56838](7c56838eee1fa245bf81b040ac4ee4b17dbca9bb))
16
+
17
+ ### Documentation
18
+
19
+ - :memo: README - fix ref to changelog ([4bfc4a4](4bfc4a4f01631e5a1b6c49e71aefc918251845fc))
20
+
21
+ ### Miscellaneous Tasks
22
+
23
+ - :construction_worker: release-it - auto-publish NPM module ([e452923](e452923ade48217127cc9c786a6e12af2eab3829))
24
+
25
+ ## 1.0.7 - 2025-02-05
26
+
27
+ [88faf33](88faf333e35787b53a8988f8a42647e5fde4bfdc)...[30f323d](30f323da067b92b69f912cea5ce85b90997cef44)
28
+
29
+ ### Bug Fixes
30
+
31
+ - :recycle: try to detect brew location ([2aace79](2aace79ab5570049af7bfd87908cbfd4a5f9334f))
32
+ - :bug: fix avdmanager path error ([9b28ba2](9b28ba2f4163454a5d36e48af93c3e51509a8b9c))
33
+
34
+ ### Documentation
35
+
36
+ - :bookmark: fix changelog for previous version ([8792d75](8792d759de54c46be3cf3471a7ef3c18f937a41c))
37
+
38
+ ### Miscellaneous Tasks
39
+
40
+ - :construction_worker: fix changelog generation ([30f323d](30f323da067b92b69f912cea5ce85b90997cef44))
41
+
42
+ ## 1.0.6 - 2024-12-09
43
+
44
+ [462ee69](462ee6964edfa65a224b1cc56f1f7cc15fdc600a)...[88faf33](88faf333e35787b53a8988f8a42647e5fde4bfdc)
45
+
46
+ ### Miscellaneous Tasks
47
+
48
+ - :hammer: add GITHUB_TOKEN ([4d14cbf](4d14cbfae18980d645d60f10a7feef9ce7650b06))
49
+ - :arrow_up: update dependency to node >= 18 ([ca92511](ca925115cb3137e795d55769dfa7332cf38b89cf))
50
+ - Release 1.0.6 ([88faf33](88faf333e35787b53a8988f8a42647e5fde4bfdc))
51
+
52
+ ## 1.0.5 - 2024-12-09
53
+
54
+ [bc39b3e](bc39b3e006b19b68acd7deb3b30a8be93b50a52b)...[462ee69](462ee6964edfa65a224b1cc56f1f7cc15fdc600a)
55
+
56
+ ### Bug Fixes
57
+
58
+ - :bug: fix issue with android sdkmanager path ([6bb0ba6](6bb0ba6fcca63f56f44808eff220eda86579ce85))
59
+
60
+ ### Features
61
+
62
+ - Add commit linting and release-it ([12729bd](12729bd019abd9219e6cb3eeda040fc90e836228))
63
+
64
+ ### Miscellaneous Tasks
65
+
66
+ - :hammer: add vscode conventional commit scopes ([84e7ca5](84e7ca516dccec2ea1a798859480fbd65e77b935))
67
+ - :hammer: add vscode conventional commit scopes ([5979eed](5979eed216a65ef6faa733bf71d2a5f47ffb708b))
68
+ - :hammer: add release-it config ([639b8bb](639b8bb2122be6c4d7a83267c516636458d1743c))
69
+ - Release 1.0.5 ([462ee69](462ee6964edfa65a224b1cc56f1f7cc15fdc600a))
70
+
71
+ ## 1.0.4 - 2024-10-03
72
+
73
+ [d44b8c0](d44b8c0a12b30f9b4d8f15f89a1ee80150d147cd)...[bc39b3e](bc39b3e006b19b68acd7deb3b30a8be93b50a52b)
74
+
75
+ ## 1.0.3 - 2024-10-03
76
+
77
+ <!-- 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
- - v1.0: Initial release
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'] };
@@ -1,8 +1,9 @@
1
1
  androidAVD() {
2
2
  # Android Virtual Device Cleanup
3
- command -v ${ANDROID_HOME}/tools/bin/avdmanager >/dev/null 2>&1 && {
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=$(avdmanager list avd | grep "Path:" | head -1 | tr -s " "| cut -f3 -d" ")
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 $(avdmanager list avd -c); do
17
+ for AVD in $(${AVDMANAGER} list avd -c); do
17
18
  printf " - deleting AVD %s ..."
18
- avdmanager delete avd -n "${AVD}"
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 "'${ANDROID_HOME}/tools/bin/avdmanager' command not found"
25
+ echo "'${AVDMANAGER}' command not found"
25
26
  return 1
26
27
  }
27
28
  }
@@ -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=$(sdkmanager --list_installed --include_obsolete)
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 couldn't parse the output of 'sdkmanager --list_installed --include_obsolete'"
26
- echo " (very likely there's just nothing to remove)"
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
- sdkmanager --uninstall --package_file="${OUTFILENAME}"
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
  }
@@ -2,11 +2,13 @@ dockerFiles() {
2
2
  # Docker
3
3
  command -v docker >/dev/null 2>&1 && {
4
4
  echo "=== docker ==="
5
- echo " BEFORE DOCKER CLEANUP:"
6
- docker system df
7
- if [ $? -ne 0 ]; then
5
+ local DOCKER_RUNNING=0;
6
+ docker version && DOCKER_RUNNING=1 || DOCKER_RUNNING=0;
7
+ if [ ! $DOCKER_RUNNING == 1 ]; then
8
8
  echo "======= ERROR: docker daemon not running; skipping docker cleanup ======="
9
9
  else
10
+ echo " BEFORE DOCKER CLEANUP:"
11
+ docker system df
10
12
  # remove all docker artifacts
11
13
  echo " = removing all docker containers"
12
14
  docker ps -a -q | xargs -r docker rm — force
@@ -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 brew >/dev/null 2>&1 && {
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
- brew cleanup --prune=all
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
+ }
@@ -1,6 +1,6 @@
1
1
  # remove everything in ~/Library/Caches
2
2
  libraryCaches() {
3
- local LIBRARYCACHESIZE=$(du -hs "${HOME}/Library/Caches" | cut -f1)
3
+ local LIBRARYCACHESIZE=$((du -hs "${HOME}/Library/Caches" | cut -f1 ) || echo "ERROR: COULD NOT RUN 'du'")
4
4
  echo "=== emptying ~/Library/Caches...(${LIBRARYCACHESIZE}) ==="
5
- rm -rf "${HOME}/Library/Caches"
5
+ rm -rf "${HOME}/Library/Caches" || echo "=== ERROR! COULD NOT empty ~/Library/Caches. Continuing. ==="
6
6
  }
package/package.json CHANGED
@@ -1,17 +1,31 @@
1
1
  {
2
2
  "name": "mikes-macos-developer-disk-cleanup",
3
- "version": "1.0.4",
3
+ "version": "1.0.8",
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
  }