Skip to content

Instantly share code, notes, and snippets.

@maxxcrawford
Last active February 4, 2025 18:37
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"
# Set directory to new tab (See Bug #1937151)
local FIREFOX_NEWTAB_PATH="browser/extensions/newtab"
# Ignore if no arguments are passed
if [ $# -gt 0 ]; then
if [ $1 = 'run' ]; then
echo 'Starting hnt server..'
./mach npm run bundle --prefix=$FIREFOX_NEWTAB_PATH && ./mach build faster && ./mach run
elif [ $1 = 'new' ]; then
echo 'Starting hnt server..'
./mach clobber && ./mach build && ./mach npm run bundle --prefix=$FIREFOX_NEWTAB_PATH
elif [ $1 = 'build' ]; then
echo 'Starting hnt server..'
./mach npm run bundle --prefix=$FIREFOX_NEWTAB_PATH && ./mach build faster
elif [ $1 = 'watch' ]; then
echo "watching HNT server.."
./mach npm run watchmc --prefix=$FIREFOX_NEWTAB_PATH && ./mach build faster && ./mach run
elif [ $1 = 'install' ]; then
echo "HNT npm install"
./mach npm install --prefix=$FIREFOX_NEWTAB_PATH
elif [ $1 = 'test' ]; then
if [ $2 = 'all' ]; then
echo "Running HNT browser tests."
(mach test browser/components/newtab --headless &&
mach npm test --prefix=$FIREFOX_NEWTAB_PATH)
elif [ $2 = 'fast' ]; then
echo "Running HNT unit tests."
./mach test browser/components/newtab/test/xpcshell &&
./mach npm test --prefix=$FIREFOX_NEWTAB_PATH
elif [ $2 = 'unit' ]; then
echo "Running HNT unit tests."
./mach npm test --prefix=$FIREFOX_NEWTAB_PATH
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
./mach npm run bundle --prefix=$FIREFOX_NEWTAB_PATH
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=$FIREFOX_NEWTAB_PATH && ./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=$FIREFOX_NEWTAB_PATH && ./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