<commit_before>#!/bin/sh
set -ex

# travis_retry isn't available to sub-scripts
retry () { for i in 1 2 3; do "$@" && return || sleep 10; done; exit 1; }

# install npm v2
[ `npm -v | awk -F '.' '{print $1}'` -ge 2 ] || retry npm install -g npm@2.13.4

npm prune
npm cache clean

if test -f ./node_modules/.node-version && [ $(cat ./node_modules/.node-version) != `node -v` ]; then
  echo "Node version changed since last build; rebuilding dependencies"
  npm rebuild
fi

retry npm install

echo `node -v` > ./node_modules/.node-version
<commit_msg>allow NPM_VERSION override in npm-install.sh<commit_after>#!/bin/bash -euxo pipefail

# travis_retry isn't available to sub-scripts
retry () { for i in 1 2 3; do "$@" && return || sleep 10; done; exit 1; }

retry npm install -g npm@${NPM_VERSION:-2.13.4}

npm prune
npm cache clean

if test -f ./node_modules/.node-version && [ $(cat ./node_modules/.node-version) != `node -v` ]; then
  echo "Node version changed since last build; rebuilding dependencies"
  npm rebuild
fi

retry npm install

echo `node -v` > ./node_modules/.node-version
{'fraction_non_alphanumeric': 0.14705882352941177, 'fraction_numerical': 0.021139705882352942, 'mean_word_length': 3.5, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2431454', 'n_tokens_mistral': 405, 'n_tokens_neox': 370, 'n_words': 135}