Skip to content

Commit

Permalink
fix(about): version is undefined and repo url is incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammed-Rahif committed Oct 17, 2024
1 parent 0b0072b commit 254846b
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
3 changes: 3 additions & 0 deletions src/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"version": "1.0.0-1"
}
9 changes: 5 additions & 4 deletions src/lib/components/AboutDialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<script lang="ts">
import { Button } from '@/components/ui/button';
import * as Dialog from '@/components/ui/dialog';
import appIconLight from '@assets/images/Notpad Logo Light.svg';
import appIconDark from '@assets/images/Notpad Logo Dark.svg';
import appIconLight from '@/src/assets/images/Notpad Logo Light.svg';
import appIconDark from '@/src/assets/images/Notpad Logo Dark.svg';
import GitHubIcon from '@/components/icons/GItHub.svelte';
import Separator from '@/components/ui/separator/separator.svelte';
import { Badge } from '@/components/ui/badge';
Expand All @@ -21,6 +21,7 @@
import type { ButtonEventHandler } from 'bits-ui';
import { Notpad } from '@/helpers/notpad';
import { slide } from 'svelte/transition';
import appJson from '@/src/app.json';
function closeDialog() {
open.set(false);
Expand All @@ -34,7 +35,7 @@
function openGithubRepo(e: ButtonEventHandler<MouseEvent>) {
e.stopPropagation();
e.preventDefault();
window.open('https://github.com/Muhammed-Rahif', '_blank');
window.open('https://github.com/Muhammed-Rahif/Notpad', '_blank');
}
</script>

Expand All @@ -48,7 +49,7 @@

<div>
<span class="text-xl font-bold">Notpad</span><br />
Version {window.APP_VERSION}<br />
Version {appJson.version}<br />
<a href="https://github.com/Muhammed-Rahif" target="_blank">Muhammed-Rahif</a>
<span class="text-sm">© 2024. All rights reserved.</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/MenuBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/helpers/file-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
8 changes: 0 additions & 8 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
/// <reference types="svelte" />
/// <reference types="vite/client" />
/// <reference types="vite-plugin-pwa/svelte" />

declare global {
interface Window {
APP_VERSION: string;
}
}

export {};
5 changes: 2 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
15 changes: 12 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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: {
Expand Down

0 comments on commit 254846b

Please sign in to comment.