Skip to content

pnpm kondo fails on hnvm v0.12.7 #35

@joseph-galindo

Description

@joseph-galindo

First, confirmed the version of hnvm I'm using:

[joseph.galindo@C02XK68RJG5L probot-pr-checklist (jrg/BT-3953)]$ brew list hnvm
/usr/local/Cellar/hnvm/v0.12.7/.hnvmrc
/usr/local/Cellar/hnvm/v0.12.7/bin/node
/usr/local/Cellar/hnvm/v0.12.7/bin/npm
/usr/local/Cellar/hnvm/v0.12.7/bin/npx
/usr/local/Cellar/hnvm/v0.12.7/bin/pnpm
/usr/local/Cellar/hnvm/v0.12.7/bin/pnpx
/usr/local/Cellar/hnvm/v0.12.7/bin/yarn
/usr/local/Cellar/hnvm/v0.12.7/lib/.tmp/node/>=4
/usr/local/Cellar/hnvm/v0.12.7/lib/hnvm/ (4 files)

So..I was trying to run pnpm kondo in uc-node-services and ran into this:

[joseph.galindo@C02XK68RJG5L probot-pr-checklist (jrg/BT-3953)]$ pnpm kondo
Using Hermetic NodeJS v16.13.0
/usr/local/bin/pnpm: line 23: /usr/local/Cellar/hnvm/v0.12.7/lib/hnvm/../lib/hnvm/kondo.sh: No such file or directory

I thought that's weird, since I never remember having a problem with this script, at least in uc-frontend. I went to where it is on disk:

[joseph.galindo@C02XK68RJG5L lib]$ cd /usr/local/Cellar/hnvm/v0.12.7/lib/hnvm/
[joseph.galindo@C02XK68RJG5L hnvm]$ ls
colors.sh	config.sh	ensure_bin.sh	kondo.sh
[joseph.galindo@C02XK68RJG5L hnvm]$ pwd
/usr/local/Cellar/hnvm/v0.12.7/lib/hnvm
[joseph.galindo@C02XK68RJG5L hnvm]$ ls /usr/local/Cellar/hnvm/v0.12.7/lib/hnvm/kondo.sh
/usr/local/Cellar/hnvm/v0.12.7/lib/hnvm/kondo.sh

So I tried to log out what was happening to the $script_dir variable being relied on in hnvm, and found these:

[joseph.galindo@C02XK68RJG5L probot-pr-checklist (jrg/BT-3953)]$ pnpm kondo
derived script_dir is /usr/local/bin
derived script_dir in /usr/local/bin/pnpm is /usr/local/Cellar/hnvm/v0.12.7/bin
we are now sourcing /usr/local/Cellar/hnvm/v0.12.7/bin/../lib/hnvm/ensure_bin.sh in the /usr/local/bin/pnpm code
script_dir in usr/local/Cellar/hnvm/v0.12.7/lib/hnvm/ensure_bin is /usr/local/Cellar/hnvm/v0.12.7/lib/hnvm
Using Hermetic NodeJS v16.13.0
derived script_dir in /usr/local/bin/pnpm is /usr/local/Cellar/hnvm/v0.12.7/lib/hnvm
/usr/local/bin/pnpm: line 29: /usr/local/Cellar/hnvm/v0.12.7/lib/hnvm/../lib/hnvm/kondo.sh: No such file or directory
derived script_dir in /usr/local/bin/pnpm is /usr/local/Cellar/hnvm/v0.12.7/lib/hnvm
^^^ this is not good, we probably don't expect this value to change at all

It looks like these files:

  • /usr/local/bin/pnpm
  • /usr/local/Cellar/hnvm/v0.12.7/lib/hnvm/ensure_bin.sh

Both set up their own variable $script_dir. When the pnpm bin script bash sources the ensure_bin.sh script, I think the variable from ensure_bin.sh is sourced and shadows the variable in pnpm. Which can break the pnpm kondo logic since it relies on that variable.


To work around the issue, I changed pnpm locally to use source "$script_dir/kondo.sh" "${node_bin}" "${pnpm_bin}, but we probably need to fix upstream in hnvm itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions