The published vref bin can exit 0 having done nothing, depending on how pnpm generated the shim.
src/cli.ts guards its entry point with:
if (process.argv[1] !== undefined && import.meta.url === pathToFileURL(process.argv[1]).href) {
main(process.argv.slice(2), process.cwd());
}
Node canonicalises import.meta.url through symlinks but leaves process.argv[1] as given. pnpm
places the real package under node_modules/.pnpm/… and symlinks node_modules/@putdotio/vref to
it, so whether the guard holds depends on which path the generated shim uses:
…/.bin/../.pnpm/@putdotio+vref@1.1.0/node_modules/@putdotio/vref/dist/cli.mjs — real path, guard passes, CLI runs
…/.bin/../@putdotio/vref/dist/cli.mjs — symlink, guard fails, CLI exits 0 with no output and no work done
Both shims occur in practice. putio-roku got the first and works; a fresh pnpm add -D @putdotio/vref in putio-ios got the second, where vref describe, vref build, and
vref validate all silently do nothing. Same pnpm 11.2.2, same Node 24.18.0, same package
checksum — only the shim differs.
Silent success is the bad part: a CI step running vref build --check would pass while validating
nothing.
Suggested fix — canonicalise both sides before comparing:
import { realpathSync } from "node:fs";
const entry = process.argv[1];
if (entry !== undefined && import.meta.url === pathToFileURL(realpathSync(entry)).href) {
main(process.argv.slice(2), process.cwd());
}
Worth a regression test that invokes the built dist/cli.mjs through a symlink and asserts it
produces output.
Workaround for consumers: call the library API (buildGallery, validateGallery) from a thin
script, as putio-roku does in scripts/vref.ts. putdotio/putio-ios#48 will do the same.
The published
vrefbin can exit 0 having done nothing, depending on how pnpm generated the shim.src/cli.tsguards its entry point with:Node canonicalises
import.meta.urlthrough symlinks but leavesprocess.argv[1]as given. pnpmplaces the real package under
node_modules/.pnpm/…and symlinksnode_modules/@putdotio/vreftoit, so whether the guard holds depends on which path the generated shim uses:
…/.bin/../.pnpm/@putdotio+vref@1.1.0/node_modules/@putdotio/vref/dist/cli.mjs— real path, guard passes, CLI runs…/.bin/../@putdotio/vref/dist/cli.mjs— symlink, guard fails, CLI exits 0 with no output and no work doneBoth shims occur in practice.
putio-rokugot the first and works; a freshpnpm add -D @putdotio/vrefinputio-iosgot the second, wherevref describe,vref build, andvref validateall silently do nothing. Same pnpm 11.2.2, same Node 24.18.0, same packagechecksum — only the shim differs.
Silent success is the bad part: a CI step running
vref build --checkwould pass while validatingnothing.
Suggested fix — canonicalise both sides before comparing:
Worth a regression test that invokes the built
dist/cli.mjsthrough a symlink and asserts itproduces output.
Workaround for consumers: call the library API (
buildGallery,validateGallery) from a thinscript, as
putio-rokudoes inscripts/vref.ts. putdotio/putio-ios#48 will do the same.