<commit_before># Installs and updates npm modules.
# https://docs.npmjs.com/cli
#
# Sequencing
# - After: brew (installed with node)
function 🕸__npm
    echo "🕸  NPM"
    echo

    # Ensure NPM is installed.
    if not which -s npm
        error "NPM is not installed."
        return 1
    end

    # Verify the user owns the node_modules dir.
    set -l global_modules /usr/local/lib/node_modules
    if test $USER != (fileowner $global_modules)
        if status is-login
            echo "You must be the owner of "$global_modules" to run this command."
        end
        return 1
    end

    set -l global_packages \
        eslint \
        express-generator \
        fast-cli \
        n \
        ralio \
        realm-cli \
        realm-object-server \
        ts2kt

    set -l installed_packages (npm list -g --depth=0)
    # Example output:
    # /usr/local/lib
    # ├── fast-cli@0.2.1
    # ├── n@2.1.7
    # ├── npm@4.5.0
    # └── ralio@0.6.1
    # Manual installation check
    # string match "*ralio*" $installed_packages[5]

    echo "Updating NPM"
    npm install npm@latest -g

    # TODO: Add package uninstall

    # Update
    npm update -g

    # TODO: Refactor to only install missing packages
    npm install --global $global_packages

    npm doctor
end<commit_msg>[npm] Install yarn<commit_after># Installs and updates npm modules.
# https://docs.npmjs.com/cli
#
# Sequencing
# - After: brew (installed with node)
function 🕸__npm
    echo "🕸  NPM"
    echo

    # Ensure NPM is installed.
    if not which -s npm
        error "NPM is not installed."
        return 1
    end

    # Verify the user owns the node_modules dir.
    set -l global_modules /usr/local/lib/node_modules
    if test $USER != (fileowner $global_modules)
        if status is-login
            echo "You must be the owner of "$global_modules" to run this command."
        end
        return 1
    end

    set -l global_packages \
        eslint \
        express-generator \
        fast-cli \
        n \
        ralio \
        realm-cli \
        realm-object-server \
        ts2kt \
        yarn

    set -l installed_packages (npm list -g --depth=0)
    # Example output:
    # /usr/local/lib
    # ├── fast-cli@0.2.1
    # ├── n@2.1.7
    # ├── npm@4.5.0
    # └── ralio@0.6.1
    # Manual installation check
    # string match "*ralio*" $installed_packages[5]

    echo "Updating NPM"
    npm install npm@latest -g

    # TODO: Add package uninstall

    # Update
    npm update -g

    # TODO: Refactor to only install missing packages
    npm install --global $global_packages

    npm doctor
end
{'fraction_non_alphanumeric': 0.09824159021406728, 'fraction_numerical': 0.012996941896024464, 'mean_word_length': 1.8758241758241758, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '508239', 'n_tokens_mistral': 896, 'n_tokens_neox': 840, 'n_words': 274}