Files
odoo_source/addons/web/tooling/enable.sh
T
Simon Genin (ges) 8d57a5cde9 [ADD] web: prettier and eslint tooling
Provide an opt in js tooling system by adding a node env with prettier and eslint configured.
3 bash scripts are provided: enable.sh, disable.sh and reload.sh.

Enable.sh: add to the community root (and optionaly to the enterprise root) the env.
Disable.sh: remove the env.
Reload.sh: disable then enable.
2021-06-18 21:31:27 +02:00

46 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
script="$0"
basename="$(dirname $script)"
read -p "Do you want the tooling installed in enterprise too ? [y, n]" willingToInstallToolingInEnterprise
if [[ $willingToInstallToolingInEnterprise != "n" ]]
then
read -p "What is the relative path from community to enterprise ? (../enterprise)" pathToEnterprise
pathToEnterprise=${pathToEnterprise:-../enterprise}
fi
cp -r $basename/_husky $basename/../../../.husky
cp $basename/_eslintignore $basename/../../../.eslintignore
cp $basename/_prettierignore $basename/../../../.prettierignore
cp $basename/_eslintrc.json $basename/../../../.eslintrc.json
cp $basename/_prettierrc.json $basename/../../../.prettierrc.json
cp $basename/_package.json $basename/../../../package.json
if [[ $willingToInstallToolingInEnterprise != "n" ]]
then
cp -r $basename/_husky $basename/../../../$pathToEnterprise/.husky
cp $basename/_eslintignore $basename/../../../$pathToEnterprise/.eslintignore
cp $basename/_prettierignore $basename/../../../$pathToEnterprise/.prettierignore
cp $basename/_eslintrc.json $basename/../../../$pathToEnterprise/.eslintrc.json
cp $basename/_prettierrc.json $basename/../../../$pathToEnterprise/.prettierrc.json
cp $basename/_package.json $basename/../../../$pathToEnterprise/package.json
fi
cd $basename
npm install
cd -
if [[ $willingToInstallToolingInEnterprise != "n" ]]
then
cd $basename/../../../$pathToEnterprise
npm install
cd -
fi
echo ""
echo "JS tooling have been added to the roots"
echo "Make sure to refresh the eslint service and configure your IDE so it uses the config files"
echo 'For VSCode, look inside your .vscode/settings.json file ("editor.defaultFormatter": "dbaeumer.vscode-eslint")'
echo ""