From 9eb42aea65df77a3cbfc35687ff01fed77c993b5 Mon Sep 17 00:00:00 2001 From: Lorenzo Dal'Aqua Date: Tue, 8 Mar 2022 10:19:16 -0300 Subject: [PATCH] build: move bash scripts to sh (#124) * Change file names to .sh * Change shebang * Update references to files * Use "[" operator in conditionals instead of bash-specific "[[" operator --- .github/workflows/ci.yml | 4 ++-- list-npx-cache.bash => list-npx-cache.sh | 4 ++-- package.json | 2 +- postinstall.bash => postinstall.sh | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) rename list-npx-cache.bash => list-npx-cache.sh (94%) rename postinstall.bash => postinstall.sh (76%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f457e4..552e056 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,9 +85,9 @@ jobs: - name: Install dependencies if: env.CI_SKIP == 'false' run: | - bash ./list-npx-cache.bash + bash ./list-npx-cache.sh npm ci - bash ./list-npx-cache.bash + bash ./list-npx-cache.sh - name: Lint if: env.CI_SKIP == 'false' diff --git a/list-npx-cache.bash b/list-npx-cache.sh similarity index 94% rename from list-npx-cache.bash rename to list-npx-cache.sh index d8851c2..33ebe22 100644 --- a/list-npx-cache.bash +++ b/list-npx-cache.sh @@ -1,11 +1,11 @@ -#!/bin/bash +#!/bin/sh # NOTE: THere is a discrepancy in the npx cache in npm between 8.4.1 and 8.1.4. # There is an additional zx found in the npx cache when compared to the local npx cache using 8.1.4. NPX_CACHE_DIR="$(npm config get cache)/_npx" -if [[ -d $NPX_CACHE_DIR ]]; then +if [ -d "$NPX_CACHE_DIR" ]; then FILES=$(find $NPX_CACHE_DIR -type f | grep -v 'node_modules' | grep -v 'package-lock.json') # FILES=$(find $NPX_CACHE_DIR -type f | grep -v 'node_modules') diff --git a/package.json b/package.json index 0f25b2d..be57bc4 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "scripts": { "build": "npm run clean && tsc", "clean": "rm -rf .*cache *.log .swc/ coverage/ dist/ logs/", - "postinstall": "bash postinstall.bash", + "postinstall": "sh postinstall.sh", "lint": "eslint src --ext .js,.ts", "lint:build": "npm run lint -- --config .build.eslintrc.json", "lint:commit": "npm x -y -- commitlint@latest --edit", diff --git a/postinstall.bash b/postinstall.sh similarity index 76% rename from postinstall.bash rename to postinstall.sh index 6cd948a..f8eeb42 100644 --- a/postinstall.bash +++ b/postinstall.sh @@ -1,3 +1,3 @@ -#!/bin/bash +#!/bin/sh npx -y -- zx@latest ./postinstall.mjs