Tooling: add HTTPS-mode development hosting for debugging on Android

This commit is contained in:
Pieter Vander Vennet 2024-01-15 01:54:09 +01:00
parent 53524532ef
commit e71ae91e2c
3 changed files with 33 additions and 5 deletions

24
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "mapcomplete",
"version": "0.36.11",
"version": "0.36.12",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "mapcomplete",
"version": "0.36.11",
"version": "0.36.12",
"license": "GPL-3.0-or-later",
"dependencies": {
"@rgossiaux/svelte-headlessui": "^1.0.2",
@ -83,6 +83,7 @@
"@types/xml2js": "^0.4.9",
"@typescript-eslint/eslint-plugin": "^6.1.0",
"@typescript-eslint/parser": "^6.1.0",
"@vitejs/plugin-basic-ssl": "^1.0.2",
"assert": "^2.0.0",
"chai": "^4.3.6",
"dependency-cruiser": "^10.4.0",
@ -4608,6 +4609,18 @@
"resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz",
"integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q=="
},
"node_modules/@vitejs/plugin-basic-ssl": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@vitejs/plugin-basic-ssl/-/plugin-basic-ssl-1.0.2.tgz",
"integrity": "sha512-DKHKVtpI+eA5fvObVgQ3QtTGU70CcCnedalzqmGSR050AzKZMdUzgC8KmlOneHWH8dF2hJ3wkC9+8FDVAaDRCw==",
"dev": true,
"engines": {
"node": ">=14.6.0"
},
"peerDependencies": {
"vite": "^3.0.0 || ^4.0.0 || ^5.0.0"
}
},
"node_modules/@vitest/expect": {
"version": "0.28.3",
"resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.28.3.tgz",
@ -17096,6 +17109,13 @@
"resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz",
"integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q=="
},
"@vitejs/plugin-basic-ssl": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@vitejs/plugin-basic-ssl/-/plugin-basic-ssl-1.0.2.tgz",
"integrity": "sha512-DKHKVtpI+eA5fvObVgQ3QtTGU70CcCnedalzqmGSR050AzKZMdUzgC8KmlOneHWH8dF2hJ3wkC9+8FDVAaDRCw==",
"dev": true,
"requires": {}
},
"@vitest/expect": {
"version": "0.28.3",
"resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.28.3.tgz",

View file

@ -43,8 +43,9 @@
},
"scripts": {
"start": "npm run generate:layeroverview && npm run strt",
"#strt:https": "Start in HTTPS mode. Makes a few things a bit harder, but allows to debug on Android with logging in",
"strt:https": "vite --host | sed 's/localhost:/127.0.0.1:/g'",
"strt": "vite --host | sed 's/localhost:/127.0.0.1:/g'",
"strttest": "export NODE_OPTIONS=--max_old_space_size=8364 && parcel serve test.html assets/templates/*.svg assets/templates/fonts/*.ttf",
"watch:css": "tailwindcss -i src/index.css -o public/css/index-tailwind-output.css --watch",
"generate:css": "tailwindcss -i src/index.css -o public/css/index-tailwind-output.css",
"generate:doctests": "doctest-ts-improved . --ignore .*.spec.ts --ignore .*ConfigJson.ts",
@ -179,6 +180,7 @@
"@types/xml2js": "^0.4.9",
"@typescript-eslint/eslint-plugin": "^6.1.0",
"@typescript-eslint/parser": "^6.1.0",
"@vitejs/plugin-basic-ssl": "^1.0.2",
"assert": "^2.0.0",
"chai": "^4.3.6",
"dependency-cruiser": "^10.4.0",

View file

@ -1,6 +1,7 @@
import { defineConfig } from "vite"
import { svelte } from "@sveltejs/vite-plugin-svelte"
import fs from "fs"
import basicSsl from '@vitejs/plugin-basic-ssl'
const allHtmlFiles = fs.readdirSync(".").filter((f) => f.endsWith(".html"))
const input = {}
@ -10,7 +11,12 @@ for (const html of allHtmlFiles) {
const name = html.substring(0, html.length - 5)
input[name] = "./" + html
}
console.log("Args:",process.argv)
const plugins = [svelte() ]
if(process.argv.indexOf("--https") >= 0){
console.log("Adding basicSSL")
plugins.push(basicSsl())
}
export default defineConfig({
build: {
rollupOptions: {
@ -18,7 +24,7 @@ export default defineConfig({
},
},
base: `${ASSET_URL}`,
plugins: [svelte()],
plugins ,
server: {
port: 1234,
},