Created
October 7, 2019 22:52
-
-
Save retyui/89515f67e32ad7abcd70d58ce222a879 to your computer and use it in GitHub Desktop.
fbt bash utils
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BIN=./node_modules/babel-plugin-fbt/bin | |
TMP_ROOT=./.i18n-cache | |
SRC_ROOT=./src | |
SRC_MANIFEST=${TMP_ROOT}/src-manifest.json | |
ENUM_MANIFEST=${TMP_ROOT}/enum-manifest.json | |
SOURCE_STRINGS=${TMP_ROOT}/source-strings.json | |
TRANSLATIONS_MASK=${SRC_ROOT}/i18n/translations/*.json | |
OUTPUT_TRANSLATED=${SRC_ROOT}/i18n/translated.json | |
[ -d ${TMP_ROOT} ] || mkdir -p ${TMP_ROOT} | |
if [[ $1 == "manifest" ]]; then | |
rm -f ${SRC_MANIFEST} ${ENUM_MANIFEST} | |
node ${BIN}/manifest.js \ | |
--src ${SRC_ROOT} \ | |
--enum-manifest ${ENUM_MANIFEST} \ | |
--src-manifest ${SRC_MANIFEST} | |
elif [[ $1 == "collect" ]]; then | |
rm -f ${SOURCE_STRINGS} | |
node ${BIN}/collectFBT.js \ | |
--react-native-mode \ | |
--pretty \ | |
--manifest \ | |
<${SRC_MANIFEST} \ | |
>${SOURCE_STRINGS} | |
elif [[ $1 == "translate" ]]; then | |
node ${BIN}/translate.js \ | |
--jenkins \ | |
--pretty \ | |
--src-manifest ${SRC_MANIFEST} \ | |
--source-strings ${SOURCE_STRINGS} \ | |
--translations ${TRANSLATIONS_MASK} \ | |
>${OUTPUT_TRANSLATED} | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment