Skip to content

Commit

Permalink
chore: update template project to use [email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
Zakrok09 committed Aug 26, 2024
1 parent ee5d3f9 commit b4d1d0c
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/serpenta-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/serpenta-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@delft-hyperloop/create-serpenta-app",
"version": "0.1.5",
"version": "0.2.0",
"description": "A starter template for working with serpenta. Creates the routes and Tauri base files",
"main": "index.mjs",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion packages/serpenta-app/template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"type": "module",
"dependencies": {
"@delft-hyperloop/serpenta": "0.2.0",
"@delft-hyperloop/serpenta": "0.3.1",
"@tauri-apps/api": "^1.6.0",
"zod": "^3.23.4"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/serpenta-app/template/src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export type NamedCommand = "command";
export const NamedCommandValues:NamedCommand[] = ["command"];

/*AUTO GENERATED USING npm run generate:datatypes */
export type NamedDatatype = "Datatype1" | "Datatype2" | "Datatype3" | "Datatype4" | "Datatype5" | "Datatype6" | "Datatype7";
export type NamedDatatype = "Datatype1" | "Datatype2" | "Datatype3" | "Datatype4" | "Datatype5" | "Datatype6" | "Datatype7" | "FSMState";
export const NamedDatatypeValues = ["Datatype1", "Datatype2", "Datatype3", "Datatype4", "Datatype5", "Datatype6", "Datatype7"];
// Not touched by auto-gen

Expand Down
8 changes: 8 additions & 0 deletions packages/serpenta-app/template/src/lib/util/CommandInvoker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { CommandInvocation } from "@delft-hyperloop/serpenta";
import { invoke } from "@tauri-apps/api/tauri";

export class CommandInvoker implements CommandInvocation {
invokeCommand<T>(commandName: string, args: Record<string, unknown>): Promise<T> {
return invoke<T>(commandName, args);
}
}
8 changes: 8 additions & 0 deletions packages/serpenta-app/template/src/lib/util/WindowControl.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { WebviewWindow, type WindowOptions } from "@tauri-apps/api/window"

import type { WindowEngine } from "@delft-hyperloop/serpenta";

export class ViewWindow {
private readonly _webview: WebviewWindow

Expand All @@ -14,4 +16,10 @@ export class ViewWindow {
console.error("Error creating window", e)
})
}
}

export class WindowCreator implements WindowEngine<WindowOptions> {
spawnWindow(url: string, label: string): void {
new ViewWindow(label, url);
}
}
9 changes: 8 additions & 1 deletion packages/serpenta-app/template/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import "../app.postcss";
import { initializeStores } from "@skeletonlabs/skeleton";
import { SerpentaShell, defineConfig, PlotBuffer, StrokePresets } from "@delft-hyperloop/serpenta";
import { SerpentaShell, defineConfig } from "@delft-hyperloop/serpenta";
initializeStores();
Expand All @@ -14,6 +14,8 @@
import { appWindow } from "@tauri-apps/api/window";
import { writable } from "svelte/store";
import { GrandDataDistributor } from "$lib/util/GrandDataDistributor";
import { WindowCreator } from "$lib/util/WindowControl";
import { CommandInvoker } from "$lib/util/CommandInvoker";
const gdd = GrandDataDistributor.getInstance();
gdd.registerStore("Datatype1", 0, undefined, "V");
Expand All @@ -25,12 +27,17 @@
gdd.registerStore("Datatype7", 0, undefined, "V");
gdd.registerStore("FSMState", 0);
const wm = new WindowCreator();
const ci = new CommandInvoker();
const config = defineConfig({
appWindow: appWindow,
pod_name: "Helios III",
// @todo: see if you will use the default grand data distributor - K.P.
grand_data_distributor: gdd,
window_engine: wm,
command_invocation: ci,
latest_timestamp: latestTimestamp
});
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<script lang="ts">
import {
ProceduresTab,
} from "$lib"
import type { PageData } from './$types';
export let data: PageData;
</script>

Expand All @@ -26,5 +22,4 @@
<!--{:else if data.index === 7}-->
<!-- <DebugTab pop_up={false} />-->
<!--{/if}-->
<ProceduresTab pop_up={false} />
</div>

0 comments on commit b4d1d0c

Please sign in to comment.