🐛 fix(projectdo): disabled npm run if to always use npm run

This commit is contained in:
Sergio Laín 2023-11-16 15:40:25 +01:00
parent d357133ae1
commit de8a417063
No known key found for this signature in database
GPG key ID: 14C9B8080681777B

View file

@ -85,17 +85,17 @@ try_nodejs() {
fi
local node_action="$ACTION"
# Only the "run" action need translation, the others match 1-to-1
if [ "$ACTION" = run ]; then
node_action=start
fi
# if [ "$ACTION" = run ]; then
# node_action=start
# fi
# We check if the package.json file contains an appropriate script. We use
# grep for this. The check is not 100% bulletproof, but it's very close. We
# could've used `npm run` to get the authorative list of the scripts but
# invoking `npm` is two orders of magnitude slower which leads to a
# noticeable delay.
if ! $IS_TOOL && ! grep -q "^[[:space:]]*\"${node_action}\":" package.json; then
return 0
fi
# if ! $IS_TOOL && ! grep -q "^[[:space:]]*\"${node_action}\":" package.json; then
# return 0
# fi
execute_command "$tool" "$node_action"
}
@ -144,13 +144,16 @@ try_maven() {
case $ACTION in
build)
execute "mvn compile"
exit ;;
exit
;;
test)
execute "mvn test"
exit ;;
exit
;;
run)
echo "projectdo does not know how to run a project with Maven."
exit
;;
esac
fi
}
@ -217,15 +220,18 @@ try_python() {
case $ACTION in
build)
execute "poetry build"
exit ;;
exit
;;
test)
# TODO: There are other Python test frameworks, it would be nice to
# detect and run the right one.
execute "poetry run pytest"
exit ;;
exit
;;
run)
echo "projectdo does not know how to run a project with Poetry."
exit
;;
esac
else
echo "Found a pyproject.toml file but projectdo is not sure how to run it."
@ -322,21 +328,35 @@ Tool arguments:
# Main execution starts here
while getopts dhnqv-: c
do
while getopts dhnqv-: c; do
case $c in
d) DRY_RUN=true ;;
h) display_help; exit 0 ;;
h)
display_help
exit 0
;;
n) DRY_RUN=true ;;
q) QUIET=true ;;
v) display_version; exit 0 ;;
v)
display_version
exit 0
;;
-) case $OPTARG in
help) display_help; exit 0 ;;
help)
display_help
exit 0
;;
dry-run) DRY_RUN=true ;;
quiet) QUIET=true ;;
version) display_version; exit 0 ;;
version)
display_version
exit 0
;;
'') break ;; # "--" should terminate argument processing
* ) echo "Illegal option --$OPTARG" >&2; exit 1 ;;
*)
echo "Illegal option --$OPTARG" >&2
exit 1
;;
esac ;;
\?) exit 1 ;;
esac
@ -369,8 +389,7 @@ fi
set_project_root
while :
do
while :; do
# We don't want to do anything if we are in the home or root directory
if [ "$PWD" = "$HOME" ] || [ "$PWD" = / ]; then
nothing_found