<commit_before>#!/bin/sh
clear
#set the local node modules directory here
nd='/data/Projects/node_modules/'

#******************************************Major Functions**********************************************************
#Configure existing directory that already contains normal node modules to work with lnpm
setupDirs(){
#Rename each directory with a 0-0-0 extention for version identification
    #Proccess directories
    cd $nd
    for path in $nd*; do
    [ -d "${path}" ] || continue # if not a directory, skip
    dirname="$(basename "${path}")"

    cd "$dirname"
    ver=$(grep '"version"' package.json)
    pkgname=$(grep '"name"' package.json)
    #need to parc out the name from pkgname simular to the extraction of version number below
    echo $pkgname
    vers=${ver#*:} #remove everything left of the colon
    ver=${vers%*,} #drop the comma
    newdir=$dirname$ver
    if [ "$newdir" != "$dirname" ]; then
    cd ..
    echo $newdir
    fi
    #mv $dirname "$newdir"
done
exit 0
}


#validate input
case $1 in
    'install') ;;
    'update') ;;
    'configure') setupDirs ;;
    *) echo 'The first parameter must be install, configure or update'
       exit 0
       ;;
esac

case $3 in
    '-dev') ;;
    '') ;;
    *) echo 'The third parameter must be -dev or null'
       exit 0
       ;;
esac<commit_msg>add error protection to configure<commit_after>#!/bin/sh
clear
#set the local node modules directory here
nd='/data/Projects/node_modules/'
#define colors
red='\e[0;31m'
green='\e[0;32m'
#******************************************Major Functions**********************************************************
#Configure existing directory that already contains normal node modules to work with lnpm
setupDirs(){
#Rename each directory with a 0-0-0 extention for version identification
    #Proccess directories
    cd $nd
    for path in $nd*; do
    [ -d "${path}" ] || continue # if not a directory, skip
    dirname="$(basename "${path}")"

    cd "$dirname"
    ver=$(grep '"version"' package.json)
    pkgname=$(grep '"_id"' package.json)
    pkgnm=${pkgname#*:} #remove everything left of the colon
    pknm=${pkgnm%*,}
    pknmlength=${#pknm}
    charvalid=true
    count=1
    pknam=''
    #extract everything left of the @ to retrieve package name
    while (( count < $pknmlength )); do
    testval=${pknm:count:1}
    if [ $testval == "@" ]; then
    charvalid=false
    fi
    if [ $charvalid = true ]; then
    pknam=$pknam${pknm:count:1}
    fi
    let count+=1
    done
    pknam=${pknam:1:${#pknam}-1}
    #extract from version field to retrieve version number
    vers=${ver#*:} #remove everything left of the colon
    ver=${vers%*,} #drop the comma
    newdir=$pknam$ver
    cd ..
    #if the directory does not have a version number with name add it here otherwise leave alone
    if [ "$newdir" != "$dirname" ]; then
        mv $dirname "$newdir"
        echo 'Converted' $dirname 'to' $newdir
    else
        echo $dirname 'already prepared, nothing to do.'
    fi
done
exit 0
}


#validate input
case $1 in
    'install') ;;
    'update') ;;
    'configure')
        setupDirs
     ;;
    *)
        echo 'The first parameter must be install, configure or update'
        exit 0
    ;;
esac

case $3 in
    '-dev') ;;
    '') ;;
    *) echo 'The third parameter must be -dev or null'
       exit 0
       ;;
esac
{'fraction_non_alphanumeric': 0.18108831400535236, 'fraction_numerical': 0.008325899494498959, 'mean_word_length': 3.1276073619631903, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, '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': '838216', 'n_tokens_mistral': 1052, 'n_tokens_neox': 999, 'n_words': 356}