This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cp-dep() { | |
# Copy directory named $1 in current package to node_modules of package named $2 | |
# e.g. `cp-dep lib my-parent-app` | |
cd $(git rev-parse --show-toplevel) | |
package=$(node -p -e "require('./package.json').name") | |
dependency="$(cd .. && pwd)/$2/node_modules/$package" | |
to="$dependency/$1" | |
if [ -d $1 ] && [ -d $dependency ]; then | |
rm -rf $to && cp -r $1 $to | |
echo "Copied '$1' to '$to'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Loads a feature branch as unstaged changes to master (or `$2`) and opens the files in VS Code. | |
# Usage: `code-pr feature-branch` | |
# Does not run if working directory is not clean. | |
# `code-pr -r` resets working directory and returns to previous branch/directory | |
code-pr() { | |
base="${2:-master}" | |
if [ "$1" = "-r" ]; then | |
code-pr-r | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
# Opens modified and new files in working directory using VSCode | |
wip() { | |
cd $(git rev-parse --show-toplevel) && | |
code $(git diff $1 $2 --diff-filter=d --name-only) $(git status -s | grep '??' | grep -v '/$' | cut -c 4-) && | |
cd -; | |
} | |
# Opens modified and new files in the previous commit using VSCode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
chrome-e2e() { | |
# Opens Chrome with web security turned off | |
# `$1` is the url to visit on launch | |
# `$2` is optional Chrome app name override e.g. Chromium | |
browser="${2:-Google Chrome}" | |
set -x | |
open -n -a "$browser" "$1" --args --ignore-certificate-errors --ignore-urlfetcher-cert-requests --disable-web-security --allow-insecure-localhost --user-data-dir=/tmp/chrome | |
} |