You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.
do linux home dirs always contain no whitespace? If so we can replace $HOME with ~ and lose all the escaped double quotes
could make a new executable in the package e.g. enforce or enforce-check which always returns 0 to remove the [ -x ... ]
what does any of this look like on Windows/cross-platform? On Windows it looks like you're best off delegating to e.g. Git bash and double-escaping quotes - even when npm is launched from Git bash, the script is executed by the Windows command interpreter, so "" must be used to safely escape args in the sh argument line:
List possible patterns for preinstall script here and update docs once clear winners emerge.
Current front-runner, worryingly:
using npm to install enforce:
"preinstall": "ENFORCE_VERSION=1.0.0; ENFORCE_DIR=\"$HOME/.npm/enforce/$ENFORCE_VERSION\"; [ -x \"$ENFORCE_DIR/bin/enforce-yarn\" ] || npm i -g --prefix=\"$ENFORCE_DIR\" @blackpepper/enforce@$ENFORCE_VERSION || exit 1; PATH=\"$ENFORCE_DIR/bin:$PATH\"; enforce-yarn --prohibit"
using yarn to install enforce:
"preinstall": "ENFORCE_VERSION=1.0.0; ENFORCE_DIR=\"$HOME/.npm/enforce/$ENFORCE_VERSION\"; [ -x \"$ENFORCE_DIR/bin/enforce-yarn\" ] || yarn global add --prefix=\"$ENFORCE_DIR\" @blackpepper/enforce@$ENFORCE_VERSION || exit 1; PATH=\"$ENFORCE_DIR/bin:$PATH\"; enforce-yarn"
Thoughts:
$HOME
with~
and lose all the escaped double quotesenforce
orenforce-check
which always returns0
to remove the[ -x ... ]
""
must be used to safely escape args in thesh
argument line:"preinstall": "sh -c \"ENFORCE_VERSION=1.0.0; ENFORCE_DIR=\"\"$HOME/.npm/enforce/$ENFORCE_VERSION\"\"; [ -x \"\"$ENFORCE_DIR/bin/enforce-yarn\"\" ] || npm i -g --prefix=\"\"$ENFORCE_DIR\"\" @blackpepper/enforce@$ENFORCE_VERSION || exit 1; PATH=\"\"$ENFORCE_DIR/bin:$PATH\"\"; enforce-yarn --prohibit\""
Previous bad ideas:
yarn:
((type $(yarn global bin)/enforce-yarn &> /dev/null && yarn global upgrade -s @blackpepper/enforce) || yarn global add -s @blackpepper/enforce) && enforce-yarn
maven:3.6-jdk-8
imageThe text was updated successfully, but these errors were encountered: