🐛 fix(projectdo): disabled npm run if to always use npm run
This commit is contained in:
parent
d357133ae1
commit
de8a417063
1 changed files with 249 additions and 230 deletions
|
@ -85,17 +85,17 @@ try_nodejs() {
|
||||||
fi
|
fi
|
||||||
local node_action="$ACTION"
|
local node_action="$ACTION"
|
||||||
# Only the "run" action need translation, the others match 1-to-1
|
# Only the "run" action need translation, the others match 1-to-1
|
||||||
if [ "$ACTION" = run ]; then
|
# if [ "$ACTION" = run ]; then
|
||||||
node_action=start
|
# node_action=start
|
||||||
fi
|
# fi
|
||||||
# We check if the package.json file contains an appropriate script. We use
|
# 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
|
# 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
|
# 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
|
# invoking `npm` is two orders of magnitude slower which leads to a
|
||||||
# noticeable delay.
|
# noticeable delay.
|
||||||
if ! $IS_TOOL && ! grep -q "^[[:space:]]*\"${node_action}\":" package.json; then
|
# if ! $IS_TOOL && ! grep -q "^[[:space:]]*\"${node_action}\":" package.json; then
|
||||||
return 0
|
# return 0
|
||||||
fi
|
# fi
|
||||||
execute_command "$tool" "$node_action"
|
execute_command "$tool" "$node_action"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,13 +144,16 @@ try_maven() {
|
||||||
case $ACTION in
|
case $ACTION in
|
||||||
build)
|
build)
|
||||||
execute "mvn compile"
|
execute "mvn compile"
|
||||||
exit ;;
|
exit
|
||||||
|
;;
|
||||||
test)
|
test)
|
||||||
execute "mvn test"
|
execute "mvn test"
|
||||||
exit ;;
|
exit
|
||||||
|
;;
|
||||||
run)
|
run)
|
||||||
echo "projectdo does not know how to run a project with Maven."
|
echo "projectdo does not know how to run a project with Maven."
|
||||||
exit
|
exit
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -217,15 +220,18 @@ try_python() {
|
||||||
case $ACTION in
|
case $ACTION in
|
||||||
build)
|
build)
|
||||||
execute "poetry build"
|
execute "poetry build"
|
||||||
exit ;;
|
exit
|
||||||
|
;;
|
||||||
test)
|
test)
|
||||||
# TODO: There are other Python test frameworks, it would be nice to
|
# TODO: There are other Python test frameworks, it would be nice to
|
||||||
# detect and run the right one.
|
# detect and run the right one.
|
||||||
execute "poetry run pytest"
|
execute "poetry run pytest"
|
||||||
exit ;;
|
exit
|
||||||
|
;;
|
||||||
run)
|
run)
|
||||||
echo "projectdo does not know how to run a project with Poetry."
|
echo "projectdo does not know how to run a project with Poetry."
|
||||||
exit
|
exit
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
echo "Found a pyproject.toml file but projectdo is not sure how to run it."
|
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
|
# Main execution starts here
|
||||||
|
|
||||||
while getopts dhnqv-: c
|
while getopts dhnqv-: c; do
|
||||||
do
|
|
||||||
case $c in
|
case $c in
|
||||||
d) DRY_RUN=true ;;
|
d) DRY_RUN=true ;;
|
||||||
h) display_help; exit 0 ;;
|
h)
|
||||||
|
display_help
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
n) DRY_RUN=true ;;
|
n) DRY_RUN=true ;;
|
||||||
q) QUIET=true ;;
|
q) QUIET=true ;;
|
||||||
v) display_version; exit 0 ;;
|
v)
|
||||||
|
display_version
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
-) case $OPTARG in
|
-) case $OPTARG in
|
||||||
help) display_help; exit 0 ;;
|
help)
|
||||||
|
display_help
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
dry-run) DRY_RUN=true ;;
|
dry-run) DRY_RUN=true ;;
|
||||||
quiet) QUIET=true ;;
|
quiet) QUIET=true ;;
|
||||||
version) display_version; exit 0 ;;
|
version)
|
||||||
|
display_version
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
'') break ;; # "--" should terminate argument processing
|
'') break ;; # "--" should terminate argument processing
|
||||||
* ) echo "Illegal option --$OPTARG" >&2; exit 1 ;;
|
*)
|
||||||
|
echo "Illegal option --$OPTARG" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
esac ;;
|
esac ;;
|
||||||
\?) exit 1 ;;
|
\?) exit 1 ;;
|
||||||
esac
|
esac
|
||||||
|
@ -369,8 +389,7 @@ fi
|
||||||
|
|
||||||
set_project_root
|
set_project_root
|
||||||
|
|
||||||
while :
|
while :; do
|
||||||
do
|
|
||||||
# We don't want to do anything if we are in the home or root directory
|
# We don't want to do anything if we are in the home or root directory
|
||||||
if [ "$PWD" = "$HOME" ] || [ "$PWD" = / ]; then
|
if [ "$PWD" = "$HOME" ] || [ "$PWD" = / ]; then
|
||||||
nothing_found
|
nothing_found
|
||||||
|
|
Loading…
Add table
Reference in a new issue