From 12791dcbcf30ef1777e8a8dffc4d53becfd579dc Mon Sep 17 00:00:00 2001 From: Wisaroot Lertthaweedech Date: Thu, 10 Jul 2025 21:21:15 +0700 Subject: [PATCH 1/4] feat: update README.md --- .prettierrc.json | 6 ++++++ .releaserc.json | 12 ++++++------ Makefile | 3 ++- README.md | 21 +++++++++++++++++---- 4 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 .prettierrc.json diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..a33508c --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,6 @@ +{ + "semi": false, + "tabWidth": 4, + "trailingComma": "es5", + "printWidth": 105 +} diff --git a/.releaserc.json b/.releaserc.json index 7bf05ec..6b74405 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -1,8 +1,8 @@ { - "branches": ["main"], - "plugins": [ - "@semantic-release/commit-analyzer", - "@semantic-release/release-notes-generator", - "@semantic-release/github" - ] + "branches": ["main"], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/github" + ] } diff --git a/Makefile b/Makefile index 0712fbd..14d1606 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ setup_dev: pipx install pre-commit pre-commit install - brew install shfmt shellcheck + brew install shfmt shellcheck prettier assert_setup_dev: pre-commit run -a @@ -16,3 +16,4 @@ assert_setup_dev: lint: find . -type f -name "*.sh" -exec shfmt -w -i 6 {} + find . -type f -name "*.sh" -exec shellcheck {} + + prettier --write "**/*.{json,yaml,yml,md}" diff --git a/README.md b/README.md index 41e1089..492c5fd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Shared Scripts -Collection of development setup and utility scripts for macOS environments. +Quick-share command line scripts for use in quick command runner like Makefile or Justfile. ## Quick Start @@ -11,6 +11,19 @@ make assert_setup_dev # Validate setup ## Requirements -- macOS -- Homebrew -- Zsh shell +- macOS +- Homebrew +- Zsh shell + +## Usage + +```bash +git submodule add -b main https://github.com/wisarootl/shared-scripts.git scripts/shared +``` + +```Makefile +setup_dev: + chmod +x scripts/shared/node/setup_dev.sh + ./scripts/shared/node/setup_dev.sh + exec zsh +``` From 3f614aabcb4e414f4661ddd6300f2a4a945307f4 Mon Sep 17 00:00:00 2001 From: Wisaroot Lertthaweedech Date: Thu, 10 Jul 2025 21:24:08 +0700 Subject: [PATCH 2/4] ci: update ci --- .github/workflows/versioning.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/versioning.yml b/.github/workflows/versioning.yml index a552cc6..d6ee9bd 100644 --- a/.github/workflows/versioning.yml +++ b/.github/workflows/versioning.yml @@ -16,11 +16,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2 with: fetch-depth: 0 - name: Release - uses: cycjimmy/semantic-release-action@v4 + uses: cycjimmy/semantic-release-action@16ca923e6ccbb50770c415a0ccd43709a8c5f7a4 #v4.2.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 3f6ca725a3cca85d8f81944b749a1fd51c4735a9 Mon Sep 17 00:00:00 2001 From: Wisaroot Lertthaweedech Date: Thu, 10 Jul 2025 21:24:53 +0700 Subject: [PATCH 3/4] ci: update ci --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 721221b..da97324 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: python-version: "3.x" - name: Install shfmt and shellcheck if: steps.apt-cache.outputs.cache-hit != 'true' - run: sudo apt-get update && sudo apt-get install -y shellcheck shfmt + run: sudo apt-get update && sudo apt-get install -y shellcheck shfmt prettier - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd #v3.0.1 with: extra_args: --all-files From 82b9cb4bd9662bed74acc1a70354a089af86cc23 Mon Sep 17 00:00:00 2001 From: Wisaroot Lertthaweedech Date: Thu, 10 Jul 2025 21:36:16 +0700 Subject: [PATCH 4/4] fix: fix ci bug --- .github/workflows/ci.yml | 7 ++++--- Makefile | 7 ++++++- shell/install_shell_deps.sh | 11 +++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100755 shell/install_shell_deps.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da97324..5438780 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,9 +13,10 @@ jobs: - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 #v5.6.0 with: python-version: "3.x" - - name: Install shfmt and shellcheck - if: steps.apt-cache.outputs.cache-hit != 'true' - run: sudo apt-get update && sudo apt-get install -y shellcheck shfmt prettier + - name: Install dependencies + run: | + chmod +x shell/install_shell_deps.sh + ./shell/install_shell_deps.sh - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd #v3.0.1 with: extra_args: --all-files diff --git a/Makefile b/Makefile index 14d1606..8ace469 100644 --- a/Makefile +++ b/Makefile @@ -8,11 +8,16 @@ setup_dev: pipx install pre-commit pre-commit install - brew install shfmt shellcheck prettier + chmod +x shell/install_shell_deps.sh + ./shell/install_shell_deps.sh assert_setup_dev: pre-commit run -a +ci: + chmod +x common/install_brew_packages.sh + ./common/install_brew_packages.sh + lint: find . -type f -name "*.sh" -exec shfmt -w -i 6 {} + find . -type f -name "*.sh" -exec shellcheck {} + diff --git a/shell/install_shell_deps.sh b/shell/install_shell_deps.sh new file mode 100755 index 0000000..e9d0f6a --- /dev/null +++ b/shell/install_shell_deps.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -e + +if [[ "$OSTYPE" == "darwin"* ]]; then + brew install shfmt shellcheck prettier +else + sudo apt-get update + sudo apt-get install -y shfmt shellcheck nodejs npm + npm install -g prettier +fi