forked from tauri-apps/tauri-plugin-sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Rewrite svelte example (tauri-apps#170)
* new svelte example * ignore all target dirs * move example a folder up * remove old svelte example * fix path error due to project relocation Co-authored-by: FabianLars <[email protected]>
- Loading branch information
1 parent
deefe16
commit 3128e46
Showing
90 changed files
with
840 additions
and
1,266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ debug.log | |
package-lock.json | ||
yarn.lock | ||
|
||
/target | ||
target | ||
Cargo.lock | ||
node_modules/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Tauri-Sql Plugin Todo Example</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.ts"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "svelte-ts", | ||
"private": true, | ||
"version": "1.2.0", | ||
"type": "module", | ||
"scripts": { | ||
"tauri":"tauri", | ||
"dev": "vite", | ||
"build": "vite build", | ||
"preview": "vite preview", | ||
"check": "svelte-check --tsconfig ./tsconfig.json" | ||
}, | ||
"devDependencies": { | ||
"@sveltejs/vite-plugin-svelte": "^1.1.0", | ||
"@tauri-apps/api": "^1.2.0", | ||
"@tauri-apps/cli": "^1.2.0", | ||
"@tsconfig/svelte": "^3.0.0", | ||
"svelte": "^3.52.0", | ||
"svelte-check": "^2.9.2", | ||
"svelte-preprocess": "^4.10.7", | ||
"tslib": "^2.4.0", | ||
"typescript": "^4.6.4", | ||
"vite": "^3.2.3" | ||
}, | ||
"dependencies": { | ||
"tauri-plugin-sql-api": "../.." | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[package] | ||
name = "app" | ||
version = "0.1.0" | ||
description = "A Tauri App" | ||
authors = ["you"] | ||
license = "" | ||
repository = "" | ||
default-run = "app" | ||
edition = "2021" | ||
rust-version = "1.59" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[build-dependencies] | ||
tauri-build = { version = "1.2.0", features = [] } | ||
|
||
[dependencies] | ||
serde_json = "1.0" | ||
serde = { version = "1.0", features = ["derive"] } | ||
tauri = { version = "1.2.0", features = ["api-all"] } | ||
tauri-plugin-sql = { path = "../../..", features = ["sqlite"] } | ||
|
||
[features] | ||
# by default Tauri runs in production mode | ||
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL | ||
default = [ "custom-protocol" ] | ||
# this feature is used for production builds where `devPath` points to the filesystem | ||
# DO NOT remove this | ||
custom-protocol = [ "tauri/custom-protocol" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn main() { | ||
tauri_build::build() | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#![cfg_attr( | ||
all(not(debug_assertions), target_os = "windows"), | ||
windows_subsystem = "windows" | ||
)] | ||
|
||
use tauri_plugin_sql::{Migration, MigrationKind, TauriSql}; | ||
|
||
fn main() { | ||
tauri::Builder::default() | ||
.plugin(TauriSql::default()) | ||
.run(tauri::generate_context!()) | ||
.expect("error while running tauri application"); | ||
} |
67 changes: 32 additions & 35 deletions
67
examples/todos-app/src-tauri/tauri.conf.json → examples/svelte-ts/src-tauri/tauri.conf.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,66 @@ | ||
{ | ||
"package": { | ||
"productName": "todos-app", | ||
"version": "0.1.0" | ||
}, | ||
"$schema": "../node_modules/@tauri-apps/cli/schema.json", | ||
"build": { | ||
"distDir": "../build", | ||
"devPath": "http://localhost:5173", | ||
"beforeDevCommand": "yarn dev", | ||
"beforeBuildCommand": "yarn build" | ||
"beforeBuildCommand": "npm run build", | ||
"beforeDevCommand": "npm run dev", | ||
"devPath": "http://localhost:1420", | ||
"distDir": "../dist" | ||
}, | ||
"package": { | ||
"productName": "svelte-todo", | ||
"version": "0.0.1" | ||
}, | ||
"tauri": { | ||
"systemTray": { | ||
"iconPath": "icons/icon.png", | ||
"iconAsTemplate": true | ||
"allowlist": { | ||
"all": true | ||
}, | ||
"bundle": { | ||
"active": true, | ||
"targets": "all", | ||
"identifier": "com.parker-codes.todos-app", | ||
"category": "DeveloperTool", | ||
"copyright": "", | ||
"deb": { | ||
"depends": [] | ||
}, | ||
"externalBin": [], | ||
"icon": [ | ||
"icons/32x32.png", | ||
"icons/128x128.png", | ||
"icons/[email protected]", | ||
"icons/icon.icns", | ||
"icons/icon.ico" | ||
], | ||
"resources": [], | ||
"externalBin": [], | ||
"copyright": "", | ||
"category": "Productivity", | ||
"shortDescription": "Handy TODOs app!", | ||
"identifier": "com.tauri.example", | ||
"longDescription": "", | ||
"deb": { | ||
"depends": [] | ||
}, | ||
"macOS": { | ||
"frameworks": [], | ||
"minimumSystemVersion": "", | ||
"entitlements": null, | ||
"exceptionDomain": "", | ||
"signingIdentity": null, | ||
"entitlements": null | ||
"frameworks": [], | ||
"providerShortName": null, | ||
"signingIdentity": null | ||
}, | ||
"resources": [], | ||
"shortDescription": "", | ||
"targets": "all", | ||
"windows": { | ||
"certificateThumbprint": null, | ||
"digestAlgorithm": "sha256", | ||
"timestampUrl": "" | ||
} | ||
}, | ||
"security": { | ||
"csp": null | ||
}, | ||
"updater": { | ||
"active": false | ||
}, | ||
"allowlist": { | ||
"all": true | ||
}, | ||
"windows": [ | ||
{ | ||
"title": "TODOs", | ||
"width": 800, | ||
"fullscreen": false, | ||
"height": 600, | ||
"resizable": true, | ||
"fullscreen": false | ||
"title": "Svelte-Todo Example", | ||
"width": 800 | ||
} | ||
], | ||
"security": { | ||
"csp": "default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<script> | ||
import TodoDisplay from './lib/components/todo/display/TodoDisplay.svelte'; | ||
import TodoCreator from './lib/components/todo/create/TodoCreator.svelte'; | ||
</script> | ||
|
||
<main> | ||
<div class="container"> | ||
<TodoCreator /> | ||
<TodoDisplay /> | ||
</div> | ||
</main> | ||
|
||
<style> | ||
:global(:root) { | ||
--primary: #c6d7dd; | ||
--secondary: #c0c0c2; | ||
--bg-100: rgb(94, 94, 94); | ||
--bg-200: #424242; | ||
--bg-300: #252525; | ||
--bg-400: #202020; | ||
} | ||
main { | ||
min-height: 100vh; | ||
min-width: 100vw; | ||
background-color: var(--bg-300); | ||
} | ||
.container { | ||
max-width: 600px; | ||
margin: auto; | ||
padding: 1rem 0; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1rem; | ||
} | ||
</style> |
Oops, something went wrong.