5 # Extract all the files we need to parse to get the translations
10 # We remove as much files a possible so it's faster
12 # Remove what we do not need to filter + it makes find more complex
13 rm -rf node_modules | true
14 rm -rf webpack
:/*/webpack | true
15 rm -rf webpack
:/*/locales | true
17 grep -Ril "from 'ttag'" .
21 if [ -s "dist" ]; then
22 echo "extract from dist bundle local"
26 # Cache for the CI so we're faster
27 if [ -s 'webapp-bundle.tar.gz' ]; then
28 echo "we extract the bundle"
31 tar xzf webapp-bundle.
tar.gz
-C dist
33 echo "bundle must be built first"
42 appName
="$(jq -r .name package.json)"
44 if [ ! -d "/tmp/sourcemapper" ]; then
45 echo "missing source mapper, run ./build.sh"
51 # Extract all the code available inside the dist and only the one we built (post tree-shacking)
52 for file in $
(find .
/dist
/ -type f
-name "*.js.map"); do
53 echo "[Parsing] $file";
54 if [[ "$OSTYPE" = "darwin"* ]]; then
55 if [[ "$(uname -m)" == 'arm64' ]]; then
56 /tmp
/sourcemapper
/bin
/isourcemapper-arm
--input "$file" --output 'i18n-js' &> /dev
/null
&
58 /tmp
/sourcemapper
/bin
/isourcemapper
--input "$file" --output 'i18n-js' &> /dev
/null
&
61 /tmp
/sourcemapper
/bin
/sourcemapper
--input "$file" --output 'i18n-js' &> /dev
/null
&
67 # Extract on top of the extracted code from the bundle
68 # Use direct relative path instead of npx or dlx since it doesn't resolve to the installed dependencies
71 echo "Running ttag extract"
72 # Output from ttag extract is full of babel errors, silence it
73 ..
/..
/..
/node_modules
/.bin
/ttag extract $
(getFileList
) -o "../${1}" 2>&1;
78 if [[ "$OSTYPE" = "darwin"* ]]; then
79 sed -i '' 's|webpack:/||g;s| /src/app/| src/app/|g' "$1";
81 sed -i 's|webpack:/||g;s| /src/app/| src/app/|g' "$1";