diff --git a/.github/workflows/deploy_dev.yml b/.github/workflows/deploy_dev.yml index d92079aec..3893cf3ed 100644 --- a/.github/workflows/deploy_dev.yml +++ b/.github/workflows/deploy_dev.yml @@ -33,18 +33,14 @@ jobs: run: npm run generate:translations shell: bash - - name: generate layeroverview - run: npm run reset:layeroverview + - name: Prepare deploy + run: npm run prepare-deploy shell: bash - name: run tests run: npm run test shell: bash - - name: Prepare deploy - run: npm run prepare-deploy - shell: bash - - name: Clone deployment repo env: DEPLOY_KEY_PIETERVDVN: ${{ secrets.DEPLOY_KEY_PIETERVDVN }} diff --git a/package.json b/package.json index 2f8f269e5..18288ad89 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,8 @@ "generate:service-worker": "tsc src/service-worker.ts --outFile public/service-worker.js && git_hash=$(git rev-parse HEAD) && sed -i.bak \"s/GITHUB-COMMIT/$git_hash/\" public/service-worker.js && rm public/service-worker.js.bak", "optimize-images": "cd assets/generated/ && find -name '*.png' -exec optipng '{}' \\; && echo 'PNGs are optimized'", "generate:stats": "vite-node scripts/GenerateSeries.ts", - "reset: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 && npm run generate:layeroverview && vite-node scripts/generateLayerOverview.ts -- --force", + "reset:layeroverview": "npm run prep:layeroverview && npm run generate:layeroverview && npm run refresh:layeroverview", + "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", diff --git a/scripts/build.sh b/scripts/build.sh index c989e5803..aa0929689 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -14,8 +14,9 @@ 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 generate && -npm run generate:layouts +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 if [ $? -ne 0 ]; then echo "ERROR - stopping the build"