forked from MapComplete/MapComplete
Cleanup script again, webmanifest already uses the relative manifest + add small script to create a contributors JSON file
This commit is contained in:
parent
35ecc21e09
commit
e26999b31b
4 changed files with 118 additions and 9 deletions
108
assets/contributors.json
Normal file
108
assets/contributors.json
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
{
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"contributor": "Noémie",
|
||||||
|
"commits": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "Schouppe Joost",
|
||||||
|
"commits": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "tbowdecl97",
|
||||||
|
"commits": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "Thibault Molleman",
|
||||||
|
"commits": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "Tomas Fiers",
|
||||||
|
"commits": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "David Haberthür",
|
||||||
|
"commits": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "graveelius",
|
||||||
|
"commits": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "pbarban",
|
||||||
|
"commits": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "Sebastian Kürten",
|
||||||
|
"commits": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "Stanislas Gueniffey",
|
||||||
|
"commits": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "Mateusz Konieczny",
|
||||||
|
"commits": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "dependabot[bot]",
|
||||||
|
"commits": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "pelderson",
|
||||||
|
"commits": 6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "Binnette",
|
||||||
|
"commits": 7
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "Flo Edelmann",
|
||||||
|
"commits": 7
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "Joost",
|
||||||
|
"commits": 7
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "yopaseopor",
|
||||||
|
"commits": 7
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "Midgard",
|
||||||
|
"commits": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "Bavo Vanderghote",
|
||||||
|
"commits": 12
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "ToastHawaii",
|
||||||
|
"commits": 15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "Pieter Fiers",
|
||||||
|
"commits": 31
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "Win Olario",
|
||||||
|
"commits": 31
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "Christian Neumann",
|
||||||
|
"commits": 33
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "Tobias",
|
||||||
|
"commits": 35
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "pietervdvn",
|
||||||
|
"commits": 512
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contributor": "Pieter Vander Vennet",
|
||||||
|
"commits": 669
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -20,13 +20,14 @@
|
||||||
"generate:layeroverview": "ts-node scripts/generateLayerOverview.ts --no-fail",
|
"generate:layeroverview": "ts-node scripts/generateLayerOverview.ts --no-fail",
|
||||||
"generate:licenses": "ts-node scripts/generateLicenseInfo.ts --no-fail",
|
"generate:licenses": "ts-node scripts/generateLicenseInfo.ts --no-fail",
|
||||||
"generate:report": "cd Docs/Tools && ./compileStats.sh && git commit . -m 'New statistics ands graphs' && git push",
|
"generate:report": "cd Docs/Tools && ./compileStats.sh && git commit . -m 'New statistics ands graphs' && git push",
|
||||||
|
"generate:contributor-list": "git log --pretty='%aN' | sort | uniq -c | sort -h| sed 's/ *\\([0-9]*\\) \\(.*\\)$/{\"contributor\":\"\\2\", \"commits\":\\1}/' | tr '\\n' ',' | sed 's/^/{\"contributors\":[/' | sed 's/,$/]}/' > assets/contributors.json",
|
||||||
"validate:layeroverview": "ts-node scripts/generateLayerOverview.ts --report",
|
"validate:layeroverview": "ts-node scripts/generateLayerOverview.ts --report",
|
||||||
"validate:licenses": "ts-node scripts/generateLicenseInfo.ts --report",
|
"validate:licenses": "ts-node scripts/generateLicenseInfo.ts --report",
|
||||||
"optimize-images": "cd assets/generated/ && find -name '*.png' -exec optipng '{}' \\; && echo 'PNGs are optimized'",
|
"optimize-images": "cd assets/generated/ && find -name '*.png' -exec optipng '{}' \\; && echo 'PNGs are optimized'",
|
||||||
"reset:layeroverview": "echo '{\"layers\":[], \"themes\":[]}' > ./assets/generated/known_layers_and_themes.json",
|
"reset:layeroverview": "echo '{\"layers\":[], \"themes\":[]}' > ./assets/generated/known_layers_and_themes.json",
|
||||||
"generate": "mkdir -p ./assets/generated && npm run reset:layeroverview && npm run generate:images && npm run generate:translations && npm run generate:licenses && npm run generate:licenses && npm run generate:layeroverview",
|
"generate": "mkdir -p ./assets/generated && npm run reset:layeroverview && npm run generate:images && npm run generate:translations && npm run generate:licenses && npm run generate:licenses && npm run generate:layeroverview",
|
||||||
"build": "rm -rf dist/ && npm run generate && parcel build --public-url ./ *.html assets/** assets/**/** assets/**/**/** vendor/* vendor/*/*",
|
"build": "rm -rf dist/ && npm run generate && parcel build --public-url ./ *.html assets/** assets/**/** assets/**/**/** vendor/* vendor/*/*",
|
||||||
"prepare-deploy": "npm run generate && npm run test && npm run generate:editor-layer-index && npm run generate:layouts && npm run generate:layeroverview && npm run build && rm -rf .cache && npm run generate:docs",
|
"prepare-deploy": "npm run generate && npm run test && npm run generate:editor-layer-index && npm run generate:layeroverview && npm run generate:layouts && 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",
|
"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",
|
||||||
"deploy:pietervdvn": "cd /home/pietervdvn/git/pietervdvn.github.io/ && git pull && cd - && npm run prepare-deploy && rm -rf /home/pietervdvn/git/pietervdvn.github.io/MapComplete/* && cp -r dist/* /home/pietervdvn/git/pietervdvn.github.io/MapComplete/ && cd /home/pietervdvn/git/pietervdvn.github.io/ && git add * && git commit -m 'New MapComplete Version' && git push && cd - && npm run clean",
|
"deploy:pietervdvn": "cd /home/pietervdvn/git/pietervdvn.github.io/ && git pull && cd - && npm run prepare-deploy && rm -rf /home/pietervdvn/git/pietervdvn.github.io/MapComplete/* && cp -r dist/* /home/pietervdvn/git/pietervdvn.github.io/MapComplete/ && cd /home/pietervdvn/git/pietervdvn.github.io/ && git add * && git commit -m 'New MapComplete Version' && git push && cd - && npm run clean",
|
||||||
"deploy:production": "rm -rf ./assets/generated && npm run prepare-deploy && npm run optimize-images && rm -rf /home/pietervdvn/git/mapcomplete.github.io/* && cp -r dist/* /home/pietervdvn/git/mapcomplete.github.io/ && cd /home/pietervdvn/git/mapcomplete.github.io/ && echo \"mapcomplete.osm.be\" > CNAME && git add * && git commit -m 'New MapComplete Version' && git push && cd - && npm run clean",
|
"deploy:production": "rm -rf ./assets/generated && npm run prepare-deploy && npm run optimize-images && rm -rf /home/pietervdvn/git/mapcomplete.github.io/* && cp -r dist/* /home/pietervdvn/git/mapcomplete.github.io/ && cd /home/pietervdvn/git/mapcomplete.github.io/ && echo \"mapcomplete.osm.be\" > CNAME && git add * && git commit -m 'New MapComplete Version' && git push && cd - && npm run clean",
|
||||||
|
|
|
@ -52,12 +52,13 @@ async function createIcon(iconPath: string, size: number) {
|
||||||
return newname;
|
return newname;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createManifest(layout: LayoutConfig, relativePath: string) {
|
async function createManifest(layout: LayoutConfig) {
|
||||||
const name = layout.id;
|
const name = layout.id;
|
||||||
|
|
||||||
Translation.forcedLanguage = "en"
|
Translation.forcedLanguage = "en"
|
||||||
const icons = [];
|
const icons = [];
|
||||||
|
|
||||||
|
|
||||||
let icon = layout.icon;
|
let icon = layout.icon;
|
||||||
if (icon.endsWith(".svg") || icon.startsWith("<svg") || icon.startsWith("<?xml")) {
|
if (icon.endsWith(".svg") || icon.startsWith("<svg") || icon.startsWith("<?xml")) {
|
||||||
// This is an svg. Lets create the needed pngs!
|
// This is an svg. Lets create the needed pngs!
|
||||||
|
@ -93,7 +94,7 @@ async function createManifest(layout: LayoutConfig, relativePath: string) {
|
||||||
return {
|
return {
|
||||||
name: name,
|
name: name,
|
||||||
short_name: ogTitle,
|
short_name: ogTitle,
|
||||||
start_url: `${relativePath}/${layout.id.toLowerCase()}.html`,
|
start_url: `${layout.id.toLowerCase()}.html`,
|
||||||
display: "standalone",
|
display: "standalone",
|
||||||
background_color: "#fff",
|
background_color: "#fff",
|
||||||
description: ogDescr,
|
description: ogDescr,
|
||||||
|
@ -176,7 +177,6 @@ if (!existsSync(generatedDir)) {
|
||||||
const blacklist = ["", "test", ".", "..", "manifest", "index", "land", "preferences", "account", "openstreetmap", "custom"]
|
const blacklist = ["", "test", ".", "..", "manifest", "index", "land", "preferences", "account", "openstreetmap", "custom"]
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const all : LayoutConfigJson[] = all_known_layouts.themes;
|
const all : LayoutConfigJson[] = all_known_layouts.themes;
|
||||||
|
|
||||||
for (const i in all) {
|
for (const i in all) {
|
||||||
const layoutConfigJson : LayoutConfigJson = all[i]
|
const layoutConfigJson : LayoutConfigJson = all[i]
|
||||||
const layout = new LayoutConfig(layoutConfigJson, true, "generating layouts")
|
const layout = new LayoutConfig(layoutConfigJson, true, "generating layouts")
|
||||||
|
@ -190,7 +190,7 @@ for (const i in all) {
|
||||||
console.log("Could not write manifest for ", layoutName, " because ", err)
|
console.log("Could not write manifest for ", layoutName, " because ", err)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
createManifest(layout, "").then(manifObj => {
|
createManifest(layout).then(manifObj => {
|
||||||
const manif = JSON.stringify(manifObj, undefined, 2);
|
const manif = JSON.stringify(manifObj, undefined, 2);
|
||||||
const manifestLocation = encodeURIComponent(layout.id.toLowerCase()) + ".webmanifest";
|
const manifestLocation = encodeURIComponent(layout.id.toLowerCase()) + ".webmanifest";
|
||||||
writeFile(manifestLocation, manif, err);
|
writeFile(manifestLocation, manif, err);
|
||||||
|
@ -215,7 +215,7 @@ createManifest(new LayoutConfig({
|
||||||
title: {en:"MapComplete"},
|
title: {en:"MapComplete"},
|
||||||
version: Constants.vNumber,
|
version: Constants.vNumber,
|
||||||
description: {en:"A thematic map viewer and editor based on OpenStreetMap"}
|
description: {en:"A thematic map viewer and editor based on OpenStreetMap"}
|
||||||
}), "").then(manifObj => {
|
})).then(manifObj => {
|
||||||
const manif = JSON.stringify(manifObj, undefined, 2);
|
const manif = JSON.stringify(manifObj, undefined, 2);
|
||||||
writeFileSync("index.manifest", manif)
|
writeFileSync("index.manifest", manif)
|
||||||
})
|
})
|
||||||
|
|
|
@ -34,11 +34,11 @@ function genTranslations() {
|
||||||
const translations = JSON.parse(fs.readFileSync("./assets/translations.json", "utf-8"))
|
const translations = JSON.parse(fs.readFileSync("./assets/translations.json", "utf-8"))
|
||||||
const transformed = transformTranslation(translations);
|
const transformed = transformTranslation(translations);
|
||||||
|
|
||||||
let module = `import {Translation} from "./UI/i18n/Translation"\n\nexport default class AllTranslationAssets {\n\n`;
|
let module = `import {Translation} from "../../UI/i18n/Translation"\n\nexport default class CompiledTranslations {\n\n`;
|
||||||
module += " public static t = " + transformed;
|
module += " public static t = " + transformed;
|
||||||
module += "}"
|
module += "}"
|
||||||
|
|
||||||
fs.writeFileSync("AllTranslationAssets.ts", module);
|
fs.writeFileSync("./assets/generated/CompiledTranslations.ts", module);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue