diff --git a/.github/actions/cache/restore/action.yml b/.github/actions/cache/restore/action.yml new file mode 100644 index 00000000..609c61cf --- /dev/null +++ b/.github/actions/cache/restore/action.yml @@ -0,0 +1,30 @@ +name: Restore cache +description: Restore cache using actions/cache/restore +inputs: + key: + description: 'An explicit key for restoring the cache' + required: true + restore-keys: + description: 'An ordered multiline string listing the prefix-matched keys, that are used for restoring stale cache if no cache hit occurred for key. Note `cache-hit` returns false in this case.' + required: true +outputs: + cache-primary-key: + description: 'A resolved cache key for which cache match was attempted' + value: ${{ steps.cache-action-restore.outputs.cache-primary-key }} + +runs: + using: "composite" + steps: + - id: cache-action-restore + uses: actions/cache/restore@v4.2.3 + with: + key: ${{ inputs.key }} + restore-keys: ${{ inputs.restore-keys }} + path: | + ~/.cache/sccache + ~/.cargo/registry + ~/.cargo/git + ~/.cargo/bin + ~/.cargo/.crates.toml + ~/.cargo/.crates2.json + ~/work/**/target diff --git a/.github/actions/cache/save/action.yml b/.github/actions/cache/save/action.yml new file mode 100644 index 00000000..caab50cc --- /dev/null +++ b/.github/actions/cache/save/action.yml @@ -0,0 +1,21 @@ +name: Save cache +description: Save cache using actions/cache/save +inputs: + key: + description: 'An explicit key for saving the cache' + required: true + +runs: + using: "composite" + steps: + - uses: actions/cache/save@v4.2.3 + with: + key: ${{ inputs.key }} + path: | + ~/.cache/sccache + ~/.cargo/registry + ~/.cargo/git + ~/.cargo/bin + ~/.cargo/.crates.toml + ~/.cargo/.crates2.json + ~/work/**/target diff --git a/.github/actions/pre-commit/dependencies/action.yml b/.github/actions/pre-commit/dependencies/action.yml new file mode 100644 index 00000000..5d939944 --- /dev/null +++ b/.github/actions/pre-commit/dependencies/action.yml @@ -0,0 +1,23 @@ +name: Install pre-commit dependencies +description: Install pre-commit dependencies + +runs: + using: "composite" + steps: + - name: Install Rust + uses: actions-rust-lang/setup-rust-toolchain@v1.13.0 + with: + toolchain: nightly-2025-01-06, stable + override: true + components: rustfmt, clippy + cache: 'false' + + # For more tools, see: https://github.com/taiki-e/install-action/blob/main/TOOLS.md + - name: Install Rust tools + uses: taiki-e/install-action@v2.57.8 + with: + tool: cargo-binstall,just,cargo-nextest,typos + + - name: Install NPM stuff from helpers/npm-install-g.txt + shell: bash + run: ./helpers/npm-install-g.sh diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml deleted file mode 100644 index 0cba14d5..00000000 --- a/.github/workflows/cli.yml +++ /dev/null @@ -1,60 +0,0 @@ -# Github workflow to build and test the Nexus CLI code - -name: Nexus CLI -on: - pull_request: - push: - branches: - - main - -# Fix for OOM. -env: - CARGO_BUILD_JOBS: 1 - CARGO_INCREMENTAL: 0 - RUSTFLAGS: > - -C codegen-units=1 - -jobs: - detect-changes: - uses: ./.github/workflows/detect_changes.yml - with: - files: | - cli/** - # 1. Install Rust - # 2. Install Rust cache - # 3. Install just - # 4. Build, fmt, clippy and test the CLI - build-and-test: - name: Build and test - runs-on: ubuntu-latest - needs: detect-changes - if: needs.detect-changes.outputs.changed == 'true' - steps: - - name: Check out repository code - uses: actions/checkout@v4 - - # 1. - - name: Install Rust - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - toolchain: stable, nightly-2025-01-06 - override: true - components: rustfmt, clippy - - # 2. - - name: Cache Build - uses: Swatinem/rust-cache@v2 - with: - workspaces: cli - - # 3 - - uses: taiki-e/install-action@just - - # 4 - - run: cargo +stable --version - - run: cargo +nightly-2025-01-06 --version - - run: just cli check - - run: just cli fmt-check - - run: just cli clippy - - run: just cli test - - run: just cli test-completions diff --git a/.github/workflows/pre-commit_(PR).yml b/.github/workflows/pre-commit_(PR).yml new file mode 100644 index 00000000..9b92956d --- /dev/null +++ b/.github/workflows/pre-commit_(PR).yml @@ -0,0 +1,60 @@ +name: Pre-commit hook (PR) +on: + pull_request: + +# Fix for OOM. +env: + RUST_CACHE_VERBOSE: true + CARGO_BUILD_JOBS: 1 + CARGO_INCREMENTAL: 0 + RUSTFLAGS: > + -C codegen-units=1 + + +jobs: + run-pre-commit: + name: Run pre-commit hook (PR branch) + runs-on: ubuntu-latest + steps: + - name: Get architecture + id: get-arch + run: echo "ARCH=$(uname -m)" >> $GITHUB_OUTPUT + + - name: Check out repository code + uses: actions/checkout@v4 + + - name: Compute cache keys + id: cache-keys + run: | + # `main` branch cache keys + echo "MAIN_CACHE_KEY=v7-${{ runner.os }}-${{ steps.get-arch.outputs.ARCH }}-main-${{ hashFiles('**/Cargo.lock') }}" >> $GITHUB_OUTPUT + echo "MAIN_CACHE_RESTORE_KEY=v7-${{ runner.os }}-${{ steps.get-arch.outputs.ARCH }}-main-" >> $GITHUB_OUTPUT + # PR branch cache keys + echo "PR_CACHE_KEY=v7-${{ runner.os }}-${{ steps.get-arch.outputs.ARCH }}-PR-${{ hashFiles('**/Cargo.lock') }}" >> $GITHUB_OUTPUT + echo "PR_CACHE_RESTORE_KEY=v7-${{ runner.os }}-${{ steps.get-arch.outputs.ARCH }}-PR-" >> $GITHUB_OUTPUT + + # Restoring the PR cache takes into account: + # + # 1. The PR cache itself, which is used to speed up the PR development cycle. + # 2. In case the above is missing, the main branch cache, which is used to bootstrap the PR cache. + - name: Restore cache (PR) + id: cache-restore + uses: ./.github/actions/cache/restore + with: + key: ${{ steps.cache-keys.outputs.PR_CACHE_KEY }} + restore-keys: | + ${{ steps.cache-keys.outputs.PR_CACHE_RESTORE_KEY }} + ${{ steps.cache-keys.outputs.MAIN_CACHE_RESTORE_KEY }} + + - name: Install pre-commit dependencies + uses: ./.github/actions/pre-commit/dependencies + + # Here it is ... + - name: Run pre-commit hook + run: ./.pre-commit/pre-commit + + - name: Save cache (PR) + uses: ./.github/actions/cache/save + if: ${{ always() }} + with: + key: ${{ steps.cache-restore.outputs.cache-primary-key }} diff --git a/.github/workflows/pre-commit_(main).yml b/.github/workflows/pre-commit_(main).yml new file mode 100644 index 00000000..88ee2859 --- /dev/null +++ b/.github/workflows/pre-commit_(main).yml @@ -0,0 +1,58 @@ +name: Pre-commit hook (main) +on: + push: + branches: + - main + +# Fix for OOM. +env: + RUST_CACHE_VERBOSE: true + CARGO_BUILD_JOBS: 1 + CARGO_INCREMENTAL: 0 + RUSTFLAGS: > + -C codegen-units=1 + +jobs: + run-pre-commit: + name: Run pre-commit hook (main branch) + runs-on: ubuntu-latest + steps: + - name: Get architecture + id: get-arch + run: echo "ARCH=$(uname -m)" >> $GITHUB_OUTPUT + + - name: Check out repository code + uses: actions/checkout@v4 + + - name: Compute cache keys + id: cache-keys + run: | + # `main` branch cache keys + echo "MAIN_CACHE_KEY=v7-${{ runner.os }}-${{ steps.get-arch.outputs.ARCH }}-main-${{ hashFiles('**/Cargo.lock') }}" >> $GITHUB_OUTPUT + echo "MAIN_CACHE_RESTORE_KEY=v7-${{ runner.os }}-${{ steps.get-arch.outputs.ARCH }}-main-" >> $GITHUB_OUTPUT + # PR branch cache keys + echo "PR_CACHE_RESTORE_KEY=v7-${{ runner.os }}-${{ steps.get-arch.outputs.ARCH }}-PR-" >> $GITHUB_OUTPUT + + - name: Restore cache (main) + id: cache-restore + uses: ./.github/actions/cache/restore + with: + key: ${{ steps.cache-keys.outputs.MAIN_CACHE_KEY }} + restore-keys: | + ${{ steps.cache-keys.outputs.MAIN_CACHE_RESTORE_KEY }} + ${{ steps.cache-keys.outputs.MAIN_CACHE_RESTORE_KEY0 }} + ${{ steps.cache-keys.outputs.PR_CACHE_RESTORE_KEY }} + + - name: Install pre-commit dependencies + uses: ./.github/actions/pre-commit/dependencies + + # Here it is ... + - name: Run pre-commit hook + run: ./.pre-commit/pre-commit + + + - name: Save cache (main) + uses: ./.github/actions/cache/save + if: ${{ always() }} + with: + key: ${{ steps.cache-restore.outputs.cache-primary-key }} diff --git a/.github/workflows/sdk.yml b/.github/workflows/sdk.yml deleted file mode 100644 index c27a5c31..00000000 --- a/.github/workflows/sdk.yml +++ /dev/null @@ -1,62 +0,0 @@ -# Github workflow to build and test the Nexus SDK code - -name: Nexus SDK -on: - pull_request: - push: - branches: - - main - -# Fix for OOM. -env: - CARGO_BUILD_JOBS: 1 - CARGO_INCREMENTAL: 0 - RUSTFLAGS: > - -C codegen-units=1 - -jobs: - detect-changes: - uses: ./.github/workflows/detect_changes.yml - with: - files: | - sdk/** - # 1. Install Rust - # 2. Install Rust cache - # 3. Install just - # 4. Build, fmt, clippy and test the Nexus SDK - build-and-test: - name: Build and test - runs-on: ubuntu-latest - needs: detect-changes - if: needs.detect-changes.outputs.changed == 'true' - steps: - - name: Check out repository code - uses: actions/checkout@v4 - - - name: Set up Docker - uses: docker/setup-docker-action@v4 - - # 1. - - name: Install Rust - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - toolchain: stable, nightly-2025-01-06 - override: true - components: rustfmt, clippy - - # 2. - - name: Cache Build - uses: Swatinem/rust-cache@v2 - with: - workspaces: sdk - - # 3. - - uses: taiki-e/install-action@just - - # 4 - - run: cargo +stable --version - - run: cargo +nightly-2025-01-06 --version - - run: just sdk check - - run: just sdk fmt-check - - run: just sdk clippy - - run: just sdk test diff --git a/.github/workflows/toolkit-rust.yml b/.github/workflows/toolkit-rust.yml deleted file mode 100644 index c3bbbe6c..00000000 --- a/.github/workflows/toolkit-rust.yml +++ /dev/null @@ -1,59 +0,0 @@ -# Github workflow to build and test the Nexus Toolkit for Rust code - -name: Nexus Toolkit for Rust -on: - pull_request: - push: - branches: - - main - -# Fix for OOM. -env: - CARGO_BUILD_JOBS: 1 - CARGO_INCREMENTAL: 0 - RUSTFLAGS: > - -C codegen-units=1 - -jobs: - detect-changes: - uses: ./.github/workflows/detect_changes.yml - with: - files: | - toolkit-rust/** - # 1. Install Rust - # 2. Install Rust cache - # 3. Install just - # 4. Build, fmt, clippy and test the Toolkit for Rust - build-and-test: - name: Build and test - runs-on: ubuntu-latest - needs: detect-changes - if: needs.detect-changes.outputs.changed == 'true' - steps: - - name: Check out repository code - uses: actions/checkout@v4 - - # 1. - - name: Install Rust - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - toolchain: stable, nightly-2025-01-06 - override: true - components: rustfmt, clippy - - # 2. - - name: Cache Build - uses: Swatinem/rust-cache@v2 - with: - workspaces: toolkit-rust - - # 3. - - uses: taiki-e/install-action@just - - # 4 - - run: cargo +stable --version - - run: cargo +nightly-2025-01-06 --version - - run: just toolkit-rust check - - run: just toolkit-rust fmt-check - - run: just toolkit-rust clippy - - run: just toolkit-rust test diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml deleted file mode 100644 index de718fe3..00000000 --- a/.github/workflows/tools.yml +++ /dev/null @@ -1,59 +0,0 @@ -# Github workflow to build and test the native Nexus Tools code - -name: Native Nexus Tools -on: - pull_request: - push: - branches: - - main - -# Fix for OOM. -env: - CARGO_BUILD_JOBS: 1 - CARGO_INCREMENTAL: 0 - RUSTFLAGS: > - -C codegen-units=1 - -jobs: - detect-changes: - uses: ./.github/workflows/detect_changes.yml - with: - files: | - tools/** - # 1. Install Rust - # 2. Install Rust cache - # 3. Install just - # 4. Build, fmt, clippy and test the native Nexus Tools - build-and-test: - name: Build and test - runs-on: ubuntu-latest - needs: detect-changes - if: needs.detect-changes.outputs.changed == 'true' - steps: - - name: Check out repository code - uses: actions/checkout@v4 - - # 1. - - name: Install Rust - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - toolchain: stable, nightly-2025-01-06 - override: true - components: rustfmt, clippy - - # 2. - - name: Cache Build - uses: Swatinem/rust-cache@v2 - with: - workspaces: tools - - # 3. - - uses: taiki-e/install-action@just - - # 4 - - run: cargo +stable --version - - run: cargo +nightly-2025-01-06 --version - - run: just tools check - - run: just tools fmt-check - - run: just tools clippy - - run: just tools test diff --git a/.pre-commit/.just b/.pre-commit/.just index a3e2f0e0..dd90d707 100644 --- a/.pre-commit/.just +++ b/.pre-commit/.just @@ -1,4 +1,4 @@ -import '../just/_helpers.just' +import '../helpers/helpers.just' [private] _default: @@ -32,7 +32,7 @@ check-container-runtime: # We of course assume the (test) code is written in a # container runtime agnostic way but this will require some # investigation, so: - # TODO: https://github.com/Talus-Network/nexus-sdk/issues/262 + # NOTE: https://github.com/Talus-Network/nexus-sdk/issues/262 runtimes=(docker podman) # colima etc ... check_commands=( @@ -71,13 +71,13 @@ check-container-runtime: # cargo clippy --all-targets --all-features cargo-clippy: _check-cargo - cargo clippy --all-targets --all-features + cargo clippy --locked --all-targets --all-features # TODO: Perhaps consider this stricter version in the future. # cargo clippy --all-targets --all-features -- -D warnings cargo-clippy-strict: _check-cargo - cargo clippy --all-targets --all-features -- -D warnings + cargo clippy --locked --all-targets --all-features -- -D warnings # cargo nextest run --locked --no-run --workspace --all-features --bins --examples --tests @@ -90,7 +90,6 @@ cargo-nextest-build: _check-cargo-nextest # cargo nextest run --locked --fail-fast --workspace --all-features --bins --examples --tests cargo-nextest-run: _check-cargo-nextest # Note that tests require docker to be running. - # TODO: https://github.com/Talus-Network/nexus-sdk/issues/254 cargo nextest run --locked --fail-fast --workspace --all-features --bins --examples --tests @@ -189,3 +188,37 @@ typos: _check-typos cd $(git rev-parse --show-toplevel) typos + +# Test completions (bash for now) +test-cli-completions: + #!/usr/bin/env bash + + source <(cargo +stable run --locked --package nexus-cli completion bash) + +executable-scripts: + #!/usr/bin/env bash + + set -euo pipefail + + error=0 + + cd $(git rev-parse --show-toplevel) + + for f in $(git ls-files); do + first_line=$(head -n 1 "$f") + + # see if the first line is a shell shebang + if [[ "$first_line" =~ ^(#! *) ]]; then + # ... of the correct format, we checked that in another script. + if [[ "$first_line" =~ ^(#! */usr/bin/env *) ]]; then + if [[ ! -x "$f" ]]; then + echo "❌ $f is not executable" >&2 + error=1 + else + echo "✅ $f" >&2 + fi + fi + fi + done + + exit $error diff --git a/.pre-commit/11-test-cli-completions b/.pre-commit/11-test-cli-completions new file mode 100755 index 00000000..0ea7a1f7 --- /dev/null +++ b/.pre-commit/11-test-cli-completions @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +exec just pre-commit::test-cli-completions diff --git a/.pre-commit/12-executable-scripts b/.pre-commit/12-executable-scripts new file mode 100755 index 00000000..3be7a9e3 --- /dev/null +++ b/.pre-commit/12-executable-scripts @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +exec just pre-commit::executable-scripts diff --git a/.pre-commit/pre-commit b/.pre-commit/pre-commit index 7a4e0637..b814d394 100755 --- a/.pre-commit/pre-commit +++ b/.pre-commit/pre-commit @@ -4,7 +4,7 @@ # Source: https://github.com/loverdos/pre-commit # shellcheck disable=SC2034 -SCRIPT_VERSION=14 +SCRIPT_VERSION=16 # shellcheck disable=SC2034 SCRIPT_ID=AF13AE47-34E0-41FA-8FF8-AF660A922C6A @@ -100,6 +100,14 @@ function backup_file() { mv "$file" "$new_location" } +function sec_to_mmss() { + local time_sec=$1 + local time_min=$((time_sec / 60)) + time_sec=$((time_sec % 60)) + + printf "%02d:%02d" $time_min $time_sec +} + function install() { LOG "Begin installation process from $MY_PATH to $git_root" @@ -169,9 +177,9 @@ function run() { local successes=0 local failures=0 local mark="" - local time_sec=0 - local time_min=0 - local time="" + local script_seconds=0 + local script_time="" + local script_times=() LOG "Running pre-commit hook" SECONDS=0 # bash builtin ;) @@ -188,12 +196,19 @@ function run() { LOG LOG "Run: $script" + script_seconds=$SECONDS + $script status=$? + + script_seconds=$((SECONDS - script_seconds)) cmds+=("$script") cmd_statuses+=("$status") + script_time=$(sec_to_mmss $script_seconds) + script_times+=("$script_time") + if ((status == 0)); then ((successes++)) mark="✅" @@ -206,23 +221,20 @@ function run() { done set -e - time_sec=$SECONDS - time_min=$((time_sec / 60)) - time_sec=$((time_sec % 60)) - time=$(printf "%02d:%02d" $time_min $time_sec) + time=$(sec_to_mmss $SECONDS) LOG LOG "Results: $successes success(es), $failures failure(s)" - LOG " In: $time (min:sec)" + LOG " In: $time [min:sec]" LOG local result=0 for i in "${!cmds[@]}"; do if ((cmd_statuses[i] == 0)); then - LOG "✅ ${cmds[i]}" + LOG "✅ [${script_times[i]}] ${cmds[i]}" else - LOG "❌ ${cmds[i]}" + LOG "❌ [${script_times[i]}] ${cmds[i]}" result=1 fi done diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b248fec..b7fa92ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - CONTRIBUTING.md - CODE_OF_CONDUCT.md -- `pre-commit` hook +- `pre-commit` hook (also in CI) ### `nexus-cli` diff --git a/cli/.just b/cli/.just index 44cf2e43..a61b18f6 100644 --- a/cli/.just +++ b/cli/.just @@ -4,7 +4,7 @@ # Commands related the Nexus CLI # -import '../just/_helpers.just' +import '../helpers/helpers.just' package := 'nexus-cli' @@ -24,12 +24,6 @@ check: _check-cargo test: _check-cargo cargo +stable test --package {{ package }} -# Test completions (bash for now) -test-completions: build - #!/usr/bin/env bash - - source <(cargo +stable run --package {{ package }} completion bash) - # Run rustfmt on the CLI project fmt-check: _check-cargo cargo +nightly-2025-01-06 fmt --package {{ package }} --check diff --git a/helpers/helpers.just b/helpers/helpers.just new file mode 100644 index 00000000..73f29667 --- /dev/null +++ b/helpers/helpers.just @@ -0,0 +1,115 @@ + +[private] +_check-cargo: + #!/usr/bin/env bash + + if ! command -v cargo &> /dev/null + then + echo "cargo could not be found" + echo "Install cargo from https://doc.rust-lang.org/cargo/getting-started/installation.html" + exit 1 + fi + +[private] +_check-cargo-nextest: _check-cargo + #!/usr/bin/env bash + + if ! command -v cargo-nextest &> /dev/null + then + echo "cargo-nextest could not be found" + echo "Install cargo-nextest from https://nexte.st/" + exit 1 + fi + +[private] +_check-markdownlint-cli2: + #!/usr/bin/env bash + + exe=markdownlint-cli2 + if ! command -v $exe &> /dev/null + then + echo "$exe could not be found" + echo "Install $exe from https://github.com/DavidAnson/$exe" + exit 1 + fi + +[private] +_check-typos: + #!/usr/bin/env bash + + exe=typos + if ! command -v $exe &> /dev/null + then + echo "$exe could not be found" + echo "Install $exe from https://github.com/crate-ci/typos" + exit 1 + fi + +[private] +detect-changes +GLOBS: + #!/usr/bin/env bash + + set -euo pipefail + + GLOBS="{{GLOBS}}" + REGEXES=() # technically not needed but useful for debugging + BIG_REGEX="" + + function LOG() { + echo "== $*" >&2 + } + + # Get list of changed files compared to last commit + changed_files=$(git diff --name-only HEAD) + LOG "Changed files: $changed_files" + ## If GLOBS is not set, we just output the changed files + #if [[ -z "${GLOBS}" ]]; then + # echo "$changed_files" + # exit 0 + #fi + + # Convert simple globs to regexes. By simple we mean `**` and `*` stuff. + # + # We support either separate globs: + # + # '**/*.rs' '*.md' + # + # or one big string with space-separated globs: + # + # '**/*.rs' '*.md' + # + # Both will give the same result, one big regex: + # + # '^.*/[^/]*\.rs$|^[^/]*\.md$' + # + for glob in $(echo "$GLOBS"); do + # Escape special characters and convert to regex + regex=$(echo "$glob" |\ + # We do the following transformations: + # 1. escape common regex meta + # 2. create a temporary token for ** + # 3. convert * to [^/]* (matches any character except /) + # 4. convert ** to .* + sed -e 's/[.[\^$()+{}|]/\\&/g' \ + -e 's#\*\*#__GLOBSTAR__#g' \ + -e 's#\*#[^/]*#g' \ + -e 's#__GLOBSTAR__#.*#g') + + # match the whole string, so we add ^ and $ at the beginning and end + regex="^$regex\$" + + if [[ -z "$BIG_REGEX" ]]; then + BIG_REGEX="$regex" + else + BIG_REGEX+="|$regex" + fi + + REGEXES+=("$regex") + + LOG "Glob: $glob => Regex: $regex" + done + + LOG "Big regex: $BIG_REGEX" + LOG "" + + grep -E "$BIG_REGEX" <<< "$changed_files" diff --git a/helpers/npm-install-g.sh b/helpers/npm-install-g.sh new file mode 100755 index 00000000..5bc0f273 --- /dev/null +++ b/helpers/npm-install-g.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# Go to the root of the git repository +cd $(git rev-parse --show-toplevel) + +# Install NPM stuff from helpers/npm-install-g.txt +while read -r tool_at_version; do + # Split the tool name and version + tool=$(echo "$tool_at_version" | cut -d'@' -f1) + + if ! command -v "$tool" &> /dev/null; then + echo "Installing tool: $tool_at_version" + npm install -g "$tool_at_version" + else + echo "Tool already installed: $tool_at_version" + fi +done < helpers/npm-install-g.txt diff --git a/helpers/npm-install-g.txt b/helpers/npm-install-g.txt new file mode 100644 index 00000000..f4537ac3 --- /dev/null +++ b/helpers/npm-install-g.txt @@ -0,0 +1 @@ +markdownlint-cli2@0.18.1 diff --git a/just/_helpers.just b/just/_helpers.just deleted file mode 100644 index 9d4cbbbe..00000000 --- a/just/_helpers.just +++ /dev/null @@ -1,46 +0,0 @@ - -[private] -_check-cargo: - #!/usr/bin/env bash - - if ! command -v cargo &> /dev/null - then - echo "cargo could not be found" - echo "Install cargo from https://doc.rust-lang.org/cargo/getting-started/installation.html" - exit 1 - fi - -[private] -_check-cargo-nextest: _check-cargo - #!/usr/bin/env bash - - if ! command -v cargo-nextest &> /dev/null - then - echo "cargo-nextest could not be found" - echo "Install cargo-nextest from https://nexte.st/" - exit 1 - fi - -[private] -_check-markdownlint-cli2: - #!/usr/bin/env bash - - exe=markdownlint-cli2 - if ! command -v $exe &> /dev/null - then - echo "$exe could not be found" - echo "Install $exe from https://github.com/DavidAnson/$exe" - exit 1 - fi - -[private] -_check-typos: - #!/usr/bin/env bash - - exe=typos - if ! command -v $exe &> /dev/null - then - echo "$exe could not be found" - echo "Install $exe from https://github.com/crate-ci/typos" - exit 1 - fi diff --git a/sdk/.just b/sdk/.just index b5cff5b6..ebd02905 100644 --- a/sdk/.just +++ b/sdk/.just @@ -4,7 +4,7 @@ # Commands related the Nexus SDK. # -import '../just/_helpers.just' +import '../helpers/helpers.just' package := 'nexus-sdk' diff --git a/toolkit-rust/.just b/toolkit-rust/.just index d266be38..0d27f4b4 100644 --- a/toolkit-rust/.just +++ b/toolkit-rust/.just @@ -4,7 +4,7 @@ # Commands related the Nexus Toolkit for Rust # -import '../just/_helpers.just' +import '../helpers/helpers.just' package := 'nexus-toolkit' diff --git a/tools/.just b/tools/.just index e938bac1..d1754fac 100644 --- a/tools/.just +++ b/tools/.just @@ -4,7 +4,7 @@ # Commands related to native Nexus Tools. # -import '../just/_helpers.just' +import '../helpers/helpers.just' [private] _default: