-
-
Save ruyaoyao/f4fccf6c1f07f85accd4d82cfbb3ecb3 to your computer and use it in GitHub Desktop.
[nodejs][nvm] bash function of node with full `Intl` locales support by automatic installing the prebuilt "icu4c-data" package
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
[ -s $HOME/.nvm/nvm.sh ] && . $HOME/.nvm/nvm.sh # This loads NVM | |
function node { | |
rawnode=$(which node) | |
icu4cdata=$(dirname $(dirname $rawnode))/lib/node_modules/icu4c-data | |
[[ -d $icu4cdata ]] || npm install -g icu4c-data@$($rawnode -e ' | |
console.log((v => v.icu_ver_major + v.icu_endianness)( | |
process.config.variables));') | |
NODE_ICU_DATA=$icu4cdata $rawnode "$@" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment