workflow/initialization/partials/dev_tools.sh

63 lines
1.3 KiB
Bash
Raw Normal View History

2023-08-17 09:34:05 +02:00
#!/bin/bash
echo " ------ install developing tools ------"
############ install developping tools
# nvm node version manager
if ! hash nvm > /dev/null; then
echo "installation de nvm"
cd tmp
echo "install nvm"
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
fi
nvm install $node_version_expected
nvm alias default $node_version_expected
nvm alias global $node_version_expected
# yarn
corepack enable
npm i -g pnpm
echo "nvm installé, version des outils js:"
nvm --version
node --version
yarn --version
echo "install des outils en php"
# composer php
# symfony cli tool
# créer le dossier de scripts
if ! hash symfony ; then
wget https://get.symfony.com/cli/installer -O - | bash
fi
if ! hash composer ; then
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi
php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php
sudo mv composer.phar /usr/local/bin/composer
fi