Small fixes and cleanup of package scripts

This commit is contained in:
pietervdvn 2021-12-22 23:50:43 +01:00
parent 630bcd8dad
commit 220d65ef85
4 changed files with 15 additions and 48 deletions

View file

@ -1,34 +0,0 @@
import {FixedUiElement} from "./Base/FixedUiElement";
import Combine from "./Base/Combine";
import MoreScreen from "./BigComponents/MoreScreen";
import Translations from "./i18n/Translations";
import Constants from "../Models/Constants";
import UserRelatedState from "../Logic/State/UserRelatedState";
import {Utils} from "../Utils";
import LanguagePicker from "./LanguagePicker";
import IndexText from "./BigComponents/IndexText";
import FeaturedMessage from "./BigComponents/FeaturedMessage";
export default class Professional {
constructor() {
new FixedUiElement("").AttachTo("centermessage")
const state = new UserRelatedState(undefined);
const intro = new Combine([
LanguagePicker.CreateLanguagePicker(Translations.t.index.title.SupportedLanguages())
.SetClass("absolute top-2 right-3"),
new IndexText()
]);
new Combine([
intro,
new FeaturedMessage(),
new MoreScreen(state, true),
Translations.t.general.aboutMapcomplete
.Subs({"osmcha_link": Utils.OsmChaLinkFor(7)})
.SetClass("link-underline"),
new FixedUiElement("v" + Constants.vNumber)
]).SetClass("block m-5 lg:w-3/4 lg:ml-40")
.SetStyle("pointer-events: all;")
.AttachTo("topleft-tools");
}
}

View file

@ -97,7 +97,7 @@ export default class ProfessionalGui {
Svg.back_svg().SetStyle("height: 1.5rem;"),
t.backToMapcomplete,
{
url: window.location.host + "/index.html"
url: "./index.html"
}
)]).SetClass("block")

View file

@ -37,9 +37,8 @@
"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",
"generate": "mkdir -p ./assets/generated && npm run reset:layeroverview && npm run generate:images && npm run generate:charging-stations && npm run generate:translations && npm run generate:licenses && npm run generate:layeroverview",
"build": "npm run generate && ./scripts/build.sh",
"generate:charging-stations": "cd ./assets/layers/charging_station && ts-node csvToJson.ts && cd -",
"prepare-deploy": "npm run generate && npm run test && npm run generate:editor-layer-index && npm run generate:layouts && npm run build",
"prepare-deploy": "./scripts/build.sh",
"gittag": "ts-node scripts/printVersion.ts | bash",
"lint": "tslint --project . -c tslint.json '**.ts' ",
"clean": "rm -rf .cache/ && (find *.html | grep -v \"\\(404\\|index\\|land\\|test\\|preferences\\|customGenerator\\|professional\\|automaton\\|theme\\).html\" | xargs rm) && (ls | grep \"^index_[a-zA-Z_]\\+\\.ts$\" | xargs rm) && (ls | grep \".*.webmanifest$\" | xargs rm)",

View file

@ -8,25 +8,27 @@ rm -rf .cache
mkdir dist 2> /dev/null
mkdir dist/assets 2> /dev/null
npm run generate
npm run test
npm run generate:editor-layer-index
npm run generate:layouts
# Copy the layer files, as these might contain assets (e.g. svgs)
cp -r assets/layers/ dist/assets/layers/
cp -r assets/themes/ dist/assets/themes/
cp -r assets/svg/ dist/assets/svg/
echo "\n\n Building non-theme pages"
echo " ==========================\n\n"
parcel build --no-source-maps "index.html" "404.html" "professional.html" "automaton.html" "land.html" "customGenerator.html" "theme.html" vendor
echo "\n\n Building theme pages"
echo " ======================\n\n"
echo -e "\n\n Building non-theme pages"
echo -e " ==========================\n\n"
parcel build --public-url "./" --no-source-maps "index.html" "404.html" "professional.html" "automaton.html" "land.html" "customGenerator.html" "theme.html" vendor
echo -e "\n\n Building theme pages"
echo -e " ======================\n\n"
for file in $(ls index_*.ts)
do
theme=${file:6:-3}
echo "\n\n $theme"
echo " ------------ \n\n"
echo -e "\n\n $theme"
echo -e " ------------ \n\n"
# Builds the necessary files for just one theme, e.g. 'bookcases.html' + 'index_bookcases.ts' + supporting file
# npm run generate && node --max_old_space_size=12000 $(which parcel) build
parcel build --no-source-maps "$theme.html"
parcel build --public-url "./" --no-source-maps "$theme.html"
done
# Optimize images
cd dist/ && find -name '*.png' -exec optipng '{}' \; && echo 'PNGs are optimized'