Skip to content

Commit

Permalink
Upgrade UI build to webpack.
Browse files Browse the repository at this point in the history
  • Loading branch information
kellegous committed Jul 12, 2018
1 parent 92e228e commit af4d9a8
Show file tree
Hide file tree
Showing 12 changed files with 5,444 additions and 127 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["env", "react"]
}
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.vagrant
.build
/.vagrant
/.build
/node_modules
.DS_Store
*.exe
32 changes: 27 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
CMDS := $(GOPATH)/bin/houndd $(GOPATH)/bin/hound

ALL: ui/bindata.go
SRCS := $(shell find . -type f -name '*.go')

WEBPACK_ARGS := -p
ifdef DEBUG
WEBPACK_ARGS := -d
endif

ALL: $(CMDS)

ui: ui/bindata.go

node_modules:
npm install

$(GOPATH)/bin/houndd: ui/bindata.go $(SRCS)
go install github.com/etsy/hound/cmds/houndd

$(GOPATH)/bin/hound: ui/bindata.go $(SRCS)
go install github.com/etsy/hound/cmds/hound

.build/bin/go-bindata:
GOPATH=`pwd`/.build go get github.com/jteeuwen/go-bindata/...

ui/bindata.go: .build/bin/go-bindata $(wildcard ui/assets/**/*)
rsync -r --exclude '*.js' ui/assets/* .build/ui
jsx --no-cache-dir ui/assets/js .build/ui/js
ui/bindata.go: .build/bin/go-bindata node_modules $(wildcard ui/assets/**/*)
rsync -r ui/assets/* .build/ui
npx webpack $(WEBPACK_ARGS)
$< -o $@ -pkg ui -prefix .build/ui -nomemcopy .build/ui/...

test:
go test github.com/etsy/hound/...

clean:
rm -rf .build
rm -rf .build node_modules
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ You should be able to navigate to [http://localhost:6080/](http://localhost:6080

## Running in Production

There are no special flags to run Hound in production. You can use the `--addr=:6880` flag to control the port to which the server binds. Currently, Hound does not supports SSL/TLS as most users simply run Hound behind either Apache or nginx. Adding TLS support is pretty straight forward though if anyone wants to add it.
There are no special flags to run Hound in production. You can use the `--addr=:6880` flag to control the port to which the server binds. Currently, Hound does not support TLS as most users simply run Hound behind either Apache or nginx. Adding TLS support is pretty straight forward though if anyone wants to add it.

## Why Another Code Search Tool?

Expand Down Expand Up @@ -96,14 +96,14 @@ Currently the following editors have plugins that support Hound:
#### Requirements:
* make
* Node.js ([Installation Instructions](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager))
* React-tools (install w/ `npm -g install react-tools`)

Hound includes tools to make building locally easy. It is recommended that you use these tools if you are working on Hound. To get setup and build, just run the following commands:
Hound includes a `Makefile` to aid in building locally, but it depends on the source being added to a proper Go workspace so that
Go tools work accordingly. See [Setting GOPATH](https://github.com/golang/go/wiki/SettingGOPATH) for further details about setting
up your Go workspace. With a `GOPATH` set, the following commands will build hound locally.

```
git clone https://github.com/etsy/hound.git hound/src/github.com/etsy/hound
cd hound
src/github.com/etsy/hound/tools/setup
git clone https://github.com/etsy/hound.git ${GOPATH}/src/github.com/etsy/hound
cd ${GOPATH}/src/github.com/etsy/hound
make
```

Expand All @@ -119,6 +119,12 @@ make test

Hound includes a web UI that is composed of several files (html, css, javascript, etc.). To make sure hound works seamlessly with the standard Go tools, these resources are all bundled inside of the `houndd` binary. Note that changes to the UI will result in local changes to the `ui/bindata.go` file. You must include these changes in your Pull Request.

To bundle UI changes in `ui/bindata.go` use:

```
make ui
```

To make development easier, there is a flag that will read the files from the file system (allowing the much-loved edit/refresh cycle).

```
Expand Down
Loading

0 comments on commit af4d9a8

Please sign in to comment.