Fix deployment: No more symlinks in dist.

This commit is contained in:
baldo 2022-07-11 12:13:06 +02:00
parent 5e8bd35bf1
commit 73ef6ac422
3 changed files with 30 additions and 3 deletions

27
bin/dist-fix-symlinks.sh Executable file
View file

@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -e
cd "$(dirname "${BASH_SOURCE[0]}")/.."
echo "Fixing symlinks in dist:"
if [[ ! -d "dist" ]]; then
echo " Error: Directory dist does not exist."
exit 1
fi
cd dist
find . -type l | while read symlink; do
target=$(readlink -e "$symlink")
if [[ -z "$target" ]] || [[ ! -f "$target" ]]; then
echo " Could not resolve symlink in dist: $symlink"
exit 1
fi
echo " $symlink"
rsync "$target" "$symlink" -az --copy-links
done
echo "Done"

View file

@ -22,7 +22,7 @@
"test": "yarn run server:test", "test": "yarn run server:test",
"build": "yarn run server:build && grunt build && rsync -avzL --exclude='*/__mocks__/' --exclude='*.test.*' server-build/ dist/server/", "build": "yarn run server:build && grunt build && rsync -avzL --exclude='*/__mocks__/' --exclude='*.test.*' server-build/ dist/server/",
"clean": "rm -rf server-build/ && grunt clean", "clean": "rm -rf server-build/ && grunt clean",
"dist": "yarn run clean && yarn run build && yarn run test", "dist": "yarn run clean && yarn run build && ./bin/dist-fix-symlinks.sh && yarn run test",
"client:serve": "grunt serve", "client:serve": "grunt serve",
"server:test": "jest --config=jest.server.config.js", "server:test": "jest --config=jest.server.config.js",
"server:build": "tsc -b server && ln -sfv ../../server/db/patches ./server-build/db/ && ln -sfv ../server/templates ./server-build/ && ln -sfv ../server/mailTemplates ./server-build/", "server:build": "tsc -b server && ln -sfv ../../server/db/patches ./server-build/db/ && ln -sfv ../server/templates ./server-build/ && ln -sfv ../server/mailTemplates ./server-build/",

View file

@ -22,7 +22,7 @@ function confirm() {
done done
} }
cd $(dirname $0) cd "$(dirname "${BASH_SOURCE[0]}")"
version=$(grep '^ *"version": *"[^"]*" *, *$' package.json | cut -d '"' -f4) version=$(grep '^ *"version": *"[^"]*" *, *$' package.json | cut -d '"' -f4)
@ -44,5 +44,5 @@ if confirm "Continue publishing?"; then
yarn run dist yarn run dist
cd dist cd dist
npm publish yarn publish --new-version "$version"
fi fi