-
-
Notifications
You must be signed in to change notification settings - Fork 419
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Use log/slog for logging to file or stdout
Switched to Go1.21 to use the log/slog package for strutctured logging. TODO: Log messages that are stringifying objects can now use strutctured output. TODO: Customise log levels for different messages. Fix tests
- Loading branch information
Showing
13 changed files
with
184 additions
and
179 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,88 @@ | ||
# How to setup Browsh's build system for Mac | ||
If you just want to try Browsh, you can use [Homebrew](https://brew.sh/) (check out the [installation page](https://www.brow.sh/docs/installation/) at the [official site](https://www.brow.sh/)). | ||
|
||
If you want to try Browsh, you can use [Homebrew](https://brew.sh/). | ||
Check out the [installation page](https://www.brow.sh/docs/installation/) at the | ||
[official site](https://www.brow.sh/)). | ||
|
||
## Installations | ||
|
||
You need Go, Firefox and Node.js to run Browsh. | ||
|
||
### Install Go | ||
Follow the [installation guide](https://golang.org/doc/install) (you can use an installer). | ||
|
||
#### Ensure your GOPATH is set | ||
|
||
```sh | ||
$ echo $GOPATH | ||
/Users/uesr_name/go | ||
$ # anywhere is ok, but make sure it's not none | ||
``` | ||
|
||
#### Ensure you have `$GOPATH/src` and `$GOPATH/bin` folders | ||
If you're not sure if you have these folders, run: | ||
|
||
```sh | ||
$ mkdir "$GOPATH/src" | ||
$ mkdir "$GOPATH/bin" | ||
``` | ||
Follow the [installation guide](https://golang.org/doc/install) (you can use an installer). | ||
|
||
### Install Firefox | ||
Follow the official [guide](https://support.mozilla.org/en-US/kb/how-download-and-install-firefox-mac) to install Firefox. | ||
|
||
Follow the official [guide](https://support.mozilla.org/en-US/kb/how-download-and-install-firefox-mac) | ||
to install Firefox. | ||
|
||
#### Include Firefox to your PATH | ||
The `firefox` executable is probably at `/Applications/Firefox.app/Contents/MacOS`. You need to add it to your `PATH` so that Browsh can create new instances of Firefox. | ||
|
||
The `firefox` executable is probably at `/Applications/Firefox.app/Contents/MacOS`. | ||
You need to add it to your `PATH` so that Browsh can create new instances of Firefox. | ||
|
||
### Install Node.js | ||
|
||
Follow the [official downloading page](https://nodejs.org/en/download/). | ||
|
||
> v8.11.4. is currently recommended for working with Browsh (?) | ||
Use Nodejs > v8.11.4 with Browsh. | ||
|
||
#### Install web-ext globally | ||
It's a Mozilla's handy tool for working with Firefox web extensions: | ||
|
||
```sh | ||
$ npm install -g web-ext | ||
It's a Mozilla tool for working with Firefox web extensions: | ||
|
||
```shell | ||
npm install -g web-ext | ||
``` | ||
|
||
## Setting up your Browsh | ||
|
||
### Clone Browsh | ||
Fork Browsh to your Github account. Clone it to `$GOPATH/src`. | ||
|
||
Fork Browsh to your Github account. | ||
Clone it to a directory of your choice. | ||
We will refer to this directory as `$browsh` for the rest of the guide. | ||
|
||
### Install NPM packages | ||
|
||
```shell | ||
$ cd "$GOPATH/src/browsh/webext" | ||
$ npm install | ||
cd "$browsh/webext" | ||
npm install | ||
``` | ||
|
||
### Run the build script | ||
|
||
```sh | ||
$ cd "$GOPATH/src/browsh" | ||
$ # install several required package" | ||
$ ./interfacer/contrib/build_browsh.sh | ||
cd "$browsh" | ||
# install required package" | ||
./interfacer/contrib/build_browsh.sh | ||
``` | ||
|
||
## Running Browsh from source | ||
Now that you have all of the required dependencies installed, we can run Browsh. Open three terminals and do the follows: | ||
|
||
Now that you have the required dependencies installed, we can run Browsh. | ||
Open three terminals and do the following: | ||
|
||
### Terminal 1 (builds JavaScript) | ||
|
||
```sh | ||
$ cd "$GOPATH/src/browsh/webext" | ||
$ # create a dist folder inside the webext folder. | ||
$ npx webpack --watch | ||
cd "$browsh/webext | ||
# create a dist folder inside the webext folder. | ||
npx webpack --watch | ||
``` | ||
### Terminal 2 (handles Firefox web extension) | ||
```sh | ||
$ # the dist folder is created in the first terminal | ||
$ cd "$GOPATH/src/browsh/webext/dist" | ||
$ # create a dist folder inside the webext folder. | ||
$ npx webpack --watch | ||
mkdir "$browsh/webext/dist" | ||
cd "$browsh/webext/dist" | ||
npx webpack --watch | ||
``` | ||
### Terminal 3 (Displays Browsh) | ||
```sh | ||
$ cd "$GOPATH/src/browsh/interfacer" | ||
$ go run ./cmd/browsh/main.go --firefox.use-existing --debug | ||
cd "$browsh/interfacer" | ||
go run ./cmd/browsh/main.go --firefox.use-existing --debug | ||
``` | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module github.com/browsh-org/browsh/interfacer | ||
|
||
go 1.18 | ||
go 1.21 | ||
|
||
require ( | ||
github.com/NYTimes/gziphandler v1.1.1 | ||
|
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
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
Oops, something went wrong.