mirror of
https://github.com/dnote/dnote
synced 2026-03-15 06:55:49 +01:00
Implement MVC
This commit is contained in:
parent
172f608b66
commit
cd5d094c25
146 changed files with 13596 additions and 2328 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC1090
|
||||
# test-local.sh runs api tests using local setting
|
||||
set -eux
|
||||
set -ex
|
||||
|
||||
dir=$(dirname "${BASH_SOURCE[0]}")
|
||||
|
||||
|
|
@ -9,4 +9,4 @@ set -a
|
|||
source "$dir/../../pkg/server/.env.test"
|
||||
set +a
|
||||
|
||||
"$dir/test.sh"
|
||||
"$dir/test.sh" "$1"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
# test.sh runs server tests. It is to be invoked by other scripts that set
|
||||
# appropriate env vars.
|
||||
set -eux
|
||||
set -ex
|
||||
|
||||
dir=$(realpath "$(dirname "${BASH_SOURCE[0]}")")
|
||||
pushd "$dir/../../pkg/server"
|
||||
|
|
@ -10,7 +10,11 @@ emailTemplateDir=$(realpath "$dir/../../pkg/server/mailer/templates/src")
|
|||
export DNOTE_TEST_EMAIL_TEMPLATE_DIR="$emailTemplateDir"
|
||||
|
||||
function run_test {
|
||||
go test ./... -cover -p 1
|
||||
if [ -z "$1" ]; then
|
||||
go test ./... -cover -p 1
|
||||
else
|
||||
go test "$1" -cover -p 1
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "${WATCH-false}" == true ]; then
|
||||
|
|
@ -18,7 +22,7 @@ if [ "${WATCH-false}" == true ]; then
|
|||
while inotifywait --exclude .swp -e modify -r .; do run_test; done;
|
||||
set -e
|
||||
else
|
||||
run_test
|
||||
run_test "$1"
|
||||
fi
|
||||
|
||||
popd
|
||||
|
|
|
|||
|
|
@ -9,3 +9,10 @@ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-ke
|
|||
echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list
|
||||
sudo apt-get -y update
|
||||
sudo apt-get install -y google-chrome-stable
|
||||
|
||||
# Install dart-sass
|
||||
dart_version=1.34.1
|
||||
dart_tarball="dart-sass-$dart_version-linux-x64.tar.gz"
|
||||
wget -q "https://github.com/sass/dart-sass/releases/download/$dart_version/$dart_tarball"
|
||||
tar -xvzf "$dart_tarball" -C /tmp/
|
||||
sudo install /tmp/dart-sass/sass /usr/bin
|
||||
|
|
|
|||
|
|
@ -3,17 +3,9 @@
|
|||
# dev.sh builds and starts development environment
|
||||
set -eux -o pipefail
|
||||
|
||||
# clean up background processes
|
||||
function cleanup {
|
||||
kill "$devServerPID"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
dir=$(dirname "${BASH_SOURCE[0]}")
|
||||
basePath="$dir/../.."
|
||||
appPath="$basePath/web"
|
||||
serverPath="$basePath/pkg/server"
|
||||
serverPort=3000
|
||||
|
||||
# load env
|
||||
set -a
|
||||
|
|
@ -21,20 +13,22 @@ dotenvPath="$serverPath/.env.dev"
|
|||
source "$dotenvPath"
|
||||
set +a
|
||||
|
||||
# run webpack-dev-server for js in the background
|
||||
(
|
||||
BUNDLE_BASE_URL=http://localhost:8080 \
|
||||
ASSET_BASE_URL=http://localhost:3000/static \
|
||||
ROOT_URL=http://localhost:$serverPort \
|
||||
COMPILED_PATH="$appPath"/compiled \
|
||||
PUBLIC_PATH="$appPath"/public \
|
||||
COMPILED_PATH="$basePath/web/compiled" \
|
||||
STANDALONE=true \
|
||||
VERSION="$VERSION" \
|
||||
WEBPACK_HOST="0.0.0.0" \
|
||||
"$dir/webpack-dev.sh"
|
||||
) &
|
||||
devServerPID=$!
|
||||
# copy assets
|
||||
mkdir -p "$basePath/pkg/server/static"
|
||||
cp "$basePath"/pkg/server/assets/static/* "$basePath/pkg/server/static"
|
||||
# run asset pipeline in the background
|
||||
(cd "$basePath/pkg/server/assets/" && "$basePath/pkg/server/assets/styles/build.sh" true ) &
|
||||
(cd "$basePath/pkg/server/assets/" && "$basePath/pkg/server/assets/js/build.sh") &
|
||||
|
||||
# run server
|
||||
(cd "$basePath/pkg/watcher" && go run main.go --task="go run main.go start -port 3000" --context="$serverPath" "$serverPath")
|
||||
moduleName="github.com/dnote/dnote"
|
||||
ldflags="-X '$moduleName/pkg/server/buildinfo.CSSFiles=main.css' -X '$moduleName/pkg/server/buildinfo.JSFiles=main.js' -X '$moduleName/pkg/server/buildinfo.Version=dev'"
|
||||
task="go run -ldflags \"$ldflags\" main.go start -port 3000"
|
||||
|
||||
(
|
||||
cd "$basePath/pkg/watcher" && \
|
||||
go run main.go \
|
||||
--task="$task" \
|
||||
--context="$serverPath" \
|
||||
"$serverPath"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue