Skip to content

Commit

Permalink
chore: Rewrite svelte example (tauri-apps#170)
Browse files Browse the repository at this point in the history
* 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
Fractal-Tess and FabianLars authored Nov 16, 2022
1 parent deefe16 commit 3128e46
Show file tree
Hide file tree
Showing 90 changed files with 840 additions and 1,266 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ debug.log
package-lock.json
yarn.lock

/target
target
Cargo.lock
node_modules/

Expand Down
13 changes: 13 additions & 0 deletions examples/svelte-ts/index.html
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>
28 changes: 28 additions & 0 deletions examples/svelte-ts/package.json
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": "../.."
}
}
1 change: 1 addition & 0 deletions examples/svelte-ts/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions examples/svelte-ts/src-tauri/Cargo.toml
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" ]
3 changes: 3 additions & 0 deletions examples/svelte-ts/src-tauri/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
tauri_build::build()
}
Binary file added examples/svelte-ts/src-tauri/icons/128x128.png
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 added examples/svelte-ts/src-tauri/icons/32x32.png
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 added examples/svelte-ts/src-tauri/icons/StoreLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/svelte-ts/src-tauri/icons/icon.icns
Binary file not shown.
Binary file added examples/svelte-ts/src-tauri/icons/icon.ico
Binary file not shown.
Binary file added examples/svelte-ts/src-tauri/icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions examples/svelte-ts/src-tauri/src/main.rs
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");
}
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'"
}
]
}
}
36 changes: 36 additions & 0 deletions examples/svelte-ts/src/App.svelte
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>
Loading

0 comments on commit 3128e46

Please sign in to comment.