Skip to content

Commit

Permalink
feat: export and import vscode extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
rgomezcasas committed Feb 14, 2023
1 parent 2d6ddc3 commit ec4be28
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
3 changes: 3 additions & 0 deletions scripts/package/dump
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ source "$DOTLY_PATH/scripts/package/src/dump.sh"
##? Dump all installed packages from:
##? * Brew
##? * Apt
##? * VSCode
##? * Snap
##? * Python
##? * Volta.sh or NPM
Expand All @@ -23,6 +24,8 @@ platform::command_exists snap && package::snap_dump && output::answer "Snap apps

platform::command_exists pip3 && package::python_dump && output::answer "Python apps dumped on $PYTHON_DUMP_FILE_PATH"

platform::command_exists code && package::code_dump && output::answer "VSCode extensions dumped on $CODE_DUMP_FILE_PATH"

if platform::command_exists volta; then
package::volta_dump && output::answer "Volta apps dumped on $VOLTA_DUMP_FILE_PATH"
elif platform::command_exists npm; then
Expand Down
2 changes: 2 additions & 0 deletions scripts/package/import
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ platform::command_exists snap && output::header "Importing Snap apps from $SNAP_

platform::command_exists pip3 && output::header "Importing Python apps from $PYTHON_DUMP_FILE_PATH" && package::python_import

platform::command_exists code && output::header "Importing VSCode extensions from $CODE_DUMP_FILE_PATH" && package::code_import

if platform::command_exists volta; then
output::header "Importing Volta apps from $VOLTA_DUMP_FILE_PATH" && package::volta_import
elif platform::command_exists npm; then
Expand Down
19 changes: 16 additions & 3 deletions scripts/package/src/dump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ elif platform::is_linux; then
fi

APT_DUMP_FILE_PATH="$DOTFILES_PATH/os/linux/apt/packages.txt"
SNAP_DUMP_FILE_PATH="$DOTFILES_PATH/os/linux/snap/packages.txt"
PYTHON_DUMP_FILE_PATH="$DOTFILES_PATH/langs/python/requirements.txt"
CODE_DUMP_FILE_PATH="$DOTFILES_PATH/editors/code/extensions.txt"
NPM_DUMP_FILE_PATH="$DOTFILES_PATH/langs/js/global_modules.txt"
PACMAN_DUMP_FILE_PATH="$DOTFILES_PATH/os/linux/pacman/packages.txt"
PYTHON_DUMP_FILE_PATH="$DOTFILES_PATH/langs/python/requirements.txt"
SNAP_DUMP_FILE_PATH="$DOTFILES_PATH/os/linux/snap/packages.txt"
VOLTA_DUMP_FILE_PATH="$DOTFILES_PATH/langs/js/volta_dependencies.txt"
WINGET_DUMP_FILE_PATH="$DOTFILES_PATH/os/windows/winget.output"
PACMAN_DUMP_FILE_PATH="$DOTFILES_PATH/os/linux/pacman/packages.txt"

package::brew_dump() {
if platform::is_macos; then
Expand Down Expand Up @@ -43,6 +44,18 @@ package::apt_import() {
fi
}

package::code_dump() {
mkdir -p "$DOTFILES_PATH/editors/code"

code --list-extensions >"$CODE_DUMP_FILE_PATH"
}

package::code_import() {
mkdir -p "$DOTFILES_PATH/editors/code"

xargs -I_ code --install-extension _ --force <"$CODE_DUMP_FILE_PATH"
}

package::snap_dump() {
mkdir -p "$DOTFILES_PATH/os/linux/snap"

Expand Down

0 comments on commit ec4be28

Please sign in to comment.