npm / cmd-shim

The cmd-shim used in npm
ISC License
76 stars 40 forks source link

fix shebangExpr: ignore -S argument for /usr/bin/env #94

Closed milahu closed 2 years ago

milahu commented 2 years ago

fixes https://github.com/pnpm/pnpm/issues/5575

related to https://github.com/pnpm/cmd-shim/pull/42

repro does not work for npm because for this package, npm does not create a wrapper script

i guess these are only created for transitive dependencies in a deep node_modules folder where we must set the basedir

cd $(mktemp -d)
npm init -y
npm i @suid/codemod prettier
npx @suid/codemod

npm

head -n5 node_modules/.bin/codemod 

#!/usr/bin/env -S node --no-warnings --experimental-specifier-resolution=node
import fixEsm from "./actions/fixEsm";
import mui2suid from "./actions/mui2suid";
import react2solid from "./actions/react2solid";
import suidImports from "./actions/suidImports";

pnpm

head -n5 node_modules/.bin/codemod 

#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")

case `uname` in
    *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
milahu commented 2 years ago

closing as duplicate of #55