#!/usr/bin/env bash
# 
# SCRIPT NAME:
# post-install
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# This is the post-install script for my dotfiles. It should be only run
# after install has been run and the system has been rebooted. This script
# installs global npm packages.
#
# USAGE:
# ./post-install
. ./system/.local/bin/utils

#######################################
# Configuration variables
#######################################
# npm packages which should be installed globally
NPM_PACKAGES=(
    "@vue/cli"
    "eslint"
    "gatsby-cli"
    "npm-check-updates"
)

# Rust components which should be installed
RUST_COMPONENTS=(
    "rls-preview"
    "rustfmt-preview"
)

#######################################
# Main code
#######################################
print_section "Setup notes directory"
if [ ! -d "${HOME}/Notes" ]
then
    git clone gl:notes "${HOME}/Notes"
fi

print_section "Installing global npm packages"
npm i -g "${NPM_PACKAGES[@]}"

print_section "Install Rust toolchain and components"
rustup toolchain install nightly
rustup default nightly
rustup component add "${RUST_COMPONENTS[@]}"