diff --git a/src/App.svelte b/src/App.svelte
index d978a04..ce27260 100644
--- a/src/App.svelte
+++ b/src/App.svelte
@@ -4,8 +4,8 @@
import FontDialog from '@/components/font-dialog/FontDialog.svelte';
import Shortcuts from '@/components/Shortcuts.svelte';
import { Toaster } from '@/components/ui/sonner';
- import favIcon from '@assets/images/favicon.png';
- import favIconDark from '@assets/images/favicon-dark.png';
+ import favIcon from '@/src/assets/images/favicon.png';
+ import favIconDark from '@/src/assets/images/favicon-dark.png';
import { mode, ModeWatcher } from 'mode-watcher';
import { Notpad } from '@/helpers/notpad';
import AboutDialog from '@/components/AboutDialog.svelte';
diff --git a/src/app.json b/src/app.json
new file mode 100644
index 0000000..4777b31
--- /dev/null
+++ b/src/app.json
@@ -0,0 +1,3 @@
+{
+ "version": "1.0.0-1"
+}
\ No newline at end of file
diff --git a/src/lib/components/AboutDialog.svelte b/src/lib/components/AboutDialog.svelte
index 83ca244..29547f8 100644
--- a/src/lib/components/AboutDialog.svelte
+++ b/src/lib/components/AboutDialog.svelte
@@ -11,8 +11,8 @@
@@ -48,7 +49,7 @@
Notpad
- Version {window.APP_VERSION}
+ Version {appJson.version}
Muhammed-Rahif
© 2024. All rights reserved.
@@ -59,11 +60,11 @@
organize your thoughts. It is designed to be minimal and distraction-free, so you can focus
on your ideas. Notpad is an open-source project. You can contribute to the project by fixing
bugs, improving the codebase, or adding new features. The project is hosted on
- GitHub
+ GitHub.
If you have any questions, feedback, or suggestions, feel free to
- create an issue
- .
+ create an issue.
+
{#await Notpad.github.getContributors() then contributors}
diff --git a/src/lib/components/MenuBar.svelte b/src/lib/components/MenuBar.svelte
index 0e9d884..df02b48 100644
--- a/src/lib/components/MenuBar.svelte
+++ b/src/lib/components/MenuBar.svelte
@@ -4,7 +4,7 @@
import { Notpad } from '@/helpers/notpad';
import { editors, settings } from '@/store/store';
import { fade } from 'svelte/transition';
- import { isTauri } from '$lib';
+ import { isTauri } from '@/src/lib';
import screenfull from 'screenfull';
import { toggleMode, mode } from 'mode-watcher';
import { onMount } from 'svelte';
diff --git a/src/lib/helpers/file-options.ts b/src/lib/helpers/file-options.ts
index 659f00c..6ac7ef0 100644
--- a/src/lib/helpers/file-options.ts
+++ b/src/lib/helpers/file-options.ts
@@ -3,7 +3,7 @@ import { get } from 'svelte/store';
import { findAsyncSequential } from '@/utils';
import { Notpad } from '@/helpers/notpad';
import { open, save } from '@tauri-apps/plugin-dialog';
-import { isMobile, isTauri } from '$lib';
+import { isMobile, isTauri } from '@/src/lib';
import { readTextFile, BaseDirectory, exists, writeTextFile } from '@tauri-apps/plugin-fs';
import { toast } from 'svelte-sonner';
import { Delta } from 'quill/core';
diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts
index f020d22..955db5b 100644
--- a/src/vite-env.d.ts
+++ b/src/vite-env.d.ts
@@ -1,11 +1,3 @@
///
///
///
-
-declare global {
- interface Window {
- APP_VERSION: string;
- }
-}
-
-export {};
diff --git a/tsconfig.json b/tsconfig.json
index d486d50..c695958 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -16,9 +16,8 @@
"isolatedModules": true,
"baseUrl": ".",
"paths": {
- "$lib": ["./src/lib"],
- "@/*": ["./src/lib/*"],
- "@/assets/*": ["./src/assets/*"]
+ "@/src/*": ["./src/*"],
+ "@/*": ["./src/lib/*"]
}
},
"include": ["src/**/*.ts", "src/**/*.js", "src/**/*.svelte"],
diff --git a/vite.config.ts b/vite.config.ts
index 2da9e63..3958d45 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -2,6 +2,7 @@ import { VitePWA } from 'vite-plugin-pwa';
import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
import path from 'path';
+import fs from 'fs';
function baseUrl() {
const baseArgIndex = process.argv.indexOf('--base');
@@ -11,13 +12,21 @@ function baseUrl() {
return null;
}
+(function () {
+ // create a app.json with version using process.env.npm_package_version
+ const appJson = path.resolve('./src/app.json');
+ const content = {
+ version: process.env.npm_package_version
+ };
+ fs.writeFileSync(appJson, JSON.stringify(content, null, 2));
+})();
+
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
alias: {
- $lib: path.resolve('./src/lib'),
- '@': path.resolve('./src/lib'),
- '@assets': path.resolve('./src/assets')
+ '@/src': path.resolve('./src'),
+ '@': path.resolve('./src/lib')
}
},
define: {