From 838c8d2ffb749ab423e7fb5574abbac45b891ab6 Mon Sep 17 00:00:00 2001 From: Romein van Buren Date: Wed, 15 Feb 2023 19:27:51 +0100 Subject: [PATCH] Housekeeping --- .vscode/tasks.json | 51 +++++++ frontend/jsconfig.json | 25 +--- frontend/src/app.svelte | 18 +-- frontend/src/components/datepicker.svelte | 2 +- .../src/components/directorychooser.svelte | 2 +- frontend/src/components/forminput.svelte | 8 +- frontend/src/components/grid-items.svelte | 6 +- frontend/src/components/objectgrid.svelte | 2 +- frontend/src/lib/actions/controlkey.js | 13 ++ .../src/lib/{actions.js => actions/input.js} | 5 +- frontend/src/lib/constants.js | 7 + frontend/src/lib/keypaths.js | 58 ++++++++ frontend/src/lib/math.js | 23 +++ frontend/src/lib/mongo.js | 34 +++++ frontend/src/lib/stores/environment.js | 2 +- frontend/src/lib/stores/queries.js | 2 +- frontend/src/lib/stores/settings.js | 2 +- frontend/src/lib/stores/views.js | 2 +- frontend/src/lib/utils.js | 138 ------------------ frontend/src/main.js | 5 +- frontend/src/organisms/about/index.svelte | 2 +- .../collection/components/form.svelte | 7 +- .../collection/components/indexdetail.svelte | 8 +- .../collection/components/querychooser.svelte | 12 +- .../collection/components/viewconfig.svelte | 12 +- .../connection/collection/find.svelte | 20 +-- .../connection/collection/index.svelte | 8 +- .../connection/collection/indexes.svelte | 8 +- .../connection/collection/insert.svelte | 21 +-- .../connection/collection/remove.svelte | 8 +- .../connection/collection/stats.svelte | 4 +- .../connection/collection/update.svelte | 8 +- .../organisms/connection/export/export.svelte | 14 +- .../organisms/connection/hostdetail.svelte | 6 +- .../src/organisms/connection/hosttree.svelte | 8 +- .../src/organisms/connection/index.svelte | 20 +-- frontend/src/organisms/settings/index.svelte | 8 +- frontend/vite.config.js | 13 +- 38 files changed, 322 insertions(+), 270 deletions(-) create mode 100644 .vscode/tasks.json create mode 100644 frontend/src/lib/actions/controlkey.js rename frontend/src/lib/{actions.js => actions/input.js} (91%) create mode 100644 frontend/src/lib/constants.js create mode 100644 frontend/src/lib/keypaths.js create mode 100644 frontend/src/lib/math.js create mode 100644 frontend/src/lib/mongo.js delete mode 100644 frontend/src/lib/utils.js diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..6d57a96 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,51 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "npm install", + "type": "npm", + "script": "install", + "options": { + "cwd": "${workspaceFolder}/frontend" + }, + "presentation": { + "clear": true, + "panel": "shared", + "showReuseMessage": false + }, + "problemMatcher": [] + }, + { + "label": "npm run build", + "type": "npm", + "script": "build", + "options": { + "cwd": "${workspaceFolder}/frontend" + }, + "presentation": { + "clear": true, + "panel": "shared", + "showReuseMessage": false + }, + "problemMatcher": [] + }, + { + "label": "build", + "type": "shell", + "options": { + "cwd": "${workspaceFolder}" + }, + "command": "go", + "args": [ + "build", + "-tags", + "dev", + "-gcflags", + "all=-N -l", + "-o", + "build/bin/vscode.exe" + ], + "dependsOn": ["npm install", "npm run build"] + } + ] +} diff --git a/frontend/jsconfig.json b/frontend/jsconfig.json index 3918b4f..9660d5f 100644 --- a/frontend/jsconfig.json +++ b/frontend/jsconfig.json @@ -3,33 +3,22 @@ "moduleResolution": "Node", "target": "ESNext", "module": "ESNext", - /** - * svelte-preprocess cannot figure out whether you have - * a value or a type, so tell TypeScript to enforce using - * `import type` instead of `import` for Types. - */ "importsNotUsedAsValues": "error", "isolatedModules": true, "resolveJsonModule": true, - /** - * To have warnings / errors of the Svelte compiler at the - * correct position, enable source maps by default. - */ "sourceMap": true, "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "baseUrl": ".", - /** - * Typecheck JS in `.svelte` and `.js` files by default. - * Disable this if you'd like to use dynamic types. - */ - "checkJs": true + "checkJs": true, + "paths": { + "$components/*": ["src/components/*"], + "$organisms/*": ["src/organisms/*"], + "$wails/*": ["wailsjs/*"], + "$lib/*": ["src/lib/*"] + } }, - /** - * Use global.d.ts instead of compilerOptions.types - * to avoid limiting type declarations. - */ "include": [ "src/**/*.d.ts", "src/**/*.js", diff --git a/frontend/src/app.svelte b/frontend/src/app.svelte index 14d65de..f03b9d7 100644 --- a/frontend/src/app.svelte +++ b/frontend/src/app.svelte @@ -1,13 +1,13 @@ diff --git a/frontend/src/organisms/connection/collection/components/form.svelte b/frontend/src/organisms/connection/collection/components/form.svelte index b5e2798..eb777ce 100644 --- a/frontend/src/organisms/connection/collection/components/form.svelte +++ b/frontend/src/organisms/connection/collection/components/form.svelte @@ -1,7 +1,8 @@ diff --git a/frontend/src/organisms/connection/collection/update.svelte b/frontend/src/organisms/connection/collection/update.svelte index 4482472..ad68597 100644 --- a/frontend/src/organisms/connection/collection/update.svelte +++ b/frontend/src/organisms/connection/collection/update.svelte @@ -1,8 +1,8 @@ diff --git a/frontend/vite.config.js b/frontend/vite.config.js index f7acf5d..f0efb9a 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -1,7 +1,18 @@ import { defineConfig } from 'vite'; import { svelte } from '@sveltejs/vite-plugin-svelte'; +import { dirname } from 'path'; +import { fileURLToPath } from 'url'; + +const currentDir = dirname(fileURLToPath(import.meta.url)); -// https://vitejs.dev/config/ export default defineConfig({ plugins: [ svelte() ], + resolve: { + alias: { + '$components': currentDir + '/src/components', + '$organisms': currentDir + '/src/organisms', + '$wails': currentDir + '/wailsjs', + '$lib': currentDir + '/src/lib', + }, + }, });