<commit_before>#!/bin/bash

set -e

cd $(dirname $0)

DOCKER_RUN_OPTS="--rm --volumes-from ${HOSTNMAME} spark-js-sdk-builder"

echo "################################################################################"
echo "# PUBLISHING NEW VERSIONS TO NPM"
echo "################################################################################"
if [ -z "${NPM_TOKEN}" ]; then
  echo "NPM_TOKEN is not set"
fi
if [ -n "${NPM_TOKEN}" ]; then
  echo "NPM_TOKEN is set"
fi
if [ -z "${NPM_CONFIG_REGISTRY}" ]; then
  echo "NPM_CONFIG_REGISTRY is not set"
fi
if [ -n "${NPM_CONFIG_REGISTRY}" ]; then
  echo "NPM_CONFIG_REGISTRY is set"
fi

cd "${SDK_ROOT_DIR}"
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > ~/.npmrc
REG="${NPM_CONFIG_REGISTRY}"
unset NPM_CONFIG_REGISTRY
npm run lerna -- exec -- bash -c "npm publish || true"
export NPM_CONFIG_REGISTRY="${REG}"
rm -f ~/.npmrc

VERSION=$(git reflog -n 1 | grep "commit: v." | awk '{print $4}')
if [ -n "${VERSION}" ]; then
  git push origin "${VERSION}":"${VERSION}"
fi

echo "################################################################################"
echo "# PUBLISHING NEW DOCUMENENTATION"
echo "################################################################################"
npm run grunt:concurrent -- publish:docs

echo "Published ${VERSION}"

# LAST_LOG=$(git log -1 --pretty=%B)
#
# if [[ ${LAST_LOG} == "#release"* ]]; then
#   # Remove command commit, but allow it to dirty the workspace if it includes
#   # changes
#   git reset HEAD^
#   HAS_CHANGES=$(git status --porcelain | wc -l)
#   if [ "${HAS_CHANGES}" -ne "0" ]; then
#     echo "################################################################################"
#     echo "# After removing command commit, local workspace has changes"
#     echo "################################################################################"
#     echo git status
#     echo "################################################################################"
#     echo "# Command commits should not make changes, exiting"
#     echo "################################################################################"
#     exit 1
#   fi
#
#   VERSION=$(echo ${LAST_LOG} | sed -e 's/#release //g' | sed -e 's/^\s*//g' | sed -e 's/\s$//g')
# fi
<commit_msg>chore(tooling): publish publicly and remove debugging code<commit_after>#!/bin/bash

set -e

cd $(dirname $0)

DOCKER_RUN_OPTS="--rm --volumes-from ${HOSTNMAME} spark-js-sdk-builder"

echo "################################################################################"
echo "# PUBLISHING NEW VERSIONS TO NPM"
echo "################################################################################"

cd "${SDK_ROOT_DIR}"
echo '//registry.npmjs.org/:_authToken=${<PASSWORD>_TOKEN}' > ~/.npmrc
REG="${NPM_CONFIG_REGISTRY}"
unset NPM_CONFIG_REGISTRY
npm run lerna -- exec -- bash -c "npm publish --access public || true"
export NPM_CONFIG_REGISTRY="${REG}"
rm -f ~/.npmrc

VERSION=$(git reflog -n 1 | grep "commit: v." | awk '{print $4}')
if [ -n "${VERSION}" ]; then
  git push origin "${VERSION}":"${VERSION}"
fi

echo "################################################################################"
echo "# PUBLISHING NEW DOCUMENENTATION"
echo "################################################################################"
npm run grunt:concurrent -- publish:docs

echo "Published ${VERSION}"

# LAST_LOG=$(git log -1 --pretty=%B)
#
# if [[ ${LAST_LOG} == "#release"* ]]; then
#   # Remove command commit, but allow it to dirty the workspace if it includes
#   # changes
#   git reset HEAD^
#   HAS_CHANGES=$(git status --porcelain | wc -l)
#   if [ "${HAS_CHANGES}" -ne "0" ]; then
#     echo "################################################################################"
#     echo "# After removing command commit, local workspace has changes"
#     echo "################################################################################"
#     echo git status
#     echo "################################################################################"
#     echo "# Command commits should not make changes, exiting"
#     echo "################################################################################"
#     exit 1
#   fi
#
#   VERSION=$(echo ${LAST_LOG} | sed -e 's/#release //g' | sed -e 's/^\s*//g' | sed -e 's/\s$//g')
# fi

{'fraction_non_alphanumeric': 0.42206290471785385, 'fraction_numerical': 0.0027752081406105457, 'mean_word_length': 5.313868613138686, 'pattern_counts': {'":': 2, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5788128', 'n_tokens_mistral': 1270, 'n_tokens_neox': 1178, 'n_words': 340}