Skip to content

Add runtime build watch, remove custom condition, update TS templates #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: v3-alpha-feature/event-types
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions v3/internal/generator/render/templates/eventdata.d.ts.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{{- $models := (fixext $module.ModelsFile)}}
{{- $imports := $module.Imports}}
{{- with .Events -}}
/// <reference types="@wailsio/runtime/global" />
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
{{if .Defs}}
Expand Down
3 changes: 3 additions & 0 deletions v3/internal/runtime/desktop/@wailsio/runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"types": "./types/index.d.ts",
"default": "./dist/index.js"
},
"./global": {
"wails-development": "./src/global.d.ts"
},
"./plugins/*": "./plugins/*"
},
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ function rejectorFor<T>(promise: CancellablePromiseWithResolvers<T>, state: Canc
* Returns a promise that fulfills once all cancellation procedures for the given values have settled.
*/
function cancelAll(parent: CancellablePromise<unknown>, values: any[], cause?: any): Promise<void> {
const results = [];
const results: Promise<any>[] = [];
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was throwing an error in the lit-ts project without this. I'm not sure why it didn't error in the runtime project too.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. A stricter Promise<void>[] should be fine as well. Still good though


for (const value of values) {
let cancel: CancellablePromiseCanceller;
Expand Down Expand Up @@ -931,4 +931,4 @@ if (promiseWithResolvers && typeof promiseWithResolvers === 'function') {
const promise = new Promise<T>((res, rej) => { resolve = res; reject = rej; });
return { promise, resolve, reject };
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
"build": "vite build --mode production",
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "{{if .LocalModulePath}}file:../{{.LocalModulePath}}v3/internal/runtime/desktop/@wailsio/runtime{{else}}latest{{end}}",
},
"devDependencies": {
"vite": "^5.0.0",
"@wailsio/runtime": "latest"
"vite": "^5.0.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "{{if .LocalModulePath}}file:../{{.LocalModulePath}}v3/internal/runtime/desktop/@wailsio/runtime{{else}}latest{{end}}",
"lit": "^3.1.0"
},
"devDependencies": {
"typescript": "^5.2.2",
"vite": "^5.0.0",
"@wailsio/runtime": "latest"
"vite": "^5.0.0"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"compilerOptions": {
"target": "ES2020",
"compilerOptions": {
"target": "ESNext",
"experimentalDecorators": true,
"useDefineForClassFields": false,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"skipLibCheck": true,

/* Bundler mode */
Expand All @@ -19,7 +19,9 @@
"noUnusedLocals": true,
"noUnusedParameters": false,
"noImplicitAny": false,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,

{{if .LocalModulePath}}"customConditions": ["wails-development"],{{end}}
},
"include": ["src"]
"include": ["src/**/*", "bindings/**/*.d.ts"],
}
21 changes: 21 additions & 0 deletions v3/internal/templates/lit-ts/frontend/vite.config.ts.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { defineConfig } from "vite";
import WailsTypedEvents from "@wailsio/runtime/plugins/vite";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [WailsTypedEvents("./bindings")],
{{- if .LocalModulePath}}
resolve: {
// Configure the resolution system to import the development version of the runtime package.
// This is only correct when using a development version of wails directly from the repository.
// Otherwise, this option (as well as the matching one in the tsconfig.json file) should be removed.
conditions: ["wails-development"]
},
{{- end}}
build: {
// Wails supports deployment on macOS 10.13 High Sierra,
// whose webview is based on the same runtime as Safari 11.
// If the project targets later macOS versions, this option may be changed or removed.
target: "safari11"
}
})
4 changes: 2 additions & 2 deletions v3/internal/templates/lit/frontend/package.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "{{if .LocalModulePath}}file:../{{.LocalModulePath}}v3/internal/runtime/desktop/@wailsio/runtime{{else}}latest{{end}}",
"lit": "^3.1.0"
},
"devDependencies": {
"vite": "^5.0.0",
"@wailsio/runtime": "{{if .LocalModulePath}}file:../{{.LocalModulePath}}v3/internal/runtime/desktop/@wailsio/runtime{{else}}latest{{end}}"
"vite": "^5.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "{{if .LocalModulePath}}file:../{{.LocalModulePath}}v3/internal/runtime/desktop/@wailsio/runtime{{else}}latest{{end}}",
"preact": "^10.19.3"
},
"devDependencies": {
"@preact/preset-vite": "^2.7.0",
"typescript": "^5.2.2",
"vite": "^5.0.8",
"@wailsio/runtime": "latest"
"vite": "^5.0.8"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
"noUnusedLocals": true,
"noUnusedParameters": false,
"noImplicitAny": false,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,

{{if .LocalModulePath}}"customConditions": ["wails-development"],{{end}}
},
"include": ["src"],
"include": ["src/**/*", "bindings/**/*.d.ts"],
"references": [{ "path": "./tsconfig.node.json" }]
}
7 changes: 0 additions & 7 deletions v3/internal/templates/preact-ts/frontend/vite.config.ts

This file was deleted.

25 changes: 25 additions & 0 deletions v3/internal/templates/preact-ts/frontend/vite.config.ts.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { defineConfig } from 'vite'
import preact from '@preact/preset-vite'
import WailsTypedEvents from "@wailsio/runtime/plugins/vite";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [
preact(),
WailsTypedEvents("./bindings"),
],
{{- if .LocalModulePath}}
resolve: {
// Configure the resolution system to import the development version of the runtime package.
// This is only correct when using a development version of wails directly from the repository.
// Otherwise, this option (as well as the matching one in the tsconfig.json file) should be removed.
conditions: ["wails-development"]
},
{{- end}}
build: {
// Wails supports deployment on macOS 10.13 High Sierra,
// whose webview is based on the same runtime as Safari 11.
// If the project targets later macOS versions, this option may be changed or removed.
target: "safari11"
}
})
4 changes: 2 additions & 2 deletions v3/internal/templates/preact/frontend/package.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "{{if .LocalModulePath}}file:../{{.LocalModulePath}}v3/internal/runtime/desktop/@wailsio/runtime{{else}}latest{{end}}",
"preact": "^10.19.3"
},
"devDependencies": {
"@preact/preset-vite": "^2.7.0",
"vite": "^5.0.8",
"@wailsio/runtime": "{{if .LocalModulePath}}file:../{{.LocalModulePath}}v3/internal/runtime/desktop/@wailsio/runtime{{else}}latest{{end}}"
"vite": "^5.0.8"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"build": "tsc && vite build --mode production",
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "{{if .LocalModulePath}}file:../{{.LocalModulePath}}v3/internal/runtime/desktop/@wailsio/runtime{{else}}latest{{end}}",
"@builder.io/qwik": "^1.3.0"
},
"devDependencies": {
"typescript": "^5.2.2",
"vite": "^5.0.8"
},
"dependencies": {
"@builder.io/qwik": "^1.3.0",
"@wailsio/runtime": "latest"
}
}
1 change: 1 addition & 0 deletions v3/internal/templates/qwik-ts/frontend/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
"noUnusedLocals": true,
"noUnusedParameters": false,
"noImplicitAny": false,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,

{{if .LocalModulePath}}"customConditions": ["wails-development"],{{end}}
},
"include": ["src"],
"include": ["src/**/*", "bindings/**/*.d.ts"],
"references": [{ "path": "./tsconfig.node.json" }]
}
11 changes: 0 additions & 11 deletions v3/internal/templates/qwik-ts/frontend/vite.config.js

This file was deleted.

27 changes: 27 additions & 0 deletions v3/internal/templates/qwik-ts/frontend/vite.config.ts.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { defineConfig } from 'vite'
import { qwikVite } from '@builder.io/qwik/optimizer'
import WailsTypedEvents from "@wailsio/runtime/plugins/vite";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [
qwikVite({
csr: true,
}),
WailsTypedEvents("./bindings"),
],
{{- if .LocalModulePath}}
resolve: {
// Configure the resolution system to import the development version of the runtime package.
// This is only correct when using a development version of wails directly from the repository.
// Otherwise, this option (as well as the matching one in the tsconfig.json file) should be removed.
conditions: ["wails-development"]
},
{{- end}}
build: {
// Wails supports deployment on macOS 10.13 High Sierra,
// whose webview is based on the same runtime as Safari 11.
// If the project targets later macOS versions, this option may be changed or removed.
target: "safari11"
}
})
8 changes: 4 additions & 4 deletions v3/internal/templates/qwik/frontend/package.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"build:dev": "vite build --minify false --mode development",
"build": "vite build --mode production",
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "{{if .LocalModulePath}}file:../{{.LocalModulePath}}v3/internal/runtime/desktop/@wailsio/runtime{{else}}latest{{end}}",
"@builder.io/qwik": "^1.3.0"
},
"devDependencies": {
"typescript": "^5.2.2",
"vite": "^5.0.8"
},
"dependencies": {
"@builder.io/qwik": "^1.3.0",
"@wailsio/runtime": "{{if .LocalModulePath}}file:../{{.LocalModulePath}}v3/internal/runtime/desktop/@wailsio/runtime{{else}}latest{{end}}"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "{{if .LocalModulePath}}file:../{{.LocalModulePath}}v3/internal/runtime/desktop/@wailsio/runtime{{else}}latest{{end}}",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand All @@ -18,7 +19,6 @@
"@types/react-dom": "^18.2.17",
"@vitejs/plugin-react-swc": "^3.5.0",
"typescript": "^5.2.2",
"vite": "^5.0.8",
"@wailsio/runtime": "latest"
"vite": "^5.0.8"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
"noUnusedLocals": true,
"noUnusedParameters": false,
"noImplicitAny": false,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,

{{if .LocalModulePath}}"customConditions": ["wails-development"],{{end}}
},
"include": ["src"],
"include": ["src/**/*", "bindings/**/*.d.ts"],
"references": [{ "path": "./tsconfig.node.json" }]
}
7 changes: 0 additions & 7 deletions v3/internal/templates/react-swc-ts/frontend/vite.config.ts

This file was deleted.

25 changes: 25 additions & 0 deletions v3/internal/templates/react-swc-ts/frontend/vite.config.ts.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { defineConfig } from "vite";
import react from '@vitejs/plugin-react-swc'
import WailsTypedEvents from "@wailsio/runtime/plugins/vite";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
WailsTypedEvents("./bindings"),
],
{{- if .LocalModulePath}}
resolve: {
// Configure the resolution system to import the development version of the runtime package.
// This is only correct when using a development version of wails directly from the repository.
// Otherwise, this option (as well as the matching one in the tsconfig.json file) should be removed.
conditions: ["wails-development"]
},
{{- end}}
build: {
// Wails supports deployment on macOS 10.13 High Sierra,
// whose webview is based on the same runtime as Safari 11.
// If the project targets later macOS versions, this option may be changed or removed.
target: "safari11"
}
})
4 changes: 2 additions & 2 deletions v3/internal/templates/react-swc/frontend/package.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "{{if .LocalModulePath}}file:../{{.LocalModulePath}}v3/internal/runtime/desktop/@wailsio/runtime{{else}}latest{{end}}",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.2.43",
"@types/react-dom": "^18.2.17",
"@vitejs/plugin-react-swc": "^3.5.0",
"vite": "^5.0.8",
"@wailsio/runtime": "{{if .LocalModulePath}}file:../{{.LocalModulePath}}v3/internal/runtime/desktop/@wailsio/runtime{{else}}latest{{end}}"
"vite": "^5.0.8"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "{{if .LocalModulePath}}file:../{{.LocalModulePath}}v3/internal/runtime/desktop/@wailsio/runtime{{else}}latest{{end}}",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand All @@ -18,7 +19,6 @@
"@types/react-dom": "^18.2.17",
"@vitejs/plugin-react": "^4.2.1",
"typescript": "^5.2.2",
"vite": "^5.0.8",
"@wailsio/runtime": "latest"
"vite": "^5.0.8"
}
}
Loading
Loading