drop package.json, use yarn instad of npm, add build_in_docker.sh

Former-commit-id: 1f1ce1a5350eb1d4d12dc3b90bae20d6df6048f9 [formerly fae0cae6f369574aab49ab952e1aa681c97f7067] [formerly 6f8245ec50d0d2485a263e5877a6a353837b1197 [formerly f91ee24858]]
Former-commit-id: b9bb3ad6a460de55851943bbbc62aee74e32028c [formerly 049f6c239d7a936d70493e68f23838c0ec11af88]
Former-commit-id: 81f69427472bbeb3f82e6bd2c3a114e2c5fb47d7
pull/726/head
1138-4EB 2018-04-18 17:27:28 +02:00 committed by Henrique Dias
parent 6bf0e8c063
commit 56e5005484
5 changed files with 35 additions and 15 deletions

2
.gitignore vendored
View File

@ -1,5 +1,5 @@
.DS_Store
node_modules/
frontend/
*/dist/*
*.db
*.db.lock

View File

@ -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

17
build_in_docker.sh Normal file
View File

@ -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 \
'

View File

@ -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.

View File

@ -1,8 +0,0 @@
{
"name": "filebrowser",
"author": "File Browser contributors",
"private": true,
"dependencies": {
"filebrowser-frontend": "1.6.0"
}
}