From cd6f511bda64f98c7d5aaab19c40ca7504cb70af Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sat, 10 Apr 2021 16:06:01 +0200 Subject: [PATCH] Small tweaks --- .github/workflows/pull_request_check.yml | 8 ++++---- .github/workflows/theme_validation.yml | 6 +++--- package.json | 4 ++-- scripts/generateLayerOverview.ts | 7 +++++-- scripts/generateLicenseInfo.ts | 4 +++- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pull_request_check.yml b/.github/workflows/pull_request_check.yml index b76182f..3343128 100644 --- a/.github/workflows/pull_request_check.yml +++ b/.github/workflows/pull_request_check.yml @@ -24,10 +24,10 @@ jobs: - name: create stub themes run: "echo '{\"layers\": [], \"themes\": []}' > ./assets/generated/known_layers_and_themes.json" - - - name: Compile license info + - name: Compile license info; creates missing_licenses.txt if any missing run: npm run validate:licenses - - name: Compile and validate themes and layers - run: npm run validate:layeroverview + - name: Compile and validate themes and layers; creates layer_report.txt if any errors are found + run: npm run validate:layeroverview + diff --git a/.github/workflows/theme_validation.yml b/.github/workflows/theme_validation.yml index 1173e2f..944ef73 100644 --- a/.github/workflows/theme_validation.yml +++ b/.github/workflows/theme_validation.yml @@ -26,7 +26,7 @@ jobs: - name: Compile license info - run: npm run validate:licenses + run: npm run generate:licenses - - name: Compile and validate themes and layers - run: npm run validate:layeroverview + - name: Compile themes and layers + run: npm run generate:layeroverview diff --git a/package.json b/package.json index cc36ca8..1b4dea3 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,8 @@ "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 --no-fail", - "generate:licenses": "ts-node scripts/generateLicenseInfo.ts --no-fail", + "generate:layeroverview": "ts-node scripts/generateLayerOverview.ts", + "generate:licenses": "ts-node scripts/generateLicenseInfo.ts", "validate:layeroverview": "ts-node scripts/generateLayerOverview.ts --report", "validate:licenses": "ts-node scripts/generateLicenseInfo.ts --report", "optimize-images": "cd assets/generated/ && find -name '*.png' -exec optipng '{}' \\; && echo 'PNGs are optimized'", diff --git a/scripts/generateLayerOverview.ts b/scripts/generateLayerOverview.ts index 1d86eae..638b50b 100644 --- a/scripts/generateLayerOverview.ts +++ b/scripts/generateLayerOverview.ts @@ -98,7 +98,7 @@ for (const themeFile of themeFiles) { } } else { // layer.builtin contains layer overrides - we can skip those - layerErrorCount .push(validateLayer(layer, themeFile.id)) + layerErrorCount .push(...validateLayer(layer, themeFile.id)) } } } @@ -116,6 +116,9 @@ for (const themeFile of themeFiles) { themeErrorCount.push("Could not parse theme "+ themeFile["id"]+ "due to", e) } } + +console.log("LE", layerErrorCount) + if (layerErrorCount.length + themeErrorCount.length == 0) { console.log("All good!") } else { @@ -125,7 +128,7 @@ if (layerErrorCount.length + themeErrorCount.length == 0) { if(process.argv.indexOf("--no-fail") >= 0) { console.log(msg) }else if(process.argv.indexOf("--report") >= 0){ - writeFileSync("layer-report.txt", errors) + writeFileSync("layer_report.txt", errors) }else{ throw msg; diff --git a/scripts/generateLicenseInfo.ts b/scripts/generateLicenseInfo.ts index 29c2395..95dbbcc 100644 --- a/scripts/generateLicenseInfo.ts +++ b/scripts/generateLicenseInfo.ts @@ -202,7 +202,9 @@ if(missingLicenses.length > 0){ const msg = `There are ${missingLicenses.length} licenses missing.` if(process.argv.indexOf("--no-fail") >= 0){ console.log(msg) - }else{ + }else if(process.argv.indexOf("--report") >= 0){ + writeFileSync("missing_licenses.txt", missingLicenses.join("\n")) + } else{ throw msg }