@mesh-tech/mesh-cli 0.12.0 → 0.12.1
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.
- package/dist/bin/mesh.js +56 -4
- package/dist/bin/mesh.js.map +2 -2
- package/dist/build-info.json +2 -2
- package/dist/src/commands/install-shim.d.ts +7 -0
- package/dist/src/commands/install-shim.d.ts.map +1 -1
- package/dist/src/commands/install-shim.js +63 -4
- package/dist/src/commands/install-shim.js.map +1 -1
- package/package.json +2 -2
package/dist/bin/mesh.js
CHANGED
|
@@ -15459,15 +15459,67 @@ function shimScript() {
|
|
|
15459
15459
|
# it. That resolves to bin/mesh.mjs, which runs the CLI from TypeScript source \u2014
|
|
15460
15460
|
# so this always runs the LOCAL source of whatever worktree/app you are in, with
|
|
15461
15461
|
# no build step. Nothing here is version-pinned; do not edit by hand.
|
|
15462
|
+
#
|
|
15463
|
+
# Outside a workspace it hands off to a globally installed mesh CLI (MESH-2869).
|
|
15464
|
+
# Without that hand-off the shim shadows \`npm i -g @mesh-tech/mesh-cli\` on the
|
|
15465
|
+
# PATH and \`mesh login\` is unreachable from the home directory \u2014 which is the
|
|
15466
|
+
# very first thing a new developer runs.
|
|
15467
|
+
# True when $1 is another copy of this shim. Reads the marker line with the
|
|
15468
|
+
# shell alone \u2014 no head/grep \u2014 so a stripped PATH cannot break the check.
|
|
15469
|
+
_mesh_is_shim() {
|
|
15470
|
+
_n=0
|
|
15471
|
+
while [ "$_n" -lt 6 ] && IFS= read -r _line; do
|
|
15472
|
+
case $_line in *"canonical launcher shim"*) return 0 ;; esac
|
|
15473
|
+
_n=$((_n + 1))
|
|
15474
|
+
done < "$1"
|
|
15475
|
+
return 1
|
|
15476
|
+
}
|
|
15477
|
+
|
|
15478
|
+
# Walk up to the nearest workspace CLI. Parameter expansion, not \`dirname\`:
|
|
15479
|
+
# an unavailable dirname used to leave $dir empty and spin this loop forever.
|
|
15462
15480
|
dir=$(pwd)
|
|
15463
|
-
while [ "$dir"
|
|
15481
|
+
while [ -n "$dir" ]; do
|
|
15464
15482
|
if [ -x "$dir/node_modules/.bin/mesh" ]; then
|
|
15465
15483
|
exec "$dir/node_modules/.bin/mesh" "$@"
|
|
15466
15484
|
fi
|
|
15467
|
-
|
|
15485
|
+
[ "$dir" = "/" ] && break
|
|
15486
|
+
parent=\${dir%/*}
|
|
15487
|
+
[ -n "$parent" ] || parent=/
|
|
15488
|
+
dir=$parent
|
|
15489
|
+
done
|
|
15490
|
+
|
|
15491
|
+
# Not in a workspace: exec the next \`mesh\` on PATH that is not another copy of
|
|
15492
|
+
# this shim (matched on the marker line above, so we can never exec ourselves).
|
|
15493
|
+
self_dir=\${0%/*}
|
|
15494
|
+
[ "$self_dir" = "$0" ] && self_dir=.
|
|
15495
|
+
self_dir=$(CDPATH= cd -- "$self_dir" 2>/dev/null && pwd -P)
|
|
15496
|
+
saved_ifs=$IFS
|
|
15497
|
+
IFS=:
|
|
15498
|
+
set -f
|
|
15499
|
+
for entry in $PATH; do
|
|
15500
|
+
IFS=$saved_ifs
|
|
15501
|
+
set +f
|
|
15502
|
+
[ -n "$entry" ] || entry=.
|
|
15503
|
+
candidate=$entry/mesh
|
|
15504
|
+
# -f as well as -x: [ -x ] is true for a DIRECTORY named mesh, which would be
|
|
15505
|
+
# taken for the CLI and exec'd into a bare 126 without ever reaching the real
|
|
15506
|
+
# one further down PATH. A shell's own PATH search skips directories.
|
|
15507
|
+
if [ -f "$candidate" ] && [ -x "$candidate" ]; then
|
|
15508
|
+
entry_dir=$(CDPATH= cd -- "$entry" 2>/dev/null && pwd -P)
|
|
15509
|
+
if [ -n "$entry_dir" ] && [ "$entry_dir" != "$self_dir" ] && ! _mesh_is_shim "$candidate"; then
|
|
15510
|
+
exec "$candidate" "$@"
|
|
15511
|
+
fi
|
|
15512
|
+
fi
|
|
15513
|
+
IFS=:
|
|
15514
|
+
set -f
|
|
15468
15515
|
done
|
|
15469
|
-
|
|
15470
|
-
|
|
15516
|
+
IFS=$saved_ifs
|
|
15517
|
+
set +f
|
|
15518
|
+
|
|
15519
|
+
echo "mesh: not inside a Mesh workspace (no node_modules/.bin/mesh found)," >&2
|
|
15520
|
+
echo " and no global mesh CLI found on PATH." >&2
|
|
15521
|
+
echo " Install it: npm i -g @mesh-tech/mesh-cli" >&2
|
|
15522
|
+
echo " Or cd into your app/repo (after 'pnpm install') and use 'pnpm exec mesh'." >&2
|
|
15471
15523
|
exit 1
|
|
15472
15524
|
`;
|
|
15473
15525
|
}
|