2018-08-31 16:57:42 +00:00
|
|
|
# How to setup the build environment for browsh on a generic Linux system
|
2018-08-30 10:02:46 +00:00
|
|
|
|
2023-12-10 09:37:36 +00:00
|
|
|
Install Go, Node.js, and Firefox using your system's package manager.
|
|
|
|
**Browsh requires Version 57 or higher.**
|
2018-08-30 10:02:46 +00:00
|
|
|
|
|
|
|
Now you should be able to call the *go* and *node* binaries:
|
|
|
|
|
2023-12-09 21:15:51 +00:00
|
|
|
```shell
|
|
|
|
go version
|
|
|
|
node --version
|
2020-07-27 07:13:55 +00:00
|
|
|
```
|
2018-08-30 10:02:46 +00:00
|
|
|
|
2023-12-10 09:37:36 +00:00
|
|
|
## Install webpack, webpack-cli, & web-ext
|
2018-08-30 10:02:46 +00:00
|
|
|
|
2023-12-09 21:15:51 +00:00
|
|
|
```shell
|
2023-12-10 09:37:36 +00:00
|
|
|
npm install -g webpack webpack-cli web-ext
|
2020-07-27 07:13:55 +00:00
|
|
|
```
|
2018-08-30 10:02:46 +00:00
|
|
|
|
|
|
|
## Cloning the browsh repository
|
2020-07-27 07:13:55 +00:00
|
|
|
|
2018-08-30 10:02:46 +00:00
|
|
|
It's assumed that you already have *git* installed.
|
|
|
|
|
2020-07-27 07:13:55 +00:00
|
|
|
Run this anywhere you want:
|
2018-08-30 10:02:46 +00:00
|
|
|
|
2023-12-09 21:15:51 +00:00
|
|
|
```shell
|
|
|
|
git clone https://github.com/browsh-org/browsh.git
|
2020-07-27 07:13:55 +00:00
|
|
|
```
|
2018-08-30 10:02:46 +00:00
|
|
|
|
|
|
|
## Setting up the build environment in the cloned repository
|
|
|
|
|
2023-12-09 21:15:51 +00:00
|
|
|
### Setting up dependencies
|
2018-08-30 10:02:46 +00:00
|
|
|
|
2023-12-09 21:15:51 +00:00
|
|
|
```shell
|
|
|
|
browsh=/path/to/browsh
|
|
|
|
cd "$browsh/webext"
|
|
|
|
npm run get-gobindata
|
|
|
|
npm install
|
|
|
|
npm run build
|
|
|
|
diff -u <(echo -n) <(gofmt -d ./)
|
|
|
|
./node_modules/.bin/prettier --list-different "{src,test}/**/*.js"
|
2020-07-27 07:13:55 +00:00
|
|
|
```
|
2023-12-09 21:15:51 +00:00
|
|
|
|
2018-08-30 10:02:46 +00:00
|
|
|
### Building browsh
|
|
|
|
|
2023-12-09 21:15:51 +00:00
|
|
|
```shell
|
|
|
|
cd "$browsh/interfacer"
|
|
|
|
go build -o browsh src/main.go
|
2020-07-27 07:13:55 +00:00
|
|
|
```
|
2018-08-30 10:02:46 +00:00
|
|
|
|
|
|
|
### Building the web extension
|
|
|
|
|
2023-12-09 21:15:51 +00:00
|
|
|
In `$browsh/webext`:
|
2020-07-27 07:13:55 +00:00
|
|
|
|
2023-12-09 21:15:51 +00:00
|
|
|
```shell
|
|
|
|
webpack --watch
|
2020-07-27 07:13:55 +00:00
|
|
|
```
|
2018-08-30 10:02:46 +00:00
|
|
|
|
2018-08-31 16:57:42 +00:00
|
|
|
This will continuously watch for changes made to the web extension and rebuild it.
|
2018-08-30 10:02:46 +00:00
|
|
|
|
|
|
|
## Run firefox and the webextension
|
2020-07-27 07:13:55 +00:00
|
|
|
|
2023-12-09 21:15:51 +00:00
|
|
|
In `$browsh/webext/dist`:
|
2020-07-27 07:13:55 +00:00
|
|
|
|
2023-12-09 21:15:51 +00:00
|
|
|
```shell
|
|
|
|
web-ext run --verbose --firefox path/to/firefox
|
2020-07-27 07:13:55 +00:00
|
|
|
```
|
2018-08-30 10:02:46 +00:00
|
|
|
|
|
|
|
## Run browsh
|
2020-07-27 07:13:55 +00:00
|
|
|
|
2023-12-09 21:15:51 +00:00
|
|
|
```shell
|
|
|
|
cd "$browsh/interfacer"
|
|
|
|
go run ./cmd/browsh --firefox.use-existing --debug
|
2020-07-27 07:13:55 +00:00
|
|
|
```
|
2018-08-30 10:02:46 +00:00
|
|
|
|
|
|
|
Or after building:
|
2020-07-27 07:13:55 +00:00
|
|
|
|
2023-12-09 21:15:51 +00:00
|
|
|
```shell
|
|
|
|
./browsh --firefox.use-existing --debug
|
2020-07-27 07:13:55 +00:00
|
|
|
```
|