-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[v3] Fix binding generator output and import paths (#3334)
* Fix relative import path computation * Fix models output path * Add option to generate bindings using bundled runtime * Update binding example * Fix testdata * Update changelog --------- Co-authored-by: Lea Anthony <[email protected]>
- Loading branch information
1 parent
f0986a6
commit 45b2681
Showing
56 changed files
with
364 additions
and
372 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
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
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
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 @@ | ||
// @ts-check | ||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL | ||
// This file is automatically generated. DO NOT EDIT | ||
|
||
// Person holds someone's most important attributes | ||
export const Person = class { | ||
/** | ||
* Creates a new Person instance. | ||
* @constructor | ||
* @param {Object} source - The source object to create the Person. | ||
* @param {string} source.Name | ||
*/ | ||
constructor(source = {}) { | ||
const { name = "" } = source; | ||
this.name = name; | ||
} | ||
|
||
/** | ||
* Creates a new Person instance from a string or object. | ||
* @param {string|object} source - The source data to create a Person instance from. | ||
* @returns {Person} A new Person instance. | ||
*/ | ||
static createFrom(source) { | ||
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; | ||
return new Person(parsedSource); | ||
} | ||
}; | ||
|
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 @@ | ||
// @ts-check | ||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL | ||
// This file is automatically generated. DO NOT EDIT | ||
|
||
import {Call} from '/wails/runtime.js'; | ||
/** | ||
* @typedef {import('../data/models').Person} dataPerson | ||
*/ | ||
|
||
/** | ||
* Greet greets a person | ||
* @function Greet | ||
* @param name {string} | ||
* @returns {Promise<string>} | ||
**/ | ||
export async function Greet(name) { | ||
return Call.ByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0)); | ||
} | ||
|
||
/** | ||
* GreetPerson greets a person | ||
* @function GreetPerson | ||
* @param person {dataPerson} | ||
* @returns {Promise<string>} | ||
**/ | ||
export async function GreetPerson(person) { | ||
return Call.ByName("main.GreetService.GreetPerson", ...Array.prototype.slice.call(arguments, 0)); | ||
} |
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,7 @@ | ||
package data | ||
|
||
// Person holds someone's most important attributes | ||
type Person struct { | ||
// Name is the person's name | ||
Name string `json:"name"` | ||
} |
This file was deleted.
Oops, something went wrong.
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,13 +1,14 @@ | ||
package flags | ||
|
||
type GenerateBindingsOptions struct { | ||
Silent bool `name:"silent" description:"Silent mode"` | ||
ModelsFilename string `name:"m" description:"The filename for the models file" default:"models.ts"` | ||
TS bool `name:"ts" description:"Generate Typescript bindings"` | ||
TSPrefix string `description:"The prefix for the typescript names" default:""` | ||
TSSuffix string `description:"The postfix for the typescript names" default:""` | ||
UseInterfaces bool `name:"i" description:"Use interfaces instead of classes"` | ||
ProjectDirectory string `name:"p" description:"The project directory" default:"."` | ||
UseIDs bool `name:"ids" description:"Use IDs instead of names in the binding calls"` | ||
OutputDirectory string `name:"d" description:"The output directory" default:"frontend/bindings"` | ||
Silent bool `name:"silent" description:"Silent mode"` | ||
ModelsFilename string `name:"m" description:"The filename for the models file, excluding the extension" default:"models"` | ||
TS bool `name:"ts" description:"Generate Typescript bindings"` | ||
TSPrefix string `description:"The prefix for the typescript names" default:""` | ||
TSSuffix string `description:"The postfix for the typescript names" default:""` | ||
UseInterfaces bool `name:"i" description:"Use interfaces instead of classes"` | ||
UseBundledRuntime bool `name:"b" description:"Use the bundled runtime instead of importing the npm package"` | ||
ProjectDirectory string `name:"p" description:"The project directory" default:"."` | ||
UseIDs bool `name:"ids" description:"Use IDs instead of names in the binding calls"` | ||
OutputDirectory string `name:"d" description:"The output directory" default:"frontend/bindings"` | ||
} |
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
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
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
Oops, something went wrong.