guess-js-deps-bash 0.1.57 → 0.1.60

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 (2) hide show
  1. package/guess-js-deps.sh +13 -4
  2. package/package.json +1 -1
package/guess-js-deps.sh CHANGED
@@ -141,8 +141,7 @@ function find_imports_in_project () {
141
141
  local IMPORTS=()
142
142
  readarray -t IMPORTS < <(
143
143
  scan_all_scannable_files_in_project \
144
- | guess_unique_stdin_dep_types \
145
- | cut -sf 1-3)
144
+ | guess_unique_stdin_dep_types 1-3)
146
145
  progress 'done.'
147
146
 
148
147
  [ -n "${IMPORTS[0]}" ] || return 3$(
@@ -196,8 +195,16 @@ function find_manif_eslint_deps () {
196
195
  local BUF="$DEPS"
197
196
  BUF="¶ ${BUF//$'\n'/ ¶ } ¶"
198
197
  BUF="${BUF//$'\t'/ » }"
198
+
199
+ local ECNP='eslint-config-nodejs-pmb'
199
200
  case "$BUF" in
200
- *'eslint-config-nodejs-pmb '* )
201
+ *"$ECNP "* )
202
+ local PEER_DEPS="$ECNP/test/expectedPeerDependencies.js"
203
+ PEER_DEPS="require('$PEER_DEPS').join('\n')"
204
+ PEER_DEPS="$(nodejs -p "$PEER_DEPS")"
205
+ [ -n "$PEER_DEPS" ] || return 4$(
206
+ echo "E: Failed to detect peer dependencies of $ECNP" >&2)
207
+ DEPS+=$'\n'"$PEER_DEPS"
201
208
  <<<"$SCRIPTS" grep -qoPe '^\s*"elp[ \&"]' && DEPS+=$'\neslint-pretty-pmb'
202
209
  ;;
203
210
  esac
@@ -720,7 +727,9 @@ function guess_one_dep_type () {
720
727
 
721
728
 
722
729
  function guess_unique_stdin_dep_types () {
723
- csort -u | with_stdin_args guess_dep_types | csort -u
730
+ local FIELDS="${1:-1-}"; shift
731
+ csort --unique | with_stdin_args guess_dep_types | cut -sf "$FIELDS" \
732
+ | csort --unique # <-- not --version-sort: would group "@" after "z"
724
733
  }
725
734
 
726
735
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  { "name": "guess-js-deps-bash",
2
- "version": "0.1.57",
2
+ "version": "0.1.60",
3
3
  "description": "A bash attempt at npm-forgot: Guess JavaScript require() dependencies, detect their versions, compare with package.json.",
4
4
 
5
5
  "keywords": [