diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..5e41726f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +# https://EditorConfig.org +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_size = 2 +indent_style = space diff --git a/install.sh b/install.sh index 2f83f9ab..0b0bfa87 100755 --- a/install.sh +++ b/install.sh @@ -8,7 +8,7 @@ set -e cd "$(dirname "$0")" if [ -z "${PREFIX}" ]; then - PREFIX="/usr/local" + PREFIX="/usr/local" fi SHARE_PATH="${PREFIX}/share/node-build" diff --git a/script/postinstall b/script/postinstall index 25aec2b5..072fe199 100755 --- a/script/postinstall +++ b/script/postinstall @@ -4,21 +4,21 @@ set -euo pipefail IFS=$'\n\t' installed_by_name() { - local pattern='"remain":\["'${npm_package_name-} + local pattern='"remain":\["'${npm_package_name-} - [[ ${npm_config_argv-} =~ $pattern ]] + [[ ${npm_config_argv-} =~ $pattern ]] } if [ -n "${npm_config_argv-}" ] && ! installed_by_name; then - exit + exit fi cat <<-MSG - ==================== - ${npm_package_name-} caveats: +==================== +${npm_package_name-} caveats: - For \`node-build\`/\`nodenv install\` to pick up definitions provided by this plugin, - ensure share/node-build directory exists in NODE_BUILD_DEFINITIONS: - export NODE_BUILD_DEFINITIONS="$PWD/share/node-build" - ==================== +For \`node-build\`/\`nodenv install\` to pick up definitions provided by this plugin, +ensure share/node-build directory exists in NODE_BUILD_DEFINITIONS: + export NODE_BUILD_DEFINITIONS="$PWD/share/node-build" +==================== MSG diff --git a/script/preversion b/script/preversion index f33dfc45..7ff6cf23 100755 --- a/script/preversion +++ b/script/preversion @@ -21,59 +21,59 @@ set -euo pipefail unset verbose strict while getopts "ov" opt; do - case "$opt" in - o) strict=1 ;; - v) verbose=1 ;; - *) break ;; - esac + case "$opt" in + o) strict=1 ;; + v) verbose=1 ;; + *) break ;; + esac done shift $((OPTIND - 1)) if [ "${1-}" = -- ]; then - shift + shift fi abort() { - echo "Aborting: $1" >&2 - exit "${2:-1}" + echo "Aborting: $1" >&2 + exit "${2:-1}" } declare -a files if [ "$#" -gt 0 ]; then - files=("$@") + files=("$@") else - IFS=" " read -r -a files <<<"$(node -p 'require("./package").files.join(" ")')" + IFS=" " read -r -a files <<<"$(node -p 'require("./package").files.join(" ")')" fi git fetch --quiet --tags origin main existing="$(git tag --points-at HEAD)" if [ -n "$existing" ]; then - abort "HEAD is already tagged as '${existing}'" + abort "HEAD is already tagged as '${existing}'" fi current_branch="$(git symbolic-ref --short HEAD)" if [ "$current_branch" != main ]; then - abort "Not currently on main branch" 2 + abort "Not currently on main branch" 2 fi previous_tag="$(git describe --tags --abbrev=0)" if git diff --quiet "${previous_tag}..HEAD" -- "${files[@]}"; then - abort "No features to release since '${previous_tag}'" + abort "No features to release since '${previous_tag}'" fi allowed_changes=("${files[@]}" .github script *.md) allowed_changes=("${allowed_changes[@]/#/\':!\'}") # prefix pathspecs with git's "ignore" if [ -n "${strict-}" ] && - ! git diff --quiet "${previous_tag}..HEAD" -- "${allowed_changes[@]}"; then - { - echo "git diff --stat ${previous_tag}..HEAD -- ${allowed_changes[*]}" - git diff --stat "${previous_tag}..HEAD" -- "${allowed_changes[@]}" - } >&2 - abort "Changes detected outside '${allowed_changes[*]#:!}'" 2 + ! git diff --quiet "${previous_tag}..HEAD" -- "${allowed_changes[@]}"; then + { + echo "git diff --stat ${previous_tag}..HEAD -- ${allowed_changes[*]}" + git diff --stat "${previous_tag}..HEAD" -- "${allowed_changes[@]}" + } >&2 + abort "Changes detected outside '${allowed_changes[*]#:!}'" 2 fi if [ -n "${verbose-}" ]; then - git log "$previous_tag"... --oneline -- "${files[@]}" + git log "$previous_tag"... --oneline -- "${files[@]}" fi