Last active
December 18, 2019 10:17
-
-
Save bellbind/ecdd141d574bd7ba207a68ace1884394 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 hidden or 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
Thanks!