Files
odoo_source/addons/web/tooling/enable.sh
T
Simon Genin (ges) 9583c74e5f [FIX] web: make js tooling safe with paths with spaces
If $basepath in the tooling contained spaces, it could have dramatic
consequences on the rm -rf command.
We simply escape everything to avoid the problem.

closes odoo/odoo#73222

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-07-05 13:07:48 +00:00

46 lines
1.8 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 ""