diff --git a/.github/workflows/pull_request_check.yml b/.github/workflows/pull_request_check.yml
new file mode 100644
index 0000000..308a885
--- /dev/null
+++ b/.github/workflows/pull_request_check.yml
@@ -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
+
diff --git a/.github/workflows/theme_validation.yml b/.github/workflows/theme_validation.yml
new file mode 100644
index 0000000..ca4ef1e
--- /dev/null
+++ b/.github/workflows/theme_validation.yml
@@ -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
diff --git a/Customizations/AllKnownLayouts.ts b/Customizations/AllKnownLayouts.ts
index 8acc177..87d42f1 100644
--- a/Customizations/AllKnownLayouts.ts
+++ b/Customizations/AllKnownLayouts.ts
@@ -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 {
diff --git a/Models/Constants.ts b/Models/Constants.ts
index 5210c9f..b211bef 100644
--- a/Models/Constants.ts
+++ b/Models/Constants.ts
@@ -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 = {
diff --git a/Svg.ts b/Svg.ts
index a66fee7..ca23326 100644
--- a/Svg.ts
+++ b/Svg.ts
@@ -39,7 +39,7 @@ export default class Svg {
public static Ornament_Horiz_6_svg() { return new FixedUiElement(Svg.Ornament_Horiz_6);}
public static Ornament_Horiz_6_ui() { return new FixedUiElement(Svg.Ornament_Horiz_6_img);}
- public static SocialImageForeground = " "
+ public static SocialImageForeground = " "
public static SocialImageForeground_img = Img.AsImageElement(Svg.SocialImageForeground)
public static SocialImageForeground_svg() { return new FixedUiElement(Svg.SocialImageForeground);}
public static SocialImageForeground_ui() { return new FixedUiElement(Svg.SocialImageForeground_img);}
diff --git a/package.json b/package.json
index 6052e73..a9865fd 100644
--- a/package.json
+++ b/package.json
@@ -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",
diff --git a/scripts/generateIncludedImages.ts b/scripts/generateIncludedImages.ts
index 1eb4e92..f240be7 100644
--- a/scripts/generateIncludedImages.ts
+++ b/scripts/generateIncludedImages.ts
@@ -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;
}
diff --git a/scripts/generateLayerOverview.ts b/scripts/generateLayerOverview.ts
index 756a3db..ac852ae 100644
--- a/scripts/generateLayerOverview.ts
+++ b/scripts/generateLayerOverview.ts
@@ -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`)
- throw msg;
+ if(process.argv.indexOf("--no-fail") >= 0){
+ console.log(msg)
+ }else{
+ throw msg;
+ }
}
diff --git a/scripts/generateLayouts.ts b/scripts/generateLayouts.ts
index 4cfa1c1..589fe9f 100644
--- a/scripts/generateLayouts.ts
+++ b/scripts/generateLayouts.ts
@@ -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);
diff --git a/scripts/generateLicenseInfo.ts b/scripts/generateLicenseInfo.ts
index a838521..a4fea52 100644
--- a/scripts/generateLicenseInfo.ts
+++ b/scripts/generateLicenseInfo.ts
@@ -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.`
- /*
- console.log(msg)
- /*/
- throw msg
- //*/
+ 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)