<commit_before>export NODE_ENV="production"
export LIVECHAT_DIR="../../../public/livechat"
export BUILD_DIR="../build"
export BUNDLE_DIR="../build/bundle/programs/web.browser.legacy"
export LIVECHAT_ASSETS_DIR="../../../private/livechat"
export LATEST_LIVECHAT_VERSION="1.1.0"
export LIVECHAT_VERSION_DIR="1.0.0"

cd packages/rocketchat-livechat/.app
meteor npm install --production

meteor build --headless --directory $BUILD_DIR

rm -rf $LIVECHAT_DIR
mkdir -p $LIVECHAT_DIR
cp $BUNDLE_DIR/*.css $LIVECHAT_DIR/livechat.css
cp $BUNDLE_DIR/*.js $LIVECHAT_DIR/livechat.js

rm -rf $LIVECHAT_ASSETS_DIR
mkdir $LIVECHAT_ASSETS_DIR

cp $BUNDLE_DIR/head.html $LIVECHAT_ASSETS_DIR/head.html
rm -rf $BUILD_DIR

#NEW LIVECHAT#
echo "Installing new Livechat..."
cd $LIVECHAT_DIR
mkdir -p $LIVECHAT_VERSION_DIR
cd $LIVECHAT_VERSION_DIR

curl -sOL "https://github.com/RocketChat/Rocket.Chat.Livechat/releases/download/v${LATEST_LIVECHAT_VERSION}/build.tar.gz"
tar -xf build.tar.gz
rm build.tar.gz

# change to lowercase so all injected junk from rocket.chat is not sent: https://github.com/meteorhacks/meteor-inject-initial/blob/master/lib/inject-core.js#L10
# this is not harmful since doctype is case-insesitive: https://www.w3.org/TR/html5/syntax.html#the-doctype
node -e 'fs.writeFileSync("index.html", fs.readFileSync("index.html").toString().replace("<!DOCTYPE", "<!doctype"));'

cd $LIVECHAT_ASSETS_DIR
cp ../../public/livechat/$LIVECHAT_VERSION_DIR/index.html .<commit_msg>Update latest Livechat widget version(1.1.3) (#15154)<commit_after>export NODE_ENV="production"
export LIVECHAT_DIR="../../../public/livechat"
export BUILD_DIR="../build"
export BUNDLE_DIR="../build/bundle/programs/web.browser.legacy"
export LIVECHAT_ASSETS_DIR="../../../private/livechat"
export LATEST_LIVECHAT_VERSION="1.1.3"

cd packages/rocketchat-livechat/.app
meteor npm install --production

meteor build --headless --directory $BUILD_DIR

rm -rf $LIVECHAT_DIR
mkdir -p $LIVECHAT_DIR
cp $BUNDLE_DIR/*.css $LIVECHAT_DIR/livechat.css
cp $BUNDLE_DIR/*.js $LIVECHAT_DIR/livechat.js

rm -rf $LIVECHAT_ASSETS_DIR
mkdir $LIVECHAT_ASSETS_DIR

cp $BUNDLE_DIR/head.html $LIVECHAT_ASSETS_DIR/head.html
rm -rf $BUILD_DIR

#NEW LIVECHAT#
echo "Installing Livechat ${LATEST_LIVECHAT_VERSION}..."
cd $LIVECHAT_DIR

curl -sOL "https://github.com/RocketChat/Rocket.Chat.Livechat/releases/download/v${LATEST_LIVECHAT_VERSION}/build.tar.gz"
tar -xf build.tar.gz
rm build.tar.gz

# change to lowercase so all injected junk from rocket.chat is not sent: https://github.com/meteorhacks/meteor-inject-initial/blob/master/lib/inject-core.js#L10
# this is not harmful since doctype is case-insesitive: https://www.w3.org/TR/html5/syntax.html#the-doctype
node -e 'fs.writeFileSync("index.html", fs.readFileSync("index.html").toString().replace("<!DOCTYPE", "<!doctype"));'

cp index.html ../../private/livechat
{'fraction_non_alphanumeric': 0.1472027972027972, 'fraction_numerical': 0.008741258741258742, 'mean_word_length': 5.126338329764454, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4143078', 'n_tokens_mistral': 1132, 'n_tokens_neox': 1080, 'n_words': 197}