diff --git a/.gitignore b/.gitignore index 98b81469..aecda952 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ .DS_Store -node_modules/ +frontend/ */dist/* *.db *.db.lock diff --git a/build.sh b/build.sh index fc2fca57..6c060753 100644 --- a/build.sh +++ b/build.sh @@ -1,14 +1,25 @@ -#!/bin/bash +#!/bin/sh set -e +cd $(dirname $0) + +# Clean the dist folder and build the assets +if [ ! -d "frontend" ]; then + git clone -b master https://github.com/filebrowser/frontend +fi; +cd frontend +if [ -d "dist" ]; then + rm -rf dist/* +fi; +yarn install +yarn build + +cd .. + # Install rice tool if not present if ! [ -x "$(command -v rice)" ]; then go get github.com/GeertJohan/go.rice/rice fi -# Clean the dist folder and build the assets -rm -rf node_modules -npm install - # Embed the assets using rice rice embed-go diff --git a/build_in_docker.sh b/build_in_docker.sh new file mode 100644 index 00000000..21312ef2 --- /dev/null +++ b/build_in_docker.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +cd $(dirname $0) + +docker pull golang:alpine + +$(command -v winpty) docker run --rm -it \ + -v /$(pwd)://src \ + -w //src \ + golang:alpine \ + sh -c '\ + echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \ + sed -i -e "s/v[0-9]\.[0-9]/edge/g" /etc/apk/repositories && \ + apk add -U --no-cache yarn git && \ + go get github.com/GeertJohan/go.rice/rice && \ + ./build.sh \ + ' diff --git a/filebrowser.go b/filebrowser.go index 1b23e24a..3879bbb1 100644 --- a/filebrowser.go +++ b/filebrowser.go @@ -119,7 +119,7 @@ type FSBuilder func(scope string) FileSystem func (m *FileBrowser) Setup() error { // Creates a new File Browser instance with the Users // map and Assets box. - m.Assets = rice.MustFindBox("./node_modules/filebrowser-frontend/dist") + m.Assets = rice.MustFindBox("./frontend/dist") m.Cron = cron.New() // Tries to get the encryption key from the database. diff --git a/package.json b/package.json deleted file mode 100644 index 76d69197..00000000 --- a/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "filebrowser", - "author": "File Browser contributors", - "private": true, - "dependencies": { - "filebrowser-frontend": "1.6.0" - } -}