forked from MapComplete/MapComplete
Split build step in two scripts
This commit is contained in:
parent
c6f738609f
commit
7dbef4c68e
3 changed files with 55 additions and 38 deletions
|
@ -69,7 +69,8 @@
|
|||
"prep:layeroverview": "mkdir -p ./src/assets/generated/layers; echo {\\\"themes\\\":[]} > ./src/assets/generated/known_themes.json && echo {\\\"layers\\\": []} > ./src/assets/generated/known_layers.json && rm -f ./src/assets/generated/layers/*.json && rm -f ./src/assets/generated/themes/*.json && cp ./assets/layers/usersettings/usersettings.json ./src/assets/generated/layers/usersettings.json && echo '{}' > ./src/assets/generated/layers/favourite.json",
|
||||
"generate": "npm run generate:licenses && npm run generate:images && npm run generate:charging-stations && npm run generate:translations && npm run refresh:layeroverview && npm run generate:service-worker",
|
||||
"generate:charging-stations": "cd ./assets/layers/charging_station && vite-node csvToJson.ts && cd -",
|
||||
"prepare-deploy": "npm run generate:service-worker && ./scripts/build.sh",
|
||||
"prepare-deploy": "npm run generate:service-worker && ./scripts/prepare-build.sh && npm run build",
|
||||
"build": "./scripts/build.sh",
|
||||
"lint": "npm run lint:prettier && npm run lint:eslint",
|
||||
"lint:eslint": "eslint ./src",
|
||||
"lint:prettier": "prettier --check '**/*.ts' '**/*.svelte'",
|
||||
|
|
37
scripts/build.sh
Executable file → Normal file
37
scripts/build.sh
Executable file → Normal file
|
@ -4,45 +4,8 @@ echo "Starting build"
|
|||
# The build script; we build the application step by step as building everything at once takes too much RAM
|
||||
# Should be run from the repository root
|
||||
# This is the main deployment script
|
||||
rm -rf dist/*
|
||||
rm -rf .cache
|
||||
mkdir dist 2> /dev/null
|
||||
mkdir dist/assets 2> /dev/null
|
||||
|
||||
|
||||
export NODE_OPTIONS="--max-old-space-size=16384"
|
||||
|
||||
# This script ends every line with '&&' to chain everything. A failure will thus stop the build
|
||||
npm run generate:editor-layer-index &&
|
||||
npm run prep:layeroverview &&
|
||||
npm run generate && # includes a single "refresh:layeroverview". Resetting the files is unnecessary as they are not in there in the first place
|
||||
npm run refresh:layeroverview && # run refresh:layeroverview a second time to propagate all calls
|
||||
npm run refresh:layeroverview && # run refresh:layeroverview a third time to fix some issues with the favourite layer all calls
|
||||
|
||||
npm run generate:layouts
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR - stopping the build"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
BRANCH=`git rev-parse --abbrev-ref HEAD`
|
||||
echo "The branch name is $BRANCH"
|
||||
|
||||
if [ $BRANCH = "master" ] || [ $BRANCH = "develop" ]
|
||||
then
|
||||
ASSET_URL="./"
|
||||
export ASSET_URL
|
||||
echo "$ASSET_URL"
|
||||
else
|
||||
# ASSET_URL="$BRANCH"
|
||||
ASSET_URL="./"
|
||||
export ASSET_URL
|
||||
echo "$ASSET_URL"
|
||||
fi
|
||||
|
||||
# sanity check
|
||||
if [[ -f "bookcases.html" ]]
|
||||
then
|
||||
|
|
53
scripts/prepare-build.sh
Executable file
53
scripts/prepare-build.sh
Executable file
|
@ -0,0 +1,53 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
echo "Starting prepare-build"
|
||||
# The build script; we build the application step by step as building everything at once takes too much RAM
|
||||
# Should be run from the repository root
|
||||
# This is the main deployment script
|
||||
rm -rf dist/*
|
||||
rm -rf .cache
|
||||
mkdir dist 2> /dev/null
|
||||
mkdir dist/assets 2> /dev/null
|
||||
|
||||
|
||||
export NODE_OPTIONS="--max-old-space-size=16384"
|
||||
|
||||
# This script ends every line with '&&' to chain everything. A failure will thus stop the build
|
||||
npm run generate:editor-layer-index &&
|
||||
npm run prep:layeroverview &&
|
||||
npm run generate && # includes a single "refresh:layeroverview". Resetting the files is unnecessary as they are not in there in the first place
|
||||
npm run refresh:layeroverview && # run refresh:layeroverview a second time to propagate all calls
|
||||
npm run refresh:layeroverview && # run refresh:layeroverview a third time to fix some issues with the favourite layer all calls
|
||||
|
||||
npm run generate:layouts
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR - stopping the build"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
BRANCH=`git rev-parse --abbrev-ref HEAD`
|
||||
echo "The branch name is $BRANCH"
|
||||
|
||||
if [ $BRANCH = "master" ] || [ $BRANCH = "develop" ]
|
||||
then
|
||||
ASSET_URL="./"
|
||||
export ASSET_URL
|
||||
echo "$ASSET_URL"
|
||||
else
|
||||
# ASSET_URL="$BRANCH"
|
||||
ASSET_URL="./"
|
||||
export ASSET_URL
|
||||
echo "$ASSET_URL"
|
||||
fi
|
||||
|
||||
# sanity check
|
||||
if [[ -f "bookcases.html" ]]
|
||||
then
|
||||
echo "Bookcases exists"
|
||||
else
|
||||
echo "Bookcases.html does not exist - aborting"
|
||||
exit 1
|
||||
fi
|
Loading…
Reference in a new issue