cleaning up some development files (#115)

This commit is contained in:
Mike Arpaia
2016-09-05 17:58:49 -04:00
committed by GitHub
parent a06f5b2afb
commit 6bdf3fba4b
3 changed files with 11 additions and 88 deletions
+10 -36
View File
@@ -1,4 +1,6 @@
WEBPACK = $(shell npm bin)/webpack --config=tools/app/webpack.config.js
.PHONY: build
all: build
.prefix:
ifeq ($(OS), Windows_NT)
@@ -7,61 +9,33 @@ else
mkdir -p build
endif
build:
build: .prefix
ifeq ($(OS), Windows_NT)
go build -o kolide.exe
go build -o build/kolide.exe
else
go build -o kolide
go build -o build/kolide
endif
test:
go vet $(shell glide nv)
go test -v $(shell glide nv)
go test -v -cover $(shell glide nv)
generate: .prefix
go-bindata -pkg=server -o=server/bindata.go frontend/templates/ build/
go-bindata -pkg=kitserver -o=kitserver/bindata.go frontend/templates/ build/
$(WEBPACK) --progress --colors --bail
$(shell npm bin)/webpack --progress --colors --bail
deps:
npm install
go get -u github.com/Masterminds/glide
go get -u github.com/jteeuwen/go-bindata/...
ifneq ($(OS), Windows_NT)
go get -u github.com/olebedev/on
endif
# install vendored deps
glide install
distclean:
mkdir -p build
rm -rf build/*
rm -rf vendor/*
ifneq ($(OS), Windows_NT)
PID_FILE = build/kolide.pid
GO_FILES = $(filter-out ./bindata.go, $(shell find . -type f -name "*.go"))
TEMPLATES = $(wildcard frontend/templates/*)
stop:
kill `cat $(PID_FILE)` || true
watch: .prefix
BABEL_ENV=dev node tools/app/hot.proxy &
$(WEBPACK) --watch &
on -m 2 $(GO_FILES) $(TEMPLATES) | xargs -n1 -I{} make restart || make stop
restart: stop
@echo restarting the app...
kolide serve & echo $$! > $(PID_FILE)
endif
docker:
# pull the latest version of the build container
docker pull kolide/kolide-builder:1.6
# run build step to build linux binary
docker run --rm -it -v $(shell pwd):/go/src/github.com/kolide/kolide-ose -v ${GOPATH}/pkg:/go/pkg kolide/kolide-builder:1.6 -B
# compose up
docker pull kolide/kolide-builder:1.7
docker run --rm -it -v $(shell pwd):/go/src/github.com/kolide/kolide-ose -v ${GOPATH}/pkg:/go/pkg kolide/kolide-builder:1.7 -B
docker-compose up
-51
View File
@@ -1,51 +0,0 @@
// Kolide Hot Proxy. Adapated From: https://github.com/olebedev/go-starter-kit/blob/c96a70a1ebf78ed9401dcfbee3f3c79093c28f8a/hot.proxy.js
//
// Hotproxy uses the following ENV variables to configure itself
// KOLIDE_DEV_PROXY_PORT - Port where kolide binary server is listening (Default: 8080)
// KOLIDE_DEV_PROXY_HOST - Hostname or IP where kolide binary server is bound (Default: localhost)
// KOLIDE DEV_PROXY_LISTEN_PORT - Port where Kolide hot proxy listens (Default: KOLIDE_DEV_PROXY_PORT + 1)
//
let webpack = require('webpack');
let webpackDevMiddleware = require('webpack-dev-middleware');
let webpackHotMiddleware = require('webpack-hot-middleware');
let proxy = require('proxy-middleware');
let config = require('./webpack.config');
let url = require('url');
let proxyPort = +(process.env.KOLIDE_DEV_PROXY_PORT || 8080);
let proxyHost = (process.env.KOLIDE_DEV_PROXY_HOST || 'localhost');
let proxyListenPort = +(process.env.DEV_PROXY_LISTEN_PORT || proxyPort + 1 );
config.entry = {
bundle: [
'webpack-hot-middleware/client?https://' + proxyHost + ':' + proxyPort,
config.entry.bundle
]
};
config.plugins.push(
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
);
config.devtool = 'cheap-module-eval-source-map';
let proxyOptions = url.parse('https://' + proxyHost + ':' + proxyPort);
proxyOptions.rejectUnauthorized = false // Disables self-signed cert checking
let app = new require('express')();
let compiler = webpack(config);
app.use(webpackDevMiddleware(compiler, { noInfo: true, publicPath: config.output.publicPath }));
app.use(webpackHotMiddleware(compiler));
app.use(proxy(proxyOptions));
app.listen(proxyListenPort, function(error) {
if (error) {
console.error(error);
} else {
console.info("==> 🌎 Listening on port %s. Open up http://localhost:%s/ in your browser.", proxyListenPort, proxyListenPort);
}
});
@@ -34,7 +34,7 @@ if (process.env.NODE_ENV === 'production') {
postCssLoader.splice(1, 1) // drop human readable names
};
var repo = path.join(__dirname, "../../")
var repo = __dirname
var config = {
entry: {