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

This commit is contained in:
1138-4EB 2018-04-18 17:27:28 +02:00 committed by Henrique Dias
parent 46b5fa013c
commit f91ee24858
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"
}
}