-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add runtime build watch, remove custom condition, update TS templates #11
base: v3-alpha-feature/event-types
Are you sure you want to change the base?
Conversation
This will avoid churn when users `npm install` another package, for instance
@@ -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>[] = []; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
And also add a `type` import
The templates all use 5.x
They are used in the generated bindings, after all
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore: Unused imports | ||
import { Call as $Call, CancellablePromise as $CancellablePromise{{if not $useInterfaces}}, Create as $Create{{end}} } from "{{js $runtime}}"; | ||
import { Call as $Call, type CancellablePromise as $CancellablePromise{{if not $useInterfaces}}, Create as $Create{{end}} } from "{{js $runtime}}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure we can have a type
import here in the JS template. JS output has to work out of the box in all supported webviews without any bundler/transpiler.
We should probably make this a tsdoc import:
/**
* @import { CancellablePromise as $CancellablePromise } from "@wailsio/runtime"
*/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah thanks, got over-eager and thought this was TS, probably because of the @ts-ignore
comment. Should have looked more closely at the file extension.
"./plugins/*": "./plugins/*" | ||
"./plugins/*": { | ||
"types": "./types/plugins/*.d.ts", | ||
"default": "./dist/plugins/*.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure the build command is generating these files? I think the tsconfig still includes src only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved plugins
into src/plugins
, so that it is processed along with the rest of the code.
@@ -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>[] = []; |
There was a problem hiding this comment.
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
@@ -44,9 +44,6 @@ export { | |||
|
|||
/** | |||
* An internal utility consumed by the binding generator. | |||
* | |||
* @ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should still be @ignore
d though, so that it is omitted from the docs.
In a future PR I'm going to move this out of the runtime and into bindings as part of a deduplication effort.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to omit from docs but not from types?
Edit: okay, looks like @internal
trims the type from the declaration, and @ignore
prevents it from being included in the docs. 👍
@@ -1,5 +1,5 @@ | |||
{ | |||
"compilerOptions": { | |||
"compilerOptions": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think some end-of-line spaces have been added accidentally here and on another line (unless I'm misreading the gh diff and they've been removed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Really wish prettier or another formatter was being used in this project.
This:
package.json
intopackage.json.tmpl
dependencies
and devDependencies` correctly.vite.config.ts
for all ts templatesI also added a
npm run build:code:watch
script, so that developers can run that and be sure that changes to the runtime code is compiled to be consumed by linked projects. I've also added a README to describe the local development process of@wailsio/runtime
.I also did a few other things here:
// @ts-ignore
comments from generated bindings, and instead created a customtsconfig.bindings.json
project which allows us to have its own config. I'm also "include"ing the"bindings"
directory in the core tsconfig as well, and I'm not sure if that will cause trouble, but it allows a cmd+click onEvents
to go to theeventdata.d.ts
, for example. Maybe we can refine this.Create
to be exported. The function is exported, and it's used from the generated bindings, so by preventing the types from being created, it just caused unnecessary errors.