Small tweaks to the deploy scripts

This commit is contained in:
pietervdvn 2021-04-10 15:01:28 +02:00
parent 4e1fc46ff2
commit a8aaf4b219
10 changed files with 65 additions and 19 deletions

View file

@ -0,0 +1,16 @@
name: Pull request check
on:
pull_request:
types: [opened, edited, synchronize, ready_for_review, review_requested]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Compile license info
run: npm run generate:licenses
- name: Compile and validate themes and layers
run: npm run generate:layeroverview

17
.github/workflows/theme_validation.yml vendored Normal file
View file

@ -0,0 +1,17 @@
name: Theme Validation
on:
push:
branches:
- develop
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Compile license info
run: npm run generate:licenses
- name: Compile and validate themes and layers
run: npm run generate:layeroverview

View file

@ -2,7 +2,7 @@ import LayoutConfig from "./JSON/LayoutConfig";
import AllKnownLayers from "./AllKnownLayers";
import * as known_themes from "../assets/generated/known_layers_and_themes.json"
import {LayoutConfigJson} from "./JSON/LayoutConfigJson";
import * as all_layouts from "../assets/generated/known_layers_and_themes.json"
export class AllKnownLayouts {

View file

@ -2,7 +2,7 @@ import { Utils } from "../Utils";
export default class Constants {
public static vNumber = "0.6.6a";
public static vNumber = "0.6.7";
// The user journey states thresholds when a new feature gets unlocked
public static userJourney = {

2
Svg.ts

File diff suppressed because one or more lines are too long

View file

@ -15,10 +15,10 @@
"generate:translations": "ts-node scripts/generateTranslations.ts",
"generate:layouts": "ts-node scripts/generateLayouts.ts",
"generate:docs": "ts-node scripts/generateDocs.ts",
"generate:layeroverview": "ts-node scripts/generateLayerOverview.ts",
"generate:licenses": "ts-node scripts/generateLicenseInfo.ts",
"generate:layeroverview": "ts-node scripts/generateLayerOverview.ts --no-fail",
"generate:licenses": "ts-node scripts/generateLicenseInfo.ts --no-fail",
"optimize-images": "cd assets/generated/ && find -name '*.png' -exec optipng '{}' \\; && echo 'PNGs are optimized'",
"generate": "npm run generate:images && npm run generate:translations",
"generate": "npm run generate:images && npm run generate:translations && npm run generate:licenses",
"build": "rm -rf dist/ && npm run generate && parcel build --public-url ./ *.html assets/** assets/**/** assets/**/**/** vendor/* vendor/*/*",
"prepare-deploy": "npm run test && npm run generate:editor-layer-index && npm run generate:layouts && npm run generate:layeroverview && npm run generate && npm run build && rm -rf .cache && npm run generate:docs",
"deploy:staging": "npm run prepare-deploy && rm -rf /home/pietervdvn/git/pietervdvn.github.io/Staging/* && cp -r dist/* /home/pietervdvn/git/pietervdvn.github.io/Staging/ && cd /home/pietervdvn/git/pietervdvn.github.io/ && git add * && git commit -m 'New MapComplete Version' && git push && cd - && npm run clean",

View file

@ -9,6 +9,10 @@ function genImages() {
const allNames: string[] = [];
for (const path of dir) {
if(path.endsWith("license_info.json")){
continue;
}
if (!path.endsWith(".svg")) {
throw "Non-svg file detected in the svg files: " + path;
}

View file

@ -117,5 +117,9 @@ if (layerErrorCount + themeErrorCount == 0) {
console.log("All good!")
} else {
const msg = (`Found ${layerErrorCount} errors in the layers; ${themeErrorCount} errors in the themes`)
if(process.argv.indexOf("--no-fail") >= 0){
console.log(msg)
}else{
throw msg;
}
}

View file

@ -3,13 +3,13 @@ import {Utils} from "../Utils";
Utils.runningFromConsole = true;
import LayoutConfig from "../Customizations/JSON/LayoutConfig";
import {AllKnownLayouts} from "../Customizations/AllKnownLayouts";
import {existsSync, mkdirSync, readFileSync, writeFile, writeFileSync} from "fs";
import Locale from "../UI/i18n/Locale";
import Translations from "../UI/i18n/Translations";
import {Translation} from "../UI/i18n/Translation";
import Constants from "../Models/Constants";
import * as all_known_layouts from "../assets/generated/known_layers_and_themes.json"
import {LayoutConfigJson} from "../Customizations/JSON/LayoutConfigJson";
const sharp = require('sharp');
@ -234,9 +234,12 @@ if (!existsSync(generatedDir)) {
}
const blacklist = ["", "test", ".", "..", "manifest", "index", "land", "preferences", "account", "openstreetmap", "custom"]
const all = AllKnownLayouts.allKnownLayouts;
const all : LayoutConfigJson[] = all_known_layouts.themes;
for (const layoutName in all) {
for (const i in all) {
const layoutConfigJson : LayoutConfigJson = all[i]
const layout = new LayoutConfig(layoutConfigJson, true, "generating layouts")
const layoutName = layout.id
if (blacklist.indexOf(layoutName.toLowerCase()) >= 0) {
console.log(`Skipping a layout with name${layoutName}, it is on the blacklist`);
continue;
@ -246,7 +249,6 @@ for (const layoutName in all) {
console.log("Could not write manifest for ", layoutName, " because ", err)
}
};
const layout = all[layoutName];
validate(layout)
createManifest(layout, "").then(manifObj => {
const manif = JSON.stringify(manifObj, undefined, 2);

View file

@ -182,16 +182,19 @@ writeFileSync("./assets/generated/license_info.json", JSON.stringify(licenseInfo
const artwork = contents.filter(pth => pth.match(/(.svg|.png|.jpg)$/i) != null)
const missingLicenses = missingLicenseInfos(licenseInfos, artwork)
cleanLicenseInfo(licensePaths, licenseInfos)
if(missingLicenses.length > 0){
const msg = `There are ${missingLicenses.length} licenses missing.`
/*
if(process.argv.indexOf("--no-fail") >= 0){
console.log(msg)
/*/
}else{
throw msg
//*/
}
}
// queryMissingLicenses(missingLicenses)
if(process.argv.indexOf("--prompt") >= 0) {
queryMissingLicenses(missingLicenses)
}
cleanLicenseInfo(licensePaths, licenseInfos)