diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 721221b..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 + - 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/.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 }} 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..8ace469 100644 --- a/Makefile +++ b/Makefile @@ -8,11 +8,17 @@ setup_dev: pipx install pre-commit pre-commit install - brew install shfmt shellcheck + 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 {} + + 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 +``` 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