Cleanup vite.config.js and fix scripts in package.json

- Make sure rm isn't called when there are no files to delete
This commit is contained in:
wjtje 2023-02-09 14:06:23 +01:00
parent f9f1a30921
commit 325b8831f2
No known key found for this signature in database
GPG key ID: 59423E3298612FF3
3 changed files with 4 additions and 4 deletions

View file

@ -42,8 +42,8 @@
"generate:charging-stations": "cd ./assets/layers/charging_station && vite-node csvToJson.ts && cd -", "generate:charging-stations": "cd ./assets/layers/charging_station && vite-node csvToJson.ts && cd -",
"prepare-deploy": "npm run generate:service-worker && ./scripts/build.sh", "prepare-deploy": "npm run generate:service-worker && ./scripts/build.sh",
"format": "npx prettier --write --svelte-bracket-new-line=false --html-whitespace-sensitivity=ignore '**/*.ts' '**/*.svelte'", "format": "npx prettier --write --svelte-bracket-new-line=false --html-whitespace-sensitivity=ignore '**/*.ts' '**/*.svelte'",
"clean:tests": "(find . -type f -name \"*.doctest.ts\" | xargs rm)", "clean:tests": "(find . -type f -name \"*.doctest.ts\" | xargs -r rm)",
"clean": "rm -rf .cache/ && (find *.html | grep -v \"^\\(404\\|index\\|land\\|test\\|preferences\\|customGenerator\\|professional\\|automaton\\|import_helper\\|import_viewer\\|theme\\).html\" | xargs rm) && (ls | grep \"^index_[a-zA-Z_-]\\+\\.ts$\" | xargs rm) && (ls | grep \".*.webmanifest$\" | grep -v \"manifest.webmanifest\" | xargs rm)", "clean": "rm -rf .cache/ && (find *.html | grep -v \"^\\(404\\|index\\|land\\|test\\|preferences\\|customGenerator\\|professional\\|automaton\\|import_helper\\|import_viewer\\|theme\\).html\" | xargs -r rm) && (ls | grep \"^index_[a-zA-Z_-]\\+\\.ts$\" | xargs -r rm) && (ls | grep \".*.webmanifest$\" | grep -v \"manifest.webmanifest\" | xargs -r rm)",
"generate:dependency-graph": "node_modules/.bin/depcruise --exclude \"^node_modules\" --output-type dot Logic/State/MapState.ts > dependencies.dot && dot dependencies.dot -T svg -o dependencies.svg && rm dependencies.dot", "generate:dependency-graph": "node_modules/.bin/depcruise --exclude \"^node_modules\" --output-type dot Logic/State/MapState.ts > dependencies.dot && dot dependencies.dot -T svg -o dependencies.svg && rm dependencies.dot",
"weblate-add-upstream": "git remote add weblate-github git@github.com:weblate/MapComplete.git", "weblate-add-upstream": "git remote add weblate-github git@github.com:weblate/MapComplete.git",
"weblate-merge": "git remote update weblate-github; git merge weblate-github/weblate-mapcomplete-core weblate-github/weblate-mapcomplete-layers weblate-github/weblate-mapcomplete-layer-translations", "weblate-merge": "git remote update weblate-github; git merge weblate-github/weblate-mapcomplete-core weblate-github/weblate-mapcomplete-layers weblate-github/weblate-mapcomplete-layer-translations",

View file

@ -1,4 +1,5 @@
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte" import { vitePreprocess } from "@sveltejs/vite-plugin-svelte"
export default { export default {
// Consult https://svelte.dev/docs#compile-time-svelte-preprocess // Consult https://svelte.dev/docs#compile-time-svelte-preprocess
// for more information about preprocessors // for more information about preprocessors

View file

@ -1,6 +1,5 @@
import { defineConfig } from "vite" import { defineConfig } from "vite"
import { svelte } from "@sveltejs/vite-plugin-svelte" import { svelte } from "@sveltejs/vite-plugin-svelte"
import autoPreprocess, { scss } from "svelte-preprocess";
import fs from "fs" import fs from "fs"
const allHtmlFiles = fs.readdirSync(".").filter((f) => f.endsWith(".html")) const allHtmlFiles = fs.readdirSync(".").filter((f) => f.endsWith(".html"))
@ -19,7 +18,7 @@ export default defineConfig({
}, },
}, },
base: `${ASSET_URL}`, base: `${ASSET_URL}`,
plugins: [svelte({preprocess: [scss() , autoPreprocess()]})], plugins: [svelte()],
server: { server: {
port: 1234, port: 1234,
}, },