Skip to content

Instantly share code, notes, and snippets.

@maxxcrawford
Last active August 2, 2024 16:55
Show Gist options
  • Save maxxcrawford/d373ea2de89ff4daf9fa5f3e0532c2cc to your computer and use it in GitHub Desktop.
Save maxxcrawford/d373ea2de89ff4daf9fa5f3e0532c2cc to your computer and use it in GitHub Desktop.
Firefox New Tab bash runner
# Firefox
firefox() {
# Set to local path to Firefox repo
local FIREFOX_HOME="$HOME/src/firefox-unified"
# Ignore if no arguments are passed
if [ $# -gt 0 ]; then
if [ $1 = 'run' ]; then
echo 'Starting hnt server..'
./mach npm run bundle --prefix=browser/components/newtab && ./mach build && ./mach run
elif [ $1 = 'new' ]; then
echo 'Starting hnt server..'
./mach clobber && ./mach build && ./mach npm run bundle --prefix=browser/components/newtab
elif [ $1 = 'build' ]; then
echo 'Starting hnt server..'
./mach npm run bundle --prefix=browser/components/newtab && ./mach build
elif [ $1 = 'watch' ]; then
echo "watching HNT server.."
./mach npm run watchmc --prefix=browser/components/newtab && ./mach build && ./mach run
elif [ $1 = 'install' ]; then
echo "HNT npm install"
(cd browser/components/newtab && ../../../mach npm install)
elif [ $1 = 'test' ]; then
if [ $2 = 'all' ]; then
echo "Running HNT browser tests."
(mach test browser/components/newtab --headless &&
mach npm test --prefix=browser/components/newtab)
elif [ $2 = 'unit' ]; then
echo "Running HNT unit tests."
./mach npm test --prefix=browser/components/newtab
else
echo "Running HNT browser tests."
mach test browser/components/newtab --headless
fi
elif [ $1 = 'lint' ]; then
echo 'linting outgoing..'
./mach lint --outgoing --fix
elif [ $1 = 'try' ]; then
echo 'try outgoing..'
./mach npm run try --prefix browser/components/newtab
elif [ $1 = 'bundle' ]; then
if [ $2 = 'all' ]; then
echo "bundling all..."
(./mach npm run bundle --prefix=browser/components/asrouter &&
./mach npm run bundle --prefix=browser/components/aboutwelcome &&
./mach npm run bundle --prefix=browser/components/newtab)
else
echo "bundling $2..."
./mach npm run bundle --prefix=browser/components/$2
fi
elif [ $1 = 'update' ]; then
echo "updating from central and building.."
git co main && git pull && ./mach build
elif [ $1 = 'glean' ]; then
echo "running with glean debug with glean id $3"
./mach npm run bundle --prefix=browser/components/$2 && ./mach build && env GLEAN_DEBUG_VIEW_TAG=$3 ./mach run --jsdebugger
elif [ $1 = 'dev' ]; then
echo running server with jsdebugger...
./mach npm run bundle --prefix=browser/components/$2 && ./mach build && ./mach run --jsdebugger
fi
else
cd "$FIREFOX_HOME"
fi
}
@maxxcrawford
Copy link
Author

Fix firefox new

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment