@zairakai/js-dev-tools 3.20.0 → 3.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/.editorconfig +11 -72
  2. package/.gitlab/ci/parts/base.yml +95 -0
  3. package/.gitlab/ci/parts/publish.yml +156 -0
  4. package/.gitlab/ci/parts/quality.yml +161 -0
  5. package/.gitlab/ci/parts/security.yml +40 -0
  6. package/.gitlab/ci/parts/updates.yml +60 -0
  7. package/.gitlab/ci/pipeline-js-app.yml +19 -38
  8. package/.gitlab/ci/pipeline-js-package.yml +23 -528
  9. package/README.md +92 -11
  10. package/config/.markdownlintignore +8 -1
  11. package/config/.prettierignore +13 -0
  12. package/config/.stylelintignore +13 -3
  13. package/config/eslint.config.js +7 -1
  14. package/config/knip.config.js +7 -3
  15. package/config/stylelint.config.js +1 -0
  16. package/package.json +46 -29
  17. package/scripts/build.sh +28 -28
  18. package/scripts/ci-quality.sh +6 -6
  19. package/scripts/config.sh +164 -148
  20. package/scripts/doctor.sh +12 -12
  21. package/scripts/eslint-fix.sh +8 -8
  22. package/scripts/eslint.sh +15 -15
  23. package/scripts/install-bats.sh +143 -146
  24. package/scripts/install-hooks.sh +108 -111
  25. package/scripts/install-markdownlint.sh +4 -4
  26. package/scripts/install-shellcheck.sh +135 -138
  27. package/scripts/knip.sh +7 -7
  28. package/scripts/markdownlint.sh +38 -38
  29. package/scripts/outdated.sh +30 -29
  30. package/scripts/prettier-fix.sh +13 -13
  31. package/scripts/prettier.sh +13 -13
  32. package/scripts/setup-project.sh +691 -629
  33. package/scripts/stylelint-fix.sh +26 -19
  34. package/scripts/stylelint.sh +27 -20
  35. package/scripts/test.sh +13 -11
  36. package/scripts/typecheck.sh +11 -11
  37. package/scripts/update-dependencies.mjs +552 -181
  38. package/scripts/validate-shellcheck.sh +18 -18
  39. package/stubs/githooks/commit-msg +24 -21
  40. package/stubs/githooks/pre-commit +19 -19
  41. package/stubs/githooks/pre-push +18 -18
  42. package/stubs/githooks/prepare-commit-msg +6 -6
  43. package/stubs/gitlab-ci/gitlab-ci.yml.stub +1 -1
  44. package/stubs/governance/CONTRIBUTING.md.stub +5 -3
  45. package/stubs/quality/eslint.config.js.stub +1 -1
  46. package/stubs/quality/knip.config.js.stub +1 -1
  47. package/stubs/style/prettier.config.js.stub +3 -3
  48. package/stubs/style/stylelint.config.js.stub +8 -1
  49. package/stubs/testing/vitest.config.js.stub +1 -1
  50. package/tools/make/bats.mk +3 -3
  51. package/tools/make/core.mk +3 -3
  52. package/tools/make/quality.mk +2 -1
  53. package/tools/make/variables.mk +1 -1
@@ -21,212 +21,209 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
21
21
  # shellcheck source=config.sh
22
22
  source "${SCRIPT_DIR}/config.sh"
23
23
 
24
- # ============
25
24
  # Configuration
26
- # ============
25
+ # ================
27
26
 
28
27
  CI_MODE="${CI:-false}"
29
28
  TOOL_VERSIONS_FILE="${SCRIPT_DIR}/../.tool-versions"
30
29
 
31
- # ============
32
30
  # Functions
33
- # ============
31
+ # ================
34
32
 
35
33
  # Get ShellCheck version from .tool-versions or use default
36
34
  get_shellcheck_version() {
37
- local version=""
35
+ local version=""
38
36
 
39
- if [[ -f "${TOOL_VERSIONS_FILE}" ]]; then
40
- version=$(grep "^shellcheck=" "${TOOL_VERSIONS_FILE}" | awk -F "=" '{print $2}' || echo "")
37
+ if [[ -f "${TOOL_VERSIONS_FILE}" ]]; then
38
+ version=$(grep "^shellcheck=" "${TOOL_VERSIONS_FILE}" | awk -F "=" '{print $2}' || echo "")
41
39
 
42
- if [[ -n "${version}" ]]; then
43
- log_info "Found .tool-versions: ${version}"
44
- fi
40
+ if [[ -n "${version}" ]]; then
41
+ log_info "Found .tool-versions: ${version}"
45
42
  fi
43
+ fi
46
44
 
47
- # Fallback to default if not found
48
- if [[ -z "${version}" ]]; then
49
- version="0.10.0"
50
- log_info "Using default version: ${version}"
51
- fi
45
+ # Fallback to default if not found
46
+ if [[ -z "${version}" ]]; then
47
+ version="0.10.0"
48
+ log_info "Using default version: ${version}"
49
+ fi
52
50
 
53
- echo "${version}"
51
+ echo "${version}"
54
52
  }
55
53
 
56
54
  # Compare versions (returns 0 if ver1 >= ver2)
57
55
  version_ge() {
58
- local ver1="$1"
59
- local ver2="$2"
56
+ local ver1="$1"
57
+ local ver2="$2"
60
58
 
61
- if [[ "${ver1}" == "${ver2}" ]]; then
62
- return 0
63
- fi
59
+ if [[ "${ver1}" == "${ver2}" ]]; then
60
+ return 0
61
+ fi
64
62
 
65
- local IFS=.
66
- local i ver1_arr=("$ver1") ver2_arr=("$ver2")
63
+ local IFS=.
64
+ local i ver1_arr=("$ver1") ver2_arr=("$ver2")
67
65
 
68
- # Fill empty positions with zeros
69
- for ((i=${#ver1_arr[@]}; i<${#ver2_arr[@]}; i++)); do
70
- ver1_arr[i]=0
71
- done
66
+ # Fill empty positions with zeros
67
+ for ((i=${#ver1_arr[@]}; i<${#ver2_arr[@]}; i++)); do
68
+ ver1_arr[i]=0
69
+ done
72
70
 
73
- for ((i=0; i<${#ver1_arr[@]}; i++)); do
74
- if [[ -z ${ver2_arr[i]} ]]; then
75
- ver2_arr[i]=0
76
- fi
71
+ for ((i=0; i<${#ver1_arr[@]}; i++)); do
72
+ if [[ -z ${ver2_arr[i]} ]]; then
73
+ ver2_arr[i]=0
74
+ fi
77
75
 
78
- if ((10#${ver1_arr[i]} > 10#${ver2_arr[i]})); then
79
- return 0
80
- fi
76
+ if ((10#${ver1_arr[i]} > 10#${ver2_arr[i]})); then
77
+ return 0
78
+ fi
81
79
 
82
- if ((10#${ver1_arr[i]} < 10#${ver2_arr[i]})); then
83
- return 1
84
- fi
85
- done
80
+ if ((10#${ver1_arr[i]} < 10#${ver2_arr[i]})); then
81
+ return 1
82
+ fi
83
+ done
86
84
 
87
- return 0
85
+ return 0
88
86
  }
89
87
 
90
88
  # Check if ShellCheck is already installed with sufficient version
91
89
  check_shellcheck_installed() {
92
- local required_version="$1"
90
+ local required_version="$1"
93
91
 
94
- if ! command_exists shellcheck; then
95
- return 1
96
- fi
92
+ if ! command_exists shellcheck; then
93
+ return 1
94
+ fi
97
95
 
98
- local current_version
99
- current_version=$(shellcheck --version | grep "version:" | awk '{print $2}' || echo "")
96
+ local current_version
97
+ current_version=$(shellcheck --version | grep "version:" | awk '{print $2}' || echo "")
100
98
 
101
- if [[ -z "${current_version}" ]]; then
102
- log_warning "Could not determine ShellCheck version"
103
- return 1
104
- fi
99
+ if [[ -z "${current_version}" ]]; then
100
+ log_warning "Could not determine ShellCheck version"
101
+ return 1
102
+ fi
105
103
 
106
- log_info "Current version: ${current_version}"
104
+ log_info "Current version: ${current_version}"
107
105
 
108
- if version_ge "${current_version}" "${required_version}"; then
109
- log_success "ShellCheck ${current_version} is sufficient (need >=${required_version})"
110
- return 0
111
- fi
106
+ if version_ge "${current_version}" "${required_version}"; then
107
+ log_success "ShellCheck ${current_version} is sufficient (need >=${required_version})"
108
+ return 0
109
+ fi
112
110
 
113
- log_warning "Version ${current_version} is outdated (need >=${required_version})"
111
+ log_warning "Version ${current_version} is outdated (need >=${required_version})"
114
112
 
115
- # Ask for upgrade confirmation if not in CI
116
- if [[ "${CI_MODE}" != "true" ]]; then
117
- echo ""
118
- read -rp "Upgrade to ${required_version}? (y/N) " -n 1
119
- echo ""
113
+ # Ask for upgrade confirmation if not in CI
114
+ if [[ "${CI_MODE}" != "true" ]]; then
115
+ echo ""
116
+ read -rp "Upgrade to ${required_version}? (y/N) " -n 1
117
+ echo ""
120
118
 
121
- if [[ ! $REPLY =~ ^[Yy]$ ]]; then
122
- log_info "Keeping existing installation"
123
- return 0
124
- fi
125
- else
126
- log_info "CI mode: upgrading automatically"
119
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
120
+ log_info "Keeping existing installation"
121
+ return 0
127
122
  fi
123
+ else
124
+ log_info "CI mode: upgrading automatically"
125
+ fi
128
126
 
129
- return 1
127
+ return 1
130
128
  }
131
129
 
132
130
  # Detect package manager and install ShellCheck
133
131
  install_shellcheck() {
134
- local version="$1"
135
-
136
- log_header "🐚 Installing ShellCheck ${version}"
137
- echo ""
132
+ local version="$1"
138
133
 
139
- local use_sudo=true
134
+ log_header "🐚 Installing ShellCheck ${version}"
135
+ echo ""
140
136
 
141
- # Don't use sudo in CI or if running as root
142
- if [[ "${CI_MODE}" == "true" ]] || [[ "$(id -u)" -eq 0 ]]; then
143
- use_sudo=false
144
- fi
145
-
146
- # Detect and use package manager
147
- if command_exists apt-get; then
148
- log_step "Installing via apt-get..."
137
+ local use_sudo=true
149
138
 
150
- if [[ "${use_sudo}" == "true" ]]; then
151
- sudo apt-get update -qq
152
- sudo apt-get install -y -qq shellcheck
153
- else
154
- apt-get update -qq
155
- apt-get install -y -qq shellcheck
156
- fi
139
+ # Don't use sudo in CI or if running as root
140
+ if [[ "${CI_MODE}" == "true" ]] || [[ "$(id -u)" -eq 0 ]]; then
141
+ use_sudo=false
142
+ fi
157
143
 
158
- elif command_exists dnf; then
159
- log_step "Installing via dnf..."
144
+ # Detect and use package manager
145
+ if command_exists apt-get; then
146
+ log_step "Installing via apt-get..."
160
147
 
161
- if [[ "${use_sudo}" == "true" ]]; then
162
- sudo dnf install -y -q ShellCheck
163
- else
164
- dnf install -y -q ShellCheck
165
- fi
148
+ if [[ "${use_sudo}" == "true" ]]; then
149
+ sudo apt-get update -qq
150
+ sudo apt-get install -y -qq shellcheck
151
+ else
152
+ apt-get update -qq
153
+ apt-get install -y -qq shellcheck
154
+ fi
166
155
 
167
- elif command_exists pacman; then
168
- log_step "Installing via pacman..."
156
+ elif command_exists dnf; then
157
+ log_step "Installing via dnf..."
169
158
 
170
- if [[ "${use_sudo}" == "true" ]]; then
171
- sudo pacman -S --noconfirm --quiet shellcheck
172
- else
173
- pacman -S --noconfirm --quiet shellcheck
174
- fi
159
+ if [[ "${use_sudo}" == "true" ]]; then
160
+ sudo dnf install -y -q ShellCheck
161
+ else
162
+ dnf install -y -q ShellCheck
163
+ fi
175
164
 
176
- elif command_exists apk; then
177
- log_step "Installing via apk..."
178
- apk add --no-cache -q shellcheck
165
+ elif command_exists pacman; then
166
+ log_step "Installing via pacman..."
179
167
 
168
+ if [[ "${use_sudo}" == "true" ]]; then
169
+ sudo pacman -S --noconfirm --quiet shellcheck
180
170
  else
181
- log_error "No supported package manager found (apt-get, dnf, pacman, apk)"
182
- echo ""
183
- log_info "Install manually from: https://github.com/koalaman/shellcheck"
184
- return 1
171
+ pacman -S --noconfirm --quiet shellcheck
185
172
  fi
186
173
 
187
- log_success "ShellCheck installed successfully"
174
+ elif command_exists apk; then
175
+ log_step "Installing via apk..."
176
+ apk add --no-cache -q shellcheck
188
177
 
178
+ else
179
+ log_error "No supported package manager found (apt-get, dnf, pacman, apk)"
189
180
  echo ""
190
- log_header "✅ ShellCheck Installation Complete"
191
- echo ""
181
+ log_info "Install manually from: https://github.com/koalaman/shellcheck"
182
+ return 1
183
+ fi
192
184
 
193
- # Verify installation
194
- if command_exists shellcheck; then
195
- shellcheck --version
196
- echo ""
197
- log_info "Run linter with:"
198
- echo -e " ${CYAN}make shellcheck${NC}"
199
- echo -e " ${CYAN}shellcheck scripts/*.sh${NC}"
200
- echo ""
201
- else
202
- log_error "ShellCheck installation verification failed"
203
- return 1
204
- fi
185
+ log_success "ShellCheck installed successfully"
186
+
187
+ echo ""
188
+ log_header "✅ ShellCheck Installation Complete"
189
+ echo ""
190
+
191
+ # Verify installation
192
+ if command_exists shellcheck; then
193
+ shellcheck --version
194
+ echo ""
195
+ log_info "Run linter with:"
196
+ echo -e " ${CYAN}make shellcheck${NC}"
197
+ echo -e " ${CYAN}shellcheck scripts/*.sh${NC}"
198
+ echo ""
199
+ else
200
+ log_error "ShellCheck installation verification failed"
201
+ return 1
202
+ fi
205
203
  }
206
204
 
207
- # ============
208
205
  # Main
209
- # ============
206
+ # ================
210
207
 
211
208
  main() {
212
- local required_version
213
- required_version=$(get_shellcheck_version)
209
+ local required_version
210
+ required_version=$(get_shellcheck_version)
214
211
 
215
- echo ""
216
-
217
- # Check if already installed with sufficient version
218
- if check_shellcheck_installed "${required_version}"; then
219
- echo ""
220
- log_info "No action needed - ShellCheck is already available"
221
- echo ""
222
- exit 0
223
- fi
212
+ echo ""
224
213
 
214
+ # Check if already installed with sufficient version
215
+ if check_shellcheck_installed "${required_version}"; then
225
216
  echo ""
226
- log_warning "ShellCheck not found or outdated - installing..."
217
+ log_info "No action needed - ShellCheck is already available"
227
218
  echo ""
219
+ exit 0
220
+ fi
221
+
222
+ echo ""
223
+ log_warning "ShellCheck not found or outdated - installing..."
224
+ echo ""
228
225
 
229
- install_shellcheck "${required_version}"
226
+ install_shellcheck "${required_version}"
230
227
  }
231
228
 
232
229
  main "$@"
package/scripts/knip.sh CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  #
3
- # Knip — Dead Code & Unused Dependency Detection
3
+ # Knip - Dead Code & Unused Dependency Detection
4
4
  # Finds unused exports, files, and dependencies in TypeScript/JavaScript projects.
5
5
  # https://knip.dev
6
6
  #
@@ -22,20 +22,20 @@ maybe_dockerize "$0" "$@"
22
22
 
23
23
  KNIP_BIN="${BIN_DIR}/knip"
24
24
 
25
- log_header "Knip — Dead Code Detection"
25
+ log_header "Knip - Dead Code Detection"
26
26
 
27
27
  if ! ensure_bin_optional "$KNIP_BIN" "knip"; then
28
- log_info "Install: npm install --save-dev knip"
29
- exit 0
28
+ log_info "Install: npm install --save-dev knip"
29
+ exit 0
30
30
  fi
31
31
 
32
32
  KNIP_ARGS=()
33
33
 
34
34
  if [[ -n "$KNIP_CONFIG" ]]; then
35
- log_step "Using configuration: ${KNIP_CONFIG#"$PROJECT_ROOT"/}"
36
- KNIP_ARGS+=(--config "$KNIP_CONFIG")
35
+ log_step "Using configuration: ${KNIP_CONFIG#"$PROJECT_ROOT"/}"
36
+ KNIP_ARGS+=(--config "$KNIP_CONFIG")
37
37
  fi
38
38
 
39
39
  "$KNIP_BIN" "${KNIP_ARGS[@]}"
40
40
 
41
- log_success "Knip check passed — no dead code found"
41
+ log_success "Knip check passed - no dead code found"
@@ -8,77 +8,77 @@ source "$SCRIPT_DIR/config.sh"
8
8
  FIX_MODE=false
9
9
  EXTRA_IGNORES=()
10
10
  while [[ $# -gt 0 ]]; do
11
- case "$1" in
12
- --fix) FIX_MODE=true; shift ;;
13
- --ignore) EXTRA_IGNORES+=("$2"); shift 2 ;;
14
- --ignore=*) EXTRA_IGNORES+=("${1#--ignore=}"); shift ;;
15
- *) shift ;;
16
- esac
11
+ case "$1" in
12
+ --fix) FIX_MODE=true; shift ;;
13
+ --ignore) EXTRA_IGNORES+=("$2"); shift 2 ;;
14
+ --ignore=*) EXTRA_IGNORES+=("${1#--ignore=}"); shift ;;
15
+ *) shift ;;
16
+ esac
17
17
  done
18
18
 
19
19
  if [[ "$FIX_MODE" == "true" ]]; then
20
- log_header "Markdownlint Documentation Auto-Fix"
20
+ log_header "Markdownlint Documentation Auto-Fix"
21
21
  else
22
- log_header "Markdownlint Documentation Validation"
22
+ log_header "Markdownlint Documentation Validation"
23
23
  fi
24
24
 
25
25
  ensure_bin "$MARKDOWNLINT_BIN" "markdownlint-cli2" || exit 1
26
26
 
27
27
  if [[ -z "$MARKDOWNLINT_CONFIG" ]]; then
28
- log_error "No markdownlint configuration found"
29
- log_warning "Expected one of:"
30
- log_warning " .markdownlint.json (project root)"
31
- log_warning " config/dev-tools/.markdownlint.json (published config)"
32
- log_warning " node_modules/@zairakai/js-dev-tools/config/.markdownlint.json (default)"
33
- exit 1
28
+ log_error "No markdownlint configuration found"
29
+ log_warning "Expected one of:"
30
+ log_warning " .markdownlint.json (project root)"
31
+ log_warning " config/dev-tools/.markdownlint.json (published config)"
32
+ log_warning " node_modules/@zairakai/js-dev-tools/config/.markdownlint.json (default)"
33
+ exit 1
34
34
  fi
35
35
 
36
36
  log_step "Configuration: ${MARKDOWNLINT_CONFIG#"$PROJECT_ROOT"/}"
37
37
 
38
38
  # Parse a gitignore-format file and inject each entry as !pattern
39
39
  _add_ignore_file() {
40
- local file="$1"
41
- [[ ! -f "$file" ]] && return
42
- while IFS= read -r _line || [[ -n "$_line" ]]; do
43
- [[ -z "$_line" || "$_line" =~ ^[[:space:]]*# || "$_line" =~ ^! ]] && continue
44
- MARKDOWNLINT_ARGS+=("!${_line}")
45
- done < "$file"
40
+ local file="$1"
41
+ [[ ! -f "$file" ]] && return
42
+ while IFS= read -r _line || [[ -n "$_line" ]]; do
43
+ [[ -z "$_line" || "$_line" =~ ^[[:space:]]*# || "$_line" =~ ^! ]] && continue
44
+ MARKDOWNLINT_ARGS+=("!${_line}")
45
+ done < "$file"
46
46
  }
47
47
 
48
- MARKDOWNLINT_ARGS=("--config" "$MARKDOWNLINT_CONFIG" "**/*.md" "!.git" "!node_modules" "!vendor")
48
+ MARKDOWNLINT_ARGS=("--config" "$MARKDOWNLINT_CONFIG" "**/*.md")
49
49
 
50
50
  # Parse .gitignore entries as exclusion patterns
51
51
  _add_ignore_file "${PROJECT_ROOT}/.gitignore"
52
52
 
53
53
  # Parse project-specific markdownlint ignore file
54
54
  if [[ -n "$MARKDOWNLINT_IGNORE" ]]; then
55
- _add_ignore_file "$MARKDOWNLINT_IGNORE"
55
+ _add_ignore_file "$MARKDOWNLINT_IGNORE"
56
56
  fi
57
57
 
58
58
  # Extra ignores passed via --ignore
59
59
  if [[ ${#EXTRA_IGNORES[@]} -gt 0 ]]; then
60
- for _ignore in "${EXTRA_IGNORES[@]}"; do
61
- MARKDOWNLINT_ARGS+=("!${_ignore}")
62
- done
60
+ for _ignore in "${EXTRA_IGNORES[@]}"; do
61
+ MARKDOWNLINT_ARGS+=("!${_ignore}")
62
+ done
63
63
  fi
64
64
 
65
65
  if [[ "$FIX_MODE" == "true" ]]; then
66
- MARKDOWNLINT_ARGS=("--fix" "${MARKDOWNLINT_ARGS[@]}")
67
- log_step "Fixing Markdown documentation..."
66
+ MARKDOWNLINT_ARGS=("--fix" "${MARKDOWNLINT_ARGS[@]}")
67
+ log_step "Fixing Markdown documentation..."
68
68
  else
69
- log_step "Validating Markdown documentation..."
69
+ log_step "Validating Markdown documentation..."
70
70
  fi
71
71
 
72
72
  if "$MARKDOWNLINT_BIN" "${MARKDOWNLINT_ARGS[@]}"; then
73
- if [[ "$FIX_MODE" == "true" ]]; then
74
- log_success "Markdown documentation fixed"
75
- else
76
- log_success "Markdown validation passed"
77
- fi
78
- exit 0
73
+ if [[ "$FIX_MODE" == "true" ]]; then
74
+ log_success "Markdown documentation fixed"
75
+ else
76
+ log_success "Markdown validation passed"
77
+ fi
78
+ exit 0
79
79
  else
80
- log_error "Markdownlint found documentation issues"
81
- echo ""
82
- echo "Fix automatically with: make markdownlint-fix"
83
- exit 1
80
+ log_error "Markdownlint found documentation issues"
81
+ echo ""
82
+ echo "Fix automatically with: make markdownlint-fix"
83
+ exit 1
84
84
  fi
@@ -10,41 +10,42 @@ log_header "NPM Outdated Check"
10
10
 
11
11
  ensure_dir "build/reports"
12
12
 
13
- # ─── IGNORE LIST ──────────────────────────────────────────────────────────────
13
+ # IGNORE LIST
14
+ # ================
14
15
  # Packages to exclude from the outdated check.
15
16
  # Populated from two sources (merged):
16
- # 1. OUTDATED_IGNORE env var — comma-separated list
17
+ # 1. OUTDATED_IGNORE env var - comma-separated list
17
18
  # e.g. OUTDATED_IGNORE=prettier-plugin-blade,some-other-pkg
18
19
  # 2. package.json "outdatedIgnore" array field (optional, project-level)
19
20
  # e.g. "outdatedIgnore": ["prettier-plugin-blade"]
20
- # ──────────────────────────────────────────────────────────────────────────────
21
+ # ================
21
22
  build_jq_filter() {
22
- local ignore_csv="${OUTDATED_IGNORE:-}"
23
- local pkg_json="${PROJECT_ROOT}/package.json"
24
- local from_pkg_json=""
23
+ local ignore_csv="${OUTDATED_IGNORE:-}"
24
+ local pkg_json="${PROJECT_ROOT}/package.json"
25
+ local from_pkg_json=""
25
26
 
26
- if command_exists jq && [[ -f "$pkg_json" ]]; then
27
- from_pkg_json="$(jq -r '(.outdatedIgnore // []) | join(",")' "$pkg_json" 2>/dev/null || true)"
28
- fi
27
+ if command_exists jq && [[ -f "$pkg_json" ]]; then
28
+ from_pkg_json="$(jq -r '(.outdatedIgnore // []) | join(",")' "$pkg_json" 2>/dev/null || true)"
29
+ fi
29
30
 
30
- # Merge both sources
31
- local combined="${ignore_csv}${ignore_csv:+,}${from_pkg_json}"
31
+ # Merge both sources
32
+ local combined="${ignore_csv}${ignore_csv:+,}${from_pkg_json}"
32
33
 
33
- if [[ -z "$combined" ]]; then
34
- echo "."
35
- return
36
- fi
34
+ if [[ -z "$combined" ]]; then
35
+ echo "."
36
+ return
37
+ fi
37
38
 
38
- # Build: del(.pkg1) | del(.pkg2) | ...
39
- local filter="."
40
- IFS=',' read -ra packages <<< "$combined"
41
- for pkg in "${packages[@]}"; do
42
- pkg="${pkg// /}" # trim spaces
43
- [[ -z "$pkg" ]] && continue
44
- filter+=" | del(.\"${pkg}\")"
45
- done
39
+ # Build: del(.pkg1) | del(.pkg2) | ...
40
+ local filter="."
41
+ IFS=',' read -ra packages <<< "$combined"
42
+ for pkg in "${packages[@]}"; do
43
+ pkg="${pkg// /}" # trim spaces
44
+ [[ -z "$pkg" ]] && continue
45
+ filter+=" | del(.\"${pkg}\")"
46
+ done
46
47
 
47
- echo "$filter"
48
+ echo "$filter"
48
49
  }
49
50
 
50
51
  log_step "Checking direct dependencies for outdated packages..."
@@ -54,14 +55,14 @@ npm outdated --omit=peer --json > build/reports/npm-outdated.json 2>/dev/null ||
54
55
  JQ_FILTER="$(build_jq_filter)"
55
56
 
56
57
  if command_exists jq && [[ "$JQ_FILTER" != "." ]]; then
57
- log_step "Ignoring: ${OUTDATED_IGNORE:-}$(jq -r '(.outdatedIgnore // []) | join(", ")' "${PROJECT_ROOT}/package.json" 2>/dev/null || true)"
58
- filtered="$(jq "${JQ_FILTER}" build/reports/npm-outdated.json 2>/dev/null || cat build/reports/npm-outdated.json)"
59
- echo "$filtered" > build/reports/npm-outdated.json
58
+ log_step "Ignoring: ${OUTDATED_IGNORE:-}$(jq -r '(.outdatedIgnore // []) | join(", ")' "${PROJECT_ROOT}/package.json" 2>/dev/null || true)"
59
+ filtered="$(jq "${JQ_FILTER}" build/reports/npm-outdated.json 2>/dev/null || cat build/reports/npm-outdated.json)"
60
+ echo "$filtered" > build/reports/npm-outdated.json
60
61
  fi
61
62
 
62
63
  if [[ ! -s build/reports/npm-outdated.json ]] || [[ "$(cat build/reports/npm-outdated.json)" == "{}" ]]; then
63
- log_success "All dependencies are up to date"
64
- exit 0
64
+ log_success "All dependencies are up to date"
65
+ exit 0
65
66
  fi
66
67
 
67
68
  log_error "Outdated packages found:"
@@ -8,11 +8,11 @@ maybe_dockerize "$0" "$@"
8
8
 
9
9
  EXTRA_IGNORES=()
10
10
  while [[ $# -gt 0 ]]; do
11
- case "$1" in
12
- --ignore) EXTRA_IGNORES+=("$2"); shift 2 ;;
13
- --ignore=*) EXTRA_IGNORES+=("${1#--ignore=}"); shift ;;
14
- *) shift ;;
15
- esac
11
+ case "$1" in
12
+ --ignore) EXTRA_IGNORES+=("$2"); shift 2 ;;
13
+ --ignore=*) EXTRA_IGNORES+=("${1#--ignore=}"); shift ;;
14
+ *) shift ;;
15
+ esac
16
16
  done
17
17
 
18
18
  log_header "Prettier Fix"
@@ -20,30 +20,30 @@ log_header "Prettier Fix"
20
20
  ensure_bin "$PRETTIER_BIN" "prettier" || exit 1
21
21
 
22
22
  if [[ -n "$PRETTIER_CONFIG" ]]; then
23
- log_step "Using configuration: ${PRETTIER_CONFIG#"$PROJECT_ROOT"/}"
23
+ log_step "Using configuration: ${PRETTIER_CONFIG#"$PROJECT_ROOT"/}"
24
24
  fi
25
25
 
26
26
  PRETTIER_ARGS=(--write)
27
27
 
28
28
  if [[ -n "$PRETTIER_CONFIG" ]] && [[ "$PRETTIER_CONFIG" != "${PROJECT_ROOT}/prettier.config.js" ]]; then
29
- PRETTIER_ARGS+=(--config "$PRETTIER_CONFIG")
29
+ PRETTIER_ARGS+=(--config "$PRETTIER_CONFIG")
30
30
  fi
31
31
 
32
32
  if [[ -n "$PRETTIER_IGNORE" ]]; then
33
- PRETTIER_ARGS+=(--ignore-path "$PRETTIER_IGNORE")
33
+ PRETTIER_ARGS+=(--ignore-path "$PRETTIER_IGNORE")
34
34
  fi
35
35
 
36
36
  # Also respect .gitignore if present
37
37
  if [[ -f "${PROJECT_ROOT}/.gitignore" ]]; then
38
- PRETTIER_ARGS+=(--ignore-path "${PROJECT_ROOT}/.gitignore")
38
+ PRETTIER_ARGS+=(--ignore-path "${PROJECT_ROOT}/.gitignore")
39
39
  fi
40
40
 
41
41
  # Extra ignores passed via --ignore
42
42
  if [[ ${#EXTRA_IGNORES[@]} -gt 0 ]]; then
43
- _TMP_IGNORE=$(mktemp)
44
- trap 'rm -f "$_TMP_IGNORE"' EXIT
45
- printf '%s\n' "${EXTRA_IGNORES[@]}" > "$_TMP_IGNORE"
46
- PRETTIER_ARGS+=(--ignore-path "$_TMP_IGNORE")
43
+ _TMP_IGNORE=$(mktemp)
44
+ trap 'rm -f "$_TMP_IGNORE"' EXIT
45
+ printf '%s\n' "${EXTRA_IGNORES[@]}" > "$_TMP_IGNORE"
46
+ PRETTIER_ARGS+=(--ignore-path "$_TMP_IGNORE")
47
47
  fi
48
48
 
49
49
  PRETTIER_ARGS+=(".")